Skip to content

Commit

Permalink
fix media resolving on editor switch
Browse files Browse the repository at this point in the history
When switching editors, the current ID needs to be passed to the Ajax
call or media resolving for relative links will fail.
  • Loading branch information
splitbrain committed Nov 20, 2024
1 parent e28ccbf commit 202bbc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion action/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 202bbc1

Please sign in to comment.