From 92efbad1865b0a5315cb9f4903211c1501d77328 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 27 May 2024 16:17:13 +0200 Subject: [PATCH] :bug: [#4012] Fix content component link popup in form builder because the ckeditor element previously was not removed after closing the modal, this did not work --- .../js/components/formio_builder/WebformBuilder.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openforms/js/components/formio_builder/WebformBuilder.js b/src/openforms/js/components/formio_builder/WebformBuilder.js index a8c18f8b29..ef29e7ae61 100644 --- a/src/openforms/js/components/formio_builder/WebformBuilder.js +++ b/src/openforms/js/components/formio_builder/WebformBuilder.js @@ -184,6 +184,13 @@ class WebformBuilder extends WebformBuilderFormio { // Clean up. this.removeEventListener(this.dialog, 'close', dialogClose); this.dialog = null; + + // We have to reset the ckeditor BodyCollection to allow link popups to work + // after closing the editComponent modal, because it seems that `ClassicEditor.destroy` isn't being called + // https://ckeditor.com/docs/ckeditor5/latest/api/module_ui_editorui_bodycollection-BodyCollection.html + // See https://github.com/open-formulieren/open-forms/issues/4012 + if (document.querySelector('.ck-body-wrapper')) + document.querySelector('.ck-body-wrapper').remove(); }; this.addEventListener(this.dialog, 'close', dialogClose);