mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
hiding spellcheck by default and adding a interface option to enable it
This commit is contained in:
@@ -473,6 +473,16 @@ export default class CodeEditor extends React.Component {
|
|||||||
needRefresh = true
|
needRefresh = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevProps.spellCheck !== this.props.spellCheck) {
|
||||||
|
if (this.props.spellCheck === false) {
|
||||||
|
spellcheck.setLanguage(this.editor, spellcheck.SPELLCHECK_DISABLED)
|
||||||
|
let elem = document.getElementById('editor-bottom-panel')
|
||||||
|
elem.parentNode.removeChild(elem)
|
||||||
|
} else {
|
||||||
|
this.editor.addPanel(this.createSpellCheckPanel(), {position: 'bottom'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (needRefresh) {
|
if (needRefresh) {
|
||||||
this.editor.refresh()
|
this.editor.refresh()
|
||||||
}
|
}
|
||||||
@@ -731,6 +741,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
createSpellCheckPanel () {
|
createSpellCheckPanel () {
|
||||||
const panel = document.createElement('div')
|
const panel = document.createElement('div')
|
||||||
panel.className = 'panel bottom'
|
panel.className = 'panel bottom'
|
||||||
|
panel.id = 'editor-bottom-panel'
|
||||||
const dropdown = document.createElement('select')
|
const dropdown = document.createElement('select')
|
||||||
dropdown.title = 'Spellcheck'
|
dropdown.title = 'Spellcheck'
|
||||||
dropdown.className = styles['spellcheck-select']
|
dropdown.className = styles['spellcheck-select']
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ class MarkdownEditor extends React.Component {
|
|||||||
enableTableEditor={config.editor.enableTableEditor}
|
enableTableEditor={config.editor.enableTableEditor}
|
||||||
onChange={(e) => this.handleChange(e)}
|
onChange={(e) => this.handleChange(e)}
|
||||||
onBlur={(e) => this.handleBlur(e)}
|
onBlur={(e) => this.handleBlur(e)}
|
||||||
spellCheck
|
spellCheck={config.editor.spellcheck}
|
||||||
/>
|
/>
|
||||||
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
|
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
|
||||||
? 'preview'
|
? 'preview'
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class MarkdownSplitEditor extends React.Component {
|
|||||||
noteKey={noteKey}
|
noteKey={noteKey}
|
||||||
onChange={this.handleOnChange.bind(this)}
|
onChange={this.handleOnChange.bind(this)}
|
||||||
onScroll={this.handleScroll.bind(this)}
|
onScroll={this.handleScroll.bind(this)}
|
||||||
spellCheck
|
spellCheck={config.editor.spellcheck}
|
||||||
/>
|
/>
|
||||||
<div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} >
|
<div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} >
|
||||||
<div styleName='slider-hitbox' />
|
<div styleName='slider-hitbox' />
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ export const DEFAULT_CONFIG = {
|
|||||||
fetchUrlTitle: true,
|
fetchUrlTitle: true,
|
||||||
enableTableEditor: false,
|
enableTableEditor: false,
|
||||||
enableFrontMatterTitle: true,
|
enableFrontMatterTitle: true,
|
||||||
frontMatterTitleField: 'title'
|
frontMatterTitleField: 'title',
|
||||||
|
spellcheck: false
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: '14',
|
fontSize: '14',
|
||||||
|
|||||||
@@ -91,7 +91,8 @@ class UiTab extends React.Component {
|
|||||||
fetchUrlTitle: this.refs.editorFetchUrlTitle.checked,
|
fetchUrlTitle: this.refs.editorFetchUrlTitle.checked,
|
||||||
enableTableEditor: this.refs.enableTableEditor.checked,
|
enableTableEditor: this.refs.enableTableEditor.checked,
|
||||||
enableFrontMatterTitle: this.refs.enableFrontMatterTitle.checked,
|
enableFrontMatterTitle: this.refs.enableFrontMatterTitle.checked,
|
||||||
frontMatterTitleField: this.refs.frontMatterTitleField.value
|
frontMatterTitleField: this.refs.frontMatterTitleField.value,
|
||||||
|
spellcheck: this.refs.spellcheck.checked
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: this.refs.previewFontSize.value,
|
fontSize: this.refs.previewFontSize.value,
|
||||||
@@ -499,6 +500,16 @@ class UiTab extends React.Component {
|
|||||||
{i18n.__('Enable smart table editor')}
|
{i18n.__('Enable smart table editor')}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div styleName='group-checkBoxSection'>
|
||||||
|
<label>
|
||||||
|
<input onChange={(e) => this.handleUIChange(e)}
|
||||||
|
checked={this.state.config.editor.spellcheck}
|
||||||
|
ref='spellcheck'
|
||||||
|
type='checkbox'
|
||||||
|
/>
|
||||||
|
{i18n.__('Enable spellcheck - Experimental feature!! :)')}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div styleName='group-header2'>{i18n.__('Preview')}</div>
|
<div styleName='group-header2'>{i18n.__('Preview')}</div>
|
||||||
<div styleName='group-section'>
|
<div styleName='group-section'>
|
||||||
|
|||||||
Reference in New Issue
Block a user