mirror of
https://github.com/anatolykopyl/vue-highlights.git
synced 2026-03-26 12:55:35 +00:00
Ignore keys used for text highlight
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user