From 1d022678bb9715974c7d2dfc0c747377b153f34f Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 29 Sep 2017 14:24:19 +0000 Subject: [PATCH] TinyMCE: fix "flickering inline toolbar" in Chrome in RTL mode by not showing tooltips while an inline toolbar is shown. Fixes #42018. git-svn-id: https://develop.svn.wordpress.org/trunk@41643 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/css/editor.css | 5 +++++ .../js/tinymce/plugins/wordpress/plugin.js | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/css/editor.css b/src/wp-includes/css/editor.css index e9f7842800..b80d072e72 100644 --- a/src/wp-includes/css/editor.css +++ b/src/wp-includes/css/editor.css @@ -762,6 +762,11 @@ 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 ); diff --git a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 96fae445e1..014f3217ff 100644 --- a/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -685,7 +685,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { mceIframe = document.getElementById( editor.id + '_ifr' ), mceToolbar, mceStatusbar, - wpStatusbar; + wpStatusbar, + isChromeRtl = ( editor.rtl && /Chrome/.test( navigator.userAgent ) ); if ( container ) { mceToolbar = tinymce.$( '.mce-toolbar-grp', container )[0]; @@ -929,6 +930,16 @@ 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 ) {