From 37a3f54051897d8d0810c6a9ceb88eb876bac30c 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 6a318c525..100d2c33b 100644 --- a/packages/shell/src/document-model.ts +++ b/packages/shell/src/document-model.ts @@ -208,7 +208,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)!); }); } @@ -217,7 +217,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); }); }