Ticket #45264: 45264.diff
File 45264.diff, 2.5 KB (added by , 6 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
20 20 21 21 function toggleToolbars( state ) { 22 22 var iframe, initial, toolbars, 23 pixels = 0; 23 pixels = 0, 24 classicBlockToolbar = tinymce.$( '.block-library-classic__toolbar' ); 24 25 25 initial = ( state === 'hide' ); 26 if ( state === 'hide' ) { 27 initial = true; 28 classicBlockToolbar.addClass( 'hide-advanced-toolbars' ); 29 } else if ( classicBlockToolbar.hasClass( 'hide-advanced-toolbars' ) ) { 30 classicBlockToolbar.removeClass( 'hide-advanced-toolbars' ); 31 state = 'show'; 32 } 26 33 27 34 if ( editor.theme.panel ) { 28 35 toolbars = editor.theme.panel.find('.toolbar:not(.menubar)'); 29 36 } 30 37 31 if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) { 32 return; 38 if ( toolbars && toolbars.length > 1 ) { 39 if ( ! state && toolbars[1].visible() ) { 40 state = 'hide'; 41 } 42 43 each( toolbars, function( toolbar, i ) { 44 if ( i > 0 ) { 45 if ( state === 'hide' ) { 46 toolbar.hide(); 47 pixels += 30; 48 } else { 49 toolbar.show(); 50 pixels -= 30; 51 } 52 } 53 }); 33 54 } 34 55 35 if ( ! state && toolbars[1].visible() ) { 36 state = 'hide'; 56 // Resize editor iframe, not needed for iOS and inline instances. 57 if ( pixels && ! tinymce.Env.iOS && editor.iframeElement ) { 58 DOM.setStyle( editor.iframeElement, 'height', editor.iframeElement.clientHeight + pixels ); 37 59 } 38 60 39 each( toolbars, function( toolbar, i ) { 40 if ( i > 0 ) { 41 if ( state === 'hide' ) { 42 toolbar.hide(); 43 pixels += 30; 44 } else { 45 toolbar.show(); 46 pixels -= 30; 47 } 48 } 49 }); 50 51 if ( pixels && ! initial ) { 52 // Resize iframe, not needed in iOS 53 if ( ! tinymce.Env.iOS ) { 54 iframe = editor.getContentAreaContainer().firstChild; 55 DOM.setStyle( iframe, 'height', iframe.clientHeight + pixels ); 56 } 57 61 if ( ! initial ) { 58 62 if ( state === 'hide' ) { 59 63 setUserSetting('hidetb', '0'); 60 64 wpAdvButton && wpAdvButton.active( false ); … … 426 430 stateSelector: 'code' 427 431 }); 428 432 433 editor.addButton( 'wp_add_media', { 434 tooltip: 'Insert Media', 435 icon: 'dashicon dashicons-admin-media', 436 cmd: 'WP_Medialib', 437 } ); 438 429 439 // Menubar 430 440 // Insert->Add Media 431 441 if ( wp && wp.media && wp.media.editor ) {