From 2a43a8a650188a055464e806121b232604d50dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Wed, 16 Oct 2024 12:31:41 +0200 Subject: [PATCH] IBX-9097: [PB] Error with Richtext validator in nested_attribute --- .../public/js/CKEditor/core/base-ckeditor.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js index 81aab8bd..72677801 100644 --- a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js +++ b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js @@ -281,14 +281,15 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0; '.ibexa-field-edit__distraction-free-mode-control-container .ibexa-field-edit__distraction-free-mode-btns', ); - if (distractionFreeModeControlNodeBtn === null) { - return; - } - const dataSourceNode = fieldEditNode.querySelector('.ibexa-data-source'); - const { offsetWidth: distractionFreeModeControlNodeBtnWidth } = distractionFreeModeControlNodeBtn; const { offsetWidth: dataSourceNodeWidth } = dataSourceNode; - const toolbarNodeMaxWidth = dataSourceNodeWidth - distractionFreeModeControlNodeBtnWidth; + let toolbarNodeMaxWidth = dataSourceNodeWidth; + + if (distractionFreeModeControlNodeBtn !== null) { + const { offsetWidth: distractionFreeModeControlNodeBtnWidth } = distractionFreeModeControlNodeBtn; + + toolbarNodeMaxWidth = dataSourceNodeWidth - distractionFreeModeControlNodeBtnWidth; + } toolbarNode.style.maxWidth = `${toolbarNodeMaxWidth}px`; };