mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
minor improvement on multi-key detection
-check if number of keys pressed is the same as number of keys in a shortcut key combo before matching to avoid incorrect detection
This commit is contained in:
@@ -167,10 +167,13 @@ class MarkdownEditor extends React.Component {
|
|||||||
keyPressed.add(e.keyCode)
|
keyPressed.add(e.keyCode)
|
||||||
this.setState({ keyPressed })
|
this.setState({ keyPressed })
|
||||||
let isNoteHandlerKey = (el) => { return keyPressed.has(el) }
|
let isNoteHandlerKey = (el) => { return keyPressed.has(el) }
|
||||||
if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) {
|
if (keyPressed.size === this.escapeFromEditor.length
|
||||||
|
&& !this.state.isLocked
|
||||||
|
&& this.state.status === 'CODE'
|
||||||
|
&& this.escapeFromEditor.every(isNoteHandlerKey)) {
|
||||||
document.activeElement.blur()
|
document.activeElement.blur()
|
||||||
}
|
}
|
||||||
if (this.supportMdSelectionBold.every(isNoteHandlerKey)) {
|
if (keyPressed.size === this.supportMdSelectionBold.length && this.supportMdSelectionBold.every(isNoteHandlerKey)) {
|
||||||
this.addMdAroundWord('**')
|
this.addMdAroundWord('**')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user