From 77a961d62cc02d85b4c780ca701a4c24e6cc1e22 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 12 Apr 2022 17:26:03 +0000 Subject: [PATCH] Bug 30474: (follow-up) Tie editor initialization to tab activation The way Bootstrap tabs manipulate the DOM, CodeMirror has problems initializing correctly, I think because of redraws and CodeMirror's attemps to position things absolutely. The solution seems to be to wait until after a Bootstrap tab has activated before initializing the CodeMirror instance. This patch implements that, along with a check to prevent double-initializing the same textarea. I've also made a similar change to the way TinyMCE is initialized, which I hope will help with the issue of the editor not always loading correctly. To test, apply the patch and go to Tools -> HTML customizations. - Test creation and editing of HTML customization entries using both the default editor and the text editor (Edit -> Edit with text editor). - Verify that the editor (CodeMirror or TinyMCE) loads correctly and looks correct, both upon page load and upon switching tabs between "Default" and other language tabs - Verify that your edits are saved correctly. Signed-off-by: Lucas Gass Signed-off-by: Martin Renvoize --- .../en/modules/tools/additional-contents.tt | 100 ++++++++++++------ 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 33632c2472..73cd2a4630 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -558,14 +558,11 @@ [% ELSE %] [% ELSE %] [% Asset.js("lib/tiny_mce/tinymce.min.js") | $raw %] [% INCLUDE 'str/tinymce_i18n.inc' %] [% END # /UNLESS wysiwyg %] [% END %] -- 2.20.1