Add historyCurrentStep to setHistory event
This commit is contained in:
parent
749609f9a0
commit
7a81bbaec6
3 changed files with 14 additions and 10 deletions
|
@ -12,7 +12,7 @@ export interface IEditorEvent {
|
|||
func: (
|
||||
root: Element | Document,
|
||||
editorState: IEditorState,
|
||||
setNewHistory: (newHistory: IHistoryState[]) => void,
|
||||
setNewHistory: (newHistory: IHistoryState[], historyCurrentStep?: number) => void,
|
||||
eventInitDict?: CustomEventInit
|
||||
) => void
|
||||
}
|
||||
|
@ -50,11 +50,12 @@ function GetEditorStateAsString(root: Element | Document,
|
|||
|
||||
function SetHistory(root: Element | Document,
|
||||
editorState: IEditorState,
|
||||
setNewHistory: (newHistory: IHistoryState[]) => void,
|
||||
setNewHistory: (newHistory: IHistoryState[], historyCurrentStep?: number) => void,
|
||||
eventInitDict?: CustomEventInit): void {
|
||||
const history: IHistoryState[] = eventInitDict?.detail;
|
||||
const history: IHistoryState[] = eventInitDict?.detail.history;
|
||||
const historyCurrentStep: number | undefined = eventInitDict?.detail.historyCurrentStep;
|
||||
ReviveHistoryAction(history);
|
||||
setNewHistory(history);
|
||||
setNewHistory(history, historyCurrentStep);
|
||||
const customEvent = new CustomEvent<IEditorState>('setHistory', { detail: editorState });
|
||||
root.dispatchEvent(customEvent);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue