mirror of
https://github.com/heyman/heynote.git
synced 2025-08-18 02:20:08 +02:00
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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user