Skip to content

Commit

Permalink
fix - set selection on update
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangohjw committed Jan 9, 2025
1 parent 69c314b commit d8c64aa
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ export function JsonFormsProseControl({
// Needed to force the value to be set when user clicks on "Go back to editing" in the exit modal
useEffect(() => {
if (data !== undefined) {
const selection = editor?.state.selection
if (!selection) return
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
editor?.commands.setContent(data)
editor.commands.setContent(data, false)
editor.commands.setTextSelection(selection)
}
}, [data])

Expand Down

0 comments on commit d8c64aa

Please sign in to comment.