This commit is contained in:
Olivier Gagnon
2021-05-17 23:59:45 -04:00
parent 218a9dd250
commit b28f607056
15 changed files with 196 additions and 57 deletions
+6
View File
@@ -233,19 +233,25 @@ class AceEditorWrapper extends ScriptEditor {
// Highlight Active line
const highlightActiveChkBox = safeClearEventListeners("script-editor-option-highlightactiveline", "Active Line Checkbox");
highlightActiveChkBox.checked = Settings.EditorHighlightActiveLine;
highlightActiveChkBox.onchange = () => {
Settings.EditorHighlightActiveLine = highlightActiveChkBox.checked;
this.editor.setHighlightActiveLine(highlightActiveChkBox.checked);
};
// Show Invisibles
const showInvisiblesChkBox = safeClearEventListeners("script-editor-option-showinvisibles", "Show Invisible Checkbox");
showInvisiblesChkBox.checked = Settings.EditorShowInvisibles;
showInvisiblesChkBox.onchange = () => {
Settings.EditorShowInvisibles = showInvisiblesChkBox.checked;
this.editor.setShowInvisibles(showInvisiblesChkBox.checked);
};
// Use Soft Tab
const softTabChkBox = safeClearEventListeners("script-editor-option-usesofttab", "Soft Tab Checkbox");
softTabChkBox.checked = Settings.EditorUseSoftTab;
softTabChkBox.onchange = () => {
Settings.EditorUseSoftTab = softTabChkBox.checked;
this.editor.getSession().setUseSoftTabs(softTabChkBox.checked);
};
+13 -3
View File
@@ -375,14 +375,18 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
// Highlight Active line
const highlightActiveChkBox = safeClearEventListeners("script-editor-option-highlightactiveline", "Active Line Checkbox");
highlightActiveChkBox.checked = Settings.EditorHighlightActiveLine;
highlightActiveChkBox.onchange = () => {
Settings.EditorHighlightActiveLine = highlightActiveChkBox.checked;
this.editor.setOption("styleActiveLine", highlightActiveChkBox.checked);
};
highlightActiveChkBox.onchange();
// Show Invisibles
const showInvisiblesChkBox = safeClearEventListeners("script-editor-option-showinvisibles", "Show Invisible Checkbox");
showInvisiblesChkBox.checked = Settings.EditorShowInvisibles;
showInvisiblesChkBox.onchange = () => {
Settings.EditorShowInvisibles = showInvisiblesChkBox.checked;
const overlayMode = {
name: 'invisibles',
token: function(stream) {
@@ -428,7 +432,9 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
//Use Soft Tab
const softTabChkBox = safeClearEventListeners("script-editor-option-usesofttab", "Soft Tab Checkbox");
softTabChkBox.checked = Settings.EditorUseSoftTab;
softTabChkBox.onchange = () => {
Settings.EditorUseSoftTab = softTabChkBox.checked;
this.editor.setOption("indentWithTabs", !softTabChkBox.checked);
if (softTabChkBox.checked) {
this.editor.addKeyMap({
@@ -482,13 +488,14 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
}));
const flex1Checkbox = createElement("input", {
checked: true,
checked: Settings.EditorAutoCloseBrackets,
id: flex1Id,
name: flex1Id,
type: "checkbox",
});
flex1Fieldset.appendChild(flex1Checkbox);
flex1Checkbox.onchange = () => {
Settings.EditorAutoCloseBrackets = flex1Checkbox.checked;
this.editor.setOption("autoCloseBrackets", flex1Checkbox.checked);
};
flex1Checkbox.onchange();
@@ -502,7 +509,7 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
}));
const flex2Checkbox = createElement("input", {
checked: true,
checked: Settings.EditorEnableLinting,
id: flex2Id,
name: flex2Id,
type: "checkbox",
@@ -510,8 +517,10 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
flex2Fieldset.appendChild(flex2Checkbox);
flex2Checkbox.onchange = () => {
if (flex2Checkbox.checked) {
Settings.EditorEnableLinting = true;
this.editor.setOption("lint", CodeMirror.lint.netscript);
} else {
Settings.EditorEnableLinting = false;
this.editor.setOption("lint", false);
}
}
@@ -526,13 +535,14 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
}));
const flex3Checkbox = createElement("input", {
checked: true,
checked: Settings.EditorContinueComments,
id: flex3Id,
name: flex3Id,
type: "checkbox",
});
flex3Fieldset.appendChild(flex3Checkbox);
flex3Checkbox.onchange = () => {
Settings.EditorContinueComments = flex3Checkbox.checked;
this.editor.setOption("continueComments", flex3Checkbox.checked);
}
flex3Checkbox.onchange();