Skip to content

Commit

Permalink
Fix so that clicking on "Create new" item in notes selector works
Browse files Browse the repository at this point in the history
#build
  • Loading branch information
heyman committed Dec 6, 2024
1 parent fe095a0 commit e573edb
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/components/NoteSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,27 @@
this.deleteConfirm = false
} else if (event.key === "Enter") {
event.preventDefault()
if (item.createNew) {
if (this.filteredItems.length === 1) {
this.openCreateNote("new", this.filter)
} else {
this.openCreateNote("new", "")
}
} else if (this.actionButton === 1) {
if (this.actionButton === 1) {
//console.log("edit file:", path)
this.editNote(item.path)
} else if (this.actionButton === 2) {
this.deleteConfirmNote(item.path)
} else {
this.selectItem(item.path)
this.selectItem(item)
}
}
},
selectItem(path) {
this.$emit("openNote", path)
selectItem(item) {
if (item.createNew) {
if (this.filteredItems.length === 1) {
this.openCreateNote("new", this.filter)
} else {
this.openCreateNote("new", "")
}
} else {
this.$emit("openNote", item.path)
}
},
itemHasActionButtons(item) {
Expand Down Expand Up @@ -253,7 +255,7 @@
<li v-if="item.createNew" class="line-separator"></li>
<li
:class="getItemClass(item, idx)"
@click="selectItem(item.path)"
@click="selectItem(item)"
ref="item"
>
<span class="name" v-html="item.name" />
Expand Down

0 comments on commit e573edb

Please sign in to comment.