Fix so that clicking on "Create new" item in notes selector works

#build
This commit is contained in:
Jonatan Heyman 2024-12-06 01:32:37 +01:00
parent 3466e0d4fc
commit 0deefa01d9

View File

@ -156,25 +156,27 @@
this.deleteConfirm = false this.deleteConfirm = false
} else if (event.key === "Enter") { } else if (event.key === "Enter") {
event.preventDefault() event.preventDefault()
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)
}
}
},
selectItem(item) {
if (item.createNew) { if (item.createNew) {
if (this.filteredItems.length === 1) { if (this.filteredItems.length === 1) {
this.openCreateNote("new", this.filter) this.openCreateNote("new", this.filter)
} else { } else {
this.openCreateNote("new", "") this.openCreateNote("new", "")
} }
} else if (this.actionButton === 1) {
//console.log("edit file:", path)
this.editNote(item.path)
} else if (this.actionButton === 2) {
this.deleteConfirmNote(item.path)
} else { } else {
this.selectItem(item.path) this.$emit("openNote", item.path)
} }
}
},
selectItem(path) {
this.$emit("openNote", path)
}, },
itemHasActionButtons(item) { itemHasActionButtons(item) {
@ -253,7 +255,7 @@
<li v-if="item.createNew" class="line-separator"></li> <li v-if="item.createNew" class="line-separator"></li>
<li <li
:class="getItemClass(item, idx)" :class="getItemClass(item, idx)"
@click="selectItem(item.path)" @click="selectItem(item)"
ref="item" ref="item"
> >
<span class="name" v-html="item.name" /> <span class="name" v-html="item.name" />