summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/paste/editor_plugin_src.js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-24 13:22:08 +0000
committeralecpl <alec@alec.pl>2010-06-24 13:22:08 +0000
commit2011bef155aacdfa8461a4d5c2cd3988d946d135 (patch)
tree15eb4903597ded4ea1d6cbe3c9e18d6d31f13f0a /program/js/tiny_mce/plugins/paste/editor_plugin_src.js
parentf821fecac880c8e4b3ca33897b6a32c140348c65 (diff)
- TinyMCE 3.3.7
Diffstat (limited to 'program/js/tiny_mce/plugins/paste/editor_plugin_src.js')
-rw-r--r--program/js/tiny_mce/plugins/paste/editor_plugin_src.js25
1 files changed, 18 insertions, 7 deletions
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