MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / getTopNodes

Method getTopNodes

packages/shell/src/model/selection.ts:103–113  ·  view source on GitHub ↗

* 获取选区的顶层节点 * for example: * getNodes() returns [A, subA, B], then * getTopNodes() will return [A, B], subA will be removed * @returns

(includeRoot: boolean = false)

Source from the content-addressed store, hash-verified

101 * @returns
102 */
103 getTopNodes(includeRoot: boolean = false): IPublicModelNode[] {
104 const innerNodes = this[selectionSymbol].getTopNodes(includeRoot);
105 const nodes: IPublicModelNode[] = [];
106 innerNodes.forEach((node: InnerNode) => {
107 const shellNode = ShellNode.create(node);
108 if (shellNode) {
109 nodes.push(shellNode);
110 }
111 });
112 return nodes;
113 }
114
115 onSelectionChange(fn: (ids: string[]) => void): IPublicTypeDisposable {
116 return this[selectionSymbol].onSelectionChange(fn);

Callers

nothing calls this directly

Calls 4

pushMethod · 0.80
getTopNodesMethod · 0.65
forEachMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected