From 6f281efa593a6a5b93e1dec1d7d6891270cf6b7c Mon Sep 17 00:00:00 2001 From: Marius Dumitru Florea <marius@xwiki.com> Date: Tue, 6 Aug 2024 12:53:05 +0300 Subject: [PATCH] XWIKI-22267: Velocity content not processed in inline javascript of access rights of terminal pages * Bulletproofing (cherry picked from commit ac352781f21d076e505d51d62456764833290ef7) --- .../src/main/resources/flamingo/edit.vm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/edit.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/edit.vm index 57f562bed2f..7a0240b8091 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/edit.vm +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/edit.vm @@ -173,7 +173,8 @@ ## This javascript must be placed here since it uses velocity variables set in the template above. <script> //<![CDATA[ - if ($('tmEditWysiwyg')) { + let form = document.forms[$jsontool.serialize($formname)]; + if (form && $('tmEditWysiwyg')) { var switchEditor = function(editor, event) { // We switch the editor by submitting the edit form to the new editor (in order to preserve the unsaved changes // made to the edited content). We don't submit the edit form using one of the existing action buttons (e.g. @@ -184,7 +185,6 @@ // fields for syntax conversion before the form is submitted. In order to overcome this we trigger an event to // let the form fields know that their values are about to be submitted. It makes sense to use the preview action // events because we don't want to save the content, we want to preview it in a different editor. - var form = document.forms.${formname}; form.fire('xwiki:actions:beforePreview'); // This is needed in order to silence the leave confirmation (we're not going to loose unsaved changes). form.fire('xwiki:actions:preview'); -- GitLab