Changeset 44247
- Timestamp:
- 12/16/2018 11:55:58 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43889
- Property svn:mergeinfo changed
-
trunk/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js
r43336 r44247 20 20 21 21 function toggleToolbars( state ) { 22 var iframe, initial, toolbars, 23 pixels = 0; 24 25 initial = ( state === 'hide' ); 22 var initial, toolbars, 23 pixels = 0, 24 classicBlockToolbar = tinymce.$( '.block-library-classic__toolbar' ); 25 26 if ( state === 'hide' ) { 27 initial = true; 28 } else if ( classicBlockToolbar.length && ! classicBlockToolbar.hasClass( 'has-advanced-toolbar' ) ) { 29 // Show the second, third, etc. toolbar rows in the Classic block instance. 30 classicBlockToolbar.addClass( 'has-advanced-toolbar' ); 31 state = 'show'; 32 } 26 33 27 34 if ( editor.theme.panel ) { … … 29 36 } 30 37 31 if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) { 32 return; 33 } 34 35 if ( ! state && toolbars[1].visible() ) { 36 state = 'hide'; 37 } 38 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 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 }); 54 } 55 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 ); 59 } 60 61 if ( ! initial ) { 58 62 if ( state === 'hide' ) { 59 setUserSetting( 'hidetb', '0');63 setUserSetting( 'hidetb', '0' ); 60 64 wpAdvButton && wpAdvButton.active( false ); 61 65 } else { 62 setUserSetting( 'hidetb', '1');66 setUserSetting( 'hidetb', '1' ); 63 67 wpAdvButton && wpAdvButton.active( true ); 64 68 } … … 74 78 onPostRender: function() { 75 79 wpAdvButton = this; 76 wpAdvButton.active( getUserSetting( 'hidetb' ) === '1' ? true : false);80 wpAdvButton.active( getUserSetting( 'hidetb' ) === '1' ); 77 81 } 78 82 }); … … 82 86 if ( editor.getParam( 'wordpress_adv_hidden', true ) && getUserSetting( 'hidetb', '0' ) === '0' ) { 83 87 toggleToolbars( 'hide' ); 88 } else { 89 tinymce.$( '.block-library-classic__toolbar' ).addClass( 'has-advanced-toolbar' ); 84 90 } 85 91 }); … … 427 433 }); 428 434 429 // Menubar430 435 // Insert->Add Media 431 436 if ( wp && wp.media && wp.media.editor ) { 437 editor.addButton( 'wp_add_media', { 438 tooltip: 'Add Media', 439 icon: 'dashicon dashicons-admin-media', 440 cmd: 'WP_Medialib' 441 } ); 442 432 443 editor.addMenuItem( 'add_media', { 433 444 text: 'Add Media', -
trunk/src/wp-includes/css/editor.css
r43309 r44247 360 360 .mce-toolbar .mce-btn-group { 361 361 margin: 0; 362 } 363 364 /* Classic block hide/show toolbars */ 365 .block-library-classic__toolbar .mce-toolbar-grp .mce-toolbar:not(:first-child) { 366 display: none; 367 } 368 369 .block-library-classic__toolbar.has-advanced-toolbar .mce-toolbar-grp .mce-toolbar { 370 display: block; 362 371 } 363 372 -
trunk/src/wp-includes/script-loader.php
r44239 r44247 518 518 'spellchecker', 519 519 'wp_add_media', 520 ' kitchensink',520 'wp_adv', 521 521 ); 522 522
Note: See TracChangeset
for help on using the changeset viewer.