feat: add note moving functionality with UI controls

- Added new API endpoint /api/vault/notes/move for moving markdown files between folders
- Implemented setupMoveNoteEndpoint with path validation, error handling, and event broadcasting
- Added move note UI component to note header with folder selection
- Updated note viewer to handle note path changes after moving
- Added moveNoteToFolder method to VaultService for client-side integration
- Modified note header layout to include move trigger
This commit is contained in:
2025-10-25 21:39:31 -04:00
parent b1da9b111d
commit 0ae9cae1eb
10 changed files with 988 additions and 7 deletions
@@ -60,6 +60,7 @@ export interface WikiLinkActivation {
[tags]="note.tags ?? []"
(copyRequested)="copyPath()"
(openDirectory)="directoryClicked.emit(getDirectoryFromPath(note.filePath))"
(noteMoved)="onNoteMoved($event)"
(tagsChange)="onTagsChange($event)"
(tagSelected)="tagClicked.emit($event)"
></app-note-header>
@@ -479,6 +480,21 @@ export class NoteViewerComponent implements OnDestroy {
// Pas besoin de sauvegarder ici, c'est déjà fait par TagsEditorComponent
}
onNoteMoved(newPath: string): void {
const currentNote = this.note();
if (!currentNote || !newPath) {
return;
}
currentNote.filePath = newPath;
currentNote.originalPath = newPath.replace(/\\/g, '/').replace(/\.md$/i, '');
const newFolder = this.getDirectoryFromPath(newPath);
if (newFolder) {
this.directoryClicked.emit(newFolder);
}
}
async copyPath(): Promise<void> {
const path = this.note()?.filePath ?? '';
try {