]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/paste/plugin.js
WordPress 4.5.1
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / paste / plugin.js
index 249f0cc3338bc73a71eba6e8543c22c3b5a67715..7ecf23a44a7e6878ecfc5756706a230f3975e51e 100644 (file)
@@ -818,6 +818,10 @@ define("tinymce/pasteplugin/Clipboard", [
                                draggingInternally = e.type == 'dragstart';
                        });
 
+                       function isPlainTextFileUrl(content) {
+                               return content['text/plain'].indexOf('file://') === 0;
+                       }
+
                        editor.on('drop', function(e) {
                                var dropContent, rng;
 
@@ -829,7 +833,7 @@ define("tinymce/pasteplugin/Clipboard", [
 
                                dropContent = getDataTransferItems(e.dataTransfer);
 
-                               if (!hasHtmlOrText(dropContent) && pasteImageData(e, rng)) {
+                               if ((!hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && pasteImageData(e, rng)) {
                                        return;
                                }
 
@@ -839,20 +843,23 @@ define("tinymce/pasteplugin/Clipboard", [
                                        if (content) {
                                                e.preventDefault();
 
-                                               editor.undoManager.transact(function() {
-                                                       if (dropContent['mce-internal']) {
-                                                               editor.execCommand('Delete');
-                                                       }
+                                               // FF 45 doesn't paint a caret when dragging in text in due to focus call by execCommand
+                                               Delay.setEditorTimeout(editor, function() {
+                                                       editor.undoManager.transact(function() {
+                                                               if (dropContent['mce-internal']) {
+                                                                       editor.execCommand('Delete');
+                                                               }
 
-                                                       editor.selection.setRng(rng);
+                                                               editor.selection.setRng(rng);
 
-                                                       content = Utils.trimHtml(content);
+                                                               content = Utils.trimHtml(content);
 
-                                                       if (!dropContent['text/html']) {
-                                                               pasteText(content);
-                                                       } else {
-                                                               pasteHtml(content);
-                                                       }
+                                                               if (!dropContent['text/html']) {
+                                                                       pasteText(content);
+                                                               } else {
+                                                                       pasteHtml(content);
+                                                               }
+                                                       });
                                                });
                                        }
                                }
@@ -1670,7 +1677,7 @@ define("tinymce/pasteplugin/Plugin", [
                });
 
                // Block all drag/drop events
-               if (editor.paste_block_drop) {
+               if (editor.settings.paste_block_drop) {
                        editor.on('dragend dragover draggesture dragdrop drop drag', function(e) {
                                e.preventDefault();
                                e.stopPropagation();