Mercurial > public > sg101
diff media/js/tiny_mce/plugins/paste/editor_plugin_src.js @ 217:237710206167
Update TinyMCE to 3.3.6
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 01 Jun 2010 04:49:29 +0000 |
parents | 149c3567fec1 |
children | 6ed2932901fa |
line wrap: on
line diff
--- a/media/js/tiny_mce/plugins/paste/editor_plugin_src.js Sun May 30 20:51:41 2010 +0000 +++ b/media/js/tiny_mce/plugins/paste/editor_plugin_src.js Tue Jun 01 04:49:29 2010 +0000 @@ -113,9 +113,9 @@ if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) { if (getParam(ed, "paste_text_sticky")) { - ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode."); + ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky')); } else { - ed.windowManager.alert("Paste is now in plain text mode. Click again to toggle back to regular paste mode."); + ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky')); } if (!getParam(ed, "paste_text_notifyalways")) { @@ -134,6 +134,13 @@ function grabContent(e) { var n, or, rng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY; + // Check if browser supports direct plaintext access + if (ed.pasteAsPlainText && (e.clipboardData || dom.doc.dataTransfer)) { + e.preventDefault(); + process({content : (e.clipboardData || dom.doc.dataTransfer).getData('Text')}, true); + return; + } + if (dom.get('_mcePaste')) return; @@ -207,8 +214,12 @@ dom.remove(n, 1); }); - // Contents in WebKit is sometimes wrapped in a apple style span so we need to grab it from that one - h += (dom.select('> span.Apple-style-span div', n)[0] || dom.select('> span.Apple-style-span', n)[0] || n).innerHTML; + // Remove apply style spans + each(dom.select('span.Apple-style-span', n), function(n) { + dom.remove(n, 1); + }); + + h += n.innerHTML; }); // Remove the nodes @@ -707,10 +718,10 @@ * Inserts the specified contents at the caret position. */ _insert : function(h, skip_undo) { - var ed = this.editor; + var ed = this.editor, r = ed.selection.getRng(); - // First delete the contents seems to work better on WebKit - if (!ed.selection.isCollapsed()) + // First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells. + if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer) ed.getDoc().execCommand('Delete', false, null); // It's better to use the insertHTML method on Gecko since it will combine paragraphs correctly before inserting the contents