mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Simplify custom Actions: universal Action predicates instead of
action-specific guards.
This commit is contained in:
parent
512e506798
commit
c8d4e8c421
9 changed files with 105 additions and 193 deletions
|
@ -20,6 +20,7 @@ import {
|
|||
SubtypeRecord,
|
||||
prepareSubtype,
|
||||
selectSubtype,
|
||||
subtypeActionPredicate,
|
||||
} from "../../subtypes";
|
||||
import {
|
||||
maybeGetSubtypeProps,
|
||||
|
@ -36,6 +37,7 @@ const { h } = window;
|
|||
|
||||
export class API {
|
||||
constructor() {
|
||||
h.app.actionManager.registerActionPredicate(subtypeActionPredicate);
|
||||
if (true) {
|
||||
// Call `prepareSubtype()` here for `@excalidraw/excalidraw`-specific subtypes
|
||||
}
|
||||
|
@ -45,7 +47,6 @@ export class API {
|
|||
const prep = prepareSubtype(record, subtypePrepFn);
|
||||
if (prep.actions) {
|
||||
h.app.actionManager.registerAll(prep.actions);
|
||||
h.app.actionManager.registerActionGuards();
|
||||
}
|
||||
return prep;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue