Move list of events at the top so it can be seen immediately
This commit is contained in:
parent
6aa5acd4c0
commit
3a7c60bd1c
1 changed files with 28 additions and 28 deletions
|
@ -7,6 +7,34 @@ import { IHistoryState } from '../Interfaces/IHistoryState';
|
||||||
import { FindContainerById } from '../utils/itertools';
|
import { FindContainerById } from '../utils/itertools';
|
||||||
import { Revive, ReviveHistory as ReviveHistoryAction } from '../utils/saveload';
|
import { Revive, ReviveHistory as ReviveHistoryAction } from '../utils/saveload';
|
||||||
|
|
||||||
|
export interface IEditorEvent {
|
||||||
|
name: string
|
||||||
|
func: (
|
||||||
|
root: Element | Document,
|
||||||
|
editorState: IEditorState,
|
||||||
|
setNewHistory: (newHistory: IHistoryState[]) => void,
|
||||||
|
eventInitDict?: CustomEventInit
|
||||||
|
) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const events: IEditorEvent[] = [
|
||||||
|
{ name: 'getEditorState', func: GetEditorState },
|
||||||
|
{ name: 'setEditorState', func: SetEditorState },
|
||||||
|
{ name: 'reviveEditorState', func: ReviveEditorState },
|
||||||
|
{ name: 'reviveHistory', func: ReviveHistory },
|
||||||
|
{ name: 'getCurrentHistoryState', func: GetCurrentHistoryState },
|
||||||
|
{ name: 'appendNewState', func: AppendNewState },
|
||||||
|
{ name: 'addContainer', func: AddContainer },
|
||||||
|
{ name: 'addContainerToSelectedContainer', func: AddContainerToSelectedContainer },
|
||||||
|
{ name: 'appendContainer', func: AppendContainer },
|
||||||
|
{ name: 'appendContainerToSelectedContainer', func: AppendContainerToSelectedContainer },
|
||||||
|
{ name: 'selectContainer', func: SelectContainer },
|
||||||
|
{ name: 'deleteContainer', func: DeleteContainer },
|
||||||
|
{ name: 'addSymbol', func: AddSymbol },
|
||||||
|
{ name: 'selectSymbol', func: SelectSymbol },
|
||||||
|
{ name: 'deleteSymbol', func: DeleteSymbol }
|
||||||
|
];
|
||||||
|
|
||||||
function GetEditorState(root: Element | Document,
|
function GetEditorState(root: Element | Document,
|
||||||
editorState: IEditorState): void {
|
editorState: IEditorState): void {
|
||||||
const customEvent = new CustomEvent<IEditorState>('getEditorState', { detail: structuredClone(editorState) });
|
const customEvent = new CustomEvent<IEditorState>('getEditorState', { detail: structuredClone(editorState) });
|
||||||
|
@ -303,31 +331,3 @@ function DeleteSymbol(root: Element | Document,
|
||||||
{ detail: structuredClone(editorState.history[editorState.historyCurrentStep]) });
|
{ detail: structuredClone(editorState.history[editorState.historyCurrentStep]) });
|
||||||
root.dispatchEvent(customEvent);
|
root.dispatchEvent(customEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEditorEvent {
|
|
||||||
name: string
|
|
||||||
func: (
|
|
||||||
root: Element | Document,
|
|
||||||
editorState: IEditorState,
|
|
||||||
setNewHistory: (newHistory: IHistoryState[]) => void,
|
|
||||||
eventInitDict?: CustomEventInit
|
|
||||||
) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
export const events: IEditorEvent[] = [
|
|
||||||
{ name: 'getEditorState', func: GetEditorState },
|
|
||||||
{ name: 'setEditorState', func: SetEditorState },
|
|
||||||
{ name: 'reviveEditorState', func: ReviveEditorState },
|
|
||||||
{ name: 'reviveHistory', func: ReviveHistory },
|
|
||||||
{ name: 'getCurrentHistoryState', func: GetCurrentHistoryState },
|
|
||||||
{ name: 'appendNewState', func: AppendNewState },
|
|
||||||
{ name: 'addContainer', func: AddContainer },
|
|
||||||
{ name: 'addContainerToSelectedContainer', func: AddContainerToSelectedContainer },
|
|
||||||
{ name: 'appendContainer', func: AppendContainer },
|
|
||||||
{ name: 'appendContainerToSelectedContainer', func: AppendContainerToSelectedContainer },
|
|
||||||
{ name: 'selectContainer', func: SelectContainer },
|
|
||||||
{ name: 'deleteContainer', func: DeleteContainer },
|
|
||||||
{ name: 'addSymbol', func: AddSymbol },
|
|
||||||
{ name: 'selectSymbol', func: SelectSymbol },
|
|
||||||
{ name: 'deleteSymbol', func: DeleteSymbol }
|
|
||||||
];
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue