summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js')
-rw-r--r--public/js/extra.js14
-rw-r--r--public/js/index.js1
2 files changed, 15 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;
diff --git a/public/js/index.js b/public/js/index.js
index 695d9d22..ca99d8c9 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -253,6 +253,7 @@ var textit = document.getElementById("textit");
if (!textit) throw new Error("There was no textit area!");
var editor = CodeMirror.fromTextArea(textit, {
mode: 'gfm',
+ backdrop: 'gfm',
keyMap: "sublime",
viewportMargin: viewportMargin,
styleActiveLine: true,