Skip to content

Commit

Permalink
fix: prevent default save shortcut on notes edit
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 5, 2024
1 parent fb1628d commit 07aa1bb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/client/internals/NoteEditable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ function calculateEditorHeight() {
inputEl.value.style.height = `${inputEl.value.scrollHeight}px`
}
function onKeyDown(e: KeyboardEvent) {
// Override save shortcut on editing mode
if (editing.value && e.metaKey && e.key === 's') {
e.preventDefault()
update({ note: note.value }, props.no)
}
}
watch(
[note, editing],
() => {
Expand Down Expand Up @@ -129,5 +137,6 @@ watch(
:class="props.class"
:placeholder="placeholder"
@keydown.esc="editing = false"
@keydown="onKeyDown"
/>
</template>

0 comments on commit 07aa1bb

Please sign in to comment.