From 202bbc1a5027d4f9b8f4fbf0e7c857e1c5ff5bff Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 20 Nov 2024 09:08:55 +0100 Subject: [PATCH] fix media resolving on editor switch When switching editors, the current ID needs to be passed to the Ajax call or media resolving for relative links will fail. --- action/ajax.php | 3 ++- script.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/action/ajax.php b/action/ajax.php index d542676b..14450345 100644 --- a/action/ajax.php +++ b/action/ajax.php @@ -143,7 +143,8 @@ public function switchEditors(Event $event) $event->preventDefault(); $event->stopPropagation(); - global $INPUT; + global $INPUT, $ID; + $ID = $INPUT->str('id'); if ($INPUT->bool('getJSON')) { $text = $INPUT->str('data'); diff --git a/script.js b/script.js index 1c2b8a17..826bf97c 100644 --- a/script.js +++ b/script.js @@ -122,6 +122,7 @@ function toggleEditor() { call: 'plugin_prosemirror_switch_editors', data: window.proseMirrorIsActive ? $jsonField.val() : $textArea.val(), getJSON: window.proseMirrorIsActive ? '0' : '1', + id: JSINFO.id }).done(function handleSwitchEditorResponse(data) { if (window.proseMirrorIsActive) { showDefaultEditor(data.text);