Add Spell Checker Option to SimpleMDE Plugin

Default is off.
This commit is contained in:
anaggh 2016-11-19 14:00:53 +05:30
parent dbaf520653
commit 26c03bc9d7
2 changed files with 14 additions and 3 deletions

View File

@ -6,5 +6,6 @@
},
"toolbar": "Toolbar",
"tab-size": "Tab size",
"autosave": "Autosave"
"autosave": "Autosave",
"spell-checker": "Spell Checker"
}

View File

@ -14,7 +14,8 @@ class pluginsimpleMDE extends Plugin {
$this->dbFields = array(
'tabSize'=>'2',
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen", "guide"',
'autosave'=>0
'autosave'=>0,
'spellChecker'=>0
);
}
@ -38,6 +39,12 @@ class pluginsimpleMDE extends Plugin {
$html .= '<label class="forCheckbox" for="jsautosave">'.$Language->get('Autosave').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="spellChecker" value="0">';
$html .= '<input name="spellChecker" id="jsspellChecker" type="checkbox" value="1" '.($this->getDbField('spellChecker')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsspellChecker">'.$Language->get('spell-checker').'</label>';
$html .= '</div>';
return $html;
}
@ -96,6 +103,9 @@ class pluginsimpleMDE extends Plugin {
$autosaveID = $_Post->key();
}
// Spell Checker
$spellCheckerEnable = $this->getDbField('spellChecker')?'true':'false';
$pluginPath = $this->htmlPath();
$html = '<script>'.PHP_EOL;
@ -123,7 +133,7 @@ class pluginsimpleMDE extends Plugin {
autoDownloadFontAwesome: false,
indentWithTabs: true,
tabSize: '.$this->getDbField('tabSize').',
spellChecker: false,
spellChecker: '.$spellCheckerEnable.',
autosave: {
enabled: '.$autosaveEnable.',
uniqueId: "'.$autosaveID.'",