diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js
index d676a1a4..62a6e294 100644
--- a/browser/components/CodeEditor.js
+++ b/browser/components/CodeEditor.js
@@ -473,6 +473,16 @@ export default class CodeEditor extends React.Component {
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) {
this.editor.refresh()
}
@@ -731,6 +741,7 @@ export default class CodeEditor extends React.Component {
createSpellCheckPanel () {
const panel = document.createElement('div')
panel.className = 'panel bottom'
+ panel.id = 'editor-bottom-panel'
const dropdown = document.createElement('select')
dropdown.title = 'Spellcheck'
dropdown.className = styles['spellcheck-select']
diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js
index d43a7693..dea5f3e2 100644
--- a/browser/components/MarkdownEditor.js
+++ b/browser/components/MarkdownEditor.js
@@ -272,7 +272,7 @@ class MarkdownEditor extends React.Component {
enableTableEditor={config.editor.enableTableEditor}
onChange={(e) => this.handleChange(e)}
onBlur={(e) => this.handleBlur(e)}
- spellCheck
+ spellCheck={config.editor.spellcheck}
/>