]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/paste/plugin.js
WordPress 4.3
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / paste / plugin.js
index 65ed95d2256dd180f72633565e8562b89d95f501..6c1c2b3db8123cf4c3cec70b993e8bb3afd6fbab 100644 (file)
@@ -85,8 +85,8 @@
 /**
  * Utils.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing
@@ -217,8 +217,8 @@ define("tinymce/pasteplugin/Utils", [
 /**
  * Clipboard.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing
@@ -281,7 +281,7 @@ define("tinymce/pasteplugin/Clipboard", [
                                }
 
                                if (!args.isDefaultPrevented()) {
-                                       editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false});
+                                       editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false, data: {paste: true}});
                                }
                        }
                }
@@ -805,19 +805,40 @@ define("tinymce/pasteplugin/Clipboard", [
 
                        // Remove all data images from paste for example from Gecko
                        // except internal images like video elements
-                       editor.parser.addNodeFilter('img', function(nodes) {
-                               if (!editor.settings.paste_data_images) {
+                       editor.parser.addNodeFilter('img', function(nodes, name, args) {
+                               function isPasteInsert(args) {
+                                       return args.data && args.data.paste === true;
+                               }
+
+                               function remove(node) {
+                                       if (!node.attr('data-mce-object') && src !== Env.transparentSrc) {
+                                               node.remove();
+                                       }
+                               }
+
+                               function isWebKitFakeUrl(src) {
+                                       return src.indexOf("webkit-fake-url") === 0;
+                               }
+
+                               function isDataUri(src) {
+                                       return src.indexOf("data:") === 0;
+                               }
+
+                               if (!editor.settings.paste_data_images && isPasteInsert(args)) {
                                        var i = nodes.length;
 
                                        while (i--) {
                                                var src = nodes[i].attributes.map.src;
 
-                                               // Some browsers automatically produce data uris on paste
+                                               if (!src) {
+                                                       continue;
+                                               }
+
                                                // Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141
-                                               if (src && /^(data:image|webkit\-fake\-url)/.test(src)) {
-                                                       if (!nodes[i].attr('data-mce-object') && src !== Env.transparentSrc) {
-                                                               nodes[i].remove();
-                                                       }
+                                               if (isWebKitFakeUrl(src)) {
+                                                       remove(nodes[i]);
+                                               } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
+                                                       remove(nodes[i]);
                                                }
                                        }
                                }
@@ -831,8 +852,8 @@ define("tinymce/pasteplugin/Clipboard", [
 /**
  * WordFilter.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing
@@ -1332,8 +1353,8 @@ define("tinymce/pasteplugin/WordFilter", [
 /**
  * Quirks.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing
@@ -1494,8 +1515,8 @@ define("tinymce/pasteplugin/Quirks", [
 /**
  * Plugin.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing