~canonical-sysadmins/wordpress/4.8.3

« back to all changes in this revision

Viewing changes to wp-includes/js/tinymce/plugins/paste/plugin.js

  • Committer: Ryan Finnie
  • Date: 2015-08-31 16:09:47 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: ryan.finnie@canonical.com-20150831160947-1h6rfxby9z1ec62u
Merge WP4.3 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
/**
86
86
 * Utils.js
87
87
 *
88
 
 * Copyright, Moxiecode Systems AB
89
88
 * Released under LGPL License.
 
89
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
90
90
 *
91
91
 * License: http://www.tinymce.com/license
92
92
 * Contributing: http://www.tinymce.com/contributing
217
217
/**
218
218
 * Clipboard.js
219
219
 *
220
 
 * Copyright, Moxiecode Systems AB
221
220
 * Released under LGPL License.
 
221
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
222
222
 *
223
223
 * License: http://www.tinymce.com/license
224
224
 * Contributing: http://www.tinymce.com/contributing
281
281
                                }
282
282
 
283
283
                                if (!args.isDefaultPrevented()) {
284
 
                                        editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false});
 
284
                                        editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false, data: {paste: true}});
285
285
                                }
286
286
                        }
287
287
                }
805
805
 
806
806
                        // Remove all data images from paste for example from Gecko
807
807
                        // except internal images like video elements
808
 
                        editor.parser.addNodeFilter('img', function(nodes) {
809
 
                                if (!editor.settings.paste_data_images) {
 
808
                        editor.parser.addNodeFilter('img', function(nodes, name, args) {
 
809
                                function isPasteInsert(args) {
 
810
                                        return args.data && args.data.paste === true;
 
811
                                }
 
812
 
 
813
                                function remove(node) {
 
814
                                        if (!node.attr('data-mce-object') && src !== Env.transparentSrc) {
 
815
                                                node.remove();
 
816
                                        }
 
817
                                }
 
818
 
 
819
                                function isWebKitFakeUrl(src) {
 
820
                                        return src.indexOf("webkit-fake-url") === 0;
 
821
                                }
 
822
 
 
823
                                function isDataUri(src) {
 
824
                                        return src.indexOf("data:") === 0;
 
825
                                }
 
826
 
 
827
                                if (!editor.settings.paste_data_images && isPasteInsert(args)) {
810
828
                                        var i = nodes.length;
811
829
 
812
830
                                        while (i--) {
813
831
                                                var src = nodes[i].attributes.map.src;
814
832
 
815
 
                                                // Some browsers automatically produce data uris on paste
 
833
                                                if (!src) {
 
834
                                                        continue;
 
835
                                                }
 
836
 
816
837
                                                // Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141
817
 
                                                if (src && /^(data:image|webkit\-fake\-url)/.test(src)) {
818
 
                                                        if (!nodes[i].attr('data-mce-object') && src !== Env.transparentSrc) {
819
 
                                                                nodes[i].remove();
820
 
                                                        }
 
838
                                                if (isWebKitFakeUrl(src)) {
 
839
                                                        remove(nodes[i]);
 
840
                                                } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
 
841
                                                        remove(nodes[i]);
821
842
                                                }
822
843
                                        }
823
844
                                }
831
852
/**
832
853
 * WordFilter.js
833
854
 *
834
 
 * Copyright, Moxiecode Systems AB
835
855
 * Released under LGPL License.
 
856
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
836
857
 *
837
858
 * License: http://www.tinymce.com/license
838
859
 * Contributing: http://www.tinymce.com/contributing
1332
1353
/**
1333
1354
 * Quirks.js
1334
1355
 *
1335
 
 * Copyright, Moxiecode Systems AB
1336
1356
 * Released under LGPL License.
 
1357
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
1337
1358
 *
1338
1359
 * License: http://www.tinymce.com/license
1339
1360
 * Contributing: http://www.tinymce.com/contributing
1494
1515
/**
1495
1516
 * Plugin.js
1496
1517
 *
1497
 
 * Copyright, Moxiecode Systems AB
1498
1518
 * Released under LGPL License.
 
1519
 * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
1499
1520
 *
1500
1521
 * License: http://www.tinymce.com/license
1501
1522
 * Contributing: http://www.tinymce.com/contributing