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:
Eric Nguyen 2022-08-26 09:13:51 +00:00
parent 7f3f6a489a
commit 444b96736a
17 changed files with 132 additions and 24 deletions

View file

@ -14,6 +14,7 @@ import { AddSymbol, OnPropertyChange as OnSymbolPropertyChange, DeleteSymbol, Se
import { findContainerById } from '../../utils/itertools';
interface IEditorProps {
root: Element | Document
configuration: IConfiguration
history: IHistoryState[]
historyCurrentStep: number
@ -57,6 +58,7 @@ function useShortcuts(
}
function useWindowEvents(
root: Element | Document,
history: IHistoryState[],
historyCurrentStep: number,
configuration: IConfiguration,
@ -75,6 +77,7 @@ function useWindowEvents(
const funcs = new Map<string, () => void>();
for (const event of events) {
const func = (eventInitDict?: CustomEventInit): void => event.func(
root,
editorState,
setHistory,
setHistoryCurrentStep,
@ -102,6 +105,7 @@ const Editor: React.FunctionComponent<IEditorProps> = (props) => {
useShortcuts(history, historyCurrentStep, setHistoryCurrentStep);
useWindowEvents(
props.root,
history,
historyCurrentStep,
props.configuration,