mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 22:22:18 +08:00
Avoid scrolling to cursor when Control/Alt/Shift/Escape is hit
This behavior now matches other editors
This commit is contained in:
parent
03afc1ec29
commit
fc26306b7e
@ -54,7 +54,12 @@ export const EVENT_KEYS = Object.freeze(generateKeyHash([
|
|||||||
'ArrowLeft',
|
'ArrowLeft',
|
||||||
'ArrowRight',
|
'ArrowRight',
|
||||||
'Tab',
|
'Tab',
|
||||||
'Escape'
|
'Escape',
|
||||||
|
'Control',
|
||||||
|
'Alt',
|
||||||
|
'Shift',
|
||||||
|
'PageUp',
|
||||||
|
'PageDown'
|
||||||
]))
|
]))
|
||||||
|
|
||||||
export const LOWERCASE_TAGS = Object.freeze(generateKeyHash([
|
export const LOWERCASE_TAGS = Object.freeze(generateKeyHash([
|
||||||
|
@ -68,6 +68,10 @@ class Keyboard {
|
|||||||
) {
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (event.key === EVENT_KEYS.Control || event.key === EVENT_KEYS.Alt || event.key === EVENT_KEYS.Escape || event.key === EVENT_KEYS.Shift || event.key === EVENT_KEYS.PageUp || event.key === EVENT_KEYS.PageDown) { // we don't want to focus on the cursor if the user just hits one of these keys. Other editors do not.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Cursor outside editor area or over not editable elements.
|
// Cursor outside editor area or over not editable elements.
|
||||||
if (event.target.closest('[contenteditable=false]')) {
|
if (event.target.closest('[contenteditable=false]')) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user