feat: add onMountNode event for DocumentModel

This commit is contained in:
LeoYuan 袁力皓 2022-06-07 11:19:25 +08:00 committed by 林熠
parent 00c2d5ec51
commit dcc247c7d5

View File

@ -204,6 +204,16 @@ export default class DocumentModel {
}); });
} }
/**
* document document
*/
onMountNode(fn: (node: Node) => void) {
this[editorSymbol].on('node.add', fn as any);
return () => {
this[editorSymbol].off('node.add', fn as any);
};
}
/** /**
* document * document
*/ */