\
+
\
+
\
+ \
+ \
+ \
+ All\
+
\
+
\
+ \
+ Replace\
+ All\
+
\
+
\
+ +\
+ \
+ .*\
+ Aa\
+ \\b\
+ S\
+
\
+
'.replace(/> +/g, ">");
+
+var SearchBox = function(editor, range, showReplaceForm) {
+ var div = dom.createElement("div");
+ div.innerHTML = html;
+ this.element = div.firstChild;
+
+ this.setSession = this.setSession.bind(this);
+
+ this.$init();
+ this.setEditor(editor);
+ dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
+};
+
+(function() {
+ this.setEditor = function(editor) {
+ editor.searchBox = this;
+ editor.renderer.scroller.appendChild(this.element);
+ this.editor = editor;
+ };
+
+ this.setSession = function(e) {
+ this.searchRange = null;
+ this.$syncOptions(true);
+ };
+
+ this.$initElements = function(sb) {
+ this.searchBox = sb.querySelector(".ace_search_form");
+ this.replaceBox = sb.querySelector(".ace_replace_form");
+ this.searchOption = sb.querySelector("[action=searchInSelection]");
+ this.replaceOption = sb.querySelector("[action=toggleReplace]");
+ this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
+ this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
+ this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
+ this.searchInput = this.searchBox.querySelector(".ace_search_field");
+ this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
+ this.searchCounter = sb.querySelector(".ace_search_counter");
+ };
+
+ this.$init = function() {
+ var sb = this.element;
+
+ this.$initElements(sb);
+
+ var _this = this;
+ event.addListener(sb, "mousedown", function(e) {
+ setTimeout(function(){
+ _this.activeInput.focus();
+ }, 0);
+ event.stopPropagation(e);
+ });
+ event.addListener(sb, "click", function(e) {
+ var t = e.target || e.srcElement;
+ var action = t.getAttribute("action");
+ if (action && _this[action])
+ _this[action]();
+ else if (_this.$searchBarKb.commands[action])
+ _this.$searchBarKb.commands[action].exec(_this);
+ event.stopPropagation(e);
+ });
+
+ event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
+ var keyString = keyUtil.keyCodeToString(keyCode);
+ var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
+ if (command && command.exec) {
+ command.exec(_this);
+ event.stopEvent(e);
+ }
+ });
+
+ this.$onChange = lang.delayedCall(function() {
+ _this.find(false, false);
+ });
+
+ event.addListener(this.searchInput, "input", function() {
+ _this.$onChange.schedule(20);
+ });
+ event.addListener(this.searchInput, "focus", function() {
+ _this.activeInput = _this.searchInput;
+ _this.searchInput.value && _this.highlight();
+ });
+ event.addListener(this.replaceInput, "focus", function() {
+ _this.activeInput = _this.replaceInput;
+ _this.searchInput.value && _this.highlight();
+ });
+ };
+ this.$closeSearchBarKb = new HashHandler([{
+ bindKey: "Esc",
+ name: "closeSearchBar",
+ exec: function(editor) {
+ editor.searchBox.hide();
+ }
+ }]);
+ this.$searchBarKb = new HashHandler();
+ this.$searchBarKb.bindKeys({
+ "Ctrl-f|Command-f": function(sb) {
+ var isReplace = sb.isReplace = !sb.isReplace;
+ sb.replaceBox.style.display = isReplace ? "" : "none";
+ sb.replaceOption.checked = false;
+ sb.$syncOptions();
+ sb.searchInput.focus();
+ },
+ "Ctrl-H|Command-Option-F": function(sb) {
+ sb.replaceOption.checked = true;
+ sb.$syncOptions();
+ sb.replaceInput.focus();
+ },
+ "Ctrl-G|Command-G": function(sb) {
+ sb.findNext();
+ },
+ "Ctrl-Shift-G|Command-Shift-G": function(sb) {
+ sb.findPrev();
+ },
+ "esc": function(sb) {
+ setTimeout(function() { sb.hide();});
+ },
+ "Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replace();
+ sb.findNext();
+ },
+ "Shift-Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replace();
+ sb.findPrev();
+ },
+ "Alt-Return": function(sb) {
+ if (sb.activeInput == sb.replaceInput)
+ sb.replaceAll();
+ sb.findAll();
+ },
+ "Tab": function(sb) {
+ (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
+ }
+ });
+
+ this.$searchBarKb.addCommands([{
+ name: "toggleRegexpMode",
+ bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
+ exec: function(sb) {
+ sb.regExpOption.checked = !sb.regExpOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "toggleCaseSensitive",
+ bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
+ exec: function(sb) {
+ sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "toggleWholeWords",
+ bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
+ exec: function(sb) {
+ sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "toggleReplace",
+ exec: function(sb) {
+ sb.replaceOption.checked = !sb.replaceOption.checked;
+ sb.$syncOptions();
+ }
+ }, {
+ name: "searchInSelection",
+ exec: function(sb) {
+ sb.searchOption.checked = !sb.searchRange;
+ sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange());
+ sb.$syncOptions();
+ }
+ }]);
+
+ this.setSearchRange = function(range) {
+ this.searchRange = range;
+ if (range) {
+ this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line");
+ } else if (this.searchRangeMarker) {
+ this.editor.session.removeMarker(this.searchRangeMarker);
+ this.searchRangeMarker = null;
+ }
+ };
+
+ this.$syncOptions = function(preventScroll) {
+ dom.setCssClass(this.replaceOption, "checked", this.searchRange);
+ dom.setCssClass(this.searchOption, "checked", this.searchOption.checked);
+ this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
+ dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
+ dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
+ dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
+ this.replaceBox.style.display = this.replaceOption.checked ? "" : "none";
+ this.find(false, false, preventScroll);
+ };
+
+ this.highlight = function(re) {
+ this.editor.session.highlight(re || this.editor.$search.$options.re);
+ this.editor.renderer.updateBackMarkers();
+ };
+ this.find = function(skipCurrent, backwards, preventScroll) {
+ var range = this.editor.find(this.searchInput.value, {
+ skipCurrent: skipCurrent,
+ backwards: backwards,
+ wrap: true,
+ regExp: this.regExpOption.checked,
+ caseSensitive: this.caseSensitiveOption.checked,
+ wholeWord: this.wholeWordOption.checked,
+ preventScroll: preventScroll,
+ range: this.searchRange
+ });
+ var noMatch = !range && this.searchInput.value;
+ dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
+ this.editor._emit("findSearchBox", { match: !noMatch });
+ this.highlight();
+ this.updateCounter();
+ };
+ this.updateCounter = function() {
+ var editor = this.editor;
+ var regex = editor.$search.$options.re;
+ var all = 0;
+ var before = 0;
+ if (regex) {
+ var value = this.searchRange
+ ? editor.session.getTextRange(this.searchRange)
+ : editor.getValue();
+
+ var offset = editor.session.doc.positionToIndex(editor.selection.anchor);
+ if (this.searchRange)
+ offset -= editor.session.doc.positionToIndex(this.searchRange.start);
+
+ var last = regex.lastIndex = 0;
+ var m;
+ while ((m = regex.exec(value))) {
+ all++;
+ last = m.index;
+ if (last <= offset)
+ before++;
+ if (all > MAX_COUNT)
+ break;
+ if (!m[0]) {
+ regex.lastIndex = last += 1;
+ if (last >= value.length)
+ break;
+ }
+ }
+ }
+ this.searchCounter.textContent = before + " of " + (all > MAX_COUNT ? MAX_COUNT + "+" : all);
+ };
+ this.findNext = function() {
+ this.find(true, false);
+ };
+ this.findPrev = function() {
+ this.find(true, true);
+ };
+ this.findAll = function(){
+ var range = this.editor.findAll(this.searchInput.value, {
+ regExp: this.regExpOption.checked,
+ caseSensitive: this.caseSensitiveOption.checked,
+ wholeWord: this.wholeWordOption.checked
+ });
+ var noMatch = !range && this.searchInput.value;
+ dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
+ this.editor._emit("findSearchBox", { match: !noMatch });
+ this.highlight();
+ this.hide();
+ };
+ this.replace = function() {
+ if (!this.editor.getReadOnly())
+ this.editor.replace(this.replaceInput.value);
+ };
+ this.replaceAndFindNext = function() {
+ if (!this.editor.getReadOnly()) {
+ this.editor.replace(this.replaceInput.value);
+ this.findNext();
+ }
+ };
+ this.replaceAll = function() {
+ if (!this.editor.getReadOnly())
+ this.editor.replaceAll(this.replaceInput.value);
+ };
+
+ this.hide = function() {
+ this.active = false;
+ this.setSearchRange(null);
+ this.editor.off("changeSession", this.setSession);
+
+ this.element.style.display = "none";
+ this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
+ this.editor.focus();
+ };
+ this.show = function(value, isReplace) {
+ this.active = true;
+ this.editor.on("changeSession", this.setSession);
+ this.element.style.display = "";
+ this.replaceOption.checked = isReplace;
+
+ if (value)
+ this.searchInput.value = value;
+
+ this.searchInput.focus();
+ this.searchInput.select();
+
+ this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
+
+ this.$syncOptions(true);
+ };
+
+ this.isFocused = function() {
+ var el = document.activeElement;
+ return el == this.searchInput || el == this.replaceInput;
+ };
+}).call(SearchBox.prototype);
+
+exports.SearchBox = SearchBox;
+
+exports.Search = function(editor, isReplace) {
+ var sb = editor.searchBox || new SearchBox(editor);
+ sb.show(editor.session.getTextRange(), isReplace);
+};
+
+});
+ (function() {
+ ace.require(["ace/ext/searchbox"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-settings_menu.js b/src/main/resources/static/js/ace-noconflict/ext-settings_menu.js
new file mode 100644
index 0000000..07f4a97
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-settings_menu.js
@@ -0,0 +1,771 @@
+ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
+'use strict';
+var dom = require("../../lib/dom");
+var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
+background-color: #F7F7F7;\
+color: black;\
+box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
+padding: 1em 0.5em 2em 1em;\
+overflow: auto;\
+position: absolute;\
+margin: 0;\
+bottom: 0;\
+right: 0;\
+top: 0;\
+z-index: 9991;\
+cursor: default;\
+}\
+.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
+box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
+background-color: rgba(255, 255, 255, 0.6);\
+color: black;\
+}\
+.ace_optionsMenuEntry:hover {\
+background-color: rgba(100, 100, 100, 0.1);\
+transition: all 0.3s\
+}\
+.ace_closeButton {\
+background: rgba(245, 146, 146, 0.5);\
+border: 1px solid #F48A8A;\
+border-radius: 50%;\
+padding: 7px;\
+position: absolute;\
+right: -8px;\
+top: -8px;\
+z-index: 100000;\
+}\
+.ace_closeButton{\
+background: rgba(245, 146, 146, 0.9);\
+}\
+.ace_optionsMenuKey {\
+color: darkslateblue;\
+font-weight: bold;\
+}\
+.ace_optionsMenuCommand {\
+color: darkcyan;\
+font-weight: normal;\
+}\
+.ace_optionsMenuEntry input, .ace_optionsMenuEntry button {\
+vertical-align: middle;\
+}\
+.ace_optionsMenuEntry button[ace_selected_button=true] {\
+background: #e7e7e7;\
+box-shadow: 1px 0px 2px 0px #adadad inset;\
+border-color: #adadad;\
+}\
+.ace_optionsMenuEntry button {\
+background: white;\
+border: 1px solid lightgray;\
+margin: 0px;\
+}\
+.ace_optionsMenuEntry button:hover{\
+background: #f0f0f0;\
+}";
+dom.importCssString(cssText);
+module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
+ top = top ? 'top: ' + top + ';' : '';
+ bottom = bottom ? 'bottom: ' + bottom + ';' : '';
+ right = right ? 'right: ' + right + ';' : '';
+ left = left ? 'left: ' + left + ';' : '';
+
+ var closer = document.createElement('div');
+ var contentContainer = document.createElement('div');
+
+ function documentEscListener(e) {
+ if (e.keyCode === 27) {
+ closer.click();
+ }
+ }
+
+ closer.style.cssText = 'margin: 0; padding: 0; ' +
+ 'position: fixed; top:0; bottom:0; left:0; right:0;' +
+ 'z-index: 9990; ' +
+ 'background-color: rgba(0, 0, 0, 0.3);';
+ closer.addEventListener('click', function() {
+ document.removeEventListener('keydown', documentEscListener);
+ closer.parentNode.removeChild(closer);
+ editor.focus();
+ closer = null;
+ });
+ document.addEventListener('keydown', documentEscListener);
+
+ contentContainer.style.cssText = top + right + bottom + left;
+ contentContainer.addEventListener('click', function(e) {
+ e.stopPropagation();
+ });
+
+ var wrapper = dom.createElement("div");
+ wrapper.style.position = "relative";
+
+ var closeButton = dom.createElement("div");
+ closeButton.className = "ace_closeButton";
+ closeButton.addEventListener('click', function() {
+ closer.click();
+ });
+
+ wrapper.appendChild(closeButton);
+ contentContainer.appendChild(wrapper);
+
+ contentContainer.appendChild(contentElement);
+ closer.appendChild(contentContainer);
+ document.body.appendChild(closer);
+ editor.blur();
+};
+
+});
+
+ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
+"use strict";
+
+var modes = [];
+function getModeForPath(path) {
+ var mode = modesByName.text;
+ var fileName = path.split(/[\/\\]/).pop();
+ for (var i = 0; i < modes.length; i++) {
+ if (modes[i].supportsFile(fileName)) {
+ mode = modes[i];
+ break;
+ }
+ }
+ return mode;
+}
+
+var Mode = function(name, caption, extensions) {
+ this.name = name;
+ this.caption = caption;
+ this.mode = "ace/mode/" + name;
+ this.extensions = extensions;
+ var re;
+ if (/\^/.test(extensions)) {
+ re = extensions.replace(/\|(\^)?/g, function(a, b){
+ return "$|" + (b ? "^" : "^.*\\.");
+ }) + "$";
+ } else {
+ re = "^.*\\.(" + extensions + ")$";
+ }
+
+ this.extRe = new RegExp(re, "gi");
+};
+
+Mode.prototype.supportsFile = function(filename) {
+ return filename.match(this.extRe);
+};
+var supportedModes = {
+ ABAP: ["abap"],
+ ABC: ["abc"],
+ ActionScript:["as"],
+ ADA: ["ada|adb"],
+ Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
+ AsciiDoc: ["asciidoc|adoc"],
+ ASL: ["dsl|asl"],
+ Assembly_x86:["asm|a"],
+ AutoHotKey: ["ahk"],
+ BatchFile: ["bat|cmd"],
+ Bro: ["bro"],
+ C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
+ C9Search: ["c9search_results"],
+ Cirru: ["cirru|cr"],
+ Clojure: ["clj|cljs"],
+ Cobol: ["CBL|COB"],
+ coffee: ["coffee|cf|cson|^Cakefile"],
+ ColdFusion: ["cfm"],
+ CSharp: ["cs"],
+ Csound_Document: ["csd"],
+ Csound_Orchestra: ["orc"],
+ Csound_Score: ["sco"],
+ CSS: ["css"],
+ Curly: ["curly"],
+ D: ["d|di"],
+ Dart: ["dart"],
+ Diff: ["diff|patch"],
+ Dockerfile: ["^Dockerfile"],
+ Dot: ["dot"],
+ Drools: ["drl"],
+ Edifact: ["edi"],
+ Eiffel: ["e|ge"],
+ EJS: ["ejs"],
+ Elixir: ["ex|exs"],
+ Elm: ["elm"],
+ Erlang: ["erl|hrl"],
+ Forth: ["frt|fs|ldr|fth|4th"],
+ Fortran: ["f|f90"],
+ FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
+ FTL: ["ftl"],
+ Gcode: ["gcode"],
+ Gherkin: ["feature"],
+ Gitignore: ["^.gitignore"],
+ Glsl: ["glsl|frag|vert"],
+ Gobstones: ["gbs"],
+ golang: ["go"],
+ GraphQLSchema: ["gql"],
+ Groovy: ["groovy"],
+ HAML: ["haml"],
+ Handlebars: ["hbs|handlebars|tpl|mustache"],
+ Haskell: ["hs"],
+ Haskell_Cabal: ["cabal"],
+ haXe: ["hx"],
+ Hjson: ["hjson"],
+ HTML: ["html|htm|xhtml|vue|we|wpy"],
+ HTML_Elixir: ["eex|html.eex"],
+ HTML_Ruby: ["erb|rhtml|html.erb"],
+ INI: ["ini|conf|cfg|prefs"],
+ Io: ["io"],
+ Jack: ["jack"],
+ Jade: ["jade|pug"],
+ Java: ["java"],
+ JavaScript: ["js|jsm|jsx"],
+ JSON: ["json"],
+ JSONiq: ["jq"],
+ JSP: ["jsp"],
+ JSSM: ["jssm|jssm_state"],
+ JSX: ["jsx"],
+ Julia: ["jl"],
+ Kotlin: ["kt|kts"],
+ LaTeX: ["tex|latex|ltx|bib"],
+ LESS: ["less"],
+ Liquid: ["liquid"],
+ Lisp: ["lisp"],
+ LiveScript: ["ls"],
+ LogiQL: ["logic|lql"],
+ LSL: ["lsl"],
+ Lua: ["lua"],
+ LuaPage: ["lp"],
+ Lucene: ["lucene"],
+ Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
+ Markdown: ["md|markdown"],
+ Mask: ["mask"],
+ MATLAB: ["matlab"],
+ Maze: ["mz"],
+ MEL: ["mel"],
+ MIXAL: ["mixal"],
+ MUSHCode: ["mc|mush"],
+ MySQL: ["mysql"],
+ Nix: ["nix"],
+ NSIS: ["nsi|nsh"],
+ ObjectiveC: ["m|mm"],
+ OCaml: ["ml|mli"],
+ Pascal: ["pas|p"],
+ Perl: ["pl|pm"],
+ pgSQL: ["pgsql"],
+ PHP_Laravel_blade: ["blade.php"],
+ PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
+ Puppet: ["epp|pp"],
+ Pig: ["pig"],
+ Powershell: ["ps1"],
+ Praat: ["praat|praatscript|psc|proc"],
+ Prolog: ["plg|prolog"],
+ Properties: ["properties"],
+ Protobuf: ["proto"],
+ Python: ["py"],
+ R: ["r"],
+ Razor: ["cshtml|asp"],
+ RDoc: ["Rd"],
+ Red: ["red|reds"],
+ RHTML: ["Rhtml"],
+ RST: ["rst"],
+ Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
+ Rust: ["rs"],
+ SASS: ["sass"],
+ SCAD: ["scad"],
+ Scala: ["scala"],
+ Scheme: ["scm|sm|rkt|oak|scheme"],
+ SCSS: ["scss"],
+ SH: ["sh|bash|^.bashrc"],
+ SJS: ["sjs"],
+ Slim: ["slim|skim"],
+ Smarty: ["smarty|tpl"],
+ snippets: ["snippets"],
+ Soy_Template:["soy"],
+ Space: ["space"],
+ SQL: ["sql"],
+ SQLServer: ["sqlserver"],
+ Stylus: ["styl|stylus"],
+ SVG: ["svg"],
+ Swift: ["swift"],
+ Tcl: ["tcl"],
+ Terraform: ["tf", "tfvars", "terragrunt"],
+ Tex: ["tex"],
+ Text: ["txt"],
+ Textile: ["textile"],
+ Toml: ["toml"],
+ TSX: ["tsx"],
+ Twig: ["twig|swig"],
+ Typescript: ["ts|typescript|str"],
+ Vala: ["vala"],
+ VBScript: ["vbs|vb"],
+ Velocity: ["vm"],
+ Verilog: ["v|vh|sv|svh"],
+ VHDL: ["vhd|vhdl"],
+ Wollok: ["wlk|wpgm|wtest"],
+ XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
+ XQuery: ["xq"],
+ YAML: ["yaml|yml"],
+ Django: ["html"]
+};
+
+var nameOverrides = {
+ ObjectiveC: "Objective-C",
+ CSharp: "C#",
+ golang: "Go",
+ C_Cpp: "C and C++",
+ Csound_Document: "Csound Document",
+ Csound_Orchestra: "Csound",
+ Csound_Score: "Csound Score",
+ coffee: "CoffeeScript",
+ HTML_Ruby: "HTML (Ruby)",
+ HTML_Elixir: "HTML (Elixir)",
+ FTL: "FreeMarker",
+ PHP_Laravel_blade: "PHP (Blade Template)"
+};
+var modesByName = {};
+for (var name in supportedModes) {
+ var data = supportedModes[name];
+ var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
+ var filename = name.toLowerCase();
+ var mode = new Mode(filename, displayName, data[0]);
+ modesByName[filename] = mode;
+ modes.push(mode);
+}
+
+module.exports = {
+ getModeForPath: getModeForPath,
+ modes: modes,
+ modesByName: modesByName
+};
+
+});
+
+ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
+"use strict";
+require("ace/lib/fixoldbrowsers");
+
+var themeData = [
+ ["Chrome" ],
+ ["Clouds" ],
+ ["Crimson Editor" ],
+ ["Dawn" ],
+ ["Dreamweaver" ],
+ ["Eclipse" ],
+ ["GitHub" ],
+ ["IPlastic" ],
+ ["Solarized Light"],
+ ["TextMate" ],
+ ["Tomorrow" ],
+ ["XCode" ],
+ ["Kuroir"],
+ ["KatzenMilch"],
+ ["SQL Server" ,"sqlserver" , "light"],
+ ["Ambiance" ,"ambiance" , "dark"],
+ ["Chaos" ,"chaos" , "dark"],
+ ["Clouds Midnight" ,"clouds_midnight" , "dark"],
+ ["Dracula" ,"" , "dark"],
+ ["Cobalt" ,"cobalt" , "dark"],
+ ["Gruvbox" ,"gruvbox" , "dark"],
+ ["Green on Black" ,"gob" , "dark"],
+ ["idle Fingers" ,"idle_fingers" , "dark"],
+ ["krTheme" ,"kr_theme" , "dark"],
+ ["Merbivore" ,"merbivore" , "dark"],
+ ["Merbivore Soft" ,"merbivore_soft" , "dark"],
+ ["Mono Industrial" ,"mono_industrial" , "dark"],
+ ["Monokai" ,"monokai" , "dark"],
+ ["Pastel on dark" ,"pastel_on_dark" , "dark"],
+ ["Solarized Dark" ,"solarized_dark" , "dark"],
+ ["Terminal" ,"terminal" , "dark"],
+ ["Tomorrow Night" ,"tomorrow_night" , "dark"],
+ ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
+ ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
+ ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
+ ["Twilight" ,"twilight" , "dark"],
+ ["Vibrant Ink" ,"vibrant_ink" , "dark"]
+];
+
+
+exports.themesByName = {};
+exports.themes = themeData.map(function(data) {
+ var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
+ var theme = {
+ caption: data[0],
+ theme: "ace/theme/" + name,
+ isDark: data[2] == "dark",
+ name: name
+ };
+ exports.themesByName[name] = theme;
+ return theme;
+});
+
+});
+
+ace.define("ace/ext/options",["require","exports","module","ace/ext/menu_tools/overlay_page","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
+"use strict";
+var overlayPage = require('./menu_tools/overlay_page').overlayPage;
+
+
+var dom = require("../lib/dom");
+var oop = require("../lib/oop");
+var EventEmitter = require("../lib/event_emitter").EventEmitter;
+var buildDom = dom.buildDom;
+
+var modelist = require("./modelist");
+var themelist = require("./themelist");
+
+var themes = { Bright: [], Dark: [] };
+themelist.themes.forEach(function(x) {
+ themes[x.isDark ? "Dark" : "Bright"].push({ caption: x.caption, value: x.theme });
+});
+
+var modes = modelist.modes.map(function(x){
+ return { caption: x.caption, value: x.mode };
+});
+
+
+var optionGroups = {
+ Main: {
+ Mode: {
+ path: "mode",
+ type: "select",
+ items: modes
+ },
+ Theme: {
+ path: "theme",
+ type: "select",
+ items: themes
+ },
+ "Keybinding": {
+ type: "buttonBar",
+ path: "keyboardHandler",
+ items: [
+ { caption : "Ace", value : null },
+ { caption : "Vim", value : "ace/keyboard/vim" },
+ { caption : "Emacs", value : "ace/keyboard/emacs" }
+ ]
+ },
+ "Font Size": {
+ path: "fontSize",
+ type: "number",
+ defaultValue: 12,
+ defaults: [
+ {caption: "12px", value: 12},
+ {caption: "24px", value: 24}
+ ]
+ },
+ "Soft Wrap": {
+ type: "buttonBar",
+ path: "wrap",
+ items: [
+ { caption : "Off", value : "off" },
+ { caption : "View", value : "free" },
+ { caption : "margin", value : "printMargin" },
+ { caption : "40", value : "40" }
+ ]
+ },
+ "Cursor Style": {
+ path: "cursorStyle",
+ items: [
+ { caption : "Ace", value : "ace" },
+ { caption : "Slim", value : "slim" },
+ { caption : "Smooth", value : "smooth" },
+ { caption : "Smooth And Slim", value : "smooth slim" },
+ { caption : "Wide", value : "wide" }
+ ]
+ },
+ "Folding": {
+ path: "foldStyle",
+ items: [
+ { caption : "Manual", value : "manual" },
+ { caption : "Mark begin", value : "markbegin" },
+ { caption : "Mark begin and end", value : "markbeginend" }
+ ]
+ },
+ "Soft Tabs": [{
+ path: "useSoftTabs"
+ }, {
+ path: "tabSize",
+ type: "number",
+ values: [2, 3, 4, 8, 16]
+ }],
+ "Overscroll": {
+ type: "buttonBar",
+ path: "scrollPastEnd",
+ items: [
+ { caption : "None", value : 0 },
+ { caption : "Half", value : 0.5 },
+ { caption : "Full", value : 1 }
+ ]
+ }
+ },
+ More: {
+ "Atomic soft tabs": {
+ path: "navigateWithinSoftTabs"
+ },
+ "Enable Behaviours": {
+ path: "behavioursEnabled"
+ },
+ "Full Line Selection": {
+ type: "checkbox",
+ values: "text|line",
+ path: "selectionStyle"
+ },
+ "Highlight Active Line": {
+ path: "highlightActiveLine"
+ },
+ "Show Invisibles": {
+ path: "showInvisibles"
+ },
+ "Show Indent Guides": {
+ path: "displayIndentGuides"
+ },
+ "Persistent Scrollbar": [{
+ path: "hScrollBarAlwaysVisible"
+ }, {
+ path: "vScrollBarAlwaysVisible"
+ }],
+ "Animate scrolling": {
+ path: "animatedScroll"
+ },
+ "Show Gutter": {
+ path: "showGutter"
+ },
+ "Show Line Numbers": {
+ path: "showLineNumbers"
+ },
+ "Relative Line Numbers": {
+ path: "relativeLineNumbers"
+ },
+ "Fixed Gutter Width": {
+ path: "fixedWidthGutter"
+ },
+ "Show Print Margin": [{
+ path: "showPrintMargin"
+ }, {
+ type: "number",
+ path: "printMarginColumn"
+ }],
+ "Indented Soft Wrap": {
+ path: "indentedSoftWrap"
+ },
+ "Highlight selected word": {
+ path: "highlightSelectedWord"
+ },
+ "Fade Fold Widgets": {
+ path: "fadeFoldWidgets"
+ },
+ "Use textarea for IME": {
+ path: "useTextareaForIME"
+ },
+ "Merge Undo Deltas": {
+ path: "mergeUndoDeltas",
+ items: [
+ { caption : "Always", value : "always" },
+ { caption : "Never", value : "false" },
+ { caption : "Timed", value : "true" }
+ ]
+ },
+ "Elastic Tabstops": {
+ path: "useElasticTabstops"
+ },
+ "Incremental Search": {
+ path: "useIncrementalSearch"
+ },
+ "Read-only": {
+ path: "readOnly"
+ },
+ "Copy without selection": {
+ path: "copyWithEmptySelection"
+ },
+ "Live Autocompletion": {
+ path: "enableLiveAutocompletion"
+ }
+ }
+};
+
+
+var OptionPanel = function(editor, element) {
+ this.editor = editor;
+ this.container = element || document.createElement("div");
+ this.groups = [];
+ this.options = {};
+};
+
+(function() {
+
+ oop.implement(this, EventEmitter);
+
+ this.add = function(config) {
+ if (config.Main)
+ oop.mixin(optionGroups.Main, config.Main);
+ if (config.More)
+ oop.mixin(optionGroups.More, config.More);
+ };
+
+ this.render = function() {
+ this.container.innerHTML = "";
+ buildDom(["table", {id: "controls"},
+ this.renderOptionGroup(optionGroups.Main),
+ ["tr", null, ["td", {colspan: 2},
+ ["table", {id: "more-controls"},
+ this.renderOptionGroup(optionGroups.More)
+ ]
+ ]]
+ ], this.container);
+ };
+
+ this.renderOptionGroup = function(group) {
+ return Object.keys(group).map(function(key, i) {
+ var item = group[key];
+ if (!item.position)
+ item.position = i / 10000;
+ if (!item.label)
+ item.label = key;
+ return item;
+ }).sort(function(a, b) {
+ return a.position - b.position;
+ }).map(function(item) {
+ return this.renderOption(item.label, item);
+ }, this);
+ };
+
+ this.renderOptionControl = function(key, option) {
+ var self = this;
+ if (Array.isArray(option)) {
+ return option.map(function(x) {
+ return self.renderOptionControl(key, x);
+ });
+ }
+ var control;
+
+ var value = self.getOption(option);
+
+ if (option.values && option.type != "checkbox") {
+ if (typeof option.values == "string")
+ option.values = option.values.split("|");
+ option.items = option.values.map(function(v) {
+ return { value: v, name: v };
+ });
+ }
+
+ if (option.type == "buttonBar") {
+ control = ["div", option.items.map(function(item) {
+ return ["button", {
+ value: item.value,
+ ace_selected_button: value == item.value,
+ onclick: function() {
+ self.setOption(option, item.value);
+ var nodes = this.parentNode.querySelectorAll("[ace_selected_button]");
+ for (var i = 0; i < nodes.length; i++) {
+ nodes[i].removeAttribute("ace_selected_button");
+ }
+ this.setAttribute("ace_selected_button", true);
+ }
+ }, item.desc || item.caption || item.name];
+ })];
+ } else if (option.type == "number") {
+ control = ["input", {type: "number", value: value || option.defaultValue, style:"width:3em", oninput: function() {
+ self.setOption(option, parseInt(this.value));
+ }}];
+ if (option.defaults) {
+ control = [control, option.defaults.map(function(item) {
+ return ["button", {onclick: function() {
+ var input = this.parentNode.firstChild;
+ input.value = item.value;
+ input.oninput();
+ }}, item.caption];
+ })];
+ }
+ } else if (option.items) {
+ var buildItems = function(items) {
+ return items.map(function(item) {
+ return ["option", { value: item.value || item.name }, item.desc || item.caption || item.name];
+ });
+ };
+
+ var items = Array.isArray(option.items)
+ ? buildItems(option.items)
+ : Object.keys(option.items).map(function(key) {
+ return ["optgroup", {"label": key}, buildItems(option.items[key])];
+ });
+ control = ["select", { id: key, value: value, onchange: function() {
+ self.setOption(option, this.value);
+ } }, items];
+ } else {
+ if (typeof option.values == "string")
+ option.values = option.values.split("|");
+ if (option.values) value = value == option.values[1];
+ control = ["input", { type: "checkbox", id: key, checked: value || null, onchange: function() {
+ var value = this.checked;
+ if (option.values) value = option.values[value ? 1 : 0];
+ self.setOption(option, value);
+ }}];
+ if (option.type == "checkedNumber") {
+ control = [control, []];
+ }
+ }
+ return control;
+ };
+
+ this.renderOption = function(key, option) {
+ if (option.path && !option.onchange && !this.editor.$options[option.path])
+ return;
+ this.options[option.path] = option;
+ var safeKey = "-" + option.path;
+ var control = this.renderOptionControl(safeKey, option);
+ return ["tr", {class: "ace_optionsMenuEntry"}, ["td",
+ ["label", {for: safeKey}, key]
+ ], ["td", control]];
+ };
+
+ this.setOption = function(option, value) {
+ if (typeof option == "string")
+ option = this.options[option];
+ if (value == "false") value = false;
+ if (value == "true") value = true;
+ if (value == "null") value = null;
+ if (value == "undefined") value = undefined;
+ if (typeof value == "string" && parseFloat(value).toString() == value)
+ value = parseFloat(value);
+ if (option.onchange)
+ option.onchange(value);
+ else if (option.path)
+ this.editor.setOption(option.path, value);
+ this._signal("setOption", {name: option.path, value: value});
+ };
+
+ this.getOption = function(option) {
+ if (option.getValue)
+ return option.getValue();
+ return this.editor.getOption(option.path);
+ };
+
+}).call(OptionPanel.prototype);
+
+exports.OptionPanel = OptionPanel;
+
+});
+
+ace.define("ace/ext/settings_menu",["require","exports","module","ace/ext/options","ace/ext/menu_tools/overlay_page","ace/editor"], function(require, exports, module) {
+"use strict";
+var OptionPanel = require("ace/ext/options").OptionPanel;
+var overlayPage = require('./menu_tools/overlay_page').overlayPage;
+function showSettingsMenu(editor) {
+ if (!document.getElementById('ace_settingsmenu')) {
+ var options = new OptionPanel(editor);
+ options.render();
+ options.container.id = "ace_settingsmenu";
+ overlayPage(editor, options.container, '0', '0', '0');
+ options.container.querySelector("select,input,button,checkbox").focus();
+ }
+}
+module.exports.init = function(editor) {
+ var Editor = require("ace/editor").Editor;
+ Editor.prototype.showSettingsMenu = function() {
+ showSettingsMenu(this);
+ };
+};
+});
+ (function() {
+ ace.require(["ace/ext/settings_menu"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-spellcheck.js b/src/main/resources/static/js/ace-noconflict/ext-spellcheck.js
new file mode 100644
index 0000000..1660ccb
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-spellcheck.js
@@ -0,0 +1,75 @@
+ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"], function(require, exports, module) {
+"use strict";
+var event = require("../lib/event");
+
+exports.contextMenuHandler = function(e){
+ var host = e.target;
+ var text = host.textInput.getElement();
+ if (!host.selection.isEmpty())
+ return;
+ var c = host.getCursorPosition();
+ var r = host.session.getWordRange(c.row, c.column);
+ var w = host.session.getTextRange(r);
+
+ host.session.tokenRe.lastIndex = 0;
+ if (!host.session.tokenRe.test(w))
+ return;
+ var PLACEHOLDER = "\x01\x01";
+ var value = w + " " + PLACEHOLDER;
+ text.value = value;
+ text.setSelectionRange(w.length, w.length + 1);
+ text.setSelectionRange(0, 0);
+ text.setSelectionRange(0, w.length);
+
+ var afterKeydown = false;
+ event.addListener(text, "keydown", function onKeydown() {
+ event.removeListener(text, "keydown", onKeydown);
+ afterKeydown = true;
+ });
+
+ host.textInput.setInputHandler(function(newVal) {
+ console.log(newVal , value, text.selectionStart, text.selectionEnd);
+ if (newVal == value)
+ return '';
+ if (newVal.lastIndexOf(value, 0) === 0)
+ return newVal.slice(value.length);
+ if (newVal.substr(text.selectionEnd) == value)
+ return newVal.slice(0, -value.length);
+ if (newVal.slice(-2) == PLACEHOLDER) {
+ var val = newVal.slice(0, -2);
+ if (val.slice(-1) == " ") {
+ if (afterKeydown)
+ return val.substring(0, text.selectionEnd);
+ val = val.slice(0, -1);
+ host.session.replace(r, val);
+ return "";
+ }
+ }
+
+ return newVal;
+ });
+};
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+ spellcheck: {
+ set: function(val) {
+ var text = this.textInput.getElement();
+ text.spellcheck = !!val;
+ if (!val)
+ this.removeListener("nativecontextmenu", exports.contextMenuHandler);
+ else
+ this.on("nativecontextmenu", exports.contextMenuHandler);
+ },
+ value: true
+ }
+});
+
+});
+ (function() {
+ ace.require(["ace/ext/spellcheck"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-split.js b/src/main/resources/static/js/ace-noconflict/ext-split.js
new file mode 100644
index 0000000..fa3c212
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-split.js
@@ -0,0 +1,208 @@
+ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var lang = require("./lib/lang");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+
+var Editor = require("./editor").Editor;
+var Renderer = require("./virtual_renderer").VirtualRenderer;
+var EditSession = require("./edit_session").EditSession;
+
+
+var Split = function(container, theme, splits) {
+ this.BELOW = 1;
+ this.BESIDE = 0;
+
+ this.$container = container;
+ this.$theme = theme;
+ this.$splits = 0;
+ this.$editorCSS = "";
+ this.$editors = [];
+ this.$orientation = this.BESIDE;
+
+ this.setSplits(splits || 1);
+ this.$cEditor = this.$editors[0];
+
+
+ this.on("focus", function(editor) {
+ this.$cEditor = editor;
+ }.bind(this));
+};
+
+(function(){
+
+ oop.implement(this, EventEmitter);
+
+ this.$createEditor = function() {
+ var el = document.createElement("div");
+ el.className = this.$editorCSS;
+ el.style.cssText = "position: absolute; top:0px; bottom:0px";
+ this.$container.appendChild(el);
+ var editor = new Editor(new Renderer(el, this.$theme));
+
+ editor.on("focus", function() {
+ this._emit("focus", editor);
+ }.bind(this));
+
+ this.$editors.push(editor);
+ editor.setFontSize(this.$fontSize);
+ return editor;
+ };
+
+ this.setSplits = function(splits) {
+ var editor;
+ if (splits < 1) {
+ throw "The number of splits have to be > 0!";
+ }
+
+ if (splits == this.$splits) {
+ return;
+ } else if (splits > this.$splits) {
+ while (this.$splits < this.$editors.length && this.$splits < splits) {
+ editor = this.$editors[this.$splits];
+ this.$container.appendChild(editor.container);
+ editor.setFontSize(this.$fontSize);
+ this.$splits ++;
+ }
+ while (this.$splits < splits) {
+ this.$createEditor();
+ this.$splits ++;
+ }
+ } else {
+ while (this.$splits > splits) {
+ editor = this.$editors[this.$splits - 1];
+ this.$container.removeChild(editor.container);
+ this.$splits --;
+ }
+ }
+ this.resize();
+ };
+ this.getSplits = function() {
+ return this.$splits;
+ };
+ this.getEditor = function(idx) {
+ return this.$editors[idx];
+ };
+ this.getCurrentEditor = function() {
+ return this.$cEditor;
+ };
+ this.focus = function() {
+ this.$cEditor.focus();
+ };
+ this.blur = function() {
+ this.$cEditor.blur();
+ };
+ this.setTheme = function(theme) {
+ this.$editors.forEach(function(editor) {
+ editor.setTheme(theme);
+ });
+ };
+ this.setKeyboardHandler = function(keybinding) {
+ this.$editors.forEach(function(editor) {
+ editor.setKeyboardHandler(keybinding);
+ });
+ };
+ this.forEach = function(callback, scope) {
+ this.$editors.forEach(callback, scope);
+ };
+
+
+ this.$fontSize = "";
+ this.setFontSize = function(size) {
+ this.$fontSize = size;
+ this.forEach(function(editor) {
+ editor.setFontSize(size);
+ });
+ };
+
+ this.$cloneSession = function(session) {
+ var s = new EditSession(session.getDocument(), session.getMode());
+
+ var undoManager = session.getUndoManager();
+ s.setUndoManager(undoManager);
+ s.setTabSize(session.getTabSize());
+ s.setUseSoftTabs(session.getUseSoftTabs());
+ s.setOverwrite(session.getOverwrite());
+ s.setBreakpoints(session.getBreakpoints());
+ s.setUseWrapMode(session.getUseWrapMode());
+ s.setUseWorker(session.getUseWorker());
+ s.setWrapLimitRange(session.$wrapLimitRange.min,
+ session.$wrapLimitRange.max);
+ s.$foldData = session.$cloneFoldData();
+
+ return s;
+ };
+ this.setSession = function(session, idx) {
+ var editor;
+ if (idx == null) {
+ editor = this.$cEditor;
+ } else {
+ editor = this.$editors[idx];
+ }
+ var isUsed = this.$editors.some(function(editor) {
+ return editor.session === session;
+ });
+
+ if (isUsed) {
+ session = this.$cloneSession(session);
+ }
+ editor.setSession(session);
+ return session;
+ };
+ this.getOrientation = function() {
+ return this.$orientation;
+ };
+ this.setOrientation = function(orientation) {
+ if (this.$orientation == orientation) {
+ return;
+ }
+ this.$orientation = orientation;
+ this.resize();
+ };
+ this.resize = function() {
+ var width = this.$container.clientWidth;
+ var height = this.$container.clientHeight;
+ var editor;
+
+ if (this.$orientation == this.BESIDE) {
+ var editorWidth = width / this.$splits;
+ for (var i = 0; i < this.$splits; i++) {
+ editor = this.$editors[i];
+ editor.container.style.width = editorWidth + "px";
+ editor.container.style.top = "0px";
+ editor.container.style.left = i * editorWidth + "px";
+ editor.container.style.height = height + "px";
+ editor.resize();
+ }
+ } else {
+ var editorHeight = height / this.$splits;
+ for (var i = 0; i < this.$splits; i++) {
+ editor = this.$editors[i];
+ editor.container.style.width = width + "px";
+ editor.container.style.top = i * editorHeight + "px";
+ editor.container.style.left = "0px";
+ editor.container.style.height = editorHeight + "px";
+ editor.resize();
+ }
+ }
+ };
+
+}).call(Split.prototype);
+
+exports.Split = Split;
+});
+
+ace.define("ace/ext/split",["require","exports","module","ace/split"], function(require, exports, module) {
+"use strict";
+module.exports = require("../split");
+
+});
+ (function() {
+ ace.require(["ace/ext/split"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-static_highlight.js b/src/main/resources/static/js/ace-noconflict/ext-static_highlight.js
new file mode 100644
index 0000000..50887e3
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-static_highlight.js
@@ -0,0 +1,226 @@
+ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"], function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var TextLayer = require("../layer/text").Text;
+var baseStyles = ".ace_static_highlight {\
+font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\
+font-size: 12px;\
+white-space: pre-wrap\
+}\
+.ace_static_highlight .ace_gutter {\
+width: 2em;\
+text-align: right;\
+padding: 0 3px 0 0;\
+margin-right: 3px;\
+}\
+.ace_static_highlight.ace_show_gutter .ace_line {\
+padding-left: 2.6em;\
+}\
+.ace_static_highlight .ace_line { position: relative; }\
+.ace_static_highlight .ace_gutter-cell {\
+-moz-user-select: -moz-none;\
+-khtml-user-select: none;\
+-webkit-user-select: none;\
+user-select: none;\
+top: 0;\
+bottom: 0;\
+left: 0;\
+position: absolute;\
+}\
+.ace_static_highlight .ace_gutter-cell:before {\
+content: counter(ace_line, decimal);\
+counter-increment: ace_line;\
+}\
+.ace_static_highlight {\
+counter-reset: ace_line;\
+}\
+";
+var config = require("../config");
+var dom = require("../lib/dom");
+
+function Element(type) {
+ this.type = type;
+ this.style = {};
+ this.textContent = "";
+}
+Element.prototype.cloneNode = function() {
+ return this;
+};
+Element.prototype.appendChild = function(child) {
+ this.textContent += child.toString();
+};
+Element.prototype.toString = function() {
+ var stringBuilder = [];
+ if (this.type != "fragment") {
+ stringBuilder.push("<", this.type);
+ if (this.className)
+ stringBuilder.push(" class='", this.className, "'");
+ var styleStr = [];
+ for (var key in this.style) {
+ styleStr.push(key, ":", this.style[key]);
+ }
+ if (styleStr.length)
+ stringBuilder.push(" style='", styleStr.join(""), "'");
+ stringBuilder.push(">");
+ }
+
+ if (this.textContent)
+ stringBuilder.push(this.textContent);
+
+ if (this.type != "fragment") {
+ stringBuilder.push("", this.type, ">");
+ }
+
+ return stringBuilder.join("");
+};
+
+
+var simpleDom = {
+ createTextNode: function(textContent, element) {
+ return textContent;
+ },
+ createElement: function(type) {
+ return new Element(type);
+ },
+ createFragment: function() {
+ return new Element("fragment");
+ }
+};
+
+var SimpleTextLayer = function() {
+ this.config = {};
+ this.dom = simpleDom;
+};
+SimpleTextLayer.prototype = TextLayer.prototype;
+
+var highlight = function(el, opts, callback) {
+ var m = el.className.match(/lang-(\w+)/);
+ var mode = opts.mode || m && ("ace/mode/" + m[1]);
+ if (!mode)
+ return false;
+ var theme = opts.theme || "ace/theme/textmate";
+
+ var data = "";
+ var nodes = [];
+
+ if (el.firstElementChild) {
+ var textLen = 0;
+ for (var i = 0; i < el.childNodes.length; i++) {
+ var ch = el.childNodes[i];
+ if (ch.nodeType == 3) {
+ textLen += ch.data.length;
+ data += ch.data;
+ } else {
+ nodes.push(textLen, ch);
+ }
+ }
+ } else {
+ data = el.textContent;
+ if (opts.trim)
+ data = data.trim();
+ }
+
+ highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
+ dom.importCssString(highlighted.css, "ace_highlight");
+ el.innerHTML = highlighted.html;
+ var container = el.firstChild.firstChild;
+ for (var i = 0; i < nodes.length; i += 2) {
+ var pos = highlighted.session.doc.indexToPosition(nodes[i]);
+ var node = nodes[i + 1];
+ var lineEl = container.children[pos.row];
+ lineEl && lineEl.appendChild(node);
+ }
+ callback && callback();
+ });
+};
+highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
+ var waiting = 1;
+ var modeCache = EditSession.prototype.$modes;
+ if (typeof theme == "string") {
+ waiting++;
+ config.loadModule(['theme', theme], function(m) {
+ theme = m;
+ --waiting || done();
+ });
+ }
+ var modeOptions;
+ if (mode && typeof mode === "object" && !mode.getTokenizer) {
+ modeOptions = mode;
+ mode = modeOptions.path;
+ }
+ if (typeof mode == "string") {
+ waiting++;
+ config.loadModule(['mode', mode], function(m) {
+ if (!modeCache[mode] || modeOptions)
+ modeCache[mode] = new m.Mode(modeOptions);
+ mode = modeCache[mode];
+ --waiting || done();
+ });
+ }
+ function done() {
+ var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
+ return callback ? callback(result) : result;
+ }
+ return --waiting || done();
+};
+highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
+ lineStart = parseInt(lineStart || 1, 10);
+
+ var session = new EditSession("");
+ session.setUseWorker(false);
+ session.setMode(mode);
+
+ var textLayer = new SimpleTextLayer();
+ textLayer.setSession(session);
+ Object.keys(textLayer.$tabStrings).forEach(function(k) {
+ if (typeof textLayer.$tabStrings[k] == "string") {
+ var el = simpleDom.createFragment();
+ el.textContent = textLayer.$tabStrings[k];
+ textLayer.$tabStrings[k] = el;
+ }
+ });
+
+ session.setValue(input);
+ var length = session.getLength();
+
+ var outerEl = simpleDom.createElement("div");
+ outerEl.className = theme.cssClass;
+
+ var innerEl = simpleDom.createElement("div");
+ innerEl.className = "ace_static_highlight" + (disableGutter ? "" : " ace_show_gutter");
+ innerEl.style["counter-reset"] = "ace_line " + (lineStart - 1);
+
+ for (var ix = 0; ix < length; ix++) {
+ var lineEl = simpleDom.createElement("div");
+ lineEl.className = "ace_line";
+
+ if (!disableGutter) {
+ var gutterEl = simpleDom.createElement("span");
+ gutterEl.className ="ace_gutter ace_gutter-cell";
+ gutterEl.textContent = ""; /*(ix + lineStart) + */
+ lineEl.appendChild(gutterEl);
+ }
+ textLayer.$renderLine(lineEl, ix, false);
+ innerEl.appendChild(lineEl);
+ }
+ outerEl.appendChild(innerEl);
+
+ return {
+ css: baseStyles + theme.cssText,
+ html: outerEl.toString(),
+ session: session
+ };
+};
+
+module.exports = highlight;
+module.exports.highlight = highlight;
+});
+ (function() {
+ ace.require(["ace/ext/static_highlight"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-statusbar.js b/src/main/resources/static/js/ace-noconflict/ext-statusbar.js
new file mode 100644
index 0000000..9a00b5a
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-statusbar.js
@@ -0,0 +1,57 @@
+ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
+"use strict";
+var dom = require("ace/lib/dom");
+var lang = require("ace/lib/lang");
+
+var StatusBar = function(editor, parentNode) {
+ this.element = dom.createElement("div");
+ this.element.className = "ace_status-indicator";
+ this.element.style.cssText = "display: inline-block;";
+ parentNode.appendChild(this.element);
+
+ var statusUpdate = lang.delayedCall(function(){
+ this.updateStatus(editor);
+ }.bind(this)).schedule.bind(null, 100);
+
+ editor.on("changeStatus", statusUpdate);
+ editor.on("changeSelection", statusUpdate);
+ editor.on("keyboardActivity", statusUpdate);
+};
+
+(function(){
+ this.updateStatus = function(editor) {
+ var status = [];
+ function add(str, separator) {
+ str && status.push(str, separator || "|");
+ }
+
+ add(editor.keyBinding.getStatusText(editor));
+ if (editor.commands.recording)
+ add("REC");
+
+ var sel = editor.selection;
+ var c = sel.lead;
+
+ if (!sel.isEmpty()) {
+ var r = editor.getSelectionRange();
+ add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " ");
+ }
+ add(c.row + ":" + c.column, " ");
+ if (sel.rangeCount)
+ add("[" + sel.rangeCount + "]", " ");
+ status.pop();
+ this.element.textContent = status.join("");
+ };
+}).call(StatusBar.prototype);
+
+exports.StatusBar = StatusBar;
+
+});
+ (function() {
+ ace.require(["ace/ext/statusbar"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/ace-noconflict/ext-textarea.js b/src/main/resources/static/js/ace-noconflict/ext-textarea.js
new file mode 100644
index 0000000..2c65c33
--- /dev/null
+++ b/src/main/resources/static/js/ace-noconflict/ext-textarea.js
@@ -0,0 +1,567 @@
+ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
+"use strict";
+
+exports.isDark = false;
+exports.cssClass = "ace-tm";
+exports.cssText = ".ace-tm .ace_gutter {\
+background: #f0f0f0;\
+color: #333;\
+}\
+.ace-tm .ace_print-margin {\
+width: 1px;\
+background: #e8e8e8;\
+}\
+.ace-tm .ace_fold {\
+background-color: #6B72E6;\
+}\
+.ace-tm {\
+background-color: #FFFFFF;\
+color: black;\
+}\
+.ace-tm .ace_cursor {\
+color: black;\
+}\
+.ace-tm .ace_invisible {\
+color: rgb(191, 191, 191);\
+}\
+.ace-tm .ace_storage,\
+.ace-tm .ace_keyword {\
+color: blue;\
+}\
+.ace-tm .ace_constant {\
+color: rgb(197, 6, 11);\
+}\
+.ace-tm .ace_constant.ace_buildin {\
+color: rgb(88, 72, 246);\
+}\
+.ace-tm .ace_constant.ace_language {\
+color: rgb(88, 92, 246);\
+}\
+.ace-tm .ace_constant.ace_library {\
+color: rgb(6, 150, 14);\
+}\
+.ace-tm .ace_invalid {\
+background-color: rgba(255, 0, 0, 0.1);\
+color: red;\
+}\
+.ace-tm .ace_support.ace_function {\
+color: rgb(60, 76, 114);\
+}\
+.ace-tm .ace_support.ace_constant {\
+color: rgb(6, 150, 14);\
+}\
+.ace-tm .ace_support.ace_type,\
+.ace-tm .ace_support.ace_class {\
+color: rgb(109, 121, 222);\
+}\
+.ace-tm .ace_keyword.ace_operator {\
+color: rgb(104, 118, 135);\
+}\
+.ace-tm .ace_string {\
+color: rgb(3, 106, 7);\
+}\
+.ace-tm .ace_comment {\
+color: rgb(76, 136, 107);\
+}\
+.ace-tm .ace_comment.ace_doc {\
+color: rgb(0, 102, 255);\
+}\
+.ace-tm .ace_comment.ace_doc.ace_tag {\
+color: rgb(128, 159, 191);\
+}\
+.ace-tm .ace_constant.ace_numeric {\
+color: rgb(0, 0, 205);\
+}\
+.ace-tm .ace_variable {\
+color: rgb(49, 132, 149);\
+}\
+.ace-tm .ace_xml-pe {\
+color: rgb(104, 104, 91);\
+}\
+.ace-tm .ace_entity.ace_name.ace_function {\
+color: #0000A2;\
+}\
+.ace-tm .ace_heading {\
+color: rgb(12, 7, 255);\
+}\
+.ace-tm .ace_list {\
+color:rgb(185, 6, 144);\
+}\
+.ace-tm .ace_meta.ace_tag {\
+color:rgb(0, 22, 142);\
+}\
+.ace-tm .ace_string.ace_regex {\
+color: rgb(255, 0, 0)\
+}\
+.ace-tm .ace_marker-layer .ace_selection {\
+background: rgb(181, 213, 255);\
+}\
+.ace-tm.ace_multiselect .ace_selection.ace_start {\
+box-shadow: 0 0 3px 0px white;\
+}\
+.ace-tm .ace_marker-layer .ace_step {\
+background: rgb(252, 255, 0);\
+}\
+.ace-tm .ace_marker-layer .ace_stack {\
+background: rgb(164, 229, 101);\
+}\
+.ace-tm .ace_marker-layer .ace_bracket {\
+margin: -1px 0 0 -1px;\
+border: 1px solid rgb(192, 192, 192);\
+}\
+.ace-tm .ace_marker-layer .ace_active-line {\
+background: rgba(0, 0, 0, 0.07);\
+}\
+.ace-tm .ace_gutter-active-line {\
+background-color : #dcdcdc;\
+}\
+.ace-tm .ace_marker-layer .ace_selected-word {\
+background: rgb(250, 250, 255);\
+border: 1px solid rgb(200, 200, 250);\
+}\
+.ace-tm .ace_indent-guide {\
+background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
+}\
+";
+exports.$id = "ace/theme/textmate";
+
+var dom = require("../lib/dom");
+dom.importCssString(exports.cssText, exports.cssClass);
+});
+
+ace.define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate"], function(require, exports, module) {
+"use strict";
+
+var event = require("../lib/event");
+var UA = require("../lib/useragent");
+var net = require("../lib/net");
+var ace = require("../ace");
+
+require("../theme/textmate");
+
+module.exports = exports = ace;
+var getCSSProperty = function(element, container, property) {
+ var ret = element.style[property];
+
+ if (!ret) {
+ if (window.getComputedStyle) {
+ ret = window.getComputedStyle(element, '').getPropertyValue(property);
+ } else {
+ ret = element.currentStyle[property];
+ }
+ }
+
+ if (!ret || ret == 'auto' || ret == 'intrinsic') {
+ ret = container.style[property];
+ }
+ return ret;
+};
+
+function applyStyles(elm, styles) {
+ for (var style in styles) {
+ elm.style[style] = styles[style];
+ }
+}
+
+function setupContainer(element, getValue) {
+ if (element.type != 'textarea') {
+ throw new Error("Textarea required!");
+ }
+
+ var parentNode = element.parentNode;
+ var container = document.createElement('div');
+ //
+ var resizeEvent = function() {
+ var style = 'position:relative;';
+ [
+ 'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
+ ].forEach(function(item) {
+ style += item + ':' +
+ getCSSProperty(element, container, item) + ';';
+ });
+ var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
+ var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
+ style += 'height:' + height + ';width:' + width + ';';
+ style += 'display:inline-block;';
+ container.setAttribute('style', style);
+ };
+ event.addListener(window, 'resize', resizeEvent);
+ resizeEvent();
+ parentNode.insertBefore(container, element.nextSibling);
+ while (parentNode !== document) {
+ if (parentNode.tagName.toUpperCase() === 'FORM') {
+ var oldSumit = parentNode.onsubmit;
+ parentNode.onsubmit = function(evt) {
+ element.value = getValue();
+ if (oldSumit) {
+ oldSumit.call(this, evt);
+ }
+ };
+ break;
+ }
+ parentNode = parentNode.parentNode;
+ }
+ return container;
+}
+
+exports.transformTextarea = function(element, options) {
+ var isFocused = element.autofocus || document.activeElement == element;
+ var session;
+ var container = setupContainer(element, function() {
+ return session.getValue();
+ });
+ element.style.display = 'none';
+ container.style.background = 'white';
+
+ //
+ var editorDiv = document.createElement("div");
+ applyStyles(editorDiv, {
+ top: "0px",
+ left: "0px",
+ right: "0px",
+ bottom: "0px",
+ border: "1px solid gray",
+ position: "absolute"
+ });
+ container.appendChild(editorDiv);
+
+ var settingOpener = document.createElement("div");
+ applyStyles(settingOpener, {
+ position: "absolute",
+ right: "0px",
+ bottom: "0px",
+ cursor: "nw-resize",
+ border: "solid 9px",
+ borderColor: "lightblue gray gray #ceade6",
+ zIndex: 101
+ });
+
+ var settingDiv = document.createElement("div");
+ var settingDivStyles = {
+ top: "0px",
+ left: "20%",
+ right: "0px",
+ bottom: "0px",
+ position: "absolute",
+ padding: "5px",
+ zIndex: 100,
+ color: "white",
+ display: "none",
+ overflow: "auto",
+ fontSize: "14px",
+ boxShadow: "-5px 2px 3px gray"
+ };
+ if (!UA.isOldIE) {
+ settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
+ } else {
+ settingDivStyles.backgroundColor = "#333";
+ }
+
+ applyStyles(settingDiv, settingDivStyles);
+ container.appendChild(settingDiv);
+
+ options = options || exports.defaultOptions;
+ var editor = ace.edit(editorDiv);
+ session = editor.getSession();
+
+ session.setValue(element.value || element.innerHTML);
+ if (isFocused)
+ editor.focus();
+ container.appendChild(settingOpener);
+ setupApi(editor, editorDiv, settingDiv, ace, options);
+ setupSettingPanel(settingDiv, settingOpener, editor);
+
+ var state = "";
+ event.addListener(settingOpener, "mousemove", function(e) {
+ var rect = this.getBoundingClientRect();
+ var x = e.clientX - rect.left, y = e.clientY - rect.top;
+ if (x + y < (rect.width + rect.height)/2) {
+ this.style.cursor = "pointer";
+ state = "toggle";
+ } else {
+ state = "resize";
+ this.style.cursor = "nw-resize";
+ }
+ });
+
+ event.addListener(settingOpener, "mousedown", function(e) {
+ e.preventDefault();
+ if (state == "toggle") {
+ editor.setDisplaySettings();
+ return;
+ }
+ container.style.zIndex = 100000;
+ var rect = container.getBoundingClientRect();
+ var startX = rect.width + rect.left - e.clientX;
+ var startY = rect.height + rect.top - e.clientY;
+ event.capture(settingOpener, function(e) {
+ container.style.width = e.clientX - rect.left + startX + "px";
+ container.style.height = e.clientY - rect.top + startY + "px";
+ editor.resize();
+ }, function() {});
+ });
+
+ return editor;
+};
+
+function load(url, module, callback) {
+ net.loadScript(url, function() {
+ require([module], callback);
+ });
+}
+
+function setupApi(editor, editorDiv, settingDiv, ace, options) {
+ var session = editor.getSession();
+ var renderer = editor.renderer;
+
+ function toBool(value) {
+ return value === "true" || value == true;
+ }
+
+ editor.setDisplaySettings = function(display) {
+ if (display == null)
+ display = settingDiv.style.display == "none";
+ if (display) {
+ settingDiv.style.display = "block";
+ settingDiv.hideButton.focus();
+ editor.on("focus", function onFocus() {
+ editor.removeListener("focus", onFocus);
+ settingDiv.style.display = "none";
+ });
+ } else {
+ editor.focus();
+ }
+ };
+
+ editor.$setOption = editor.setOption;
+ editor.$getOption = editor.getOption;
+ editor.setOption = function(key, value) {
+ switch (key) {
+ case "mode":
+ editor.$setOption("mode", "ace/mode/" + value);
+ break;
+ case "theme":
+ editor.$setOption("theme", "ace/theme/" + value);
+ break;
+ case "keybindings":
+ switch (value) {
+ case "vim":
+ editor.setKeyboardHandler("ace/keyboard/vim");
+ break;
+ case "emacs":
+ editor.setKeyboardHandler("ace/keyboard/emacs");
+ break;
+ default:
+ editor.setKeyboardHandler(null);
+ }
+ break;
+
+ case "wrap":
+ case "fontSize":
+ editor.$setOption(key, value);
+ break;
+
+ default:
+ editor.$setOption(key, toBool(value));
+ }
+ };
+
+ editor.getOption = function(key) {
+ switch (key) {
+ case "mode":
+ return editor.$getOption("mode").substr("ace/mode/".length);
+ break;
+
+ case "theme":
+ return editor.$getOption("theme").substr("ace/theme/".length);
+ break;
+
+ case "keybindings":
+ var value = editor.getKeyboardHandler();
+ switch (value && value.$id) {
+ case "ace/keyboard/vim":
+ return "vim";
+ case "ace/keyboard/emacs":
+ return "emacs";
+ default:
+ return "ace";
+ }
+ break;
+
+ default:
+ return editor.$getOption(key);
+ }
+ };
+
+ editor.setOptions(options);
+ return editor;
+}
+
+function setupSettingPanel(settingDiv, settingOpener, editor) {
+ var BOOL = null;
+
+ var desc = {
+ mode: "Mode:",
+ wrap: "Soft Wrap:",
+ theme: "Theme:",
+ fontSize: "Font Size:",
+ showGutter: "Display Gutter:",
+ keybindings: "Keyboard",
+ showPrintMargin: "Show Print Margin:",
+ useSoftTabs: "Use Soft Tabs:",
+ showInvisibles: "Show Invisibles"
+ };
+
+ var optionValues = {
+ mode: {
+ text: "Plain",
+ javascript: "JavaScript",
+ xml: "XML",
+ html: "HTML",
+ css: "CSS",
+ scss: "SCSS",
+ python: "Python",
+ php: "PHP",
+ java: "Java",
+ ruby: "Ruby",
+ c_cpp: "C/C++",
+ coffee: "CoffeeScript",
+ json: "json",
+ perl: "Perl",
+ clojure: "Clojure",
+ ocaml: "OCaml",
+ csharp: "C#",
+ haxe: "haXe",
+ svg: "SVG",
+ textile: "Textile",
+ groovy: "Groovy",
+ liquid: "Liquid",
+ Scala: "Scala"
+ },
+ theme: {
+ clouds: "Clouds",
+ clouds_midnight: "Clouds Midnight",
+ cobalt: "Cobalt",
+ crimson_editor: "Crimson Editor",
+ dawn: "Dawn",
+ gob: "Green on Black",
+ eclipse: "Eclipse",
+ idle_fingers: "Idle Fingers",
+ kr_theme: "Kr Theme",
+ merbivore: "Merbivore",
+ merbivore_soft: "Merbivore Soft",
+ mono_industrial: "Mono Industrial",
+ monokai: "Monokai",
+ pastel_on_dark: "Pastel On Dark",
+ solarized_dark: "Solarized Dark",
+ solarized_light: "Solarized Light",
+ textmate: "Textmate",
+ twilight: "Twilight",
+ vibrant_ink: "Vibrant Ink"
+ },
+ showGutter: BOOL,
+ fontSize: {
+ "10px": "10px",
+ "11px": "11px",
+ "12px": "12px",
+ "14px": "14px",
+ "16px": "16px"
+ },
+ wrap: {
+ off: "Off",
+ 40: "40",
+ 80: "80",
+ free: "Free"
+ },
+ keybindings: {
+ ace: "ace",
+ vim: "vim",
+ emacs: "emacs"
+ },
+ showPrintMargin: BOOL,
+ useSoftTabs: BOOL,
+ showInvisibles: BOOL
+ };
+
+ var table = [];
+ table.push("