~canonical-sysadmins/wordpress/4.5.2

« back to all changes in this revision

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

  • Committer: Manuel Seelaus
  • Date: 2015-12-09 17:47:18 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: manuel.seelaus@canonical.com-20151209174718-coxethm2swbeqksy
Merge WP4.4 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
 
101
101
                                event.content = event.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
102
102
                                        return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
103
 
                                                'class="wp-more-tag mce-wp-more" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
 
103
                                                'class="wp-more-tag mce-wp-more" alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
104
104
                                });
105
105
                        }
106
106
 
109
109
 
110
110
                                event.content = event.content.replace( /<!--nextpage-->/g,
111
111
                                        '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
112
 
                                                'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
 
112
                                                'alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
113
113
                        }
114
114
 
115
115
                        if ( event.load && event.format !== 'raw' && hasWpautop ) {
162
162
                classname += ' mce-wp-' + tag;
163
163
                title = tag === 'more' ? 'Read more...' : 'Next page';
164
164
                title = __( title );
165
 
                html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' +
 
165
                html = '<img src="' + tinymce.Env.transparentSrc + '" alt="" title="' + title + '" class="' + classname + '" ' +
166
166
                        'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
167
167
 
168
168
                // Most common case
428
428
                        dom.setAttrib( doc.documentElement, 'dir', 'rtl' );
429
429
                }
430
430
 
 
431
                dom.setAttrib( doc.documentElement, 'lang', editor.getParam( 'wp_lang_attr' ) );
 
432
 
431
433
                if ( env.ie ) {
432
434
                        if ( parseInt( env.ie, 10 ) === 9 ) {
433
435
                                bodyClass.push('ie9');
470
472
                }
471
473
 
472
474
                if ( editor.getParam( 'wp_paste_filters', true ) ) {
473
 
                        if ( ! tinymce.Env.webkit ) {
474
 
                                // In WebKit handled by removeWebKitStyles()
475
 
                                editor.on( 'PastePreProcess', function( event ) {
 
475
                        editor.on( 'PastePreProcess', function( event ) {
 
476
                                // Remove trailing <br> added by WebKit browsers to the clipboard
 
477
                                event.content = event.content.replace( /<br class="?Apple-interchange-newline"?>/gi, '' );
 
478
 
 
479
                                // In WebKit this is handled by removeWebKitStyles()
 
480
                                if ( ! tinymce.Env.webkit ) {
476
481
                                        // Remove all inline styles
477
482
                                        event.content = event.content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' );
478
483
 
479
484
                                        // Put back the internal styles
480
485
                                        event.content = event.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi, '$1 style=$2' );
481
 
                                });
482
 
                        }
 
486
                                }
 
487
                        });
483
488
 
484
489
                        editor.on( 'PastePostProcess', function( event ) {
485
490
                                // Remove empty paragraphs
734
739
                                        spaceBottom = windowHeight - iframeRect.top - selection.bottom - blockedBottom,
735
740
                                        editorHeight = windowHeight - blockedTop - blockedBottom,
736
741
                                        className = '',
 
742
                                        iosOffsetTop = 0,
 
743
                                        iosOffsetBottom = 0,
737
744
                                        top, left;
738
745
 
739
746
                                if ( spaceTop >= editorHeight || spaceBottom >= editorHeight ) {
740
747
                                        return this.hide();
741
748
                                }
742
749
 
 
750
                                // Add offset in iOS to move the menu over the image, out of the way of the default iOS menu.
 
751
                                if ( tinymce.Env.iOS && currentSelection.nodeName === 'IMG' ) {
 
752
                                        iosOffsetTop = 54;
 
753
                                        iosOffsetBottom = 46;
 
754
                                }
 
755
 
743
756
                                if ( this.bottom ) {
744
757
                                        if ( spaceBottom >= spaceNeeded ) {
745
758
                                                className = ' mce-arrow-up';
746
 
                                                top = selection.bottom + iframeRect.top + scrollY;
 
759
                                                top = selection.bottom + iframeRect.top + scrollY - iosOffsetBottom;
747
760
                                        } else if ( spaceTop >= spaceNeeded ) {
748
761
                                                className = ' mce-arrow-down';
749
 
                                                top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin;
 
762
                                                top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin + iosOffsetTop;
750
763
                                        }
751
764
                                } else {
752
765
                                        if ( spaceTop >= spaceNeeded ) {
753
766
                                                className = ' mce-arrow-down';
754
 
                                                top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin;
 
767
                                                top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin + iosOffsetTop;
755
768
                                        } else if ( spaceBottom >= spaceNeeded && editorHeight / 2 > selection.bottom + iframeRect.top - blockedTop ) {
756
769
                                                className = ' mce-arrow-up';
757
 
                                                top = selection.bottom + iframeRect.top + scrollY;
 
770
                                                top = selection.bottom + iframeRect.top + scrollY - iosOffsetBottom;
758
771
                                        }
759
772
                                }
760
773
 
761
774
                                if ( typeof top === 'undefined' ) {
762
 
                                        top = scrollY + blockedTop + buffer;
 
775
                                        top = scrollY + blockedTop + buffer + iosOffsetBottom;
763
776
                                }
764
777
 
765
778
                                left = selectionMiddle - toolbarWidth / 2 + iframeRect.left + scrollX;
779
792
                                        left = selection.right - toolbarWidth + iframeRect.left + scrollX;
780
793
                                }
781
794
 
 
795
                                // No up/down arrows on the menu over images in iOS.
 
796
                                if ( tinymce.Env.iOS && currentSelection.nodeName === 'IMG' ) {
 
797
                                        className = className.replace( / ?mce-arrow-(up|down)/g, '' );
 
798
                                }
 
799
 
782
800
                                toolbar.className = toolbar.className.replace( / ?mce-arrow-[\w]+/g, '' ) + className;
783
801
 
784
802
                                DOM.setStyles( toolbar, {