@@ -142,7 +142,11 @@ export default class familyModal extends Modal {
142142 if ( ( getActiveFile . path . match ( / \/ / g) || [ ] ) . length == 1 ) {
143143 const result = await templates ( getActiveFile , "clusterSon" ) ;
144144 if ( result . state ) {
145-
145+ const childNameFromInput = this . inputEl . value . trim ( ) ;
146+ if ( childNameFromInput . endsWith ( "-cluster" ) ) {
147+ new Notice ( "The name should'nt contain '-cluster' suffix" , 3e3 )
148+ return
149+ }
146150 const sonsFolderPath = `${ getActiveFile ?. parent ?. path } /${ currentActiveFileName } ` ;
147151 await this . createDirectory ( appObject , "" , sonsFolderPath ) ;
148152 const newCreatedSonsFolder = getActiveFile . parent ?. children ?. find (
@@ -151,7 +155,7 @@ export default class familyModal extends Modal {
151155
152156 // @ts -ignore
153157 this . setFolder ( newCreatedSonsFolder , "" ) ;
154- await this . createNewNote ( appObject , this . inputEl . value . trim ( ) , result . clusterSonTemplate ) ;
158+ await this . createNewNote ( appObject , childNameFromInput , result . clusterSonTemplate ) ;
155159 }
156160
157161 } else {
@@ -166,6 +170,11 @@ export default class familyModal extends Modal {
166170 const result = await templates ( getActiveFile , "normalSon" ) ;
167171
168172 if ( result . state ) {
173+ const childNameFromInput = this . inputEl . value . trim ( ) ;
174+ if ( childNameFromInput . endsWith ( "-cluster" ) ) {
175+ new Notice ( "The name should'nt contain '-cluster' suffix" , 3e3 )
176+ return
177+ }
169178 const sonsFolderPath = `${ getActiveFile ! . parent ! . path } /${ currentActiveFileName } ` ;
170179 await this . createDirectory ( appObject , "" , sonsFolderPath ) ;
171180 const newCreatedSonsFolder = getActiveFile . parent ! . children . find (
@@ -174,7 +183,7 @@ export default class familyModal extends Modal {
174183
175184 // @ts -ignore
176185 this . setFolder ( newCreatedSonsFolder , "" ) ;
177- await this . createNewNote ( appObject , this . inputEl . value . trim ( ) , result . normalSonTemplate ) ;
186+ await this . createNewNote ( appObject , childNameFromInput , result . normalSonTemplate ) ;
178187 }
179188
180189 } else {
@@ -198,8 +207,13 @@ export default class familyModal extends Modal {
198207 const result = await templates ( getActiveFile , "brother" ) ;
199208
200209 if ( result . state == true ) {
210+ const siblingNameFromInput = this . inputEl . value . trim ( ) ;
211+ if ( siblingNameFromInput . endsWith ( "-cluster" ) ) {
212+ new Notice ( "The name should'nt contain '-cluster' suffix" , 3e3 )
213+ return
214+ }
201215 this . setFolder ( getActiveFile ! . parent ! , "" ) ;
202- this . createNewNote ( appObject , this . inputEl . value . trim ( ) , result . brotherTemplate ) ;
216+ this . createNewNote ( appObject , siblingNameFromInput , result . brotherTemplate ) ;
203217 }
204218 }
205219 } else {
0 commit comments