Ace: Config adjustments in Run JavaScript window
- Use the "Chrome" theme - Hide the gutter - Don't highlight the active line - Remove default iframe borders - Focus the editor on window open Ace instances (e.g., Scaffold) are now responsible for setting their own theme (to avoid a flash of Monokai before a lighter theme appears).
This commit is contained in:
parent
e095dbb031
commit
2ed4bb1c8f
5 changed files with 23 additions and 7 deletions
|
@ -98,7 +98,11 @@ var Scaffold = new function() {
|
||||||
_editors.import = importWin.editor;
|
_editors.import = importWin.editor;
|
||||||
_editors.code = codeWin.editor;
|
_editors.code = codeWin.editor;
|
||||||
_editors.tests = testsWin.editor;
|
_editors.tests = testsWin.editor;
|
||||||
|
|
||||||
|
for (let i in _editors) {
|
||||||
|
_editors[i].setTheme('ace/theme/monokai');
|
||||||
|
}
|
||||||
|
|
||||||
_editors.code.getSession().setMode(new codeWin.JavaScriptMode);
|
_editors.code.getSession().setMode(new codeWin.JavaScriptMode);
|
||||||
_editors.code.getSession().setUseSoftTabs(false);
|
_editors.code.getSession().setUseSoftTabs(false);
|
||||||
// The first code line is preceeded by some metadata lines, such that
|
// The first code line is preceeded by some metadata lines, such that
|
||||||
|
|
|
@ -38,5 +38,4 @@ window.addEventListener("DOMContentLoaded", function(e) {
|
||||||
TextMode = require("ace/mode/text").Mode;
|
TextMode = require("ace/mode/text").Mode;
|
||||||
EditSession = require("ace/edit_session").EditSession;
|
EditSession = require("ace/edit_session").EditSession;
|
||||||
editor = ace.edit('ace-div');
|
editor = ace.edit('ace-div');
|
||||||
editor.setTheme("ace/theme/monokai");
|
|
||||||
}, false);
|
}, false);
|
|
@ -78,15 +78,23 @@ document.getElementById('run-label').textContent = `(${shortcut})`;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
var codeWin, codeEditor;
|
var codeEditor;
|
||||||
window.addEventListener("load", function (e) {
|
window.addEventListener("load", function (e) {
|
||||||
if (e.target !== document) {
|
if (e.target !== document) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
codeWin = document.getElementById("editor-code").contentWindow;
|
var codeWin = document.getElementById("editor-code").contentWindow;
|
||||||
codeEditor = codeWin.editor;
|
codeEditor = codeWin.editor;
|
||||||
codeEditor.getSession().setMode(new codeWin.JavaScriptMode);
|
var session = codeEditor.getSession();
|
||||||
codeEditor.getSession().setUseSoftTabs(false);
|
session.setMode(new codeWin.JavaScriptMode);
|
||||||
|
codeEditor.setOptions({
|
||||||
|
// TODO: Enable if we modify to autocomplete from the Zotero API
|
||||||
|
//enableLiveAutocompletion: true,
|
||||||
|
highlightActiveLine: false,
|
||||||
|
showGutter: false,
|
||||||
|
theme: "ace/theme/chrome",
|
||||||
|
});
|
||||||
codeEditor.on('input', handleInput);
|
codeEditor.on('input', handleInput);
|
||||||
|
codeEditor.focus();
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -60,7 +60,11 @@ input[type=checkbox] {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
iframe {
|
||||||
|
border: 1px solid gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe, textarea {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
font-family: Monaco, Consolas, Inconsolata, monospace;
|
font-family: Monaco, Consolas, Inconsolata, monospace;
|
||||||
|
|
|
@ -45,6 +45,7 @@ const symlinkFiles = [
|
||||||
'resource/ace/keybinding-emacs.js',
|
'resource/ace/keybinding-emacs.js',
|
||||||
'resource/ace/keybinding-vim.js',
|
'resource/ace/keybinding-vim.js',
|
||||||
'resource/ace/mode-javascript.js',
|
'resource/ace/mode-javascript.js',
|
||||||
|
'resource/ace/theme-chrome.js',
|
||||||
'resource/ace/theme-monokai.js',
|
'resource/ace/theme-monokai.js',
|
||||||
'resource/ace/worker-javascript.js',
|
'resource/ace/worker-javascript.js',
|
||||||
'update.rdf'
|
'update.rdf'
|
||||||
|
|
Loading…
Reference in a new issue