-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
95 lines (86 loc) · 4.53 KB
/
script.js
File metadata and controls
95 lines (86 loc) · 4.53 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
function update()
{
var idoc = document.getElementById('iframe').contentWindow.document;
idoc.open();
idoc.write(editor.getValue());
idoc.close();
}
function setupEditor()
{
window.editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/html");
editor.setValue(`<!DOCTYPE html>
<html>
<style>
/* Style your page here!*/
</style>
<script>
// Write your JavaScript code here!
</script>
<body>
Hi, Welcome to <AKC⁄> Web IDE
</body>
</html>`,1);
editor.getSession().on('change', function() {
update();
});
editor.focus();
editor.setShowPrintMargin(false);
editor.setBehavioursEnabled(false);
editor.setOptions({
selectionStyle: 'line',// "line"|"text"
highlightActiveLine: true, // boolean
highlightSelectedWord: true, // boolean
readOnly: false, // boolean: true if read only
cursorStyle: 'ace', // "ace"|"slim"|"smooth"|"wide"
mergeUndoDeltas: true, // false|true|"always"
behavioursEnabled: true, // boolean: true if enable custom behaviours
wrapBehavioursEnabled: true, // boolean
autoScrollEditorIntoView: undefined, // boolean: this is needed if editor is inside scrollable page
keyboardHandler: null, // function: handle custom keyboard events
// renderer options
animatedScroll: false, // boolean: true if scroll should be animated
displayIndentGuides: false, // boolean: true if the indent should be shown. See 'showInvisibles'
showInvisibles: false, // boolean -> displayIndentGuides: true if show the invisible tabs/spaces in indents
showPrintMargin: true, // boolean: true if show the vertical print margin
printMarginColumn: 80, // number: number of columns for vertical print margin
printMargin: undefined, // boolean | number: showPrintMargin | printMarginColumn
showGutter: true, // boolean: true if show line gutter
fadeFoldWidgets: false, // boolean: true if the fold lines should be faded
showFoldWidgets: true, // boolean: true if the fold lines should be shown ?
showLineNumbers: true,
highlightGutterLine: false, // boolean: true if the gutter line should be highlighted
hScrollBarAlwaysVisible: false, // boolean: true if the horizontal scroll bar should be shown regardless
vScrollBarAlwaysVisible: false, // boolean: true if the vertical scroll bar should be shown regardless
fontSize: 18, // number | string: set the font size to this many pixels
fontFamily: undefined, // string: set the font-family css value
maxLines: undefined, // number: set the maximum lines possible. This will make the editor height changes
minLines: undefined, // number: set the minimum lines possible. This will make the editor height changes
maxPixelHeight: 0, // number -> maxLines: set the maximum height in pixel, when 'maxLines' is defined.
scrollPastEnd: 0, // number -> !maxLines: if positive, user can scroll pass the last line and go n * editorHeight more distance
fixedWidthGutter: false, // boolean: true if the gutter should be fixed width
theme: 'ace/theme/monokai', // theme string from ace/theme or custom?
// mouseHandler options
scrollSpeed: 2, // number: the scroll speed index
dragDelay: 0, // number: the drag delay before drag starts. it's 150ms for mac by default
dragEnabled: true, // boolean: enable dragging
focusTimout: 0, // number: the focus delay before focus starts.
tooltipFollowsMouse: true, // boolean: true if the gutter tooltip should follow mouse
// session options
firstLineNumber: 1, // number: the line number in first line
overwrite: false, // boolean
newLineMode: 'auto', // "auto" | "unix" | "windows"
useWorker: true, // boolean: true if use web worker for loading scripts
useSoftTabs: true, // boolean: true if we want to use spaces than tabs
tabSize: 4, // number
wrap: false, // boolean | string | number: true/'free' means wrap instead of horizontal scroll, false/'off' means horizontal scroll instead of wrap, and number means number of column before wrap. -1 means wrap at print margin
indentedSoftWrap: true, // boolean
foldStyle: 'markbegin', // enum: 'manual'/'markbegin'/'markbeginend'.
mode: 'ace/mode/html' // string: path to language mode
});
}
function ready()
{
setupEditor();
update();
}