diff --git a/lib/codemirror.js b/lib/codemirror.js index 65bfc7999ea7f6acc4448333b039e6ac0f7a6e9c..0d34b8521a96f6159d9c38d0e32998e11d957cc2 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -1197,10 +1197,10 @@ return {text: text, ranges: ranges}; } - function disableBrowserMagic(field) { + function disableBrowserMagic(field, spellcheck) { field.setAttribute("autocorrect", "off"); field.setAttribute("autocapitalize", "off"); - field.setAttribute("spellcheck", "false"); + field.setAttribute("spellcheck", !!spellcheck); } // TEXTAREA INPUT STYLE @@ -1578,7 +1578,7 @@ init: function(display) { var input = this, cm = input.cm; var div = input.div = display.lineDiv; - disableBrowserMagic(div); + disableBrowserMagic(div, cm.options.spellcheck); on(div, "paste", function(e) { if (!signalDOMEvent(cm, e)) handlePaste(e, cm); @@ -5424,6 +5424,9 @@ option("inputStyle", mobile ? "contenteditable" : "textarea", function() { throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME }, true); + option("spellcheck", false, function(cm, val) { + cm.getInputField().spellcheck = val + }, true); option("rtlMoveVisually", !windows); option("wholeLineUpdateBefore", true);