WIP: Create new node dialog

Implement folder selector UI element.
Retrieve actual folder structure from Notes library.
This commit is contained in:
Jonatan Heyman
2024-07-25 13:25:19 +02:00
parent 9ee66743d7
commit 5e34656c1d
9 changed files with 542 additions and 60 deletions

View File

@ -67,7 +67,7 @@ export class FileLibrary {
async getList() {
console.log("Loading notes")
const notes = {}
const files = await this.jetpack.findAsync(this.basePath, {
const files = await this.jetpack.findAsync(".", {
matching: "*.txt",
recursive: true,
})
@ -83,6 +83,15 @@ export class FileLibrary {
return notes
}
async getDirectoryList() {
const directories = await this.jetpack.findAsync("", {
files: false,
directories: true,
recursive: true,
})
return directories
}
setupWatcher(win) {
if (!this.watcher) {
this.watcher = fs.watch(
@ -189,6 +198,10 @@ export function setupFileLibraryEventHandlers(library, win) {
return await library.getList()
});
ipcMain.handle('buffer:getDirectoryList', async (event) => {
return await library.getDirectoryList()
});
ipcMain.handle('buffer:exists', async (event, path) => {
return await library.exists(path)
});