Implement setEditor + Add some macros
This commit is contained in:
parent
6de2c23989
commit
2ea43890f0
5 changed files with 142 additions and 13 deletions
|
@ -19,7 +19,7 @@ export interface IEditorEvent {
|
|||
|
||||
export const events: IEditorEvent[] = [
|
||||
{ name: 'getEditorState', func: GetEditorState },
|
||||
{ name: 'setEditorState', func: SetEditorState },
|
||||
{ name: 'setHistory', func: SetHistory },
|
||||
{ name: 'reviveEditorState', func: ReviveEditorState },
|
||||
{ name: 'reviveHistory', func: ReviveHistory },
|
||||
{ name: 'getCurrentHistoryState', func: GetCurrentHistoryState },
|
||||
|
@ -41,15 +41,14 @@ function GetEditorState(root: Element | Document,
|
|||
root.dispatchEvent(customEvent);
|
||||
}
|
||||
|
||||
// TODO: In the near future, implement a real SetEditorState which also change IConfiguration
|
||||
function SetEditorState(root: Element | Document,
|
||||
function SetHistory(root: Element | Document,
|
||||
editorState: IEditorState,
|
||||
setNewHistory: (newHistory: IHistoryState[]) => void,
|
||||
eventInitDict?: CustomEventInit): void {
|
||||
const history: IHistoryState[] = eventInitDict?.detail;
|
||||
ReviveHistoryAction(history);
|
||||
setNewHistory(history);
|
||||
const customEvent = new CustomEvent<IEditorState>('setEditorState', { detail: editorState });
|
||||
const customEvent = new CustomEvent<IEditorState>('setHistory', { detail: editorState });
|
||||
root.dispatchEvent(customEvent);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue