mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
feat: add importSchema event for documentModel
This commit is contained in:
parent
6eefb4e96d
commit
4b8ec09e86
@ -36,6 +36,10 @@ type PropChangeOptions = {
|
||||
oldValue: any;
|
||||
};
|
||||
|
||||
const Events = {
|
||||
IMPORT_SCHEMA: 'shell.document.importSchema',
|
||||
};
|
||||
|
||||
export default class DocumentModel {
|
||||
private readonly [documentSymbol]: InnerDocumentModel;
|
||||
private readonly [editorSymbol]: Editor;
|
||||
@ -135,6 +139,7 @@ export default class DocumentModel {
|
||||
*/
|
||||
importSchema(schema: RootSchema) {
|
||||
this[documentSymbol].import(schema);
|
||||
this[editorSymbol].emit(Events.IMPORT_SCHEMA, schema);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,4 +295,12 @@ export default class DocumentModel {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* import schema event
|
||||
* @param fn
|
||||
*/
|
||||
onImportSchema(fn: (schema: RootSchema) => void) {
|
||||
this[editorSymbol].on(Events.IMPORT_SCHEMA, fn as any);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user