]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/wordpress/plugin.js
WordPress 4.4
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / wordpress / plugin.js
index 64a80c2684cc6b38cb0705e4bd5873475d604d67..8e4d5b6a7407d965edb8e358ec3f984a7b61f9ae 100644 (file)
@@ -100,7 +100,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
 
                                event.content = event.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
                                        return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
-                                               'class="wp-more-tag mce-wp-more" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
+                                               'class="wp-more-tag mce-wp-more" alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
                                });
                        }
 
@@ -109,7 +109,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
 
                                event.content = event.content.replace( /<!--nextpage-->/g,
                                        '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
-                                               'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
+                                               'alt="" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
                        }
 
                        if ( event.load && event.format !== 'raw' && hasWpautop ) {
@@ -162,7 +162,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
                classname += ' mce-wp-' + tag;
                title = tag === 'more' ? 'Read more...' : 'Next page';
                title = __( title );
-               html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' +
+               html = '<img src="' + tinymce.Env.transparentSrc + '" alt="" title="' + title + '" class="' + classname + '" ' +
                        'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
 
                // Most common case
@@ -428,6 +428,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
                        dom.setAttrib( doc.documentElement, 'dir', 'rtl' );
                }
 
+               dom.setAttrib( doc.documentElement, 'lang', editor.getParam( 'wp_lang_attr' ) );
+
                if ( env.ie ) {
                        if ( parseInt( env.ie, 10 ) === 9 ) {
                                bodyClass.push('ie9');
@@ -470,16 +472,19 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
                }
 
                if ( editor.getParam( 'wp_paste_filters', true ) ) {
-                       if ( ! tinymce.Env.webkit ) {
-                               // In WebKit handled by removeWebKitStyles()
-                               editor.on( 'PastePreProcess', function( event ) {
+                       editor.on( 'PastePreProcess', function( event ) {
+                               // Remove trailing <br> added by WebKit browsers to the clipboard
+                               event.content = event.content.replace( /<br class="?Apple-interchange-newline"?>/gi, '' );
+
+                               // In WebKit this is handled by removeWebKitStyles()
+                               if ( ! tinymce.Env.webkit ) {
                                        // Remove all inline styles
                                        event.content = event.content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' );
 
                                        // Put back the internal styles
                                        event.content = event.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi, '$1 style=$2' );
-                               });
-                       }
+                               }
+                       });
 
                        editor.on( 'PastePostProcess', function( event ) {
                                // Remove empty paragraphs
@@ -734,32 +739,40 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
                                        spaceBottom = windowHeight - iframeRect.top - selection.bottom - blockedBottom,
                                        editorHeight = windowHeight - blockedTop - blockedBottom,
                                        className = '',
+                                       iosOffsetTop = 0,
+                                       iosOffsetBottom = 0,
                                        top, left;
 
                                if ( spaceTop >= editorHeight || spaceBottom >= editorHeight ) {
                                        return this.hide();
                                }
 
+                               // Add offset in iOS to move the menu over the image, out of the way of the default iOS menu.
+                               if ( tinymce.Env.iOS && currentSelection.nodeName === 'IMG' ) {
+                                       iosOffsetTop = 54;
+                                       iosOffsetBottom = 46;
+                               }
+
                                if ( this.bottom ) {
                                        if ( spaceBottom >= spaceNeeded ) {
                                                className = ' mce-arrow-up';
-                                               top = selection.bottom + iframeRect.top + scrollY;
+                                               top = selection.bottom + iframeRect.top + scrollY - iosOffsetBottom;
                                        } else if ( spaceTop >= spaceNeeded ) {
                                                className = ' mce-arrow-down';
-                                               top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin;
+                                               top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin + iosOffsetTop;
                                        }
                                } else {
                                        if ( spaceTop >= spaceNeeded ) {
                                                className = ' mce-arrow-down';
-                                               top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin;
+                                               top = selection.top + iframeRect.top + scrollY - toolbarHeight - margin + iosOffsetTop;
                                        } else if ( spaceBottom >= spaceNeeded && editorHeight / 2 > selection.bottom + iframeRect.top - blockedTop ) {
                                                className = ' mce-arrow-up';
-                                               top = selection.bottom + iframeRect.top + scrollY;
+                                               top = selection.bottom + iframeRect.top + scrollY - iosOffsetBottom;
                                        }
                                }
 
                                if ( typeof top === 'undefined' ) {
-                                       top = scrollY + blockedTop + buffer;
+                                       top = scrollY + blockedTop + buffer + iosOffsetBottom;
                                }
 
                                left = selectionMiddle - toolbarWidth / 2 + iframeRect.left + scrollX;
@@ -779,6 +792,11 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
                                        left = selection.right - toolbarWidth + iframeRect.left + scrollX;
                                }
 
+                               // No up/down arrows on the menu over images in iOS.
+                               if ( tinymce.Env.iOS && currentSelection.nodeName === 'IMG' ) {
+                                       className = className.replace( / ?mce-arrow-(up|down)/g, '' );
+                               }
+
                                toolbar.className = toolbar.className.replace( / ?mce-arrow-[\w]+/g, '' ) + className;
 
                                DOM.setStyles( toolbar, {