diff --git a/src/ui/ProfileSelectionModal.ts b/src/ui/ProfileSelectionModal.ts index 38a5dc9..a9a9868 100644 --- a/src/ui/ProfileSelectionModal.ts +++ b/src/ui/ProfileSelectionModal.ts @@ -95,7 +95,7 @@ export class ProfileSelectionModal extends Modal { folderButtonContainer.style.marginTop = "0.5em"; const pickFolderBtn = folderButtonContainer.createEl("button", { - text: "Pick…", + text: "Anpassen", }); pickFolderBtn.onclick = async () => { const folderModal = new FolderTreeModal(this.app, this.noteIndex, folderPath); @@ -105,31 +105,6 @@ export class ProfileSelectionModal extends Modal { folderPathSpan.textContent = folderPath || "(root)"; } }; - - const newFolderBtn = folderButtonContainer.createEl("button", { - text: "New folder…", - }); - newFolderBtn.onclick = async () => { - const folderName = await this.promptForFolderName(); - if (folderName && folderName.trim()) { - const newFolderPath = folderPath - ? `${folderPath}/${folderName.trim()}` - : folderName.trim(); - - try { - await this.app.vault.createFolder(newFolderPath); - folderPath = newFolderPath; - folderPathSpan.textContent = folderPath || "(root)"; - new Notice(`Folder created: ${newFolderPath}`); - - // Refresh note index to include new folder - this.noteIndex.refresh(); - } catch (e) { - const msg = e instanceof Error ? e.message : String(e); - new Notice(`Failed to create folder: ${msg}`); - } - } - }; // Profile selection (grouped) for (const [groupName, profiles] of grouped.entries()) { @@ -235,53 +210,6 @@ export class ProfileSelectionModal extends Modal { }); } - private async promptForFolderName(): Promise { - return new Promise((resolve) => { - const modal = new Modal(this.app); - modal.titleEl.textContent = "New folder name"; - - const inputContainer = modal.contentEl.createEl("div"); - const input = inputContainer.createEl("input", { - type: "text", - placeholder: "Folder name", - }); - input.style.width = "100%"; - input.style.marginBottom = "1em"; - - const buttonContainer = modal.contentEl.createEl("div"); - buttonContainer.style.display = "flex"; - buttonContainer.style.gap = "0.5em"; - buttonContainer.style.justifyContent = "flex-end"; - - const cancelBtn = buttonContainer.createEl("button", { text: "Cancel" }); - cancelBtn.onclick = () => { - modal.close(); - resolve(null); - }; - - const createBtn = buttonContainer.createEl("button", { - text: "Create", - cls: "mod-cta", - }); - createBtn.onclick = () => { - const value = input.value.trim(); - modal.close(); - resolve(value || null); - }; - - input.onkeydown = (evt) => { - if (evt.key === "Enter") { - createBtn.click(); - } else if (evt.key === "Escape") { - cancelBtn.click(); - } - }; - - modal.open(); - input.focus(); - input.select(); - }); - } onClose(): void { const { contentEl } = this;