TinyMCE: fix flickering inline toolbar when hovering over the buttons there and the vertical scrollbar is not shown (the page height is less than the window height). Improves/removes the previous fix for similar flickering but only in RTL, see #42018.

Props joakimsilfverberg, mukesh27, kokers, Howdy_McGee, noisysocks, azaozz.
Fixes #44911.

git-svn-id: https://develop.svn.wordpress.org/trunk@45610 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2019-07-09 01:09:53 +00:00
parent 9a54b94b4a
commit e56d5d0d4c
2 changed files with 5 additions and 20 deletions

View File

@ -788,8 +788,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
mceIframe = document.getElementById( editor.id + '_ifr' ),
mceToolbar,
mceStatusbar,
wpStatusbar,
isChromeRtl = ( editor.rtl && /Chrome/.test( navigator.userAgent ) );
wpStatusbar;
if ( container ) {
mceToolbar = tinymce.$( '.mce-toolbar-grp', container )[0];
@ -1040,16 +1039,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
toolbar.on( 'show', function() {
this.reposition();
if ( isChromeRtl ) {
tinymce.$( '.mce-widget.mce-tooltip' ).addClass( 'wp-hide-mce-tooltip' );
}
} );
toolbar.on( 'hide', function() {
if ( isChromeRtl ) {
tinymce.$( '.mce-widget.mce-tooltip' ).removeClass( 'wp-hide-mce-tooltip' );
}
} );
toolbar.on( 'keydown', function( event ) {
@ -1140,14 +1129,15 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
}
}
editor.dom.bind( editor.getWin(), 'resize', hide );
if ( editor.inline ) {
editor.on( 'resizewindow', hide );
// Enable `capture` for the event.
// This will hide/reposition the toolbar on any scrolling in the document.
document.addEventListener( 'scroll', hide, true );
} else {
editor.dom.bind( editor.getWin(), 'scroll', hide );
// For full height iframe editor.
editor.on( 'resizewindow scrollwindow', hide );
}
@ -1155,7 +1145,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
editor.on( 'remove', function() {
document.removeEventListener( 'scroll', hide, true );
editor.off( 'resizewindow scrollwindow', hide );
editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
editor.dom.unbind( editor.getWin(), 'scroll', hide );
} );
editor.on( 'blur hide', hide );

View File

@ -803,11 +803,6 @@ div.mce-menu .mce-menu-item-sep,
margin-top: 2px;
}
/* Don't show the tooltip. Used in Chrome RTL, see #42018 */
.rtl .mce-tooltip.wp-hide-mce-tooltip {
display: none !important;
}
.mce-tooltip-inner {
border-radius: 3px;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);