Skip to content

Commit f82e668

Browse files
add: renamer2 to sibling
1 parent eb773d0 commit f82e668

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/createFamily/familyModal.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,23 @@ export default class familyModal extends Modal {
218218
if (currentActiveFileName?.endsWith("-cluster")) {
219219
new Notice(`You cant make Sibling to a cluster.\nCreate new cluster instead`);
220220
} else {
221-
const result = await templates(getActiveFile, "sibling");
222221

223-
if (result.state == true) {
224-
const siblingNameFromInput = this.inputEl.value.trim();
225-
if (siblingNameFromInput.endsWith("-cluster")) {
226-
new Notice("The name should'nt contain '-cluster' suffix", 3e3)
227-
return
222+
await renamer2(this.plugin, getActiveFile)
223+
setTimeout(async () => {
224+
const result = await templates(getActiveFile, "sibling");
225+
226+
if (result.state == true) {
227+
const siblingNameFromInput = this.inputEl.value.trim();
228+
if (siblingNameFromInput.endsWith("-cluster")) {
229+
new Notice("The name should'nt contain '-cluster' suffix", 3e3)
230+
return
231+
}
232+
this.setFolder(getActiveFile?.parent, "");
233+
this.createNewNote(appObject, siblingNameFromInput, result.siblingTemplate);
234+
this.app.commands.executeCommandById('file-explorer:reveal-active-file')
235+
228236
}
229-
this.setFolder(getActiveFile?.parent, "");
230-
this.createNewNote(appObject, siblingNameFromInput, result.siblingTemplate);
231-
}
237+
}, 100)
232238
}
233239
} else {
234240
new Notice("Create new sibling should not work outside [CLUSTERS] folder")

0 commit comments

Comments
 (0)