Fix issue when pressing Ctrl/Cmd+A in a text input inside a modal dialog

This commit is contained in:
Jonatan Heyman 2025-04-07 13:01:22 +02:00
parent fa83c50f44
commit 15df9e5e5c
6 changed files with 30 additions and 2 deletions

View File

@ -5,6 +5,7 @@ Here are the most notable changes in each release. For a more detailed list of c
## 2.1.4 (not released yet) ## 2.1.4 (not released yet)
- Fix issue with positioning and size of todo list checkboxes in Markdown blocks when using a non-default font size, or a non-monospaced font. - Fix issue with positioning and size of todo list checkboxes in Markdown blocks when using a non-default font size, or a non-monospaced font.
- Fix issue when pressing `Ctrl/Cmd+A` in a text input inside a modal dialog (e.g. the buffer selector). Previously the select all command would be sent to the editor.
## 2.1.3 ## 2.1.3

View File

@ -85,11 +85,14 @@
"showCreateBuffer", "showCreateBuffer",
"showEditBuffer", "showEditBuffer",
"showMoveToBufferSelector", "showMoveToBufferSelector",
"openMoveToBufferSelector",
]), ]),
dialogVisible() {
return this.showLanguageSelector || this.showBufferSelector || this.showCreateBuffer || this.showEditBuffer || this.showMoveToBufferSelector
},
editorInert() { editorInert() {
return this.showCreateBuffer || this.showSettings || this.showEditBuffer return this.dialogVisible
}, },
}, },

View File

@ -133,6 +133,12 @@
return return
} }
// support Ctrl/Cmd+A to select all
if (event.key === "a" && event[window.heynote.platform.isMac ? "metaKey" : "ctrlKey"]) {
event.preventDefault()
event.srcElement.select()
}
if (this.filteredItems.length === 0) { if (this.filteredItems.length === 0) {
return return
} }

View File

@ -120,6 +120,12 @@
}, },
onInputKeydown(event) { onInputKeydown(event) {
// support Ctrl/Cmd+A to select all
if (event.key === "a" && event[window.heynote.platform.isMac ? "metaKey" : "ctrlKey"]) {
event.preventDefault()
event.srcElement.select()
}
// redirect arrow keys and page up/down to folder selector // redirect arrow keys and page up/down to folder selector
const redirectKeys = ["ArrowDown", "ArrowUp", "PageDown", "PageUp"] const redirectKeys = ["ArrowDown", "ArrowUp", "PageDown", "PageUp"]
if (redirectKeys.includes(event.key)) { if (redirectKeys.includes(event.key)) {

View File

@ -50,6 +50,12 @@
methods: { methods: {
onKeydown(event) { onKeydown(event) {
// support Ctrl/Cmd+A to select all
if (event.key === "a" && event[window.heynote.platform.isMac ? "metaKey" : "ctrlKey"]) {
event.preventDefault()
event.srcElement.select()
}
if (event.key === "ArrowDown") { if (event.key === "ArrowDown") {
this.selected = Math.min(this.selected + 1, this.filteredItems.length - 1) this.selected = Math.min(this.selected + 1, this.filteredItems.length - 1)
event.preventDefault() event.preventDefault()

View File

@ -128,6 +128,12 @@
}, },
onInputKeydown(event) { onInputKeydown(event) {
// support Ctrl/Cmd+A to select all
if (event.key === "a" && event[window.heynote.platform.isMac ? "metaKey" : "ctrlKey"]) {
event.preventDefault()
event.srcElement.select()
}
// redirect arrow keys and page up/down to folder selector // redirect arrow keys and page up/down to folder selector
const redirectKeys = ["ArrowDown", "ArrowUp", "PageDown", "PageUp"] const redirectKeys = ["ArrowDown", "ArrowUp", "PageDown", "PageUp"]
if (redirectKeys.includes(event.key)) { if (redirectKeys.includes(event.key)) {