mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2025-12-21 21:22:25 +00:00
feat: add snippet deletion functionality and enhance UI for snippet management
This commit is contained in:
@@ -149,4 +149,22 @@ export class SnippetManager {
|
||||
this.readOnlyMode = hasChanges && !this.isDraftVersion;
|
||||
this.editorManager.updateReadOnlyState(this.readOnlyMode);
|
||||
}
|
||||
|
||||
deleteSnippet(id) {
|
||||
if (confirm('Are you sure you want to delete this snippet?')) {
|
||||
this.snippets = this.snippets.filter(s => s.id !== id);
|
||||
this.storageManager.saveSnippets(this.snippets);
|
||||
|
||||
if (this.currentSnippetId === id) {
|
||||
this.currentSnippetId = null;
|
||||
if (this.snippets.length > 0) {
|
||||
this.loadSnippet(this.snippets[0].id);
|
||||
} else {
|
||||
this.editorManager.setValue('');
|
||||
}
|
||||
}
|
||||
|
||||
this.uiManager.renderSnippetList(this.snippets, this.currentSnippetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user