-
Notifications
You must be signed in to change notification settings - Fork 2
/
launcher.js
48 lines (39 loc) · 1.73 KB
/
launcher.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint asi: true undef: true es5: true node: true devel: true
forin: true latedef: false browser: true */
/*global define: true port: true */
!define(function(require, exports, module) {
exports.startup = function(data) {
var env = window.env = data.env;
var Range = require("ace/range").Range;
var Editor = require("ace/editor").Editor;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
var UndoManager = require("ace/undomanager").UndoManager;
var EditSession = require("ace/edit_session").EditSession;
var theme = require("./theme");
var session = new EditSession('');
session.setUndoManager(new UndoManager());
var container = document.getElementById("editor");
env.editor = new Editor(new Renderer(container, theme));
env.editor.setSession(session);
// Each editor should contain reference to an `env` which will be used be
// passed to the commands executed by keybindings.
env.editor.env = Object.create(env);
function onResize() {
container.style.width = (document.documentElement.clientWidth) + "px";
container.style.height = (document.documentElement.clientHeight - 22) + "px";
env.editor.resize();
env.editor.focus();
}
window.onresize = onResize;
onResize();
env.editor.renderer.setHScrollBarAlwaysVisible(false);
env.editor.setShowInvisibles(true);
var JavaScriptMode = require("ace/mode/javascript").Mode;
session.setValue(document.getElementById("source").value, "helpme.js");
session.setMode(new JavaScriptMode());
env.editor.renderer.setHScrollBarAlwaysVisible(false);
env.editor.setShowInvisibles(true);
env.editor.renderer.setPadding(14);
};
});