2020-04-23 01:32:20 +02:00
|
|
|
|
|
2020-04-23 16:23:56 +02:00
|
|
|
|
|
2020-04-24 00:18:16 +02:00
|
|
|
|
window.InitEditor = () => {
|
|
|
|
|
if (!window.editor)
|
|
|
|
|
return
|
|
|
|
|
window.editor = ace.edit("editor")
|
|
|
|
|
window.editor.setOptions({
|
|
|
|
|
selectionStyle: "line",
|
|
|
|
|
highlightActiveLine: true,
|
|
|
|
|
highlightSelectedWord: true,
|
|
|
|
|
readOnly: false,
|
2020-04-25 00:13:52 +02:00
|
|
|
|
cursorStyle: "smooth slim",
|
2020-04-24 00:18:16 +02:00
|
|
|
|
mergeUndoDeltas: true,
|
|
|
|
|
behavioursEnabled: true,
|
|
|
|
|
wrapBehavioursEnabled: true,
|
|
|
|
|
copyWithEmptySelection: true,
|
|
|
|
|
navigateWithinSoftTabs: true,
|
|
|
|
|
printMargin: false,
|
2020-04-25 00:13:52 +02:00
|
|
|
|
scrollPastEnd: 0.2,
|
|
|
|
|
theme: "ace/theme/solarized_light",
|
2020-04-24 00:18:16 +02:00
|
|
|
|
mode: "ace/mode/nginx",
|
|
|
|
|
fixedWidthGutter: true,
|
|
|
|
|
firstLineNumber: 1,
|
|
|
|
|
newLineMode: "auto",
|
|
|
|
|
tabSize: 2,
|
2020-04-25 00:13:52 +02:00
|
|
|
|
keyboardHandler: "ace/keyboard/vscode",
|
2020-04-24 00:18:16 +02:00
|
|
|
|
//enableBasicAutocompletion: true,
|
2020-04-25 00:13:52 +02:00
|
|
|
|
enableLiveAutocompletion: true,
|
2020-04-24 00:18:16 +02:00
|
|
|
|
//enableSnippets: true
|
2020-04-23 01:32:20 +02:00
|
|
|
|
})
|
2020-07-06 01:00:48 +02:00
|
|
|
|
window.editor.session.on('change', function (delta) {
|
|
|
|
|
// delta.start, delta.end, delta.lines, delta.action
|
|
|
|
|
})
|
2020-04-23 01:32:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 00:18:16 +02:00
|
|
|
|
window.GetEditorCode = () => {
|
|
|
|
|
return window.editor.getValue()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.UpdateEditor = (code) => {
|
|
|
|
|
window.editor.session.setValue(code)
|
|
|
|
|
window.editor.focus()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.ClearEditor = () => {
|
|
|
|
|
window.editor.session.setValue("")
|
2020-04-23 01:32:20 +02:00
|
|
|
|
}
|