Seenginx/Seenginx/wwwroot/js/index.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

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,
cursorStyle: "smooth slim",
2020-04-24 00:18:16 +02:00
mergeUndoDeltas: true,
behavioursEnabled: true,
wrapBehavioursEnabled: true,
copyWithEmptySelection: true,
navigateWithinSoftTabs: true,
printMargin: false,
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,
keyboardHandler: "ace/keyboard/vscode",
2020-04-24 00:18:16 +02:00
//enableBasicAutocompletion: true,
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
}