You've already forked obsidian-visualiser
Fix dynamic character sheet loading.
This commit is contained in:
@@ -6,11 +6,11 @@ export type HistoryHandler = {
|
||||
interface HistoryEvent
|
||||
{
|
||||
source: string;
|
||||
event: string;
|
||||
actions: HistoryAction[];
|
||||
}
|
||||
interface HistoryAction
|
||||
{
|
||||
event: string;
|
||||
element: any;
|
||||
from?: any;
|
||||
to?: any;
|
||||
@@ -47,8 +47,8 @@ export class History
|
||||
return;
|
||||
|
||||
last.actions.forEach(e => {
|
||||
this.handlers[last.source] && this.handlers[last.source].handlers[last.event]?.undo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source].any && this.handlers[last.source].any!(e);
|
||||
this.handlers[last.source] && this.handlers[last.source]?.handlers[e.event]?.undo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source]?.any && this.handlers[last.source]?.any!(e);
|
||||
});
|
||||
|
||||
this.position--;
|
||||
@@ -68,18 +68,18 @@ export class History
|
||||
}
|
||||
|
||||
last.actions.forEach(e => {
|
||||
this.handlers[last.source] && this.handlers[last.source].handlers[last.event]?.redo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source].any && this.handlers[last.source].any!(e);
|
||||
this.handlers[last.source] && this.handlers[last.source]?.handlers[e.event]?.redo(e)
|
||||
this.handlers[last.source] && this.handlers[last.source]?.any && this.handlers[last.source]?.any!(e);
|
||||
});
|
||||
}
|
||||
add(source: string, event: string, actions: HistoryAction[], apply: boolean = false)
|
||||
add(source: string, actions: HistoryAction[], apply: boolean = false)
|
||||
{
|
||||
this.position++;
|
||||
this.history.splice(this.position, history.length - this.position, { source, event, actions });
|
||||
this.history.splice(this.position, history.length - this.position, { source, actions });
|
||||
|
||||
if(apply)
|
||||
actions.forEach(e => {
|
||||
this.handlers[source] && this.handlers[source].handlers[event]?.redo(e);
|
||||
this.handlers[source] && this.handlers[source].handlers[e.event]?.redo(e);
|
||||
this.handlers[source] && this.handlers[source].any && this.handlers[source].any(e);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user