mirror of
https://github.com/heyman/heynote.git
synced 2025-08-19 10:52:03 +02:00
Implement functionality for deleting notes
This commit is contained in:
@@ -96,6 +96,14 @@ export class FileLibrary {
|
||||
await this.jetpack.moveAsync(fullOldPath, fullNewPath)
|
||||
}
|
||||
|
||||
async delete(path) {
|
||||
if (path === SCRATCH_FILE_NAME) {
|
||||
throw new Error("Can't delete scratch file")
|
||||
}
|
||||
const fullPath = join(this.basePath, path)
|
||||
await this.jetpack.removeAsync(fullPath)
|
||||
}
|
||||
|
||||
async getList() {
|
||||
//console.log("Listing notes")
|
||||
const notes = {}
|
||||
@@ -262,6 +270,10 @@ export function setupFileLibraryEventHandlers(win) {
|
||||
return await library.move(path, newPath)
|
||||
});
|
||||
|
||||
ipcMain.handle('buffer:delete', async (event, path) => {
|
||||
return await library.delete(path)
|
||||
});
|
||||
|
||||
ipcMain.handle("library:selectLocation", async () => {
|
||||
let result = await dialog.showOpenDialog({
|
||||
title: "Select directory to store buffer",
|
||||
|
Reference in New Issue
Block a user