|
|
@ -379,13 +379,14 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
exp.mkIndentSettings = function (metadataMgr) {
|
|
|
|
exp.mkIndentSettings = function (metadataMgr) {
|
|
|
|
var setIndentation = function (units, useTabs, fontSize, spellcheck) {
|
|
|
|
var setIndentation = function (units, useTabs, fontSize, spellcheck, brackets) {
|
|
|
|
if (typeof(units) !== 'number') { return; }
|
|
|
|
if (typeof(units) !== 'number') { return; }
|
|
|
|
var doc = editor.getDoc();
|
|
|
|
var doc = editor.getDoc();
|
|
|
|
editor.setOption('indentUnit', units);
|
|
|
|
editor.setOption('indentUnit', units);
|
|
|
|
editor.setOption('tabSize', units);
|
|
|
|
editor.setOption('tabSize', units);
|
|
|
|
editor.setOption('indentWithTabs', useTabs);
|
|
|
|
editor.setOption('indentWithTabs', useTabs);
|
|
|
|
editor.setOption('spellcheck', spellcheck);
|
|
|
|
editor.setOption('spellcheck', spellcheck);
|
|
|
|
|
|
|
|
editor.setOption('autoCloseBrackets', brackets);
|
|
|
|
editor.setOption("extraKeys", {
|
|
|
|
editor.setOption("extraKeys", {
|
|
|
|
Tab: function() {
|
|
|
|
Tab: function() {
|
|
|
|
if (doc.somethingSelected()) {
|
|
|
|
if (doc.somethingSelected()) {
|
|
|
@ -415,11 +416,13 @@ define([
|
|
|
|
var useTabs = data[useTabsKey];
|
|
|
|
var useTabs = data[useTabsKey];
|
|
|
|
var fontSize = data[fontKey];
|
|
|
|
var fontSize = data[fontKey];
|
|
|
|
var spellcheck = data[spellcheckKey];
|
|
|
|
var spellcheck = data[spellcheckKey];
|
|
|
|
|
|
|
|
var brackets = data.brackets;
|
|
|
|
setIndentation(
|
|
|
|
setIndentation(
|
|
|
|
typeof(indentUnit) === 'number'? indentUnit : 2,
|
|
|
|
typeof(indentUnit) === 'number'? indentUnit : 2,
|
|
|
|
typeof(useTabs) === 'boolean'? useTabs : false,
|
|
|
|
typeof(useTabs) === 'boolean'? useTabs : false,
|
|
|
|
typeof(fontSize) === 'number' ? fontSize : 12,
|
|
|
|
typeof(fontSize) === 'number' ? fontSize : 12,
|
|
|
|
typeof(spellcheck) === 'boolean' ? spellcheck : false);
|
|
|
|
typeof(spellcheck) === 'boolean' ? spellcheck : false,
|
|
|
|
|
|
|
|
typeof(brackets) === 'boolean' ? brackets : true);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
metadataMgr.onChangeLazy(updateIndentSettings);
|
|
|
|
metadataMgr.onChangeLazy(updateIndentSettings);
|
|
|
|
updateIndentSettings();
|
|
|
|
updateIndentSettings();
|
|
|
|