mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Close open prosemirror documents during reset
This commit is contained in:
parent
e10dc83cd9
commit
25f87f1baa
1 changed files with 8 additions and 2 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue