From a3d15cb92ef459b4e0a67afee4c6ded1d4d3d399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Fri, 15 Dec 2023 06:16:50 +0100 Subject: [PATCH] Added event to manipulate CKEditor config before initialization --- .../public/js/CKEditor/core/base-ckeditor.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 5d14ba83..70befa84 100644 --- a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js +++ b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js @@ -147,7 +147,7 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0; section.appendChild(doc.createElement('p')); } - CKEditor.create(container, { + const config = { initialData: section.innerHTML, plugins: [ Essentials, @@ -216,7 +216,15 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0; content: locale.language, }, ...extraConfig, - }).then((editor) => { + }; + + const event = new CustomEvent("ibexa-ckeditor:configure", { + detail: { container, config } + }) + + global.dispatchEvent(event); + + CKEditor.create(container, config).then((editor) => { this.editor = editor; const editableElement = this.editor.editing.view.getDomRoot();