Implement support for editing notes' metadata, and ability to move notes into other directories.

Create separate pinia store for the editor cache functionality.
This commit is contained in:
Jonatan Heyman
2024-09-04 15:22:06 +02:00
parent 0da3e32171
commit 7e1f01471a
11 changed files with 513 additions and 53 deletions

View File

@@ -72,6 +72,15 @@ export class FileLibrary {
await this.jetpack.writeAsync(fullPath, content)
}
async move(path, newPath) {
if (await this.exists(newPath)) {
throw new Error(`File already exists: ${newPath}`)
}
const fullOldPath = join(this.basePath, path)
const fullNewPath = join(this.basePath, newPath)
await this.jetpack.moveAsync(fullOldPath, fullNewPath)
}
async getList() {
console.log("Loading notes")
const notes = {}
@@ -231,5 +240,9 @@ export function setupFileLibraryEventHandlers(library, win) {
app.quit()
})
ipcMain.handle('buffer:move', async (event, path, newPath) => {
return await library.move(path, newPath)
});
library.setupWatcher(win)
}