From 30267cb173fca2cd80a61450b9f2fe2bceac0f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LeoYuan=20=E8=A2=81=E5=8A=9B=E7=9A=93?= Date: Fri, 27 May 2022 10:53:50 +0800 Subject: [PATCH] feat: return unbind function for onChangeDetecting & onChangeSelection --- packages/shell/src/document-model.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shell/src/document-model.ts b/packages/shell/src/document-model.ts index c5610fcb5..7d9afc16c 100644 --- a/packages/shell/src/document-model.ts +++ b/packages/shell/src/document-model.ts @@ -204,7 +204,7 @@ export default class DocumentModel { * 当前 document 的 hover 变更事件 */ onChangeDetecting(fn: (node: Node) => void) { - this[documentSymbol].designer.detecting.onDetectingChange((node: InnerNode) => { + return this[documentSymbol].designer.detecting.onDetectingChange((node: InnerNode) => { fn(Node.create(node)!); }); } @@ -213,7 +213,7 @@ export default class DocumentModel { * 当前 document 的选中变更事件 */ onChangeSelection(fn: (ids: string[]) => void) { - this[documentSymbol].selection.onSelectionChange((ids: string[]) => { + return this[documentSymbol].selection.onSelectionChange((ids: string[]) => { fn(ids); }); }