Updated text editor to syntax highlight
This commit is contained in:
parent
6e4980ca18
commit
8b2c8b723c
|
@ -8,8 +8,20 @@
|
|||
<style type="text/css" media="screen">
|
||||
|
||||
#editor {
|
||||
height: 500px;
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@media (min-height: 1000px) {
|
||||
#editor {
|
||||
height: 750px;
|
||||
}
|
||||
}
|
||||
|
||||
@@media (min-height: 1250px) {
|
||||
#editor {
|
||||
height: 1000px;
|
||||
}
|
||||
}
|
||||
|
||||
#preset-file {
|
||||
|
@ -58,7 +70,7 @@
|
|||
<form class="form-horizontal" method="post">
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="modalEditPresetFile" tabindex="-1" role="dialog" aria-labelledby="modalEditPresetFileTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalEditPresetFileTitle"></h5>
|
||||
|
@ -84,10 +96,12 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
// Setup UI
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('.text-autocolor').autocolor(false);
|
||||
|
||||
$('.btn-edit-presetfile').click(function () {
|
||||
$('.btn-edit-presetfile').click(function () {
|
||||
// Setup UI
|
||||
var settingName = $(this).data('settingname');
|
||||
var dataTarget = $(this).data('datatarget');
|
||||
|
||||
|
@ -103,6 +117,11 @@
|
|||
} else if (responseText == 'returntologin') {
|
||||
window.location.replace("@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)Login");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set ACE editor language mode.
|
||||
window.editor.session.setMode("ace/mode/yaml");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
using Core.Main;
|
||||
using Core.Helper;
|
||||
using Core.Main.DataObjects.PTMagicData;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Monitor.Pages
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
indent_size: 2
|
||||
};
|
||||
editor.setTheme("ace/theme/ptmagic");
|
||||
editor.getSession().setMode("ace/mode/java");
|
||||
editor.getSession().setMode("ace/mode/yaml");
|
||||
editor.getSession().setValue(txtArea.val());
|
||||
editor.getSession().on('change', function () {
|
||||
txtArea.val(editor.getSession().getValue());
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,9 @@
|
|||
define("ace/mode/yaml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"list.markup",regex:/^(?:-{3}|\.{3})\s*(?=#|$)/},{token:"list.markup",regex:/^\s*[\-?](?:$|\s)/},{token:"constant",regex:"!![\\w//]+"},{token:"constant.language",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:["meta.tag","keyword"],regex:/^(\s*\w.*?)(:(?=\s|$))/},{token:["meta.tag","keyword"],regex:/(\w+?)(\s*:(?=\s|$))/},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:/[|>][-+\d\s]*$/,onMatch:function(e,t,n,r){var i=/^\s*/.exec(r)[0];return n.length<1?n.push(this.next):n[0]="mlString",n.length<2?n.push(i.length):n[1]=i.length,this.token},next:"mlString"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:/(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)/},{token:"constant.numeric",regex:/[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/},{token:"constant.language.boolean",regex:"\\b(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:/[^\s,:\[\]\{\}]+/}],mlString:[{token:"indent",regex:/^\s*$/},{token:"indent",regex:/^\s*/,onMatch:function(e,t,n){var r=n[1];return r>=e.length?(this.next="start",n.splice(0)):this.next="mlString",this.token},next:"mlString"},{token:"string",regex:".+"}]},this.normalizeRules()};r.inherits(s,i),t.YamlHighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!="#")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?"start":"","";if(u==-1){if(i==a&&r[i]=="#"&&s[i]=="#")return e.foldWidgets[n-1]="",e.foldWidgets[n+1]="","start"}else if(u==i&&r[i]=="#"&&o[i]=="#"&&e.getLine(n-2).search(/\S/)==-1)return e.foldWidgets[n-1]="start",e.foldWidgets[n+1]="","";return u!=-1&&u<i?e.foldWidgets[n-1]="start":e.foldWidgets[n-1]="",i<a?"start":""}}.call(o.prototype)}),define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./yaml_highlight_rules").YamlHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./folding/coffee").FoldMode,a=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u,this.$behaviour=this.$defaultBehaviour};r.inherits(a,i),function(){this.lineCommentStart=["#","//"],this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/yaml"}.call(a.prototype),t.Mode=a});
|
||||
(function() {
|
||||
window.require(["ace/mode/yaml"], function(m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
@ -1,9 +1,43 @@
|
|||
define("ace/theme/ptmagic",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-ptmagic",t.cssText=".ace-ptmagic .ace_gutter {background: #414d59;color: #8F938F}.ace-ptmagic .ace_constant.ace_language.ace_boolean {color: #CCCCCC}.ace-ptmagic .ace_print-margin {width: 1px;background: #414d59}.ace-ptmagic {background-color: #414d59;color: #8F938F}.ace-ptmagic .ace_cursor {color: #A7A7A7}.ace-ptmagic .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20)}.ace-ptmagic.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #414d59;}.ace-ptmagic .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-ptmagic .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25)}.ace-ptmagic .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031)}.ace-ptmagic .ace_gutter-active-line {background-color: rgba(255, 255, 255, 0.031)}.ace-ptmagic .ace_marker-layer .ace_selected-word {border: 1px solid rgba(221, 240, 255, 0.20)}.ace-ptmagic .ace_invisible {color: rgba(255, 255, 255, 0.25)}.ace-ptmagic .ace_keyword,.ace-ptmagic .ace_meta {color: #757aD8}.ace-ptmagic .ace_constant,.ace-ptmagic .ace_constant.ace_character,.ace-ptmagic .ace_constant.ace_character.ace_escape,.ace-ptmagic .ace_constant.ace_other {color: #4FB7C5}.ace-ptmagic .ace_keyword.ace_operator {color: #797878}.ace-ptmagic .ace_constant.ace_character {color: #AFA472}.ace-ptmagic .ace_constant.ace_language {color: #DE8E30}.ace-ptmagic .ace_constant.ace_numeric {color: #CCCCCC}.ace-ptmagic .ace_invalid,.ace-ptmagic .ace_invalid.ace_illegal {color: #F8F8F8;background-color: rgba(86, 45, 86, 0.75)}.ace-ptmagic .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1}.ace-ptmagic .ace_fold {background-color: #757aD8;border-color: #8F938F}.ace-ptmagic .ace_support.ace_function {color: #AEB2F8}.ace-ptmagic .ace_string {color: #66A968}.ace-ptmagic .ace_string.ace_regexp {color: #E9C062}.ace-ptmagic .ace_comment {color: #A6C6FF}.ace-ptmagic .ace_variable {color: #BEBF55}.ace-ptmagic .ace_variable.ace_language {color: #C1C144}.ace-ptmagic .ace_xml-pe {color: #494949}.ace-ptmagic .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYIiPj/8PAARgAh2NTMh8AAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)});
|
||||
(function() {
|
||||
window.require(["ace/theme/ptmagic"], function(m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
define("ace/theme/ptmagic", ["require", "exports", "module", "ace/lib/dom"],
|
||||
function (e, t, n) {
|
||||
t.isDark = !0,
|
||||
t.cssClass = "ace-ptmagic",
|
||||
t.cssText = "\
|
||||
.ace-ptmagic .ace_gutter {background: #566776;color: #dddddd}\
|
||||
.ace-ptmagic .ace_constant.ace_language.ace_boolean {color: #CCCCCC}\
|
||||
.ace-ptmagic .ace_print-margin {width: 1px;background: #414d59}\
|
||||
.ace-ptmagic {background-color: #414d59;color: #8F938F}\
|
||||
.ace-ptmagic .ace_cursor {color: #A7A7A7}\
|
||||
.ace-ptmagic .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20)}\
|
||||
.ace-ptmagic.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #414d59;}\
|
||||
.ace-ptmagic .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}\
|
||||
.ace-ptmagic .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25)}\
|
||||
.ace-ptmagic .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031)}\
|
||||
.ace-ptmagic .ace_gutter-active-line {background-color: rgba(255, 255, 255, 0.031)}\
|
||||
.ace-ptmagic .ace_marker-layer .ace_selected-word {border: 1px solid rgba(221, 240, 255, 0.20)}\
|
||||
.ace-ptmagic .ace_invisible {color: rgba(255, 255, 255, 0.25)}\
|
||||
.ace-ptmagic .ace_keyword,.ace-ptmagic .ace_meta {color: #757aD8}\
|
||||
.ace-ptmagic .ace_constant,.ace-ptmagic .ace_constant.ace_character,.ace-ptmagic .ace_constant.ace_character.ace_escape,.ace-ptmagic .ace_constant.ace_other {color: #4FB7C5}\
|
||||
.ace-ptmagic .ace_keyword.ace_operator {color: #797878}\.ace-ptmagic .ace_constant.ace_character {color: #AFA472}\
|
||||
.ace-ptmagic .ace_constant.ace_language {color: #DE8E30}\.ace-ptmagic .ace_constant.ace_numeric {color: #CCCCCC}\
|
||||
.ace-ptmagic .ace_invalid,.ace-ptmagic .ace_invalid.ace_illegal {color: #F8F8F8;background-color: rgba(86, 45, 86, 0.75)}\
|
||||
.ace-ptmagic .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1}\
|
||||
.ace-ptmagic .ace_fold {background-color: #757aD8;border-color: #8F938F}\
|
||||
.ace-ptmagic .ace_support.ace_function {color: #AEB2F8}\
|
||||
.ace-ptmagic .ace_string {color: #66A968}\
|
||||
.ace-ptmagic .ace_string.ace_regexp {color: #E9C062}\
|
||||
.ace-ptmagic .ace_comment {color: #33b5e5}\
|
||||
.ace-ptmagic .ace_variable {color: #BEBF55}\
|
||||
.ace-ptmagic .ace_variable.ace_language {color: #C1C144}\
|
||||
.ace-ptmagic .ace_xml-pe {color: #494949}\
|
||||
.ace-ptmagic .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYIiPj/8PAARgAh2NTMh8AAAAAElFTkSuQmCC) right repeat-y}";
|
||||
|
||||
var r = e("../lib/dom"); r.importCssString(t.cssText, t.cssClass)
|
||||
});
|
||||
(function () {
|
||||
window.require(["ace/theme/ptmagic"], function (m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue