1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix lint errors

This commit is contained in:
Leo Lam
2017-05-03 01:17:13 -04:00
parent 50ad5e3791
commit aee6541d45

View File

@@ -9,10 +9,10 @@ class MarkdownEditor extends React.Component {
constructor (props) { constructor (props) {
super(props) super(props)
//char codes for ctrl + w // char codes for ctrl + w
this.escapeFromEditor = [17, 87] this.escapeFromEditor = [17, 87]
//ctrl + shift + ; // ctrl + shift + ;
this.supportMdSelectionBold = [16, 17, 186] this.supportMdSelectionBold = [16, 17, 186]
this.state = { this.state = {
@@ -89,7 +89,7 @@ class MarkdownEditor extends React.Component {
handleBlur (e) { handleBlur (e) {
if (this.state.isLocked) return if (this.state.isLocked) return
this.setState({ keyPressed: new Set()}) this.setState({ keyPressed: new Set() })
let { config } = this.props let { config } = this.props
if (config.editor.switchPreview === 'BLUR') { if (config.editor.switchPreview === 'BLUR') {
let cursorPosition = this.refs.code.editor.getCursor() let cursorPosition = this.refs.code.editor.getCursor()
@@ -167,10 +167,9 @@ 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 (keyPressed.size === this.escapeFromEditor.length if (keyPressed.size === this.escapeFromEditor.length &&
&& !this.state.isLocked !this.state.isLocked && this.state.status === 'CODE' &&
&& this.state.status === 'CODE' this.escapeFromEditor.every(isNoteHandlerKey)) {
&& this.escapeFromEditor.every(isNoteHandlerKey)) {
document.activeElement.blur() document.activeElement.blur()
} }
if (keyPressed.size === this.supportMdSelectionBold.length && this.supportMdSelectionBold.every(isNoteHandlerKey)) { if (keyPressed.size === this.supportMdSelectionBold.length && this.supportMdSelectionBold.every(isNoteHandlerKey)) {