mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Remove Ctrl-B shortcut for bold
This commit is contained in:
@@ -11,8 +11,6 @@ class MarkdownEditor extends React.Component {
|
|||||||
|
|
||||||
this.escapeFromEditor = ['Control', 'w']
|
this.escapeFromEditor = ['Control', 'w']
|
||||||
|
|
||||||
this.supportMdBold = ['Control', 'b']
|
|
||||||
|
|
||||||
this.supportMdWordBold = ['Control', ':']
|
this.supportMdWordBold = ['Control', ':']
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
@@ -171,21 +169,11 @@ class MarkdownEditor extends React.Component {
|
|||||||
if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) {
|
if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) {
|
||||||
document.activeElement.blur()
|
document.activeElement.blur()
|
||||||
}
|
}
|
||||||
if (this.supportMdBold.every(isNoteHandlerKey)) {
|
|
||||||
this.addMdAndMoveCaretToCenter('****')
|
|
||||||
}
|
|
||||||
if (this.supportMdWordBold.every(isNoteHandlerKey)) {
|
if (this.supportMdWordBold.every(isNoteHandlerKey)) {
|
||||||
this.addMdBetweenWord('**')
|
this.addMdBetweenWord('**')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addMdAndMoveCaretToCenter (mdElement) {
|
|
||||||
const currentCaret = this.refs.code.editor.getCursor()
|
|
||||||
const cmDoc = this.refs.code.editor.getDoc()
|
|
||||||
cmDoc.replaceRange(mdElement, currentCaret)
|
|
||||||
this.refs.code.editor.setCursor({ line: currentCaret.line, ch: currentCaret.ch + mdElement.length / 2 })
|
|
||||||
}
|
|
||||||
|
|
||||||
addMdBetweenWord (mdElement) {
|
addMdBetweenWord (mdElement) {
|
||||||
const currentCaret = this.refs.code.editor.getCursor()
|
const currentCaret = this.refs.code.editor.getCursor()
|
||||||
const word = this.refs.code.editor.findWordAt(currentCaret)
|
const word = this.refs.code.editor.findWordAt(currentCaret)
|
||||||
|
|||||||
Reference in New Issue
Block a user