Ignore keys used for text highlight

This commit is contained in:
2022-07-09 15:14:18 +03:00
parent be21eb3897
commit c136bbe2bb

View File

@@ -67,8 +67,11 @@ export default {
this.body = '' this.body = ''
}, },
onKeyUp (e) { onKeyUp (e) {
const keysToIgnore = ['Shift', 'Meta', 'Control', 'Alt', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight']
if (keysToIgnore.includes(e.key)) return
let caretPosition = this.getCaretPos() let caretPosition = this.getCaretPos()
if (e.keyCode === 13) { // Enter key if (e.key === 'Enter') {
caretPosition++ caretPosition++
} }
this.body = e.target.innerText this.body = e.target.innerText