feat: add snippet renaming functionality and enhance UI with edit button

This commit is contained in:
2025-01-19 14:26:12 +02:00
parent fe9e554cec
commit 49705d7d30
3 changed files with 49 additions and 1 deletions
+12
View File
@@ -167,4 +167,16 @@ export class SnippetManager {
this.uiManager.renderSnippetList(this.snippets, this.currentSnippetId);
}
}
renameSnippet(id) {
const snippet = this.snippets.find(s => s.id === id);
if (!snippet) return;
const newName = prompt('Enter new name:', snippet.name);
if (newName && newName.trim() !== '') {
snippet.name = newName.trim();
this.storageManager.saveSnippets(this.snippets);
this.uiManager.renderSnippetList(this.snippets, this.currentSnippetId);
}
}
}