-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathace_init.js
62 lines (53 loc) · 1.8 KB
/
ace_init.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;(function(alias){
"use strict";
var $ = document.getElementById.bind(document);
var dom = require("ace/lib/dom");
//add command to all new editor instaces
require("ace/commands/default_commands").commands.push({
name: "Toggle Fullscreen",
bindKey: "F11",
exec: function(editor_css) {
var fullScreen = dom.toggleCssClass(document.body, "fullScreen")
dom.setCssClass(editor_css.container, "fullScreen", fullScreen)
editor_css.setAutoScrollEditorIntoView(!fullScreen)
editor_css.resize()
}
})
// HTML
// create first editor
ace.require("ace/ext/language_tools");
var editor_html = ace.edit("editor_html");
editor_html.setTheme("ace/theme/monokai");
editor_html.session.setMode("ace/mode/html");
editor_html.renderer.setScrollMargin(10, 10);
editor_html.$blockScrolling = Infinity;
editor_html.setOptions({
// "scrollPastEnd": 0.8,
autoScrollEditorIntoView: true,
tabSize: 1,
useSoftTabs: true
//wrap: 75
//maxLines: 5,
});
var themes = require("ace/ext/themelist").themes.map(function(t){return t.theme});
// CSS
// create first editor
var editor_css = ace.edit("editor_css");
editor_css.setTheme("ace/theme/monokai");
editor_css.session.setMode("ace/mode/css");
editor_css.renderer.setScrollMargin(10, 10);
editor_css.$blockScrolling = Infinity;
editor_css.setOptions({
// "scrollPastEnd": 0.8,
autoScrollEditorIntoView: true,
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true,
tabSize: 1,
useSoftTabs: true
//wrap: 75
});
var themes = require("ace/ext/themelist").themes.map(function(t){return t.theme});
window.editor_html = editor_html;
window.editor_css = editor_css;
})()