Fix lot of eslint problems

This commit is contained in:
Eric NGUYEN 2022-11-21 13:47:04 +01:00
parent 5b9a0e6b34
commit 8b11c71384
17 changed files with 52 additions and 108 deletions

View file

@ -51,8 +51,14 @@ export function UseCustomEvents(
historyCurrentStep,
configuration
};
const current = editorRef.current;
if (current === null) {
return;
}
const funcs = new Map<string, () => void>();
for (const event of events) {
function Func(eventInitDict?: CustomEventInit): void {
return event.func({
@ -62,7 +68,7 @@ export function UseCustomEvents(
eventInitDict
});
}
editorRef.current?.addEventListener(event.name, Func);
current?.addEventListener(event.name, Func);
funcs.set(event.name, Func);
}
return () => {
@ -71,7 +77,7 @@ export function UseCustomEvents(
if (func === undefined) {
continue;
}
editorRef.current?.removeEventListener(event.name, func);
current?.removeEventListener(event.name, func);
}
};
});