This repository was archived by the owner on May 3, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Resources/public/js/alloyeditor/plugins Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ YUI.add('ez-alloyeditor-plugin-floatingtoolbar', function (Y) {
1111 }
1212
1313 var FLOATING_TOOLBAR_SELECTOR = '.ae-toolbar-floating' ,
14- FLOATING_TOOLBAR_FIXED_CLASS = 'ae-toolbar-floating-fixed' ;
14+ FLOATING_TOOLBAR_FIXED_CLASS = 'ae-toolbar-floating-fixed' ,
15+ SCROLL_HANDLER_DEBOUNCE_TIMEOUT = 100 ,
16+ scrollHandler ;
1517
1618 function findScrollParent ( editor ) {
1719 var container = editor . closest ( '.ez-main-content' ) ;
@@ -33,7 +35,7 @@ YUI.add('ez-alloyeditor-plugin-floatingtoolbar', function (Y) {
3335 return null ;
3436 }
3537
36- function scrollHandler ( ) {
38+ function updateToolbarPosition ( ) {
3739 var toolbar = document . querySelector ( FLOATING_TOOLBAR_SELECTOR ) ,
3840 editor = findFocusedEditor ( ) ,
3941 editorRect ,
@@ -49,6 +51,8 @@ YUI.add('ez-alloyeditor-plugin-floatingtoolbar', function (Y) {
4951 toolbar . classList . toggle ( FLOATING_TOOLBAR_FIXED_CLASS , editorRect . top < 0 ) ;
5052 }
5153
54+ scrollHandler = CKEDITOR . tools . debounce ( updateToolbarPosition , SCROLL_HANDLER_DEBOUNCE_TIMEOUT ) ;
55+
5256 /**
5357 * CKEditor plugin to handle pin/unpin the floating toolbars on scrolling in viewport.
5458 *
You can’t perform that action at this time.
0 commit comments