diff options
author | Cheng-Han, Wu | 2016-04-20 18:09:36 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-04-20 18:09:36 +0800 |
commit | 0fb70a1487f6c2ce612c372f12aaf157078a478f (patch) | |
tree | 9d5bd6375e34e2df0613309dfa2a9d552ff81b15 /public/js/extra.js | |
parent | 692903f1a10606b0e14d50623663a4c591c42674 (diff) |
Support experimental spell checking feature (en-US only), can be enabled by the YAML meta option
Diffstat (limited to '')
-rw-r--r-- | public/js/extra.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index be454ed7..83d62d4d 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -84,12 +84,14 @@ function parseMeta(md, edit, view, toc, tocAffix) { var lang = null; var dir = null; var breaks = true; + var spellcheck = false; if (md && md.meta) { var meta = md.meta; robots = meta.robots; lang = meta.lang; dir = meta.dir; breaks = meta.breaks; + spellcheck = meta.spellcheck; } //robots meta var robotsMeta = $('meta[name=robots]'); @@ -131,6 +133,18 @@ function parseMeta(md, edit, view, toc, tocAffix) { } else { md.options.breaks = true; } + // spell check + if (typeof editor === 'object') { + var mode = null; + if (typeof spellcheck === 'boolean' && spellcheck) { + mode = 'spell-checker'; + } else { + mode = 'gfm'; + } + if (mode && mode !== editor.getOption('mode')) { + editor.setOption('mode', mode); + } + } } var viewAjaxCallback = null; |