|
|
@ -142,6 +142,7 @@ define([
|
|
|
|
showTrailingSpace : true,
|
|
|
|
showTrailingSpace : true,
|
|
|
|
styleActiveLine : true,
|
|
|
|
styleActiveLine : true,
|
|
|
|
search: true,
|
|
|
|
search: true,
|
|
|
|
|
|
|
|
inputStyle: 'contenteditable',
|
|
|
|
highlightSelectionMatches: {showToken: /\w+/},
|
|
|
|
highlightSelectionMatches: {showToken: /\w+/},
|
|
|
|
extraKeys: {"Shift-Ctrl-R": undefined},
|
|
|
|
extraKeys: {"Shift-Ctrl-R": undefined},
|
|
|
|
foldGutter: true,
|
|
|
|
foldGutter: true,
|
|
|
@ -355,11 +356,12 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
exp.mkIndentSettings = function (metadataMgr) {
|
|
|
|
exp.mkIndentSettings = function (metadataMgr) {
|
|
|
|
var setIndentation = function (units, useTabs, fontSize) {
|
|
|
|
var setIndentation = function (units, useTabs, fontSize, spellcheck) {
|
|
|
|
if (typeof(units) !== 'number') { return; }
|
|
|
|
if (typeof(units) !== 'number') { return; }
|
|
|
|
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);
|
|
|
|
if (!useTabs) {
|
|
|
|
if (!useTabs) {
|
|
|
|
editor.setOption("extraKeys", {
|
|
|
|
editor.setOption("extraKeys", {
|
|
|
|
Tab: function() {
|
|
|
|
Tab: function() {
|
|
|
@ -377,6 +379,7 @@ define([
|
|
|
|
var indentKey = 'indentUnit';
|
|
|
|
var indentKey = 'indentUnit';
|
|
|
|
var useTabsKey = 'indentWithTabs';
|
|
|
|
var useTabsKey = 'indentWithTabs';
|
|
|
|
var fontKey = 'fontSize';
|
|
|
|
var fontKey = 'fontSize';
|
|
|
|
|
|
|
|
var spellcheckKey = 'spellcheck';
|
|
|
|
var updateIndentSettings = function () {
|
|
|
|
var updateIndentSettings = function () {
|
|
|
|
if (!metadataMgr) { return; }
|
|
|
|
if (!metadataMgr) { return; }
|
|
|
|
var data = metadataMgr.getPrivateData().settings;
|
|
|
|
var data = metadataMgr.getPrivateData().settings;
|
|
|
@ -384,10 +387,12 @@ define([
|
|
|
|
var indentUnit = data[indentKey];
|
|
|
|
var indentUnit = data[indentKey];
|
|
|
|
var useTabs = data[useTabsKey];
|
|
|
|
var useTabs = data[useTabsKey];
|
|
|
|
var fontSize = data[fontKey];
|
|
|
|
var fontSize = data[fontKey];
|
|
|
|
|
|
|
|
var spellcheck = data[spellcheckKey];
|
|
|
|
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);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
metadataMgr.onChangeLazy(updateIndentSettings);
|
|
|
|
metadataMgr.onChangeLazy(updateIndentSettings);
|
|
|
|
updateIndentSettings();
|
|
|
|
updateIndentSettings();
|
|
|
|