Merged PR 168: Add SmartComponent source code + Restrict Events by giving a root at the first render + Added Render function to a namespace
- Add smartcomponent source code to public/ - Restrict Events by giving a root at the first render + Added Render function to a namespace - Add attribute type="button" to all buttons
This commit is contained in:
parent
7f3f6a489a
commit
444b96736a
17 changed files with 132 additions and 24 deletions
|
@ -8,22 +8,29 @@ import { ReviveState } from '../utils/saveload';
|
|||
|
||||
const initEditor = (configuration: IConfiguration): void => {
|
||||
// faire comme la callback de fetch
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getEditorState = (editorState: IEditorState): void => {
|
||||
const getEditorState = (
|
||||
root: Element | Document,
|
||||
editorState: IEditorState
|
||||
): void => {
|
||||
const customEvent = new CustomEvent<IEditorState>('getEditorState', { detail: editorState });
|
||||
document.dispatchEvent(customEvent);
|
||||
root.dispatchEvent(customEvent);
|
||||
};
|
||||
|
||||
const getCurrentHistoryState = (editorState: IEditorState): void => {
|
||||
const getCurrentHistoryState = (
|
||||
root: Element | Document,
|
||||
editorState: IEditorState
|
||||
): void => {
|
||||
const customEvent = new CustomEvent<IHistoryState>(
|
||||
'getCurrentHistoryState',
|
||||
{ detail: editorState.history[editorState.historyCurrentStep] });
|
||||
document.dispatchEvent(customEvent);
|
||||
root.dispatchEvent(customEvent);
|
||||
};
|
||||
|
||||
const appendNewState = (
|
||||
root: Element | Document,
|
||||
editorState: IEditorState,
|
||||
setHistory: Dispatch<SetStateAction<IHistoryState[]>>,
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
|
||||
|
@ -41,6 +48,7 @@ const appendNewState = (
|
|||
export interface IEditorEvent {
|
||||
name: string
|
||||
func: (
|
||||
root: Element | Document,
|
||||
editorState: IEditorState,
|
||||
setHistory: Dispatch<SetStateAction<IHistoryState[]>>,
|
||||
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue