chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -63,17 +63,31 @@
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="flex items-center justify-end gap-3 mt-6">
|
||||
<button
|
||||
(click)="onCancel()"
|
||||
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
(click)="onSave()"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors">
|
||||
Save
|
||||
</button>
|
||||
<div class="flex items-center justify-between gap-3 mt-6">
|
||||
<!-- Left side: Delete button (if bookmark exists) -->
|
||||
<div>
|
||||
@if (pathExistsInBookmarks()) {
|
||||
<button
|
||||
(click)="onDelete()"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-md transition-colors">
|
||||
Delete
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Right side: Cancel & Save buttons -->
|
||||
<div class="flex gap-3">
|
||||
<button
|
||||
(click)="onCancel()"
|
||||
class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
(click)="onSave()"
|
||||
class="px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,10 @@ export interface BookmarkFormData {
|
||||
groupCtime: number | null;
|
||||
}
|
||||
|
||||
export interface BookmarkDeleteEvent {
|
||||
path: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-bookmark-modal',
|
||||
imports: [CommonModule, FormsModule],
|
||||
@@ -39,6 +43,7 @@ export class AddBookmarkModalComponent {
|
||||
|
||||
@Output() close = new EventEmitter<void>();
|
||||
@Output() save = new EventEmitter<BookmarkFormData>();
|
||||
@Output() delete = new EventEmitter<BookmarkDeleteEvent>();
|
||||
|
||||
readonly path = signal('');
|
||||
readonly title = signal('');
|
||||
@@ -67,6 +72,30 @@ export class AddBookmarkModalComponent {
|
||||
});
|
||||
|
||||
readonly isEditMode = computed(() => this.existingBookmark !== null);
|
||||
|
||||
/**
|
||||
* Check if current path exists in bookmarks
|
||||
*/
|
||||
readonly pathExistsInBookmarks = computed(() => {
|
||||
const currentPath = this.path();
|
||||
if (!currentPath) return false;
|
||||
|
||||
const doc = this.bookmarksService.doc();
|
||||
return this.findBookmarkByPath(doc.items, currentPath) !== null;
|
||||
});
|
||||
|
||||
private findBookmarkByPath(items: any[], path: string): any {
|
||||
for (const item of items) {
|
||||
if (item.type === 'file' && item.path === path) {
|
||||
return item;
|
||||
}
|
||||
if (item.type === 'group' && item.items) {
|
||||
const found = this.findBookmarkByPath(item.items, path);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.path.set(this.notePath);
|
||||
@@ -116,4 +145,15 @@ export class AddBookmarkModalComponent {
|
||||
this.close.emit();
|
||||
}
|
||||
}
|
||||
|
||||
onDelete(): void {
|
||||
const pathValue = this.path().trim();
|
||||
if (!pathValue) return;
|
||||
|
||||
if (!confirm(`Supprimer "${pathValue}" des favoris ?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.delete.emit({ path: pathValue });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user