From 2011bef155aacdfa8461a4d5c2cd3988d946d135 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 24 Jun 2010 13:22:08 +0000 Subject: - TinyMCE 3.3.7 --- .../js/tiny_mce/plugins/paste/editor_plugin_src.js | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'program/js/tiny_mce/plugins/paste/editor_plugin_src.js') diff --git a/program/js/tiny_mce/plugins/paste/editor_plugin_src.js b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js index d85b39bd3..4c3bf6542 100644 --- a/program/js/tiny_mce/plugins/paste/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js @@ -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 -- cgit v1.2.3