]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/editor.js
WordPress 4.2.2-scripts
[autoinstalls/wordpress.git] / wp-admin / js / editor.js
index e71871635590e32ab3df94f6487790411bd62c8f..4ff70df848846acce2a696cb11a7cbe6465ee1bb 100644 (file)
@@ -60,7 +60,8 @@ window.switchEditors = {
                        if ( ed ) {
                                ed.show();
 
-                               if ( editorHeight ) {
+                               // No point resizing the iframe in iOS
+                               if ( ! tinymce.Env.iOS && editorHeight ) {
                                        toolbarHeight = getToolbarHeight();
                                        editorHeight = editorHeight - toolbarHeight + 14;
 
@@ -75,6 +76,7 @@ window.switchEditors = {
 
                        DOM.removeClass( wrap_id, 'html-active' );
                        DOM.addClass( wrap_id, 'tmce-active' );
+                       DOM.setAttrib( txtarea_el, 'aria-hidden', true );
                        setUserSetting( 'editor', 'tinymce' );
 
                } else if ( 'html' === mode ) {
@@ -84,16 +86,18 @@ window.switchEditors = {
                        }
 
                        if ( ed ) {
-                               iframe = DOM.get( id + '_ifr' );
-                               editorHeight = iframe ? parseInt( iframe.style.height, 10 ) : 0;
-
-                               if ( editorHeight ) {
-                                       toolbarHeight = getToolbarHeight();
-                                       editorHeight = editorHeight + toolbarHeight - 14;
-
-                                       // height cannot be under 50 or over 5000
-                                       if ( editorHeight > 50 && editorHeight < 5000 ) {
-                                               txtarea_el.style.height = editorHeight + 'px';
+                               if ( ! tinymce.Env.iOS ) {
+                                       iframe = DOM.get( id + '_ifr' );
+                                       editorHeight = iframe ? parseInt( iframe.style.height, 10 ) : 0;
+
+                                       if ( editorHeight ) {
+                                               toolbarHeight = getToolbarHeight();
+                                               editorHeight = editorHeight + toolbarHeight - 14;
+
+                                               // height cannot be under 50 or over 5000
+                                               if ( editorHeight > 50 && editorHeight < 5000 ) {
+                                                       txtarea_el.style.height = editorHeight + 'px';
+                                               }
                                        }
                                }
 
@@ -109,6 +113,7 @@ window.switchEditors = {
 
                        DOM.removeClass( wrap_id, 'tmce-active' );
                        DOM.addClass( wrap_id, 'html-active' );
+                       DOM.setAttrib( txtarea_el, 'aria-hidden', false );
                        setUserSetting( 'editor', 'html' );
                }
                return false;
@@ -165,6 +170,11 @@ window.switchEditors = {
                content = content.replace( new RegExp('\\s*</(' + blocklist2 + ')>\\s*', 'g' ), '</$1>\n' );
                content = content.replace( /<li([^>]*)>/g, '\t<li$1>' );
 
+               if ( content.indexOf( '<option' ) !== -1 ) {
+                       content = content.replace( /\s*<option/g, '\n<option' );
+                       content = content.replace( /\s*<\/select>/g, '\n</select>' );
+               }
+
                if ( content.indexOf( '<hr' ) !== -1 ) {
                        content = content.replace( /\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n' );
                }
@@ -200,8 +210,8 @@ window.switchEditors = {
                var preserve_linebreaks = false,
                        preserve_br = false,
                        blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' +
-                               '|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|noscript|legend|section' +
-                               '|article|aside|hgroup|header|footer|nav|figure|details|menu|summary';
+                               '|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' +
+                               '|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary';
 
                if ( pee.indexOf( '<object' ) !== -1 ) {
                        pee = pee.replace( /<object[\s\S]+?<\/object>/g, function( a ) {
@@ -241,6 +251,8 @@ window.switchEditors = {
                pee = pee.replace( new RegExp( '(<(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), '\n$1' );
                pee = pee.replace( new RegExp( '(</(?:' + blocklist + ')>)', 'gi' ), '$1\n\n' );
                pee = pee.replace( /<hr( [^>]*)?>/gi, '<hr$1>\n\n' ); // hr is self closing block element
+               pee = pee.replace( /\s*<option/gi, '<option' ); // No <p> or <br> around <option>
+               pee = pee.replace( /<\/option>\s*/gi, '</option>' );
                pee = pee.replace( /\r\n|\r/g, '\n' );
                pee = pee.replace( /\n\s*\n+/g, '\n\n' );
                pee = pee.replace( /([\s\S]+?)\n\n/g, '<p>$1</p>\n' );