Ticket #32604: 32604.12.patch
File 32604.12.patch, 3.1 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
443 443 * Experimental: create a floating toolbar. 444 444 * This functionality will change in the next releases. Not recommended for use by plugins. 445 445 */ 446 (function() {446 editor.on( 'preinit', function() { 447 447 var Factory = tinymce.ui.Factory, 448 448 settings = editor.settings, 449 449 activeToolbar, 450 450 currentSelection, 451 timeout, 451 452 wpAdminbar = document.getElementById( 'wpadminbar' ), 452 mceIframe, mceToolbar, mceStatusbar, wpStatusbar; 453 454 editor.on( 'init', function() { 455 mceIframe = document.getElementById( editor.id + '_ifr' ); 456 mceToolbar = tinymce.$( '.mce-toolbar-grp', editor.getContainer() )[0]; 457 mceStatusbar = tinymce.$( '.mce-statusbar', editor.getContainer() )[0]; 453 mceIframe = document.getElementById( editor.id + '_ifr' ), 454 mceToolbar = tinymce.$( '.mce-toolbar-grp', editor.getContainer() )[0], 455 mceStatusbar = tinymce.$( '.mce-statusbar', editor.getContainer() )[0], 456 wpStatusbar; 458 457 459 458 if ( editor.id === 'content' ) { 460 459 wpStatusbar = document.getElementById( 'post-status-info' ); 461 460 } 462 } );463 461 464 462 function create( buttons, bottom ) { 465 463 var toolbar, … … 587 585 588 586 toolbar.bottom = bottom; 589 587 590 function hide() {591 toolbar.hide();592 }593 594 588 function reposition() { 595 589 var scrollX = window.pageXOffset || document.documentElement.scrollLeft, 596 590 scrollY = window.pageYOffset || document.documentElement.scrollTop, … … 617 611 className = '', 618 612 top, left; 619 613 614 if ( spaceTop >= editorHeight || spaceBottom >= editorHeight ) { 615 return this.hide(); 616 } 617 620 618 if ( this.bottom ) { 621 619 if ( spaceBottom >= spaceNeeded ) { 622 620 className = ' mce-arrow-up'; … … 677 675 } 678 676 } ); 679 677 680 toolbar.on( 'remove', function() {681 DOM.unbind( window, 'resize scroll', hide );682 editor.dom.unbind( editor.getWin(), 'resize scroll', hide );683 editor.off( 'blur hide', hide );684 } );685 686 editor.once( 'init', function() {687 DOM.bind( window, 'resize scroll', hide );688 editor.dom.bind( editor.getWin(), 'resize scroll', hide );689 editor.on( 'blur hide', hide );690 } );691 692 678 toolbar.reposition = reposition; 693 679 toolbar.hide().renderTo( document.body ); 694 680 … … 735 721 } 736 722 } ); 737 723 738 editor.on( 'hide', function() { 739 activeToolbar = false; 740 } ); 724 function hide( event ) { 725 if ( activeToolbar ) { 726 activeToolbar.hide(); 727 728 if ( event.type === 'hide' ) { 729 activeToolbar = false; 730 } else if ( event.type === 'resize' || event.type === 'scroll' ) { 731 clearTimeout( timeout ); 732 733 timeout = setTimeout( function() { 734 activeToolbar.show(); 735 }, 250 ); 736 } 737 } 738 } 739 740 DOM.bind( window, 'resize scroll', hide ); 741 editor.dom.bind( editor.getWin(), 'resize scroll', hide ); 742 editor.on( 'blur hide', hide ); 741 743 742 744 editor.wp = editor.wp || {}; 743 745 editor.wp._createToolbar = create; 744 } ());746 }, true ); 745 747 746 748 function noop() {} 747 749