mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Subtypes: add another test.
This commit is contained in:
parent
ab3467973f
commit
63698572db
4 changed files with 104 additions and 30 deletions
|
@ -16,8 +16,10 @@ import util from "util";
|
|||
import path from "path";
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import {
|
||||
SubtypeLoadedCb,
|
||||
SubtypePrepFn,
|
||||
SubtypeRecord,
|
||||
checkRefreshOnSubtypeLoad,
|
||||
prepareSubtype,
|
||||
selectSubtype,
|
||||
subtypeActionPredicate,
|
||||
|
@ -45,7 +47,12 @@ export class API {
|
|||
}
|
||||
|
||||
static addSubtype = (record: SubtypeRecord, subtypePrepFn: SubtypePrepFn) => {
|
||||
const prep = prepareSubtype(record, subtypePrepFn);
|
||||
const subtypeLoadedCb: SubtypeLoadedCb = (hasSubtype) => {
|
||||
if (checkRefreshOnSubtypeLoad(hasSubtype, h.elements)) {
|
||||
h.app.refresh();
|
||||
}
|
||||
};
|
||||
const prep = prepareSubtype(record, subtypePrepFn, subtypeLoadedCb);
|
||||
if (prep.actions) {
|
||||
h.app.actionManager.registerAll(prep.actions);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue