@@ -10,6 +10,7 @@ import { TextNode } from "../../../stage/stageObject/entity/TextNode";
1010import { editTextNode } from "../controller/concrete/utilsControl" ;
1111import { Direction } from "../../../../types/directions" ;
1212import { KeyboardOnlyEngine } from "./keyboardOnlyEngine" ;
13+ import { SectionMethods } from "../../../stage/stageManager/basicMethods/SectionMethods" ;
1314
1415/**
1516 * 专用于Xmind式的树形结构的键盘操作引擎
@@ -52,6 +53,14 @@ export namespace KeyboardOnlyTreeEngine {
5253 sizeAdjust : rootNode instanceof TextNode ? rootNode . sizeAdjust : "auto" ,
5354 } ) ;
5455 StageManager . addTextNode ( newNode ) ;
56+
57+ // 如果是在框里,则把新生长的节点也纳入到框里
58+ const fatherSections = SectionMethods . getFatherSections ( rootNode ) ;
59+ for ( const section of fatherSections ) {
60+ section . childrenUUIDs . push ( newNode . uuid ) ;
61+ section . children . push ( newNode ) ;
62+ }
63+
5564 // 连接节点
5665 StageManager . connectEntity ( rootNode , newNode ) ;
5766 const newEdges = GraphMethods . getEdgesBetween ( rootNode , newNode ) ;
@@ -117,6 +126,12 @@ export namespace KeyboardOnlyTreeEngine {
117126 sizeAdjust : parent instanceof TextNode ? parent . sizeAdjust : "auto" ,
118127 } ) ;
119128 StageManager . addTextNode ( newNode ) ;
129+ // 如果是在框里,则把新生长的节点也纳入到框里
130+ const fatherSections = SectionMethods . getFatherSections ( parent ) ;
131+ for ( const section of fatherSections ) {
132+ section . childrenUUIDs . push ( newNode . uuid ) ;
133+ section . children . push ( newNode ) ;
134+ }
120135 // 连接节点
121136 StageManager . connectEntity ( parent , newNode ) ;
122137
0 commit comments