Editor expand: hide TinyMCE float panels and tooltips when scrolling, props avryl, fixes #29516 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29738 git-svn-id: http://core.svn.wordpress.org/trunk@29512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
69998d452b
commit
613571202c
|
@ -148,6 +148,11 @@ jQuery( document ).ready( function($) {
|
||||||
|
|
||||||
// We need to wait for TinyMCE to initialize.
|
// We need to wait for TinyMCE to initialize.
|
||||||
$document.on( 'tinymce-editor-init.editor-expand', function( event, editor ) {
|
$document.on( 'tinymce-editor-init.editor-expand', function( event, editor ) {
|
||||||
|
var hideFloatPanels = _.debounce( function() {
|
||||||
|
! $( '.mce-floatpanel:hover' ).length && tinymce.ui.FloatPanel.hideAll();
|
||||||
|
$( '.mce-tooltip' ).hide();
|
||||||
|
}, 1000, true );
|
||||||
|
|
||||||
// Make sure it's the main editor.
|
// Make sure it's the main editor.
|
||||||
if ( editor.id !== 'content' ) {
|
if ( editor.id !== 'content' ) {
|
||||||
return;
|
return;
|
||||||
|
@ -224,6 +229,8 @@ jQuery( document ).ready( function($) {
|
||||||
|
|
||||||
// Adjust when switching editor modes.
|
// Adjust when switching editor modes.
|
||||||
function mceShow() {
|
function mceShow() {
|
||||||
|
$window.on( 'scroll.mce-float-panels', hideFloatPanels );
|
||||||
|
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
editor.execCommand( 'wpAutoResize' );
|
editor.execCommand( 'wpAutoResize' );
|
||||||
adjust();
|
adjust();
|
||||||
|
@ -231,6 +238,8 @@ jQuery( document ).ready( function($) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mceHide() {
|
function mceHide() {
|
||||||
|
$window.off( 'scroll.mce-float-panels' );
|
||||||
|
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
var top = $contentWrap.offset().top;
|
var top = $contentWrap.offset().top;
|
||||||
|
|
||||||
|
@ -251,6 +260,8 @@ jQuery( document ).ready( function($) {
|
||||||
editor.on( 'hide', mceHide );
|
editor.on( 'hide', mceHide );
|
||||||
// Adjust when the editor resizes.
|
// Adjust when the editor resizes.
|
||||||
editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
|
editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
|
||||||
|
|
||||||
|
$window.off( 'scroll.mce-float-panels' ).on( 'scroll.mce-float-panels', hideFloatPanels );
|
||||||
};
|
};
|
||||||
|
|
||||||
mceUnbind = function() {
|
mceUnbind = function() {
|
||||||
|
@ -258,6 +269,8 @@ jQuery( document ).ready( function($) {
|
||||||
editor.off( 'show', mceShow );
|
editor.off( 'show', mceShow );
|
||||||
editor.off( 'hide', mceHide );
|
editor.off( 'hide', mceHide );
|
||||||
editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
|
editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
|
||||||
|
|
||||||
|
$window.off( 'scroll.mce-float-panels' );
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
|
if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue