From 25f266ef662688aa6d1a8f46fd85cdcb3fdf9b19 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Tue, 2 Apr 2024 10:13:28 +0200 Subject: [PATCH] =?UTF-8?q?=20N=C2=B04631=20-=20Update=20fullscreen=20clas?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/ckeditor.on-init.js | 5 +++-- js/components/panel.js | 8 +++++--- js/layouts/tab-container/tab-container.js | 5 ++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/js/ckeditor.on-init.js b/js/ckeditor.on-init.js index 9006b90f4..58e95dbfb 100644 --- a/js/ckeditor.on-init.js +++ b/js/ckeditor.on-init.js @@ -19,15 +19,16 @@ CKEDITOR.on('instanceReady', function (oEvent) { // N°4631 - Add a custom class to the CKEditor container when it is in fullscreen mode // so elements know they should take into account intersecting with the editor oEvent.editor.on('maximize', function() { + const sFullscreenClass = 'ibo-is-fullscreen'; let container = this.container.getFirst( function( node ) { return node.type === CKEDITOR.NODE_ELEMENT && node.hasClass( 'cke_inner' ); } ); if (this.commands.maximize.state === CKEDITOR.TRISTATE_ON) { // The editor is in fullscreen mode, add the custom class - container.addClass('ibo-is-fullscreen-non-intersecting'); + container.addClass(sFullscreenClass); } else { // The editor is not in fullscreen mode, remove the custom class - container.removeClass('ibo-is-fullscreen-non-intersecting'); + container.removeClass(sFullscreenClass); } }); }); diff --git a/js/components/panel.js b/js/components/panel.js index 45a0db7b9..d1ddc5dda 100644 --- a/js/components/panel.js +++ b/js/components/panel.js @@ -37,7 +37,9 @@ $(function () { sticky_sentinel_top: 'ibo-sticky-sentinel-top', }, js_selectors: { - global: {}, + global: { + fullscreen_elements: '.ibo-is-fullscreen', + }, block: { panel_header: '[data-role="ibo-panel--header"]:first', panel_header_sticky_sentinel_top: '[data-role="ibo-panel--header--sticky-sentinel-top"]:first', @@ -133,7 +135,7 @@ $(function () { // ... we consider the header as sticking... .on('enter', function () { // N°4631 - If a non-intersecting element is fullscreen, we do nothing - if ($('.ibo-is-fullscreen-non-intersecting').length > 0) { + if ($(me.js_selectors.global.fullscreen_elements).length > 0) { return; } me._onHeaderBecomesSticky(); @@ -141,7 +143,7 @@ $(function () { // ... and when it comes back in the viewport, it stops. .on('leave', function () { // N°4631 - If a non-intersecting element is fullscreen, we do nothing - if ($('.ibo-is-fullscreen-non-intersecting').length > 0) { + if ($(me.js_selectors.global.fullscreen_elements).length > 0) { return; } me._onHeaderStopsBeingSticky(); diff --git a/js/layouts/tab-container/tab-container.js b/js/layouts/tab-container/tab-container.js index 3db0d03d8..582fa0046 100644 --- a/js/layouts/tab-container/tab-container.js +++ b/js/layouts/tab-container/tab-container.js @@ -32,6 +32,9 @@ $(function() extra_tabs_list_toggler: '[data-role="ibo-tab-container--extra-tabs-list-toggler"]', extra_tabs_list: '[data-role="ibo-tab-container--extra-tabs-list"]', extra_tab_toggler: '[data-role="ibo-tab-container--extra-tab-toggler"]', + global: { + fullscreen_elements: '.ibo-is-fullscreen', + }, }, // the constructor @@ -142,7 +145,7 @@ $(function() if(window.IntersectionObserver) { const oTabsListIntersectObs = new IntersectionObserver(function(aEntries, oTabsListIntersectObs){ // N°4631 - If a non-intersecting element is fullscreen, we do nothing - if ($('.ibo-is-fullscreen-non-intersecting').length > 0) { + if ($(me.js_selectors.global.fullscreen_elements).length > 0) { return; } aEntries.forEach(oEntry => {