From a31ecb6a4953680a0cdbbd79b22ac90188edd3d5 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander <marstranderthomas@gmail.com> Date: Sat, 29 May 2021 13:37:34 +0200 Subject: [PATCH] JI-2406 Fix CKEditor field collapsing The CKEditor input field would sometimes collapse because it uses an internal element to determine the height of the input field, and this element was hidden and removed from the DOM so the height returned was invalid, causing the input height to collapse to 0. Setting the getBody element of CKEditor to an element that is always visible and not removed fixes this measurement problem. --- scripts/h5peditor-html.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/h5peditor-html.js b/scripts/h5peditor-html.js index eec7ef5d..09665080 100644 --- a/scripts/h5peditor-html.js +++ b/scripts/h5peditor-html.js @@ -348,7 +348,9 @@ ns.Html.prototype.appendTo = function ($wrapper) { ns.Html.removeWysiwyg(); CKEDITOR.document.getBody = function () { - return new CKEDITOR.dom.element(that.$item[0]); + // Have to attach to an element that does not get hidden or removed, since an internal "calculator" element + // inside CKeditor relies on this element to always exist and not be hidden. + return new CKEDITOR.dom.element(window.document.body); }; ns.Html.current = that; -- GitLab