Skip to content

Commit 07aa1bb

Browse files
committed
fix: prevent default save shortcut on notes edit
1 parent fb1628d commit 07aa1bb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/client/internals/NoteEditable.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ function calculateEditorHeight() {
9494
inputEl.value.style.height = `${inputEl.value.scrollHeight}px`
9595
}
9696
97+
function onKeyDown(e: KeyboardEvent) {
98+
// Override save shortcut on editing mode
99+
if (editing.value && e.metaKey && e.key === 's') {
100+
e.preventDefault()
101+
update({ note: note.value }, props.no)
102+
}
103+
}
104+
97105
watch(
98106
[note, editing],
99107
() => {
@@ -129,5 +137,6 @@ watch(
129137
:class="props.class"
130138
:placeholder="placeholder"
131139
@keydown.esc="editing = false"
140+
@keydown="onKeyDown"
132141
/>
133142
</template>

0 commit comments

Comments
 (0)