TinyMCE Classic Block: fix repositioning of the inline toolbar on scrolling.
Props iseulde, azaozz. Fixes #46062. git-svn-id: https://develop.svn.wordpress.org/trunk@44697 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3b14a06c8c
commit
e01f30ae20
@ -1064,12 +1064,20 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For full height editor.
|
editor.dom.bind( editor.getWin(), 'resize', hide );
|
||||||
|
|
||||||
|
if ( editor.inline ) {
|
||||||
|
// 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 );
|
editor.on( 'resizewindow scrollwindow', hide );
|
||||||
// For scrollable editor.
|
}
|
||||||
editor.dom.bind( editor.getWin(), 'resize scroll', hide );
|
|
||||||
|
|
||||||
editor.on( 'remove', function() {
|
editor.on( 'remove', function() {
|
||||||
|
document.removeEventListener( 'scroll', hide, true );
|
||||||
editor.off( 'resizewindow scrollwindow', hide );
|
editor.off( 'resizewindow scrollwindow', hide );
|
||||||
editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
|
editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user