From 25f87f1baac76784c558c5d0a6e5d10572e91d80 Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Sun, 21 Dec 2025 22:26:19 -0500 Subject: [PATCH] Close open prosemirror documents during reset --- module/systemRegistration/settings.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module/systemRegistration/settings.mjs b/module/systemRegistration/settings.mjs index 5ab62e03..f4376fe6 100644 --- a/module/systemRegistration/settings.mjs +++ b/module/systemRegistration/settings.mjs @@ -134,17 +134,23 @@ const registerNonConfigSettings = () => { }); }; -/** +/** * Triggers a reset and non-forced re-render on all given actors (if given) * or all world actors and actors in all scenes to show immediate results for a changed setting. */ function resetActors(actors) { actors ??= [ game.actors.contents, - game.scenes.contents.flatMap((s) => s.tokens.contents).flatMap((t) => t.actor ?? []), + game.scenes.contents.flatMap(s => s.tokens.contents).flatMap(t => t.actor ?? []) ].flat(); actors = new Set(actors); for (const actor of actors) { + for (const app of Object.values(actor.apps)) { + for (const element of app.element?.querySelectorAll('prose-mirror.active')) { + element.open = false; // This triggers a save + } + } + actor.reset(); actor.render(); }