Bug 30474: (follow-up) Tie editor initialization to tab activation
authorOwen Leonard <oleonard@myacpl.org>
Tue, 12 Apr 2022 17:26:03 +0000 (17:26 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 5 May 2022 00:29:24 +0000 (14:29 -1000)
commitdc8a9657b1a259a18e0084ff8dbb3fef30cc72fd
tree6d821b8ef3912f82e8c3394999812a43f8358657
parentf1d77a64bb840e31fa4f0311dd5ee76233575ad9
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 <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt