mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 12:40:14 +08:00
Modify the pop-up conditions of muya-format-picker
This commit is contained in:
parent
b75895cdd1
commit
c8803a7cb0
@ -55,7 +55,8 @@ export const EVENT_KEYS = Object.freeze(generateKeyHash([
|
||||
'ArrowLeft',
|
||||
'ArrowRight',
|
||||
'Tab',
|
||||
'Escape'
|
||||
'Escape',
|
||||
'Shift'
|
||||
]))
|
||||
|
||||
export const LOWERCASE_TAGS = Object.freeze(generateKeyHash([
|
||||
|
@ -8,6 +8,7 @@ class Keyboard {
|
||||
constructor (muya) {
|
||||
this.muya = muya
|
||||
this.isComposed = false
|
||||
this.isShiftDown = false
|
||||
this.shownFloat = new Set()
|
||||
this.recordIsComposed()
|
||||
this.dispatchEditorState()
|
||||
@ -187,6 +188,10 @@ class Keyboard {
|
||||
case EVENT_KEYS.Tab:
|
||||
contentState.tabHandler(event)
|
||||
break
|
||||
case EVENT_KEYS.Shift:
|
||||
eventCenter.dispatch('muya-format-picker', { reference: null })
|
||||
this.isShiftDown = true
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -252,6 +257,10 @@ class Keyboard {
|
||||
})
|
||||
}
|
||||
|
||||
if (event.key === EVENT_KEYS.Shift) {
|
||||
this.isShiftDown = false
|
||||
}
|
||||
|
||||
const { anchor, focus, start, end } = selection.getCursorRange()
|
||||
if (!anchor || !focus) {
|
||||
return
|
||||
@ -276,6 +285,7 @@ class Keyboard {
|
||||
|
||||
const block = contentState.getBlock(anchor.key)
|
||||
if (
|
||||
this.isShiftDown === false &&
|
||||
anchor.key === focus.key &&
|
||||
anchor.offset !== focus.offset &&
|
||||
block.functionType !== 'codeContent' &&
|
||||
|
Loading…
Reference in New Issue
Block a user