Skip to content

Commit

Permalink
feat: insert empty node if none exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sorax committed Feb 6, 2024
1 parent ed9f44e commit 4a49111
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/js/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ export const Hooks = {
// })

this.handleEvent("list", ({ nodes }) => {
if ((nodes.length) == 0) {
nodes = [{
temp_id: self.crypto.randomUUID(),
content: "",
}]
}

// add all items
nodes.forEach(node => {
const item = createItem(node)
Expand Down

0 comments on commit 4a49111

Please sign in to comment.