GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: fix document.onMountNode parameters · czfadmin/lowcode-engine@055ab68

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • designer/src/document
      • document-model.ts
    • shell/src/model
      • document-model.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/designer/src/document/document-model.ts‎

Copy file name to clipboardExpand all lines: packages/designer/src/document/document-model.ts
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export interface IDocumentModel extends Omit<IPublicModelDocumentModel<
7474
'onRemoveNode' |
7575
'onChangeDetecting' |
7676
'onChangeSelection' |
77-
'onMountNode' |
7877
'onChangeNodeProp' |
7978
'onImportSchema' |
8079
'isDetectingNode' |
@@ -414,6 +413,14 @@ export class DocumentModel implements IDocumentModel {
414413
return node ? !node.isPurged : false;
415414
}
416415

416+
onMountNode(fn: (payload: { node: INode }) => void) {
417+
this.designer.editor.eventBus.on('node.add', fn as any);
418+
419+
return () => {
420+
this.designer.editor.eventBus.off('node.add', fn as any);
421+
};
422+
}
423+
417424
/**
418425
* 根据 schema 创建一个节点
419426
*/
Collapse file

‎packages/shell/src/model/document-model.ts‎

Copy file name to clipboardExpand all lines: packages/shell/src/model/document-model.ts
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,11 @@ export class DocumentModel implements IPublicModelDocumentModel {
252252
* 当前 document 新增节点事件,此时节点已经挂载到 document 上
253253
*/
254254
onMountNode(fn: (payload: { node: IPublicModelNode }) => void): IPublicTypeDisposable {
255-
this[editorSymbol].eventBus.on('node.add', fn as any);
256-
return () => {
257-
this[editorSymbol].eventBus.off('node.add', fn as any);
258-
};
255+
return this[documentSymbol].onMountNode(({
256+
node,
257+
}) => {
258+
fn({ node: ShellNode.create(node)! });
259+
});
259260
}
260261

261262
/**

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.