Selaa lähdekoodia

Merge branch 'feature/scriptEditor_monaco' into 'develop'

新增monaco脚本编辑器

See merge request o2oa/o2oa!515
胡起 5 vuotta sitten
vanhempi
commit
d9052e6c71
100 muutettua tiedostoa jossa 3309 lisäystä ja 226 poistoa
  1. 7 5
      o2web/source/o2_core/o2.js
  2. 15 5
      o2web/source/o2_core/o2/widget/CssArea.js
  3. 14 3
      o2web/source/o2_core/o2/widget/HtmlEditorArea.js
  4. 547 164
      o2web/source/o2_core/o2/widget/JavascriptEditor.js
  5. 12 4
      o2web/source/o2_core/o2/widget/MWFRaphael.js
  6. 19 7
      o2web/source/o2_core/o2/widget/ScriptArea.js
  7. 12 7
      o2web/source/o2_core/o2/widget/ace.js
  8. 3 7
      o2web/source/o2_core/o2/widget/codemirror.js
  9. 24 0
      o2web/source/o2_core/o2/widget/monaco.js
  10. 1 1
      o2web/source/o2_core/o2/xScript/Environment.js
  11. BIN
      o2web/source/o2_lib/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf
  12. 85 0
      o2web/source/o2_lib/vs/base/worker/workerMain.js
  13. 6 0
      o2web/source/o2_lib/vs/basic-languages/abap/abap.js
  14. 6 0
      o2web/source/o2_lib/vs/basic-languages/apex/apex.js
  15. 7 0
      o2web/source/o2_lib/vs/basic-languages/azcli/azcli.js
  16. 7 0
      o2web/source/o2_lib/vs/basic-languages/bat/bat.js
  17. 6 0
      o2web/source/o2_lib/vs/basic-languages/cameligo/cameligo.js
  18. 6 0
      o2web/source/o2_lib/vs/basic-languages/clojure/clojure.js
  19. 6 0
      o2web/source/o2_lib/vs/basic-languages/coffee/coffee.js
  20. 6 0
      o2web/source/o2_lib/vs/basic-languages/cpp/cpp.js
  21. 6 0
      o2web/source/o2_lib/vs/basic-languages/csharp/csharp.js
  22. 7 0
      o2web/source/o2_lib/vs/basic-languages/csp/csp.js
  23. 6 0
      o2web/source/o2_lib/vs/basic-languages/css/css.js
  24. 7 0
      o2web/source/o2_lib/vs/basic-languages/dockerfile/dockerfile.js
  25. 6 0
      o2web/source/o2_lib/vs/basic-languages/fsharp/fsharp.js
  26. 6 0
      o2web/source/o2_lib/vs/basic-languages/go/go.js
  27. 6 0
      o2web/source/o2_lib/vs/basic-languages/graphql/graphql.js
  28. 6 0
      o2web/source/o2_lib/vs/basic-languages/handlebars/handlebars.js
  29. 6 0
      o2web/source/o2_lib/vs/basic-languages/html/html.js
  30. 7 0
      o2web/source/o2_lib/vs/basic-languages/ini/ini.js
  31. 6 0
      o2web/source/o2_lib/vs/basic-languages/java/java.js
  32. 6 0
      o2web/source/o2_lib/vs/basic-languages/javascript/javascript.js
  33. 6 0
      o2web/source/o2_lib/vs/basic-languages/kotlin/kotlin.js
  34. 6 0
      o2web/source/o2_lib/vs/basic-languages/less/less.js
  35. 6 0
      o2web/source/o2_lib/vs/basic-languages/lua/lua.js
  36. 6 0
      o2web/source/o2_lib/vs/basic-languages/markdown/markdown.js
  37. 6 0
      o2web/source/o2_lib/vs/basic-languages/mips/mips.js
  38. 6 0
      o2web/source/o2_lib/vs/basic-languages/msdax/msdax.js
  39. 6 0
      o2web/source/o2_lib/vs/basic-languages/mysql/mysql.js
  40. 6 0
      o2web/source/o2_lib/vs/basic-languages/objective-c/objective-c.js
  41. 6 0
      o2web/source/o2_lib/vs/basic-languages/pascal/pascal.js
  42. 7 0
      o2web/source/o2_lib/vs/basic-languages/pascaligo/pascaligo.js
  43. 6 0
      o2web/source/o2_lib/vs/basic-languages/perl/perl.js
  44. 6 0
      o2web/source/o2_lib/vs/basic-languages/pgsql/pgsql.js
  45. 6 0
      o2web/source/o2_lib/vs/basic-languages/php/php.js
  46. 6 0
      o2web/source/o2_lib/vs/basic-languages/postiats/postiats.js
  47. 6 0
      o2web/source/o2_lib/vs/basic-languages/powerquery/powerquery.js
  48. 6 0
      o2web/source/o2_lib/vs/basic-languages/powershell/powershell.js
  49. 6 0
      o2web/source/o2_lib/vs/basic-languages/pug/pug.js
  50. 6 0
      o2web/source/o2_lib/vs/basic-languages/python/python.js
  51. 6 0
      o2web/source/o2_lib/vs/basic-languages/r/r.js
  52. 6 0
      o2web/source/o2_lib/vs/basic-languages/razor/razor.js
  53. 6 0
      o2web/source/o2_lib/vs/basic-languages/redis/redis.js
  54. 6 0
      o2web/source/o2_lib/vs/basic-languages/redshift/redshift.js
  55. 6 0
      o2web/source/o2_lib/vs/basic-languages/restructuredtext/restructuredtext.js
  56. 6 0
      o2web/source/o2_lib/vs/basic-languages/ruby/ruby.js
  57. 6 0
      o2web/source/o2_lib/vs/basic-languages/rust/rust.js
  58. 7 0
      o2web/source/o2_lib/vs/basic-languages/sb/sb.js
  59. 7 0
      o2web/source/o2_lib/vs/basic-languages/scheme/scheme.js
  60. 6 0
      o2web/source/o2_lib/vs/basic-languages/scss/scss.js
  61. 6 0
      o2web/source/o2_lib/vs/basic-languages/shell/shell.js
  62. 6 0
      o2web/source/o2_lib/vs/basic-languages/solidity/solidity.js
  63. 6 0
      o2web/source/o2_lib/vs/basic-languages/sophia/sophia.js
  64. 6 0
      o2web/source/o2_lib/vs/basic-languages/sql/sql.js
  65. 6 0
      o2web/source/o2_lib/vs/basic-languages/st/st.js
  66. 9 0
      o2web/source/o2_lib/vs/basic-languages/swift/swift.js
  67. 6 0
      o2web/source/o2_lib/vs/basic-languages/tcl/tcl.js
  68. 6 0
      o2web/source/o2_lib/vs/basic-languages/twig/twig.js
  69. 6 0
      o2web/source/o2_lib/vs/basic-languages/typescript/typescript.js
  70. 6 0
      o2web/source/o2_lib/vs/basic-languages/vb/vb.js
  71. 7 0
      o2web/source/o2_lib/vs/basic-languages/xml/xml.js
  72. 6 0
      o2web/source/o2_lib/vs/basic-languages/yaml/yaml.js
  73. 5 0
      o2web/source/o2_lib/vs/editor/editor.main.css
  74. 7 0
      o2web/source/o2_lib/vs/editor/editor.main.js
  75. 10 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.de.js
  76. 10 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.es.js
  77. 10 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.fr.js
  78. 10 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.it.js
  79. 9 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.ja.js
  80. 10 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.js
  81. 9 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.ko.js
  82. 9 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.ru.js
  83. 9 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.zh-cn.js
  84. 9 0
      o2web/source/o2_lib/vs/editor/editor.main.nls.zh-tw.js
  85. 6 0
      o2web/source/o2_lib/vs/language/css/cssMode.js
  86. 6 0
      o2web/source/o2_lib/vs/language/css/cssWorker.js
  87. 6 0
      o2web/source/o2_lib/vs/language/html/htmlMode.js
  88. 6 0
      o2web/source/o2_lib/vs/language/html/htmlWorker.js
  89. 6 0
      o2web/source/o2_lib/vs/language/json/jsonMode.js
  90. 6 0
      o2web/source/o2_lib/vs/language/json/jsonWorker.js
  91. 6 0
      o2web/source/o2_lib/vs/language/typescript/tsMode.js
  92. 20 0
      o2web/source/o2_lib/vs/language/typescript/tsWorker.js
  93. 1815 0
      o2web/source/o2_lib/vs/loader.js
  94. 9 0
      o2web/source/x_component_cms_ScriptDesigner/$Main/default/toolbars.html
  95. 55 9
      o2web/source/x_component_cms_ScriptDesigner/Main.js
  96. 33 3
      o2web/source/x_component_cms_ScriptDesigner/Script.js
  97. 22 4
      o2web/source/x_component_portal_PageDesigner/Script.js
  98. 20 0
      o2web/source/x_component_portal_ScriptDesigner/$Main/default/toolbars.html
  99. 51 5
      o2web/source/x_component_portal_ScriptDesigner/Main.js
  100. 24 2
      o2web/source/x_component_portal_ScriptDesigner/Script.js

+ 7 - 5
o2web/source/o2_core/o2.js

@@ -147,6 +147,7 @@
         var MSXML = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); };
         var MSXML = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); };
         return _attempt(XMLHTTP, MSXML2, MSXML);
         return _attempt(XMLHTTP, MSXML2, MSXML);
     })();
     })();
+    this.o2.request = _request;
 
 
     var _returnBase = function(number, base) {
     var _returnBase = function(number, base) {
         return (number).toString(base).toUpperCase();
         return (number).toString(base).toUpperCase();
@@ -290,13 +291,13 @@
             _removeListener(xhr, 'load', _checkCssLoaded);
             _removeListener(xhr, 'load', _checkCssLoaded);
             _removeListener(xhr, 'error', _checkCssErrorLoaded);
             _removeListener(xhr, 'error', _checkCssErrorLoaded);
 
 
-            if (err) {failure(xhr); return}
+            if (err) {if (failure) failure(xhr); return}
             var status = xhr.status;
             var status = xhr.status;
             status = (status == 1223) ? 204 : status;
             status = (status == 1223) ? 204 : status;
             if ((status >= 200 && status < 300))
             if ((status >= 200 && status < 300))
-                success(xhr);
+                if (success) success(xhr);
             else if ((status >= 300 && status < 400))
             else if ((status >= 300 && status < 400))
-                failure(xhr);
+                if (failure) failure(xhr);
             else
             else
                 failure(xhr);
                 failure(xhr);
             if (completed) completed(xhr);
             if (completed) completed(xhr);
@@ -308,7 +309,7 @@
         _addListener(xhr, "readystatechange", _checkCssLoaded);
         _addListener(xhr, "readystatechange", _checkCssLoaded);
         xhr.send();
         xhr.send();
     };
     };
-
+    this.o2.xhr_get = _xhr_get;
     var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
     var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
         loadSingle(ms[n], function(module){
         loadSingle(ms[n], function(module){
             if (module) thisLoaded.push(module);
             if (module) thisLoaded.push(module);
@@ -343,9 +344,10 @@
         "mootools": ["/o2_lib/mootools/mootools-1.6.0_all.js"],
         "mootools": ["/o2_lib/mootools/mootools-1.6.0_all.js"],
         "ckeditor": ["/o2_lib/htmleditor/ckeditor4114/ckeditor.js"],
         "ckeditor": ["/o2_lib/htmleditor/ckeditor4114/ckeditor.js"],
         "ckeditor5": ["/o2_lib/htmleditor/ckeditor5-12-1-0/ckeditor.js"],
         "ckeditor5": ["/o2_lib/htmleditor/ckeditor5-12-1-0/ckeditor.js"],
-        "raphael": ["/o2_lib/raphael/raphael.js"],
+        "raphael": ["/o2_lib/raphael/raphael_230.js"],
         "d3": ["/o2_lib/d3/d3.min.js"],
         "d3": ["/o2_lib/d3/d3.min.js"],
         "ace": ["/o2_lib/ace/src-min-noconflict/ace.js","/o2_lib/ace/src-min-noconflict/ext-language_tools.js"],
         "ace": ["/o2_lib/ace/src-min-noconflict/ace.js","/o2_lib/ace/src-min-noconflict/ext-language_tools.js"],
+        "monaco": ["/o2_lib/vs/loader.js"],
         "JSBeautifier": ["/o2_lib/JSBeautifier/beautify.js"],
         "JSBeautifier": ["/o2_lib/JSBeautifier/beautify.js"],
         "JSBeautifier_css": ["/o2_lib/JSBeautifier/beautify-css.js"],
         "JSBeautifier_css": ["/o2_lib/JSBeautifier/beautify-css.js"],
         "JSBeautifier_html": ["/o2_lib/JSBeautifier/beautify-html.js"],
         "JSBeautifier_html": ["/o2_lib/JSBeautifier/beautify-html.js"],

+ 15 - 5
o2web/source/o2_core/o2/widget/CssArea.js

@@ -1,6 +1,7 @@
 o2.widget = o2.widget || {};
 o2.widget = o2.widget || {};
 o2.require("o2.widget.ScriptArea", null, false);
 o2.require("o2.widget.ScriptArea", null, false);
-o2.require("o2.widget.CssEditor", null, false);
+//o2.require("o2.widget.CssEditor", null, false);
+
 o2.widget.CssArea = new Class({
 o2.widget.CssArea = new Class({
     Implements: [Options, Events],
     Implements: [Options, Events],
     Extends: o2.widget.ScriptArea,
     Extends: o2.widget.ScriptArea,
@@ -52,22 +53,31 @@ o2.widget.CssArea = new Class({
     loadEditor: function(content){
     loadEditor: function(content){
         var value=(content) ? content.code : "";
         var value=(content) ? content.code : "";
         value = (value) ? value : "";
         value = (value) ? value : "";
-        this.jsEditor = new o2.widget.CssEditor(this.contentNode,{
+        this.jsEditor = new o2.widget.JavascriptEditor(this.contentNode,{
             "option": {
             "option": {
+                "mode": "css",
                 "value": value,
                 "value": value,
                 "lineNumbers": false
                 "lineNumbers": false
             },
             },
             "onPostLoad": function(){
             "onPostLoad": function(){
                 this.editor = this.jsEditor.editor;
                 this.editor = this.jsEditor.editor;
                 this.editor.id = "2";
                 this.editor.id = "2";
-                this.editor.on("change", function() {
+
+                this.jsEditor.addEditorEvent("change", function() {
                     this.fireEvent("change");
                     this.fireEvent("change");
                 }.bind(this));
                 }.bind(this));
-                this.editor.on("blur", function() {
+                this.jsEditor.addEditorEvent("blur", function() {
                     this.fireEvent("blur");
                     this.fireEvent("blur");
                 }.bind(this));
                 }.bind(this));
 
 
-                this.editor.resize();
+                // this.editor.on("change", function() {
+                //     this.fireEvent("change");
+                // }.bind(this));
+                // this.editor.on("blur", function() {
+                //     this.fireEvent("blur");
+                // }.bind(this));
+
+                this.jsEditor.resize();
                 this.fireEvent("postLoad");
                 this.fireEvent("postLoad");
             }.bind(this),
             }.bind(this),
             "onSave": function(){
             "onSave": function(){

+ 14 - 3
o2web/source/o2_core/o2/widget/HtmlEditorArea.js

@@ -1,5 +1,6 @@
 o2.widget = o2.widget || {};
 o2.widget = o2.widget || {};
-o2.require("o2.widget.HtmlEditor", null, false);
+//o2.require("o2.widget.HtmlEditor", null, false);
+o2.require("o2.widget.ScriptArea", null, false);
 o2.widget.HtmlEditorArea = new Class({
 o2.widget.HtmlEditorArea = new Class({
 	Implements: [Options, Events],
 	Implements: [Options, Events],
 	Extends: o2.widget.ScriptArea,
 	Extends: o2.widget.ScriptArea,
@@ -7,16 +8,26 @@ o2.widget.HtmlEditorArea = new Class({
     loadEditor: function(content){
     loadEditor: function(content){
         var value=(content) ? content.code : "";
         var value=(content) ? content.code : "";
         value = (value) ? value : "";
         value = (value) ? value : "";
-        this.jsEditor = new o2.widget.HtmlEditor(this.contentNode,{
+        this.jsEditor = new o2.widget.JavascriptEditor(this.contentNode,{
             "option": {
             "option": {
+                "mode": "html",
                 "value": value,
                 "value": value,
                 "lineNumbers": false
                 "lineNumbers": false
             },
             },
             "onPostLoad": function(){
             "onPostLoad": function(){
                 this.editor = this.jsEditor.editor;
                 this.editor = this.jsEditor.editor;
-                this.editor.on("change", function() {
+
+                this.jsEditor.addEditorEvent("change", function() {
                     this.fireEvent("change");
                     this.fireEvent("change");
                 }.bind(this));
                 }.bind(this));
+                this.jsEditor.addEditorEvent("blur", function() {
+                    this.fireEvent("blur");
+                }.bind(this));
+
+                // this.editor.on("change", function() {
+                //     this.fireEvent("change");
+                // }.bind(this));
+                this.jsEditor.resize();
                 this.fireEvent("postLoad");
                 this.fireEvent("postLoad");
             }.bind(this),
             }.bind(this),
             "onSave": function(){
             "onSave": function(){

+ 547 - 164
o2web/source/o2_core/o2/widget/JavascriptEditor.js

@@ -1,220 +1,489 @@
 o2.widget = o2.widget || {};
 o2.widget = o2.widget || {};
 o2.require("o2.widget.codemirror", null, false);
 o2.require("o2.widget.codemirror", null, false);
-o2.require("o2.widget.ace", null, false);
 o2.require("o2.xDesktop.UserData", null, false);
 o2.require("o2.xDesktop.UserData", null, false);
 o2.widget.JavascriptEditor = new Class({
 o2.widget.JavascriptEditor = new Class({
 	Implements: [Options, Events],
 	Implements: [Options, Events],
 	options: {
 	options: {
-        "type": "ace",
+        //"type": "ace",
+        "type": "monaco",
 		"title": "JavascriptEditor",
 		"title": "JavascriptEditor",
 		"style": "default",
 		"style": "default",
 		"option": {
 		"option": {
 			value: "",
 			value: "",
 			mode: "javascript",
 			mode: "javascript",
 			"lineNumbers": true
 			"lineNumbers": true
-		}
+		},
+		"runtime": "all"
 	},
 	},
 	initialize: function(node, options){
 	initialize: function(node, options){
 		this.setOptions(options);
 		this.setOptions(options);
-		this.editorClass = o2.widget[this.options.type];
+		this.unbindEvents = [];
 		this.node = $(node);
 		this.node = $(node);
 	},
 	},
+    getDefaultEditorData: function(){
+	    switch (this.options.type) {
+            case "ace":
+                return {
+                    "javascriptEditor": {
+                        "theme": "tomorrow",
+                        "fontSize" : "12px"
+                    }
+                };
+            case "monaco":
+                return {
+                    "javascriptEditor": {
+                        "monaco_theme": "vs",
+                        "fontSize" : "12px"
+                    }
+                };
+        }
+    },
     getEditorTheme: function(callback){
     getEditorTheme: function(callback){
         if (!o2.editorData){
         if (!o2.editorData){
             o2.UD.getData("editor", function(json){
             o2.UD.getData("editor", function(json){
                 if (json.data){
                 if (json.data){
                     o2.editorData = JSON.decode(json.data);
                     o2.editorData = JSON.decode(json.data);
                 }else{
                 }else{
-                    o2.editorData = {
-                        "javascriptEditor": {
-                            "theme": "tomorrow",
-                            "fontSize" : "12px"
-                        }
-                    };
+                    o2.editorData = this.getDefaultEditorData();
                 }
                 }
                 if (callback) callback();
                 if (callback) callback();
-            });
+            }.bind(this));
         }else{
         }else{
             if (callback) callback();
             if (callback) callback();
         }
         }
     },
     },
     load: function(callback){
     load: function(callback){
         this.getEditorTheme(function(json){
         this.getEditorTheme(function(json){
-            if (o2.editorData.javascriptEditor){
-                this.theme = o2.editorData.javascriptEditor.theme;
-                this.fontSize = o2.editorData.javascriptEditor.fontSize;
-            }else{
-                o2.editorData.javascriptEditor = {
-                    "theme": "tomorrow",
-                    "fontSize" : "12px"
-                };
-            }
-            if (!this.theme) this.theme = "tomorrow";
-            if( !this.fontSize )this.fontSize = "12px";
+            this.options.type = o2.editorData.javascriptEditor.editor || "monaco";
             if (this.options.type.toLowerCase()=="ace"){
             if (this.options.type.toLowerCase()=="ace"){
                 this.loadAce(callback);
                 this.loadAce(callback);
             }
             }
+            if (this.options.type.toLowerCase()=="monaco"){
+                this.loadMonaco(callback);
+            }
             if (this.options.type.toLowerCase()=="codeMirror"){
             if (this.options.type.toLowerCase()=="codeMirror"){
                 this.loadCodeMirror(callback);
                 this.loadCodeMirror(callback);
             }
             }
+
+            while (this.unbindEvents.length){
+                var ev = this.unbindEvents.shift();
+                this.addEditorEvent(ev.name, ev.fun);
+            }
         }.bind(this));
         }.bind(this));
     },
     },
-    focus: function(){
-        if (this.editor){
-            this.editor.focus();
-            this.goto();
+
+    loadMonacoEditor: function(callback){
+        if (!window.monaco){
+            o2.load("monaco", {"sequence": true}, function(){
+                require.config({ paths: { "vs": "/o2_lib/vs" }});
+                require(["vs/editor/editor.main"], function() {
+                    if (callback) callback();
+                });
+            }.bind(this));
+        }else{
+            if (callback) callback();
         }
         }
     },
     },
-    goto: function(){
-        var p = this.editor.getCursorPosition();
-        if (p.row==0){
-            p.row = this.editor.renderer.getScrollBottomRow();
+    loadMonaco: function(callback){
+        if (o2.editorData.javascriptEditor){
+            this.theme = o2.editorData.javascriptEditor.monaco_theme;
+            this.fontSize = o2.editorData.javascriptEditor.fontSize;
+        }else{
+            o2.editorData.javascriptEditor = {
+                "monaco_theme": "vs",
+                "fontSize" : "12px"
+            };
         }
         }
-        this.editor.gotoLine(p.row+1, p.column+1, true);
+        if (!this.theme) this.theme = "vs";
+        if( !this.fontSize )this.fontSize = "12px";
+
+
+        o2.require("o2.widget.monaco", function () {
+            this.editorClass = o2.widget.monaco;
+
+            this.editorClass.load(function(){
+
+                this.editor = monaco.editor.create(this.node, {
+                    value: this.options.option.value,
+                    language: this.options.option.mode,
+                    theme: this.theme,
+                    fontSize: this.fontSize,
+                    lineNumbersMinChars: 3,
+                    lineNumbers: this.options.option.lineNumbers ? "on" : "off",
+                    mouseWheelZoom: true,
+                    automaticLayout: true
+                });
+                this.focus();
+
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_S, function(e){
+                    this.fireEvent("save");
+                }.bind(this));
+
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_I, function(e){
+                    this.format();
+                }.bind(this));
+                this.editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_F, function(e){
+                    this.format();
+                }.bind(this));
+
+                if( this.fontSize ){
+                    this.editor.updateOptions( {"fontSize": this.fontSize} );
+                }
+
+                o2.widget.JavascriptEditor.getCompletionEnvironment(this.options.runtime, function(){
+                    this.monacoModel = this.editor.getModel();
+                    this.monacoModel.o2Editor = this;
+                    this.registerCompletion();
+                }.bind(this));
+
+                this.fireEvent("postLoad");
+                if (callback) callback();
+
+            }.bind(this));
+        }.bind(this));
     },
     },
+
     loadAce: function(callback){
     loadAce: function(callback){
-        this.editorClass.load(function(){
-            var exports = ace.require("ace/ext/language_tools");
-            this.editor = ace.edit(this.node);
-            this.editor.session.setMode("ace/mode/"+this.options.option.mode);
-            this.editor.setTheme("ace/theme/"+this.theme);
-            this.editor.setOptions({
-                enableBasicAutocompletion: true,
-                enableSnippets: true,
-                enableLiveAutocompletion: true,
-                lineNumbers: this.options.option.lineNumbers
-            });
-            if (this.options.option.value) this.editor.setValue(this.options.option.value);
+        if (o2.editorData.javascriptEditor){
+            this.theme = o2.editorData.javascriptEditor.theme;
+            this.fontSize = o2.editorData.javascriptEditor.fontSize;
+        }else{
+            o2.editorData.javascriptEditor = {
+                "theme": "tomorrow",
+                "fontSize" : "12px"
+            };
+        }
+        if (!this.theme) this.theme = "tomorrow";
+        if( !this.fontSize )this.fontSize = "12px";
 
 
-            this.focus();
+        o2.require("o2.widget.ace", function(){
+            this.editorClass = o2.widget.ace;
 
 
-            //this.editor.focus();
-            //this.editor.navigateFileStart();
-            //添加自动完成列表
-            o2.require("o2.xScript.Macro", function(){
-                var json = null;
-                o2.getJSON("/o2_core/o2/widget/$JavascriptEditor/environment.json", function(data){ json = data; }, false);
-                this.Macro = new o2.Macro.FormContext(json);
-                exports.addCompleter({
-                    identifierRegexps: [
-                        /[a-zA-Z_0-9\$\-\u00A2-\uFFFF\.]/
-                    ],
-                    getCompletions: function(editor, session, pos, prefix, callback){
-                        var x = prefix.substr(0, prefix.lastIndexOf("."));
-                        code = "try {return "+x+";}catch(e){return null;}";
-                        var o = this.Macro.exec(code);
-
-                        if (o){
-                            var arr1 = [];
-                            var arr2 = [];
-                            Object.keys(o).each(function(key){
-                                var type = typeOf(o[key]);
-                                if (type==="function") {
-                                    var count = o[key].length;
-                                    var v = x+"."+key+"(";
-                                    for (var i=1; i<=count; i++) v+= (i==count) ? "par"+i :  "par"+i+", ";
-                                    v+=");";
-                                    arr1.push({
-                                        caption: key,
-                                        value: v,
-                                        score: 3,
-                                        meta: "function O2"
-                                    });
-                                }else{
-                                    arr2.push({
-                                        caption: key,
-                                        value: x+"."+key,
-                                        score: 3,
-                                        meta: (type!="null") ? typeOf(o[key])+" O2" : "O2"
-                                    });
-                                }
-                            });
-                            callback(null, arr1.concat(arr2));
-                        }
+            this.editorClass.load(function(){
+                this.editor = ace.edit(this.node);
+                this.editor.session.setMode("ace/mode/"+this.options.option.mode);
+                this.editor.setTheme("ace/theme/"+this.theme);
+                this.editor.setOptions({
+                    enableBasicAutocompletion: true,
+                    enableSnippets: true,
+                    enableLiveAutocompletion: true,
+                    showLineNumbers: this.options.option.lineNumbers
+                });
+                if (this.options.option.value) this.editor.setValue(this.options.option.value);
+                this.editor.o2Editor = this;
+
+                this.focus();
+
+                this.editor.commands.addCommand({
+                    name: 'save',
+                    bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
+                    exec: function(editor) {
+                        this.fireEvent("save");
+                    }.bind(this),
+                    readOnly: false
+                });
+
+                this.editor.commands.addCommand({
+                    name: 'format',
+                    bindKey: {win: 'Ctrl-Alt-i|Ctrl-Alt-f',  mac: 'Command-i|Command-f'},
+                    exec: function(editor, e, e1) {
+                        this.format();
+                    }.bind(this),
+                    readOnly: false
+                });
+
+                this.editor.commands.addCommand({
+                    name: "showKeyboardShortcuts",
+                    bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
+                    exec: function(editor) {
+                        ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
+                            module.init(editor);
+                            editor.showKeyboardShortcuts()
+                        })
                     }.bind(this)
                     }.bind(this)
                 });
                 });
+
+                this.node.addEvent("keydown", function(e){
+                    e.stopPropagation();
+                });
+
+                if( this.fontSize ){
+                    this.setFontSize( this.fontSize );
+                }
+
+                o2.widget.JavascriptEditor.getCompletionEnvironment(this.options.runtime, function(){
+                    this.registerCompletion();
+                }.bind(this));
+
+                this.fireEvent("postLoad");
+                if (callback) callback();
             }.bind(this));
             }.bind(this));
-            // this.editor.on("change", function(e){
-            //     if (e.start.row!==e.end.row){
-            //         debugger;
-            //         var code = "";
-            //         for (var i=e.start.row; i<e.end.row; i++){
-            //             code+=this.editor.getSession().getLine(i);
-            //         }
-            //         code = "try{"+code+"}catch(e){}";
-            //         this.Macro.exec(code);
-            //     }
-            // }.bind(this));
-
-
-            this.editor.commands.addCommand({
-                name: 'save',
-                bindKey: {win: 'Ctrl-S',  mac: 'Command-S'},
-                exec: function(editor) {
-                    this.fireEvent("save");
-                }.bind(this),
-                readOnly: false // false if this command should not apply in readOnly mode
-            });
-            this.editor.commands.addCommand({
-                name: 'help',
-                bindKey: {win: 'Ctrl-Q|Ctrl-Alt-Space|Ctrl-Space|Alt-/',  mac: 'Command-Q'},
-                exec: function(editor, e, e1) {
-                    this.fireEvent("reference", [editor, e, e1]);
-                }.bind(this),
-                readOnly: false // false if this command should not apply in readOnly mode
-            });
+        }.bind(this));
+    },
+    registerCompletion: function(){
+        debugger;
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.registerCompletionAce(); break;
+                case "monaco": this.registerCompletionMonaco(); break;
+            }
+        }
+    },
 
 
-            this.editor.commands.addCommand({
-                name: 'format',
-                bindKey: {win: 'Ctrl-Alt-i|Ctrl-Alt-f',  mac: 'Command-i|Command-f'},
-                exec: function(editor, e, e1) {
-                    var mode = this.options.option.mode.toString().toLowerCase();
-                    if (mode==="javascript"){
-                        o2.load("JSBeautifier", function(){
-                            editor.setValue(js_beautify(editor.getValue()));
-                        }.bind(this));
-                    }else if (mode==="html"){
-                        o2.load("JSBeautifier_html", function(){
-                            editor.setValue(html_beautify(editor.getValue()));
-                        }.bind(this));
-                    }else if (mode==="css"){
-                        o2.load("JSBeautifier_css", function(){
-                            editor.setValue(css_beautify(editor.getValue()));
-                        }.bind(this));
-                    }else{
-                        o2.load("JSBeautifier", function(){
-                            editor.setValue(js_beautify(editor.getValue()));
-                        }.bind(this));
-                    }
+    getCompletionObject: function(textPrefix, runtime){
+        var macro = o2.widget.JavascriptEditor.runtimeEnvironment[runtime];
+        var o = null;
+        if (macro){
+            code = "try {return "+textPrefix+";}catch(e){return null;}";
+            o = macro.exec(code);
+        }
+        return o;
+    },
+    registerCompletionMonaco: function(){
+        if (!o2.widget.monaco.registeredCompletion){
+            monaco.languages.registerCompletionItemProvider('javascript', {
+                "triggerCharacters": ["."],
+                provideCompletionItems: function (model, position, context, token) {
+                    var textUntilPosition = model.getValueInRange({ startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column });
+                    var textPrefix = textUntilPosition.substr(0, textUntilPosition.lastIndexOf("."));
+                    var o = this.getCompletionObject(textPrefix, model.o2Editor.options.runtime);
 
 
+                    var word = model.getWordUntilPosition(position);
+                    var range = { startLineNumber: position.lineNumber, endLineNumber: position.lineNumber, startColumn: word.startColumn, endColumn: word.endColumn };
 
 
-                    //this.fireEvent("reference", [editor, e, e1]);
-                }.bind(this),
-                readOnly: false // false if this command should not apply in readOnly mode
+                    if (o) {
+                        var arr = [];
+                        Object.keys(o).each(function (key) {
+                            var type = typeOf(o[key]);
+                            if (type === "function") {
+                                var count = o[key].length;
+                                var v = key + "(";
+                                for (var i = 1; i <= count; i++) v += (i == count) ? "par" + i : "par" + i + ", ";
+                                v += ")";
+                                arr.push({ label: key, kind: monaco.languages.CompletionItemKind.Function, insertText: v, range: range, detail: type });
+                            } else {
+                                arr.push({ label: key, kind: monaco.languages.CompletionItemKind.Interface, insertText: key, range: range, detail: type });
+                            }
+                        });
+                    }
+                    return {suggestions: arr}
+                }.bind(this)
             });
             });
+            o2.widget.monaco.registeredCompletion = true;
+        }
+    },
+    registerCompletionAce: function(){
+        if (!o2.widget.ace.registeredCompletion){
+            //添加自动完成列表
+            var exports = ace.require("ace/ext/language_tools");
+            exports.addCompleter({
+                identifierRegexps: [
+                    /[a-zA-Z_0-9\$\-\u00A2-\uFFFF\.]/
+                ],
+                getCompletions: function(editor, session, pos, prefix, callback){
+                    var x = prefix.substr(0, prefix.lastIndexOf("."));
+                    var o = this.getCompletionObject(x, editor.o2Editor.options.runtime);
 
 
-            this.editor.commands.addCommand({
-                name: "showKeyboardShortcuts",
-                bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
-                exec: function(editor) {
-                    ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
-                        module.init(editor);
-                        editor.showKeyboardShortcuts()
-                    })
+                    if (o){
+                        var arr = [];
+                        Object.keys(o).each(function(key){
+                            var type = typeOf(o[key]);
+                            if (type==="function") {
+                                var count = o[key].length;
+                                var v = x+"."+key+"(";
+                                for (var i=1; i<=count; i++) v+= (i==count) ? "par"+i :  "par"+i+", ";
+                                v+=");";
+                                arr.push({ caption: key, value: v, score: 3, meta: type });
+                            }else{
+                                arr.push({ caption: key, value: x+"."+key, score: 3, meta: type });
+                            }
+                        });
+                        callback(null, arr);
+                    }
                 }.bind(this)
                 }.bind(this)
             });
             });
+            o2.widget.ace.registeredCompletion = true;
+        }
+    },
+    changeEditor: function(type){
+	    debugger;
+        if (this.editor){
+            var value = this.getValue();
+            this.destroyEditor();
+            this.options.type = type;
+            this.load(function(){
+                this.setValue(value);
+            }.bind(this));
+        }else{
+            this.options.type = o2.editorData.javascriptEditor.editor;
+            if (this.options.type.toLowerCase()=="ace"){
+                this.loadAce(callback);
+            }
+            if (this.options.type.toLowerCase()=="monaco"){
+                this.loadMonaco(callback);
+            }
+            if (this.options.type.toLowerCase()=="codeMirror"){
+                this.loadCodeMirror(callback);
+            }
+        }
+    },
+    destroyEditor: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.destroy(); this.node.empty(); break;
+                case "monaco": this.editor.dispose(); break;
+            }
+        }
+    },
+    setTheme: function(theme){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setTheme( "ace/theme/"+theme); break;
+                case "monaco": monaco.editor.setTheme(theme); break;
+            }
+        }
+    },
+    setFontSize: function(fontSize){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setFontSize( fontSize ); break;
+                case "monaco": this.editor.updateOptions({"fontSize": fontSize}); break;
+            }
+        }
+    },
+    setValue: function(v){
+        if (this.editor) this.editor.setValue(v);
+    },
+    getValue: function(){
+        return (this.editor) ? this.editor.getValue() : "";
+    },
+    resize: function(y){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.resize(); break;
+                case "monaco": this.editor.layout(); break;
+            }
+        }
+    },
+    addEditorEvent: function(name, fun){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.on(name, fun); break;
+                case "monaco":
+                    var ev = name;
+                    switch (ev) {
+                        case "change": ev = "onDidChangeModelContent"; break;
+                        case "blue": ev = "onDidBlurEditorText"; break;
 
 
-            this.node.addEvent("keydown", function(e){
-                e.stopPropagation();
-            });
+                    }
+                    if (this.editor[ev]) this.editor[ev](fun);
+                    break;
+            }
+        }else{
+            this.unbindEvents.push({"name": name, "fun": fun});
+        }
+    },
+    validatedAce: function(){
+        var session = this.editor.getSession();
+        var annotations = session.getAnnotations();
+        for (var i=0; i<annotations.length; i++){
+            if (annotations[i].type=="error") return false;
+        }
+        return true;
+    },
+    validatedMonaco: function(){
+        var mod = this.editor.getModel();
+        var ms = monaco.editor.getModelMarkers({"resource": mod.uri});
+        for (var i=0; i<ms.length; i++){
+            if (ms[i].severity==8) return false;
+        }
+        return true;
+    },
+
+    validated: function(){
+        if (this.editor){
+           switch (this.options.type.toLowerCase()) {
+               case "ace": return this.validatedAce();
+               case "monaco": return this.validatedMonaco();
+           }
+            return true;
+        }
+        return true
+    },
 
 
-            if( this.fontSize ){
-                this.editor.setFontSize( this.fontSize );
+    formatAce: function(){
+        var mode = this.options.option.mode.toString().toLowerCase();
+        if (mode==="javascript"){
+            o2.load("JSBeautifier", function(){
+                this.editor.setValue(js_beautify(editor.getValue()));
+            }.bind(this));
+        }else if (mode==="html"){
+            o2.load("JSBeautifier_html", function(){
+                this.editor.setValue(html_beautify(editor.getValue()));
+            }.bind(this));
+        }else if (mode==="css"){
+            o2.load("JSBeautifier_css", function(){
+                this.editor.setValue(css_beautify(editor.getValue()));
+            }.bind(this));
+        }else{
+            o2.load("JSBeautifier", function(){
+                this.editor.setValue(js_beautify(editor.getValue()));
+            }.bind(this));
+        }
+    },
+    formatMonaco: function(){
+        this.editor.getAction("editor.action.formatDocument").run();
+    },
+    format: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.formatAce();
+                case "monaco": this.formatMonaco();
             }
             }
+        }
+    },
 
 
-            this.fireEvent("postLoad");
-            if (callback) callback();
-        }.bind(this));
+    focus: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.focus(); this.goto(); break;
+                case "monaco": this.editor.focus();
+            }
+        }
+    },
+    goto: function(){
+        var p = this.editor.getCursorPosition();
+        if (p.row==0){
+            p.row = this.editor.renderer.getScrollBottomRow();
+        }
+        this.editor.gotoLine(p.row+1, p.column+1, true);
+    },
+    showLineNumbers: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setOption("showLineNumbers", true); break;
+                case "codeMirror":  this.editor.setOption("lineNumbers", true); break;
+                case "monaco": this.editor.updateOptions({"lineNumbers": "on"});
+            }
+        }
+    },
+    hideLineNumbers: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace": this.editor.setOption("showLineNumbers", false); break;
+                case "codeMirror":  this.editor.setOption("lineNumbers", false); break;
+                case "monaco": this.editor.updateOptions({"lineNumbers": "off"});
+            }
+        }
+    },
+    max: function(){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "codeMirror": this.editor.setSize("100%", "100%"); break;
+                case "ace": this.editor.resize(); break;
+                case "monaco": this.editor.layout(); break;
+            }
+        }
     },
     },
 
 
 	loadCodeMirror: function(callback){
 	loadCodeMirror: function(callback){
@@ -232,12 +501,6 @@ o2.widget.JavascriptEditor = new Class({
 			}.bind(this));
 			}.bind(this));
 		}
 		}
 	},
 	},
-    showLineNumbers: function(){
-        if (this.options.type.toLowerCase()=="codeMirror") this.editor.setOption("lineNumbers", true);
-    },
-    max: function(){
-        if (this.options.type.toLowerCase()=="codeMirror") this.editor.setSize("100%", "100%");
-    },
 
 
     getCursorPixelPosition: function(){
     getCursorPixelPosition: function(){
         var session = this.editor.getSession();
         var session = this.editor.getSession();
@@ -269,6 +532,126 @@ o2.widget.JavascriptEditor = new Class({
         }
         }
         return buf.reverse().join("");
         return buf.reverse().join("");
     }
     }
+});
+
+o2.widget.JavascriptEditor.runtimeEnvironment = {};
+o2.widget.JavascriptEditor.getCompletionEnvironment = function(runtime, callback) {
+    debugger;
+    if (!o2.widget.JavascriptEditor.runtimeEnvironment[runtime]) {
+        o2.require("o2.xScript.Macro", function() {
+            switch (runtime) {
+                case "service":
+                    o2.widget.JavascriptEditor.getServiceCompletionEnvironment(runtime,callback);
+                    break;
+                case "server":
+                    o2.widget.JavascriptEditor.getServerCompletionEnvironment(runtime,callback);
+                    break;
+                case "all":
+                    o2.widget.JavascriptEditor.getAllCompletionEnvironment(runtime,callback);
+                    break;
+                default:
+                    o2.widget.JavascriptEditor.getDefaultCompletionEnvironment(runtime,callback);
+            }
+        });
+    } else {
+        if (callback) callback();
+    }
+};
+
+o2.widget.JavascriptEditor.getServiceCompletionEnvironment = function(runtime, callback) {
+    var serviceScriptText = null;
+    var serviceScriptSubstitute = null;
+    var check = function () {
+        if (o2.typeOf(serviceScriptText) !== "null" && o2.typeOf(serviceScriptSubstitute) !== "null") {
+            var code = "o2.Macro.swapSpace.tmpMacroCompletionFunction = function (){\n" + serviceScriptSubstitute + "\n" + serviceScriptText + "\nreturn bind;" + "\n};";
+            Browser.exec(code);
+            var ev = o2.Macro.swapSpace.tmpMacroCompletionFunction();
+            o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = {
+                "environment": ev,
+                exec: function(code){
+                    return o2.Macro.exec(code, this.environment);
+                }
+            }
+            if (callback) callback();
+        }
+    }
+
+    o2.xhr_get("../x_desktop/js/initialServiceScriptText.js", function (xhr) {
+        serviceScriptText = xhr.responseText;
+        check();
+    }, function () {
+        serviceScriptText = "";
+        check();
+    });
+    o2.xhr_get("../x_desktop/js/initalServiceScriptSubstitute.js", function (xhr) {
+        serviceScriptSubstitute = xhr.responseText;
+        check();
+    }, function () {
+        serviceScriptSubstitute = "";
+        check();
+    });
+};
+
+o2.widget.JavascriptEditor.getServerCompletionEnvironment = function(runtime, callback) {
+    var serverScriptText = null;
+    var serverScriptSubstitute = null;
+    var check = function () {
+        if (o2.typeOf(serverScriptText) !== "null" && o2.typeOf(serverScriptSubstitute) !== "null") {
+            var code = "o2.Macro.swapSpace.tmpMacroCompletionFunction = function (){\n" + serverScriptSubstitute + "\n" + serverScriptText + "\nreturn bind;" + "\n};";
+            Browser.exec(code);
+            var ev = o2.Macro.swapSpace.tmpMacroCompletionFunction();
+            o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = {
+                "environment": ev,
+                exec: function(code){
+                    return o2.Macro.exec(code, this.environment);
+                }
+            }
+            if (callback) callback();
+        }
+    }
+
+    o2.xhr_get("../x_desktop/js/initialScriptText.js", function (xhr) {
+        serverScriptText = xhr.responseText;
+        check();
+    }, function () {
+        serverScriptText = "";
+        check();
+    });
+    o2.xhr_get("../x_desktop/js/initalScriptSubstitute.js", function (xhr) {
+        serverScriptSubstitute = xhr.responseText;
+        check();
+    }, function () {
+        serverScriptSubstitute = "";
+        check();
+    });
+};
 
 
+o2.widget.JavascriptEditor.getDefaultCompletionEnvironment = function(runtime, callback){
+    var json = null;
+    o2.getJSON("../o2_core/o2/widget/$JavascriptEditor/environment.json", function (data) {
+        json = data;
+        o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = new o2.Macro.FormContext(json);
+        if (callback) callback();
+    });
+}
+
+o2.widget.JavascriptEditor.getAllCompletionEnvironment = function(runtime, callback){
+    var check = function(){
+        if (o2.widget.JavascriptEditor.runtimeEnvironment["service"] && o2.widget.JavascriptEditor.runtimeEnvironment["server"] && o2.widget.JavascriptEditor.runtimeEnvironment["web"] ){
+            var ev = Object.merge(o2.widget.JavascriptEditor.runtimeEnvironment["service"].environment,
+                o2.widget.JavascriptEditor.runtimeEnvironment["server"].environment,
+                o2.widget.JavascriptEditor.runtimeEnvironment["web"].environment)
+            o2.widget.JavascriptEditor.runtimeEnvironment[runtime] = {
+                "environment": ev,
+                exec: function(code){
+                    return o2.Macro.exec(code, this.environment);
+                }
+            }
+            if (callback) callback();
+        }
+    }
+    o2.widget.JavascriptEditor.getServiceCompletionEnvironment("service", check);
+    o2.widget.JavascriptEditor.getServerCompletionEnvironment("server", check);
+    o2.widget.JavascriptEditor.getDefaultCompletionEnvironment("web", check);
 
 
-});
+}

+ 12 - 4
o2web/source/o2_core/o2/widget/MWFRaphael.js

@@ -4,10 +4,18 @@ o2.widget.MWFRaphael = MWFRaphael = {
         if (window.Raphael){
         if (window.Raphael){
             if (callback) callback();
             if (callback) callback();
         }else{
         }else{
-            COMMON.AjaxModule.loadDom("raphael", function(){
-                this.expandRaphael();
-                if (callback) callback();
-            }.bind(this), true, true);
+			if(!window.Raphael && typeof require === 'function' && define.amd){
+				require(["../o2_lib/raphael/raphael.js"], function(r){
+					window.Raphael = r;
+					this.expandRaphael();
+					if (callback) callback();
+				}.bind(this));
+			}else{
+				COMMON.AjaxModule.load("raphael", function(){
+					this.expandRaphael();
+					if (callback) callback();
+				}.bind(this), true, true);
+			}
         }
         }
 	},
 	},
 	expandRaphael: function(){
 	expandRaphael: function(){

+ 19 - 7
o2web/source/o2_core/o2/widget/ScriptArea.js

@@ -12,6 +12,7 @@ o2.widget.ScriptArea = new Class({
         "isload": false,
         "isload": false,
         "isbind": true,
         "isbind": true,
         "mode": "javascript",
         "mode": "javascript",
+        "runtime": "all",
         "key": "code"
         "key": "code"
     },
     },
     initialize: function(node, options){
     initialize: function(node, options){
@@ -68,6 +69,7 @@ o2.widget.ScriptArea = new Class({
         }
         }
     },
     },
     maxSize: function(){
     maxSize: function(){
+        debugger;
         var obj = this.options.maxObj;
         var obj = this.options.maxObj;
         var coordinates = obj.getCoordinates(obj.getOffsetParent());
         var coordinates = obj.getCoordinates(obj.getOffsetParent());
 
 
@@ -80,8 +82,8 @@ o2.widget.ScriptArea = new Class({
             "position": "absolute",
             "position": "absolute",
             // "top": coordinates.top,
             // "top": coordinates.top,
             // "left": coordinates.left,
             // "left": coordinates.left,
-            "top": "0px",
-            "left": "0px",
+            "top": coordinates.top+"px",
+            "left": coordinates.left+"px",
             "width": coordinates.width,
             "width": coordinates.width,
             "height": coordinates.height-2,
             "height": coordinates.height-2,
             "z-index": 20001
             "z-index": 20001
@@ -97,7 +99,8 @@ o2.widget.ScriptArea = new Class({
     returnSize: function(){
     returnSize: function(){
         var size = this.container.retrieve("size");
         var size = this.container.retrieve("size");
 
 
-        this.editor.setOption("lineNumbers", false);
+        //this.editor.setOption("lineNumbers", false);
+        this.jsEditor.hideLineNumbers();
         this.container.inject(this.node);
         this.container.inject(this.node);
         this.container.setStyles({
         this.container.setStyles({
             "position": "static",
             "position": "static",
@@ -120,7 +123,7 @@ o2.widget.ScriptArea = new Class({
         var th = this.titleNode.getStyle("height").toInt();
         var th = this.titleNode.getStyle("height").toInt();
         var height = (size.y || h)-(titleSize.y || th)-2-6;
         var height = (size.y || h)-(titleSize.y || th)-2-6;
         this.contentNode.setStyle("height", ""+height+"px");
         this.contentNode.setStyle("height", ""+height+"px");
-        if (this.editor) this.editor.resize();
+        if (this.jsEditor) this.jsEditor.resize();
     },
     },
     toJson: function(){
     toJson: function(){
         return (this.editor) ? {"code": this.editor.getValue(), "html": this.editor.getValue()} : this.contentCode;
         return (this.editor) ? {"code": this.editor.getValue(), "html": this.editor.getValue()} : this.contentCode;
@@ -183,6 +186,7 @@ o2.widget.ScriptArea = new Class({
         var value=(content) ? content.code : "";
         var value=(content) ? content.code : "";
         value = (value) ? value : "";
         value = (value) ? value : "";
         this.jsEditor = new o2.widget.JavascriptEditor(this.contentNode,{
         this.jsEditor = new o2.widget.JavascriptEditor(this.contentNode,{
+            "runtime": this.options.runtime || "all",
             "option": {
             "option": {
                 "value": value,
                 "value": value,
                 "lineNumbers": false,
                 "lineNumbers": false,
@@ -190,10 +194,18 @@ o2.widget.ScriptArea = new Class({
             },
             },
             "onPostLoad": function(){
             "onPostLoad": function(){
                 this.editor = this.jsEditor.editor;
                 this.editor = this.jsEditor.editor;
-                this.editor.id = "2";
-                this.editor.on("change", function() {
+                //this.editor.id = "2";
+
+                this.jsEditor.addEditorEvent("change", function() {
                     this.fireEvent("change");
                     this.fireEvent("change");
                 }.bind(this));
                 }.bind(this));
+                this.jsEditor.addEditorEvent("blur", function() {
+                    this.fireEvent("blur");
+                }.bind(this));
+
+                // this.editor.on("change", function() {
+                //     this.fireEvent("change");
+                // }.bind(this));
                 // this.editor.on("paste", function() {
                 // this.editor.on("paste", function() {
                 //     o2.load("JSBeautifier", function(){
                 //     o2.load("JSBeautifier", function(){
                 //         this.editor.setValue(js_beautify(this.editor.getValue()));
                 //         this.editor.setValue(js_beautify(this.editor.getValue()));
@@ -201,7 +213,7 @@ o2.widget.ScriptArea = new Class({
                 //     this.fireEvent("paste");
                 //     this.fireEvent("paste");
                 // }.bind(this));
                 // }.bind(this));
 
 
-                this.editor.resize();
+                this.jsEditor.resize();
                 this.fireEvent("postLoad");
                 this.fireEvent("postLoad");
             }.bind(this),
             }.bind(this),
             "onSave": function(){
             "onSave": function(){

+ 12 - 7
o2web/source/o2_core/o2/widget/ace.js

@@ -2,15 +2,20 @@ o2.widget = o2.widget || {};
 o2.widget.ace = {
 o2.widget.ace = {
     //"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
     //"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
     //"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
     //"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
+    "callbackList": [],
     "load": function(callback){
     "load": function(callback){
         if (!window.ace){
         if (!window.ace){
-            var jsLoaded = false;
-            var cssLoaded = false;
-            o2.load("ace", {"sequence": true}, function(){
-                //COMMON.AjaxModule.loadDom("ace-tools", function(){
-                    if (callback) callback();
-                //}.bind(this))
-            }.bind(this));
+            this.callbackList.push(callback);
+            if (!this.isLoadding) {
+                this.isLoadding = true;
+                o2.load("ace", {"sequence": true}, function(){
+                    this.isLoadding = false;
+                    while (this.callbackList.length){
+                        this.callbackList.shift()();
+                    }
+                }.bind(this));
+            }
+
         }else{
         }else{
             if (callback) callback();
             if (callback) callback();
         }
         }

+ 3 - 7
o2web/source/o2_core/o2/widget/codemirror.js

@@ -11,8 +11,8 @@ o2.widget.codemirror = {
 		"php": COMMON.contentPath+"/res/framework/codemirror/mode/php/php.js"
 		"php": COMMON.contentPath+"/res/framework/codemirror/mode/php/php.js"
 	},
 	},
 	"addon": {
 	"addon": {
-		
-		
+
+
 	},
 	},
 	"load": function(callback){
 	"load": function(callback){
 		var jsLoaded = false;
 		var jsLoaded = false;
@@ -42,9 +42,5 @@ o2.widget.codemirror = {
 			if (callback) callback();
 			if (callback) callback();
 		}
 		}
 	}
 	}
-	
-};
-
-
-
 
 
+};

+ 24 - 0
o2web/source/o2_core/o2/widget/monaco.js

@@ -0,0 +1,24 @@
+o2.widget = o2.widget || {};
+o2.widget.monaco = {
+    "callbackList": [],
+    "load": function(callback){
+        if (!window.monaco){
+            this.callbackList.push(callback);
+            if (!this.isLoadding){
+                this.isLoadding = true;
+                o2.load("monaco", {"sequence": true}, function(){
+                    require.config({ paths: { "vs": "/o2_lib/vs" }});
+                    require(["vs/editor/editor.main"], function() {
+                        this.isLoadding = false;
+                        while (this.callbackList.length){
+                            this.callbackList.shift()();
+                        }
+                        //if (callback) callback();
+                    }.bind(this));
+                }.bind(this));
+            }
+        }else{
+            if (callback) callback();
+        }
+    }
+};

+ 1 - 1
o2web/source/o2_core/o2/xScript/Environment.js

@@ -945,7 +945,7 @@ MWF.xScript.Environment = function(ev){
 
 
     //仅前台对象-----------------------------------------
     //仅前台对象-----------------------------------------
     //form
     //form
-    this.form = {
+    this.page = this.form = {
         "getInfor": function(){return ev.formInfor;},
         "getInfor": function(){return ev.formInfor;},
         "infor": ev.formInfor,
         "infor": ev.formInfor,
         "getApp": function(){return _form.app;},
         "getApp": function(){return _form.app;},

BIN
o2web/source/o2_lib/vs/base/browser/ui/codiconLabel/codicon/codicon.ttf


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 85 - 0
o2web/source/o2_lib/vs/base/worker/workerMain.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/abap/abap.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/apex/apex.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/azcli/azcli.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/azcli/azcli",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conf={comments:{lineComment:"#"}},t.language={defaultToken:"keyword",ignoreCase:!0,tokenPostfix:".azcli",str:/[^#\s]/,tokenizer:{root:[{include:"@comment"},[/\s-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":{token:"key.identifier",next:"@type"}}}],[/^-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":{token:"key.identifier",next:"@type"}}}]],type:[{include:"@comment"},[/-+@str*\s*/,{cases:{"@eos":{token:"key.identifier",next:"@popall"},"@default":"key.identifier"}}],[/@str+\s*/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}]],comment:[[/#.*$/,{cases:{"@eos":{token:"comment",next:"@popall"}}}]]}}}));

+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/bat/bat.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/bat/bat",["require","exports"],(function(e,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.conf={comments:{lineComment:"REM"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}],surroundingPairs:[{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}],folding:{markers:{start:new RegExp("^\\s*(::\\s*|REM\\s+)#region"),end:new RegExp("^\\s*(::\\s*|REM\\s+)#endregion")}}},s.language={defaultToken:"",ignoreCase:!0,tokenPostfix:".bat",brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.parenthesis",open:"(",close:")"},{token:"delimiter.square",open:"[",close:"]"}],keywords:/call|defined|echo|errorlevel|exist|for|goto|if|pause|set|shift|start|title|not|pushd|popd/,symbols:/[=><!~?&|+\-*\/\^;\.,]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/^(\s*)(rem(?:\s.*|))$/,["","comment"]],[/(\@?)(@keywords)(?!\w)/,[{token:"keyword"},{token:"keyword.$2"}]],[/[ \t\r\n]+/,""],[/setlocal(?!\w)/,"keyword.tag-setlocal"],[/endlocal(?!\w)/,"keyword.tag-setlocal"],[/[a-zA-Z_]\w*/,""],[/:\w*/,"metatag"],[/%[^%]+%/,"variable"],[/%%[\w]+(?!\w)/,"variable"],[/[{}()\[\]]/,"@brackets"],[/@symbols/,"delimiter"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F_]*[0-9a-fA-F]/,"number.hex"],[/\d+/,"number"],[/[;,.]/,"delimiter"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],string:[[/[^\\"'%]+/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/%[\w ]+%/,"variable"],[/%%[\w]+(?!\w)/,"variable"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}],[/$/,"string","@popall"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/cameligo/cameligo.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/clojure/clojure.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/coffee/coffee.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/cpp/cpp.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/csharp/csharp.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/csp/csp.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/csp/csp",["require","exports"],(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.conf={brackets:[],autoClosingPairs:[],surroundingPairs:[]},e.language={keywords:[],typeKeywords:[],tokenPostfix:".csp",operators:[],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/child-src/,"string.quote"],[/connect-src/,"string.quote"],[/default-src/,"string.quote"],[/font-src/,"string.quote"],[/frame-src/,"string.quote"],[/img-src/,"string.quote"],[/manifest-src/,"string.quote"],[/media-src/,"string.quote"],[/object-src/,"string.quote"],[/script-src/,"string.quote"],[/style-src/,"string.quote"],[/worker-src/,"string.quote"],[/base-uri/,"string.quote"],[/plugin-types/,"string.quote"],[/sandbox/,"string.quote"],[/disown-opener/,"string.quote"],[/form-action/,"string.quote"],[/frame-ancestors/,"string.quote"],[/report-uri/,"string.quote"],[/report-to/,"string.quote"],[/upgrade-insecure-requests/,"string.quote"],[/block-all-mixed-content/,"string.quote"],[/require-sri-for/,"string.quote"],[/reflected-xss/,"string.quote"],[/referrer/,"string.quote"],[/policy-uri/,"string.quote"],[/'self'/,"string.quote"],[/'unsafe-inline'/,"string.quote"],[/'unsafe-eval'/,"string.quote"],[/'strict-dynamic'/,"string.quote"],[/'unsafe-hashed-attributes'/,"string.quote"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/css/css.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/dockerfile/dockerfile.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/dockerfile/dockerfile",["require","exports"],(function(e,s){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),s.conf={brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},s.language={defaultToken:"",tokenPostfix:".dockerfile",variable:/\${?[\w]+}?/,tokenizer:{root:[{include:"@whitespace"},{include:"@comment"},[/(ONBUILD)(\s+)/,["keyword",""]],[/(ENV)(\s+)([\w]+)/,["keyword","",{token:"variable",next:"@arguments"}]],[/(FROM|MAINTAINER|RUN|EXPOSE|ENV|ADD|ARG|VOLUME|LABEL|USER|WORKDIR|COPY|CMD|STOPSIGNAL|SHELL|HEALTHCHECK|ENTRYPOINT)/,{token:"keyword",next:"@arguments"}]],arguments:[{include:"@whitespace"},{include:"@strings"},[/(@variable)/,{cases:{"@eos":{token:"variable",next:"@popall"},"@default":"variable"}}],[/\\/,{cases:{"@eos":"","@default":""}}],[/./,{cases:{"@eos":{token:"",next:"@popall"},"@default":""}}]],whitespace:[[/\s+/,{cases:{"@eos":{token:"",next:"@popall"},"@default":""}}]],comment:[[/(^#.*$)/,"comment","@popall"]],strings:[[/'$/,"string","@popall"],[/'/,"string","@stringBody"],[/"$/,"string","@popall"],[/"/,"string","@dblStringBody"]],stringBody:[[/[^\\\$']/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}],[/\\./,"string.escape"],[/'$/,"string","@popall"],[/'/,"string","@pop"],[/(@variable)/,"variable"],[/\\$/,"string"],[/$/,"string","@popall"]],dblStringBody:[[/[^\\\$"]/,{cases:{"@eos":{token:"string",next:"@popall"},"@default":"string"}}],[/\\./,"string.escape"],[/"$/,"string","@popall"],[/"/,"string","@pop"],[/(@variable)/,"variable"],[/\\$/,"string"],[/$/,"string","@popall"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/fsharp/fsharp.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/go/go.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/graphql/graphql.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/handlebars/handlebars.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/html/html.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/ini/ini.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/ini/ini",["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.conf={comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},n.language={defaultToken:"",tokenPostfix:".ini",escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/^\[[^\]]*\]/,"metatag"],[/(^\w+)(\s*)(\=)/,["key","","delimiter"]],{include:"@whitespace"},[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,""],[/^\s*[#;].*$/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/java/java.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/javascript/javascript.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/kotlin/kotlin.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/less/less.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/lua/lua.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/markdown/markdown.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/mips/mips.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/msdax/msdax.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/mysql/mysql.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/objective-c/objective-c.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/pascal/pascal.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/pascaligo/pascaligo.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/pascaligo/pascaligo",["require","exports"],(function(e,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.conf={comments:{lineComment:"//",blockComment:["(*","*)"]},brackets:[["{","}"],["[","]"],["(",")"],["<",">"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:"'",close:"'"}]},o.language={defaultToken:"",tokenPostfix:".pascaligo",ignoreCase:!0,brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}],keywords:["begin","block","case","const","else","end","fail","for","from","function","if","is","nil","of","remove","return","skip","then","type","var","while","with","option","None","transaction"],typeKeywords:["bool","int","list","map","nat","record","string","unit","address","map","mtz","xtz"],operators:["=",">","<","<=",">=","<>",":",":=","and","mod","or","+","-","*","/","@","&","^","%"],symbols:/[=><:@\^&|+\-*\/\^%]+/,tokenizer:{root:[[/[a-zA-Z_][\w]*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/\$[0-9a-fA-F]{1,16}/,"number.hex"],[/\d+/,"number"],[/[;,.]/,"delimiter"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/'/,"string","@string"],[/'[^\\']'/,"string"],[/'/,"string.invalid"],[/\#\d+/,"string"]],comment:[[/[^\(\*]+/,"comment"],[/\*\)/,"comment","@pop"],[/\(\*/,"comment"]],string:[[/[^\\']+/,"string"],[/\\./,"string.escape.invalid"],[/'/,{token:"string.quote",bracket:"@close",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,"white"],[/\(\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/perl/perl.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/pgsql/pgsql.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/php/php.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/postiats/postiats.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/powerquery/powerquery.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/powershell/powershell.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/pug/pug.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/python/python.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/r/r.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/razor/razor.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/redis/redis.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/redshift/redshift.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/restructuredtext/restructuredtext.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/ruby/ruby.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/rust/rust.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/sb/sb.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/sb/sb",["require","exports"],(function(e,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.conf={comments:{lineComment:"'"},brackets:[["(",")"],["[","]"],["If","EndIf"],["While","EndWhile"],["For","EndFor"],["Sub","EndSub"]],autoClosingPairs:[{open:'"',close:'"',notIn:["string","comment"]},{open:"(",close:")",notIn:["string","comment"]},{open:"[",close:"]",notIn:["string","comment"]}]},o.language={defaultToken:"",tokenPostfix:".sb",ignoreCase:!0,brackets:[{token:"delimiter.array",open:"[",close:"]"},{token:"delimiter.parenthesis",open:"(",close:")"},{token:"keyword.tag-if",open:"If",close:"EndIf"},{token:"keyword.tag-while",open:"While",close:"EndWhile"},{token:"keyword.tag-for",open:"For",close:"EndFor"},{token:"keyword.tag-sub",open:"Sub",close:"EndSub"}],keywords:["Else","ElseIf","EndFor","EndIf","EndSub","EndWhile","For","Goto","If","Step","Sub","Then","To","While"],tagwords:["If","Sub","While","For"],operators:[">","<","<>","<=",">=","And","Or","+","-","*","/","="],identifier:/[a-zA-Z_][\w]*/,symbols:/[=><:+\-*\/%\.,]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[{include:"@whitespace"},[/(@identifier)(?=[.])/,"type"],[/@identifier/,{cases:{"@keywords":{token:"keyword.$0"},"@operators":"operator","@default":"variable.name"}}],[/([.])(@identifier)/,{cases:{$2:["delimiter","type.member"],"@default":""}}],[/\d*\.\d+/,"number.float"],[/\d+/,"number"],[/[()\[\]]/,"@brackets"],[/@symbols/,{cases:{"@operators":"operator","@default":"delimiter"}}],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string"]],whitespace:[[/[ \t\r\n]+/,""],[/(\').*$/,"comment"]],string:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"C?/,"string","@pop"]]}}}));

+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/scheme/scheme.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/scheme/scheme",["require","exports"],(function(e,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.conf={comments:{lineComment:";",blockComment:["#|","|#"]},brackets:[["(",")"],["{","}"],["[","]"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'}]},o.language={defaultToken:"",ignoreCase:!0,tokenPostfix:".scheme",brackets:[{open:"(",close:")",token:"delimiter.parenthesis"},{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"}],keywords:["case","do","let","loop","if","else","when","cons","car","cdr","cond","lambda","lambda*","syntax-rules","format","set!","quote","eval","append","list","list?","member?","load"],constants:["#t","#f"],operators:["eq?","eqv?","equal?","and","or","not","null?"],tokenizer:{root:[[/#[xXoObB][0-9a-fA-F]+/,"number.hex"],[/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/,"number.float"],[/(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/,["keyword","white","variable"]],{include:"@whitespace"},{include:"@strings"},[/[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/,{cases:{"@keywords":"keyword","@constants":"constant","@operators":"operators","@default":"identifier"}}]],comment:[[/[^\|#]+/,"comment"],[/#\|/,"comment","@push"],[/\|#/,"comment","@pop"],[/[\|#]/,"comment"]],whitespace:[[/[ \t\r\n]+/,"white"],[/#\|/,"comment","@comment"],[/;.*$/,"comment"]],strings:[[/"$/,"string","@popall"],[/"(?=.)/,"string","@multiLineString"]],multiLineString:[[/[^\\"]+$/,"string","@popall"],[/[^\\"]+/,"string"],[/\\./,"string.escape"],[/"/,"string","@popall"],[/\\$/,"string"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/scss/scss.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/shell/shell.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/solidity/solidity.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/sophia/sophia.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/sql/sql.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/st/st.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/basic-languages/swift/swift.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/tcl/tcl.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/twig/twig.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/typescript/typescript.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/vb/vb.js


+ 7 - 0
o2web/source/o2_lib/vs/basic-languages/xml/xml.js

@@ -0,0 +1,7 @@
+/*!-----------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * monaco-languages version: 1.10.0(1b4729c63bdb0d1e06d4e637e5c3977ddeb714dd)
+ * Released under the MIT license
+ * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md
+ *-----------------------------------------------------------------------------*/
+define("vs/basic-languages/xml/xml",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.conf={comments:{blockComment:["\x3c!--","--\x3e"]},brackets:[["<",">"]],autoClosingPairs:[{open:"<",close:">"},{open:"'",close:"'"},{open:'"',close:'"'}],surroundingPairs:[{open:"<",close:">"},{open:"'",close:"'"},{open:'"',close:'"'}]},t.language={defaultToken:"",tokenPostfix:".xml",ignoreCase:!0,qualifiedName:/(?:[\w\.\-]+:)?[\w\.\-]+/,tokenizer:{root:[[/[^<&]+/,""],{include:"@whitespace"},[/(<)(@qualifiedName)/,[{token:"delimiter"},{token:"tag",next:"@tag"}]],[/(<\/)(@qualifiedName)(\s*)(>)/,[{token:"delimiter"},{token:"tag"},"",{token:"delimiter"}]],[/(<\?)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/(<\!)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/<\!\[CDATA\[/,{token:"delimiter.cdata",next:"@cdata"}],[/&\w+;/,"string.escape"]],cdata:[[/[^\]]+/,""],[/\]\]>/,{token:"delimiter.cdata",next:"@pop"}],[/\]/,""]],tag:[[/[ \t\r\n]+/,""],[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/,["attribute.name","","attribute.value"]],[/@qualifiedName/,"attribute.name"],[/\?>/,{token:"delimiter",next:"@pop"}],[/(\/)(>)/,[{token:"tag"},{token:"delimiter",next:"@pop"}]],[/>/,{token:"delimiter",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,""],[/<!--/,{token:"comment",next:"@comment"}]],comment:[[/[^<\-]+/,"comment.content"],[/-->/,{token:"comment",next:"@pop"}],[/<!--/,"comment.content.invalid"],[/[<\-]/,"comment.content"]]}}}));

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/basic-languages/yaml/yaml.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 0
o2web/source/o2_lib/vs/editor/editor.main.css


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7 - 0
o2web/source/o2_lib/vs/editor/editor.main.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.de.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.es.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.fr.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.it.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.ja.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.ko.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.ru.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.zh-cn.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
o2web/source/o2_lib/vs/editor/editor.main.nls.zh-tw.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/css/cssMode.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/css/cssWorker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/html/htmlMode.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/html/htmlWorker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/json/jsonMode.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/json/jsonWorker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
o2web/source/o2_lib/vs/language/typescript/tsMode.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 20 - 0
o2web/source/o2_lib/vs/language/typescript/tsWorker.js


+ 1815 - 0
o2web/source/o2_lib/vs/loader.js

@@ -0,0 +1,1815 @@
+/*!-----------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Version: 0.20.0(6363745c0a33c27b149b89342a7b96d354fb554c)
+ * Released under the MIT license
+ * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt
+ *-----------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+'use strict';
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ * Please make sure to make edits in the .ts file at https://github.com/Microsoft/vscode-loader/
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *---------------------------------------------------------------------------------------------
+ *--------------------------------------------------------------------------------------------*/
+var _amdLoaderGlobal = this;
+var _commonjsGlobal = typeof global === 'object' ? global : {};
+var AMDLoader;
+(function (AMDLoader) {
+    AMDLoader.global = _amdLoaderGlobal;
+    var Environment = /** @class */ (function () {
+        function Environment() {
+            this._detected = false;
+            this._isWindows = false;
+            this._isNode = false;
+            this._isElectronRenderer = false;
+            this._isWebWorker = false;
+        }
+        Object.defineProperty(Environment.prototype, "isWindows", {
+            get: function () {
+                this._detect();
+                return this._isWindows;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isNode", {
+            get: function () {
+                this._detect();
+                return this._isNode;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isElectronRenderer", {
+            get: function () {
+                this._detect();
+                return this._isElectronRenderer;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(Environment.prototype, "isWebWorker", {
+            get: function () {
+                this._detect();
+                return this._isWebWorker;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Environment.prototype._detect = function () {
+            if (this._detected) {
+                return;
+            }
+            this._detected = true;
+            this._isWindows = Environment._isWindows();
+            this._isNode = (typeof module !== 'undefined' && !!module.exports);
+            this._isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer');
+            this._isWebWorker = (typeof AMDLoader.global.importScripts === 'function');
+        };
+        Environment._isWindows = function () {
+            if (typeof navigator !== 'undefined') {
+                if (navigator.userAgent && navigator.userAgent.indexOf('Windows') >= 0) {
+                    return true;
+                }
+            }
+            if (typeof process !== 'undefined') {
+                return (process.platform === 'win32');
+            }
+            return false;
+        };
+        return Environment;
+    }());
+    AMDLoader.Environment = Environment;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    var LoaderEvent = /** @class */ (function () {
+        function LoaderEvent(type, detail, timestamp) {
+            this.type = type;
+            this.detail = detail;
+            this.timestamp = timestamp;
+        }
+        return LoaderEvent;
+    }());
+    AMDLoader.LoaderEvent = LoaderEvent;
+    var LoaderEventRecorder = /** @class */ (function () {
+        function LoaderEventRecorder(loaderAvailableTimestamp) {
+            this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)];
+        }
+        LoaderEventRecorder.prototype.record = function (type, detail) {
+            this._events.push(new LoaderEvent(type, detail, AMDLoader.Utilities.getHighPerformanceTimestamp()));
+        };
+        LoaderEventRecorder.prototype.getEvents = function () {
+            return this._events;
+        };
+        return LoaderEventRecorder;
+    }());
+    AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
+    var NullLoaderEventRecorder = /** @class */ (function () {
+        function NullLoaderEventRecorder() {
+        }
+        NullLoaderEventRecorder.prototype.record = function (type, detail) {
+            // Nothing to do
+        };
+        NullLoaderEventRecorder.prototype.getEvents = function () {
+            return [];
+        };
+        NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
+        return NullLoaderEventRecorder;
+    }());
+    AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    var Utilities = /** @class */ (function () {
+        function Utilities() {
+        }
+        /**
+         * This method does not take care of / vs \
+         */
+        Utilities.fileUriToFilePath = function (isWindows, uri) {
+            uri = decodeURI(uri).replace(/%23/g, '#');
+            if (isWindows) {
+                if (/^file:\/\/\//.test(uri)) {
+                    // This is a URI without a hostname => return only the path segment
+                    return uri.substr(8);
+                }
+                if (/^file:\/\//.test(uri)) {
+                    return uri.substr(5);
+                }
+            }
+            else {
+                if (/^file:\/\//.test(uri)) {
+                    return uri.substr(7);
+                }
+            }
+            // Not sure...
+            return uri;
+        };
+        Utilities.startsWith = function (haystack, needle) {
+            return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
+        };
+        Utilities.endsWith = function (haystack, needle) {
+            return haystack.length >= needle.length && haystack.substr(haystack.length - needle.length) === needle;
+        };
+        // only check for "?" before "#" to ensure that there is a real Query-String
+        Utilities.containsQueryString = function (url) {
+            return /^[^\#]*\?/gi.test(url);
+        };
+        /**
+         * Does `url` start with http:// or https:// or file:// or / ?
+         */
+        Utilities.isAbsolutePath = function (url) {
+            return /^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(url);
+        };
+        Utilities.forEachProperty = function (obj, callback) {
+            if (obj) {
+                var key = void 0;
+                for (key in obj) {
+                    if (obj.hasOwnProperty(key)) {
+                        callback(key, obj[key]);
+                    }
+                }
+            }
+        };
+        Utilities.isEmpty = function (obj) {
+            var isEmpty = true;
+            Utilities.forEachProperty(obj, function () {
+                isEmpty = false;
+            });
+            return isEmpty;
+        };
+        Utilities.recursiveClone = function (obj) {
+            if (!obj || typeof obj !== 'object') {
+                return obj;
+            }
+            var result = Array.isArray(obj) ? [] : {};
+            Utilities.forEachProperty(obj, function (key, value) {
+                if (value && typeof value === 'object') {
+                    result[key] = Utilities.recursiveClone(value);
+                }
+                else {
+                    result[key] = value;
+                }
+            });
+            return result;
+        };
+        Utilities.generateAnonymousModule = function () {
+            return '===anonymous' + (Utilities.NEXT_ANONYMOUS_ID++) + '===';
+        };
+        Utilities.isAnonymousModule = function (id) {
+            return Utilities.startsWith(id, '===anonymous');
+        };
+        Utilities.getHighPerformanceTimestamp = function () {
+            if (!this.PERFORMANCE_NOW_PROBED) {
+                this.PERFORMANCE_NOW_PROBED = true;
+                this.HAS_PERFORMANCE_NOW = (AMDLoader.global.performance && typeof AMDLoader.global.performance.now === 'function');
+            }
+            return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now());
+        };
+        Utilities.NEXT_ANONYMOUS_ID = 1;
+        Utilities.PERFORMANCE_NOW_PROBED = false;
+        Utilities.HAS_PERFORMANCE_NOW = false;
+        return Utilities;
+    }());
+    AMDLoader.Utilities = Utilities;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    function ensureError(err) {
+        if (err instanceof Error) {
+            return err;
+        }
+        var result = new Error(err.message || String(err) || 'Unknown Error');
+        if (err.stack) {
+            result.stack = err.stack;
+        }
+        return result;
+    }
+    AMDLoader.ensureError = ensureError;
+    ;
+    var ConfigurationOptionsUtil = /** @class */ (function () {
+        function ConfigurationOptionsUtil() {
+        }
+        /**
+         * Ensure configuration options make sense
+         */
+        ConfigurationOptionsUtil.validateConfigurationOptions = function (options) {
+            function defaultOnError(err) {
+                if (err.phase === 'loading') {
+                    console.error('Loading "' + err.moduleId + '" failed');
+                    console.error(err);
+                    console.error('Here are the modules that depend on it:');
+                    console.error(err.neededBy);
+                    return;
+                }
+                if (err.phase === 'factory') {
+                    console.error('The factory method of "' + err.moduleId + '" has thrown an exception');
+                    console.error(err);
+                    return;
+                }
+            }
+            options = options || {};
+            if (typeof options.baseUrl !== 'string') {
+                options.baseUrl = '';
+            }
+            if (typeof options.isBuild !== 'boolean') {
+                options.isBuild = false;
+            }
+            if (typeof options.paths !== 'object') {
+                options.paths = {};
+            }
+            if (typeof options.config !== 'object') {
+                options.config = {};
+            }
+            if (typeof options.catchError === 'undefined') {
+                options.catchError = false;
+            }
+            if (typeof options.recordStats === 'undefined') {
+                options.recordStats = false;
+            }
+            if (typeof options.urlArgs !== 'string') {
+                options.urlArgs = '';
+            }
+            if (typeof options.onError !== 'function') {
+                options.onError = defaultOnError;
+            }
+            if (!Array.isArray(options.ignoreDuplicateModules)) {
+                options.ignoreDuplicateModules = [];
+            }
+            if (options.baseUrl.length > 0) {
+                if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) {
+                    options.baseUrl += '/';
+                }
+            }
+            if (typeof options.cspNonce !== 'string') {
+                options.cspNonce = '';
+            }
+            if (!Array.isArray(options.nodeModules)) {
+                options.nodeModules = [];
+            }
+            if (options.nodeCachedData && typeof options.nodeCachedData === 'object') {
+                if (typeof options.nodeCachedData.seed !== 'string') {
+                    options.nodeCachedData.seed = 'seed';
+                }
+                if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) {
+                    options.nodeCachedData.writeDelay = 1000 * 7;
+                }
+                if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') {
+                    var err = ensureError(new Error('INVALID cached data configuration, \'path\' MUST be set'));
+                    err.phase = 'configuration';
+                    options.onError(err);
+                    options.nodeCachedData = undefined;
+                }
+            }
+            return options;
+        };
+        ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) {
+            if (overwrite === void 0) { overwrite = null; }
+            if (base === void 0) { base = null; }
+            var result = AMDLoader.Utilities.recursiveClone(base || {});
+            // Merge known properties and overwrite the unknown ones
+            AMDLoader.Utilities.forEachProperty(overwrite, function (key, value) {
+                if (key === 'ignoreDuplicateModules' && typeof result.ignoreDuplicateModules !== 'undefined') {
+                    result.ignoreDuplicateModules = result.ignoreDuplicateModules.concat(value);
+                }
+                else if (key === 'paths' && typeof result.paths !== 'undefined') {
+                    AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.paths[key2] = value2; });
+                }
+                else if (key === 'config' && typeof result.config !== 'undefined') {
+                    AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.config[key2] = value2; });
+                }
+                else {
+                    result[key] = AMDLoader.Utilities.recursiveClone(value);
+                }
+            });
+            return ConfigurationOptionsUtil.validateConfigurationOptions(result);
+        };
+        return ConfigurationOptionsUtil;
+    }());
+    AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
+    var Configuration = /** @class */ (function () {
+        function Configuration(env, options) {
+            this._env = env;
+            this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options);
+            this._createIgnoreDuplicateModulesMap();
+            this._createNodeModulesMap();
+            this._createSortedPathsRules();
+            if (this.options.baseUrl === '') {
+                if (this.options.nodeRequire && this.options.nodeRequire.main && this.options.nodeRequire.main.filename && this._env.isNode) {
+                    var nodeMain = this.options.nodeRequire.main.filename;
+                    var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\'));
+                    this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);
+                }
+                if (this.options.nodeMain && this._env.isNode) {
+                    var nodeMain = this.options.nodeMain;
+                    var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\'));
+                    this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1);
+                }
+            }
+        }
+        Configuration.prototype._createIgnoreDuplicateModulesMap = function () {
+            // Build a map out of the ignoreDuplicateModules array
+            this.ignoreDuplicateModulesMap = {};
+            for (var i = 0; i < this.options.ignoreDuplicateModules.length; i++) {
+                this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[i]] = true;
+            }
+        };
+        Configuration.prototype._createNodeModulesMap = function () {
+            // Build a map out of nodeModules array
+            this.nodeModulesMap = Object.create(null);
+            for (var _i = 0, _a = this.options.nodeModules; _i < _a.length; _i++) {
+                var nodeModule = _a[_i];
+                this.nodeModulesMap[nodeModule] = true;
+            }
+        };
+        Configuration.prototype._createSortedPathsRules = function () {
+            var _this = this;
+            // Create an array our of the paths rules, sorted descending by length to
+            // result in a more specific -> less specific order
+            this.sortedPathsRules = [];
+            AMDLoader.Utilities.forEachProperty(this.options.paths, function (from, to) {
+                if (!Array.isArray(to)) {
+                    _this.sortedPathsRules.push({
+                        from: from,
+                        to: [to]
+                    });
+                }
+                else {
+                    _this.sortedPathsRules.push({
+                        from: from,
+                        to: to
+                    });
+                }
+            });
+            this.sortedPathsRules.sort(function (a, b) {
+                return b.from.length - a.from.length;
+            });
+        };
+        /**
+         * Clone current configuration and overwrite options selectively.
+         * @param options The selective options to overwrite with.
+         * @result A new configuration
+         */
+        Configuration.prototype.cloneAndMerge = function (options) {
+            return new Configuration(this._env, ConfigurationOptionsUtil.mergeConfigurationOptions(options, this.options));
+        };
+        /**
+         * Get current options bag. Useful for passing it forward to plugins.
+         */
+        Configuration.prototype.getOptionsLiteral = function () {
+            return this.options;
+        };
+        Configuration.prototype._applyPaths = function (moduleId) {
+            var pathRule;
+            for (var i = 0, len = this.sortedPathsRules.length; i < len; i++) {
+                pathRule = this.sortedPathsRules[i];
+                if (AMDLoader.Utilities.startsWith(moduleId, pathRule.from)) {
+                    var result = [];
+                    for (var j = 0, lenJ = pathRule.to.length; j < lenJ; j++) {
+                        result.push(pathRule.to[j] + moduleId.substr(pathRule.from.length));
+                    }
+                    return result;
+                }
+            }
+            return [moduleId];
+        };
+        Configuration.prototype._addUrlArgsToUrl = function (url) {
+            if (AMDLoader.Utilities.containsQueryString(url)) {
+                return url + '&' + this.options.urlArgs;
+            }
+            else {
+                return url + '?' + this.options.urlArgs;
+            }
+        };
+        Configuration.prototype._addUrlArgsIfNecessaryToUrl = function (url) {
+            if (this.options.urlArgs) {
+                return this._addUrlArgsToUrl(url);
+            }
+            return url;
+        };
+        Configuration.prototype._addUrlArgsIfNecessaryToUrls = function (urls) {
+            if (this.options.urlArgs) {
+                for (var i = 0, len = urls.length; i < len; i++) {
+                    urls[i] = this._addUrlArgsToUrl(urls[i]);
+                }
+            }
+            return urls;
+        };
+        /**
+         * Transform a module id to a location. Appends .js to module ids
+         */
+        Configuration.prototype.moduleIdToPaths = function (moduleId) {
+            if (this.nodeModulesMap[moduleId] === true) {
+                // This is a node module...
+                if (this.isBuild()) {
+                    // ...and we are at build time, drop it
+                    return ['empty:'];
+                }
+                else {
+                    // ...and at runtime we create a `shortcut`-path
+                    return ['node|' + moduleId];
+                }
+            }
+            var result = moduleId;
+            var results;
+            if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.isAbsolutePath(result)) {
+                results = this._applyPaths(result);
+                for (var i = 0, len = results.length; i < len; i++) {
+                    if (this.isBuild() && results[i] === 'empty:') {
+                        continue;
+                    }
+                    if (!AMDLoader.Utilities.isAbsolutePath(results[i])) {
+                        results[i] = this.options.baseUrl + results[i];
+                    }
+                    if (!AMDLoader.Utilities.endsWith(results[i], '.js') && !AMDLoader.Utilities.containsQueryString(results[i])) {
+                        results[i] = results[i] + '.js';
+                    }
+                }
+            }
+            else {
+                if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.containsQueryString(result)) {
+                    result = result + '.js';
+                }
+                results = [result];
+            }
+            return this._addUrlArgsIfNecessaryToUrls(results);
+        };
+        /**
+         * Transform a module id or url to a location.
+         */
+        Configuration.prototype.requireToUrl = function (url) {
+            var result = url;
+            if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                result = this._applyPaths(result)[0];
+                if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                    result = this.options.baseUrl + result;
+                }
+            }
+            return this._addUrlArgsIfNecessaryToUrl(result);
+        };
+        /**
+         * Flag to indicate if current execution is as part of a build.
+         */
+        Configuration.prototype.isBuild = function () {
+            return this.options.isBuild;
+        };
+        /**
+         * Test if module `moduleId` is expected to be defined multiple times
+         */
+        Configuration.prototype.isDuplicateMessageIgnoredFor = function (moduleId) {
+            return this.ignoreDuplicateModulesMap.hasOwnProperty(moduleId);
+        };
+        /**
+         * Get the configuration settings for the provided module id
+         */
+        Configuration.prototype.getConfigForModule = function (moduleId) {
+            if (this.options.config) {
+                return this.options.config[moduleId];
+            }
+        };
+        /**
+         * Should errors be caught when executing module factories?
+         */
+        Configuration.prototype.shouldCatchError = function () {
+            return this.options.catchError;
+        };
+        /**
+         * Should statistics be recorded?
+         */
+        Configuration.prototype.shouldRecordStats = function () {
+            return this.options.recordStats;
+        };
+        /**
+         * Forward an error to the error handler.
+         */
+        Configuration.prototype.onError = function (err) {
+            this.options.onError(err);
+        };
+        return Configuration;
+    }());
+    AMDLoader.Configuration = Configuration;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    /**
+     * Load `scriptSrc` only once (avoid multiple <script> tags)
+     */
+    var OnlyOnceScriptLoader = /** @class */ (function () {
+        function OnlyOnceScriptLoader(env) {
+            this._env = env;
+            this._scriptLoader = null;
+            this._callbackMap = {};
+        }
+        OnlyOnceScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var _this = this;
+            if (!this._scriptLoader) {
+                this._scriptLoader = (this._env.isWebWorker
+                    ? new WorkerScriptLoader()
+                    : this._env.isNode
+                        ? new NodeScriptLoader(this._env)
+                        : new BrowserScriptLoader());
+            }
+            var scriptCallbacks = {
+                callback: callback,
+                errorback: errorback
+            };
+            if (this._callbackMap.hasOwnProperty(scriptSrc)) {
+                this._callbackMap[scriptSrc].push(scriptCallbacks);
+                return;
+            }
+            this._callbackMap[scriptSrc] = [scriptCallbacks];
+            this._scriptLoader.load(moduleManager, scriptSrc, function () { return _this.triggerCallback(scriptSrc); }, function (err) { return _this.triggerErrorback(scriptSrc, err); });
+        };
+        OnlyOnceScriptLoader.prototype.triggerCallback = function (scriptSrc) {
+            var scriptCallbacks = this._callbackMap[scriptSrc];
+            delete this._callbackMap[scriptSrc];
+            for (var i = 0; i < scriptCallbacks.length; i++) {
+                scriptCallbacks[i].callback();
+            }
+        };
+        OnlyOnceScriptLoader.prototype.triggerErrorback = function (scriptSrc, err) {
+            var scriptCallbacks = this._callbackMap[scriptSrc];
+            delete this._callbackMap[scriptSrc];
+            for (var i = 0; i < scriptCallbacks.length; i++) {
+                scriptCallbacks[i].errorback(err);
+            }
+        };
+        return OnlyOnceScriptLoader;
+    }());
+    var BrowserScriptLoader = /** @class */ (function () {
+        function BrowserScriptLoader() {
+        }
+        /**
+         * Attach load / error listeners to a script element and remove them when either one has fired.
+         * Implemented for browssers supporting HTML5 standard 'load' and 'error' events.
+         */
+        BrowserScriptLoader.prototype.attachListeners = function (script, callback, errorback) {
+            var unbind = function () {
+                script.removeEventListener('load', loadEventListener);
+                script.removeEventListener('error', errorEventListener);
+            };
+            var loadEventListener = function (e) {
+                unbind();
+                callback();
+            };
+            var errorEventListener = function (e) {
+                unbind();
+                errorback(e);
+            };
+            script.addEventListener('load', loadEventListener);
+            script.addEventListener('error', errorEventListener);
+        };
+        BrowserScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var script = document.createElement('script');
+            script.setAttribute('async', 'async');
+            script.setAttribute('type', 'text/javascript');
+            this.attachListeners(script, callback, errorback);
+            script.setAttribute('src', scriptSrc);
+            // Propagate CSP nonce to dynamically created script tag.
+            var cspNonce = moduleManager.getConfig().getOptionsLiteral().cspNonce;
+            if (cspNonce) {
+                script.setAttribute('nonce', cspNonce);
+            }
+            document.getElementsByTagName('head')[0].appendChild(script);
+        };
+        return BrowserScriptLoader;
+    }());
+    var WorkerScriptLoader = /** @class */ (function () {
+        function WorkerScriptLoader() {
+        }
+        WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            try {
+                importScripts(scriptSrc);
+                callback();
+            }
+            catch (e) {
+                errorback(e);
+            }
+        };
+        return WorkerScriptLoader;
+    }());
+    var NodeScriptLoader = /** @class */ (function () {
+        function NodeScriptLoader(env) {
+            this._env = env;
+            this._didInitialize = false;
+            this._didPatchNodeRequire = false;
+        }
+        NodeScriptLoader.prototype._init = function (nodeRequire) {
+            if (this._didInitialize) {
+                return;
+            }
+            this._didInitialize = true;
+            // capture node modules
+            this._fs = nodeRequire('fs');
+            this._vm = nodeRequire('vm');
+            this._path = nodeRequire('path');
+            this._crypto = nodeRequire('crypto');
+        };
+        // patch require-function of nodejs such that we can manually create a script
+        // from cached data. this is done by overriding the `Module._compile` function
+        NodeScriptLoader.prototype._initNodeRequire = function (nodeRequire, moduleManager) {
+            // It is important to check for `nodeCachedData` first and then set `_didPatchNodeRequire`.
+            // That's because `nodeCachedData` is set _after_ calling this for the first time...
+            var nodeCachedData = moduleManager.getConfig().getOptionsLiteral().nodeCachedData;
+            if (!nodeCachedData) {
+                return;
+            }
+            if (this._didPatchNodeRequire) {
+                return;
+            }
+            this._didPatchNodeRequire = true;
+            var that = this;
+            var Module = nodeRequire('module');
+            function makeRequireFunction(mod) {
+                var Module = mod.constructor;
+                var require = function require(path) {
+                    try {
+                        return mod.require(path);
+                    }
+                    finally {
+                        // nothing
+                    }
+                };
+                require.resolve = function resolve(request) {
+                    return Module._resolveFilename(request, mod);
+                };
+                require.main = process.mainModule;
+                require.extensions = Module._extensions;
+                require.cache = Module._cache;
+                return require;
+            }
+            Module.prototype._compile = function (content, filename) {
+                // remove shebang and create wrapper function
+                var scriptSource = Module.wrap(content.replace(/^#!.*/, ''));
+                // create script
+                var recorder = moduleManager.getRecorder();
+                var cachedDataPath = that._getCachedDataPath(nodeCachedData, filename);
+                var options = { filename: filename };
+                var hashData;
+                try {
+                    var data = that._fs.readFileSync(cachedDataPath);
+                    hashData = data.slice(0, 16);
+                    options.cachedData = data.slice(16);
+                    recorder.record(60 /* CachedDataFound */, cachedDataPath);
+                }
+                catch (_e) {
+                    recorder.record(61 /* CachedDataMissed */, cachedDataPath);
+                }
+                var script = new that._vm.Script(scriptSource, options);
+                var compileWrapper = script.runInThisContext(options);
+                // run script
+                var dirname = that._path.dirname(filename);
+                var require = makeRequireFunction(this);
+                var args = [this.exports, require, this, filename, dirname, process, _commonjsGlobal, Buffer];
+                var result = compileWrapper.apply(this.exports, args);
+                // cached data aftermath
+                that._handleCachedData(script, scriptSource, cachedDataPath, !options.cachedData, moduleManager);
+                that._verifyCachedData(script, scriptSource, cachedDataPath, hashData, moduleManager);
+                return result;
+            };
+        };
+        NodeScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
+            var _this = this;
+            var opts = moduleManager.getConfig().getOptionsLiteral();
+            var nodeRequire = (opts.nodeRequire || AMDLoader.global.nodeRequire);
+            var nodeInstrumenter = (opts.nodeInstrumenter || function (c) { return c; });
+            this._init(nodeRequire);
+            this._initNodeRequire(nodeRequire, moduleManager);
+            var recorder = moduleManager.getRecorder();
+            if (/^node\|/.test(scriptSrc)) {
+                var pieces = scriptSrc.split('|');
+                var moduleExports_1 = null;
+                try {
+                    moduleExports_1 = nodeRequire(pieces[1]);
+                }
+                catch (err) {
+                    errorback(err);
+                    return;
+                }
+                moduleManager.enqueueDefineAnonymousModule([], function () { return moduleExports_1; });
+                callback();
+            }
+            else {
+                scriptSrc = AMDLoader.Utilities.fileUriToFilePath(this._env.isWindows, scriptSrc);
+                var normalizedScriptSrc_1 = this._path.normalize(scriptSrc);
+                var vmScriptPathOrUri_1 = this._getElectronRendererScriptPathOrUri(normalizedScriptSrc_1);
+                var wantsCachedData_1 = Boolean(opts.nodeCachedData);
+                var cachedDataPath_1 = wantsCachedData_1 ? this._getCachedDataPath(opts.nodeCachedData, scriptSrc) : undefined;
+                this._readSourceAndCachedData(normalizedScriptSrc_1, cachedDataPath_1, recorder, function (err, data, cachedData, hashData) {
+                    if (err) {
+                        errorback(err);
+                        return;
+                    }
+                    var scriptSource;
+                    if (data.charCodeAt(0) === NodeScriptLoader._BOM) {
+                        scriptSource = NodeScriptLoader._PREFIX + data.substring(1) + NodeScriptLoader._SUFFIX;
+                    }
+                    else {
+                        scriptSource = NodeScriptLoader._PREFIX + data + NodeScriptLoader._SUFFIX;
+                    }
+                    scriptSource = nodeInstrumenter(scriptSource, normalizedScriptSrc_1);
+                    var scriptOpts = { filename: vmScriptPathOrUri_1, cachedData: cachedData };
+                    var script = _this._createAndEvalScript(moduleManager, scriptSource, scriptOpts, callback, errorback);
+                    _this._handleCachedData(script, scriptSource, cachedDataPath_1, wantsCachedData_1 && !cachedData, moduleManager);
+                    _this._verifyCachedData(script, scriptSource, cachedDataPath_1, hashData, moduleManager);
+                });
+            }
+        };
+        NodeScriptLoader.prototype._createAndEvalScript = function (moduleManager, contents, options, callback, errorback) {
+            var recorder = moduleManager.getRecorder();
+            recorder.record(31 /* NodeBeginEvaluatingScript */, options.filename);
+            var script = new this._vm.Script(contents, options);
+            var ret = script.runInThisContext(options);
+            var globalDefineFunc = moduleManager.getGlobalAMDDefineFunc();
+            var receivedDefineCall = false;
+            var localDefineFunc = function () {
+                receivedDefineCall = true;
+                return globalDefineFunc.apply(null, arguments);
+            };
+            localDefineFunc.amd = globalDefineFunc.amd;
+            ret.call(AMDLoader.global, moduleManager.getGlobalAMDRequireFunc(), localDefineFunc, options.filename, this._path.dirname(options.filename));
+            recorder.record(32 /* NodeEndEvaluatingScript */, options.filename);
+            if (receivedDefineCall) {
+                callback();
+            }
+            else {
+                errorback(new Error("Didn't receive define call in " + options.filename + "!"));
+            }
+            return script;
+        };
+        NodeScriptLoader.prototype._getElectronRendererScriptPathOrUri = function (path) {
+            if (!this._env.isElectronRenderer) {
+                return path;
+            }
+            var driveLetterMatch = path.match(/^([a-z])\:(.*)/i);
+            if (driveLetterMatch) {
+                // windows
+                return "file:///" + (driveLetterMatch[1].toUpperCase() + ':' + driveLetterMatch[2]).replace(/\\/g, '/');
+            }
+            else {
+                // nix
+                return "file://" + path;
+            }
+        };
+        NodeScriptLoader.prototype._getCachedDataPath = function (config, filename) {
+            var hash = this._crypto.createHash('md5').update(filename, 'utf8').update(config.seed, 'utf8').digest('hex');
+            var basename = this._path.basename(filename).replace(/\.js$/, '');
+            return this._path.join(config.path, basename + "-" + hash + ".code");
+        };
+        NodeScriptLoader.prototype._handleCachedData = function (script, scriptSource, cachedDataPath, createCachedData, moduleManager) {
+            var _this = this;
+            if (script.cachedDataRejected) {
+                // cached data got rejected -> delete and re-create
+                this._fs.unlink(cachedDataPath, function (err) {
+                    moduleManager.getRecorder().record(62 /* CachedDataRejected */, cachedDataPath);
+                    _this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);
+                    if (err) {
+                        moduleManager.getConfig().onError(err);
+                    }
+                });
+            }
+            else if (createCachedData) {
+                // no cached data, but wanted
+                this._createAndWriteCachedData(script, scriptSource, cachedDataPath, moduleManager);
+            }
+        };
+        // Cached data format: | SOURCE_HASH | V8_CACHED_DATA |
+        // -SOURCE_HASH is the md5 hash of the JS source (always 16 bytes)
+        // -V8_CACHED_DATA is what v8 produces
+        NodeScriptLoader.prototype._createAndWriteCachedData = function (script, scriptSource, cachedDataPath, moduleManager) {
+            var _this = this;
+            var timeout = Math.ceil(moduleManager.getConfig().getOptionsLiteral().nodeCachedData.writeDelay * (1 + Math.random()));
+            var lastSize = -1;
+            var iteration = 0;
+            var hashData = undefined;
+            var createLoop = function () {
+                setTimeout(function () {
+                    if (!hashData) {
+                        hashData = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();
+                    }
+                    var cachedData = script.createCachedData();
+                    if (cachedData.length === 0 || cachedData.length === lastSize || iteration >= 5) {
+                        return;
+                    }
+                    lastSize = cachedData.length;
+                    _this._fs.writeFile(cachedDataPath, Buffer.concat([hashData, cachedData]), function (err) {
+                        if (err) {
+                            moduleManager.getConfig().onError(err);
+                        }
+                        moduleManager.getRecorder().record(63 /* CachedDataCreated */, cachedDataPath);
+                        createLoop();
+                    });
+                }, timeout * (Math.pow(4, iteration++)));
+            };
+            // with some delay (`timeout`) create cached data
+            // and repeat that (with backoff delay) until the
+            // data seems to be not changing anymore
+            createLoop();
+        };
+        NodeScriptLoader.prototype._readSourceAndCachedData = function (sourcePath, cachedDataPath, recorder, callback) {
+            if (!cachedDataPath) {
+                // no cached data case
+                this._fs.readFile(sourcePath, { encoding: 'utf8' }, callback);
+            }
+            else {
+                // cached data case: read both files in parallel
+                var source_1 = undefined;
+                var cachedData_1 = undefined;
+                var hashData_1 = undefined;
+                var steps_1 = 2;
+                var step_1 = function (err) {
+                    if (err) {
+                        callback(err);
+                    }
+                    else if (--steps_1 === 0) {
+                        callback(undefined, source_1, cachedData_1, hashData_1);
+                    }
+                };
+                this._fs.readFile(sourcePath, { encoding: 'utf8' }, function (err, data) {
+                    source_1 = data;
+                    step_1(err);
+                });
+                this._fs.readFile(cachedDataPath, function (err, data) {
+                    if (!err && data && data.length > 0) {
+                        hashData_1 = data.slice(0, 16);
+                        cachedData_1 = data.slice(16);
+                        recorder.record(60 /* CachedDataFound */, cachedDataPath);
+                    }
+                    else {
+                        recorder.record(61 /* CachedDataMissed */, cachedDataPath);
+                    }
+                    step_1(); // ignored: cached data is optional
+                });
+            }
+        };
+        NodeScriptLoader.prototype._verifyCachedData = function (script, scriptSource, cachedDataPath, hashData, moduleManager) {
+            var _this = this;
+            if (!hashData) {
+                // nothing to do
+                return;
+            }
+            if (script.cachedDataRejected) {
+                // invalid anyways
+                return;
+            }
+            setTimeout(function () {
+                // check source hash - the contract is that file paths change when file content
+                // change (e.g use the commit or version id as cache path). this check is
+                // for violations of this contract.
+                var hashDataNow = _this._crypto.createHash('md5').update(scriptSource, 'utf8').digest();
+                if (!hashData.equals(hashDataNow)) {
+                    moduleManager.getConfig().onError(new Error("FAILED TO VERIFY CACHED DATA, deleting stale '" + cachedDataPath + "' now, but a RESTART IS REQUIRED"));
+                    _this._fs.unlink(cachedDataPath, function (err) { return moduleManager.getConfig().onError(err); });
+                }
+            }, Math.ceil(5000 * (1 + Math.random())));
+        };
+        NodeScriptLoader._BOM = 0xFEFF;
+        NodeScriptLoader._PREFIX = '(function (require, define, __filename, __dirname) { ';
+        NodeScriptLoader._SUFFIX = '\n});';
+        return NodeScriptLoader;
+    }());
+    function createScriptLoader(env) {
+        return new OnlyOnceScriptLoader(env);
+    }
+    AMDLoader.createScriptLoader = createScriptLoader;
+})(AMDLoader || (AMDLoader = {}));
+/*---------------------------------------------------------------------------------------------
+ *  Copyright (c) Microsoft Corporation. All rights reserved.
+ *  Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+var AMDLoader;
+(function (AMDLoader) {
+    // ------------------------------------------------------------------------
+    // ModuleIdResolver
+    var ModuleIdResolver = /** @class */ (function () {
+        function ModuleIdResolver(fromModuleId) {
+            var lastSlash = fromModuleId.lastIndexOf('/');
+            if (lastSlash !== -1) {
+                this.fromModulePath = fromModuleId.substr(0, lastSlash + 1);
+            }
+            else {
+                this.fromModulePath = '';
+            }
+        }
+        /**
+         * Normalize 'a/../name' to 'name', etc.
+         */
+        ModuleIdResolver._normalizeModuleId = function (moduleId) {
+            var r = moduleId, pattern;
+            // replace /./ => /
+            pattern = /\/\.\//;
+            while (pattern.test(r)) {
+                r = r.replace(pattern, '/');
+            }
+            // replace ^./ => nothing
+            r = r.replace(/^\.\//g, '');
+            // replace /aa/../ => / (BUT IGNORE /../../)
+            pattern = /\/(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//;
+            while (pattern.test(r)) {
+                r = r.replace(pattern, '/');
+            }
+            // replace ^aa/../ => nothing (BUT IGNORE ../../)
+            r = r.replace(/^(([^\/])|([^\/][^\/\.])|([^\/\.][^\/])|([^\/][^\/][^\/]+))\/\.\.\//, '');
+            return r;
+        };
+        /**
+         * Resolve relative module ids
+         */
+        ModuleIdResolver.prototype.resolveModule = function (moduleId) {
+            var result = moduleId;
+            if (!AMDLoader.Utilities.isAbsolutePath(result)) {
+                if (AMDLoader.Utilities.startsWith(result, './') || AMDLoader.Utilities.startsWith(result, '../')) {
+                    result = ModuleIdResolver._normalizeModuleId(this.fromModulePath + result);
+                }
+            }
+            return result;
+        };
+        ModuleIdResolver.ROOT = new ModuleIdResolver('');
+        return ModuleIdResolver;
+    }());
+    AMDLoader.ModuleIdResolver = ModuleIdResolver;
+    // ------------------------------------------------------------------------
+    // Module
+    var Module = /** @class */ (function () {
+        function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {
+            this.id = id;
+            this.strId = strId;
+            this.dependencies = dependencies;
+            this._callback = callback;
+            this._errorback = errorback;
+            this.moduleIdResolver = moduleIdResolver;
+            this.exports = {};
+            this.error = null;
+            this.exportsPassedIn = false;
+            this.unresolvedDependenciesCount = this.dependencies.length;
+            this._isComplete = false;
+        }
+        Module._safeInvokeFunction = function (callback, args) {
+            try {
+                return {
+                    returnedValue: callback.apply(AMDLoader.global, args),
+                    producedError: null
+                };
+            }
+            catch (e) {
+                return {
+                    returnedValue: null,
+                    producedError: e
+                };
+            }
+        };
+        Module._invokeFactory = function (config, strModuleId, callback, dependenciesValues) {
+            if (config.isBuild() && !AMDLoader.Utilities.isAnonymousModule(strModuleId)) {
+                return {
+                    returnedValue: null,
+                    producedError: null
+                };
+            }
+            if (config.shouldCatchError()) {
+                return this._safeInvokeFunction(callback, dependenciesValues);
+            }
+            return {
+                returnedValue: callback.apply(AMDLoader.global, dependenciesValues),
+                producedError: null
+            };
+        };
+        Module.prototype.complete = function (recorder, config, dependenciesValues) {
+            this._isComplete = true;
+            var producedError = null;
+            if (this._callback) {
+                if (typeof this._callback === 'function') {
+                    recorder.record(21 /* BeginInvokeFactory */, this.strId);
+                    var r = Module._invokeFactory(config, this.strId, this._callback, dependenciesValues);
+                    producedError = r.producedError;
+                    recorder.record(22 /* EndInvokeFactory */, this.strId);
+                    if (!producedError && typeof r.returnedValue !== 'undefined' && (!this.exportsPassedIn || AMDLoader.Utilities.isEmpty(this.exports))) {
+                        this.exports = r.returnedValue;
+                    }
+                }
+                else {
+                    this.exports = this._callback;
+                }
+            }
+            if (producedError) {
+                var err = AMDLoader.ensureError(producedError);
+                err.phase = 'factory';
+                err.moduleId = this.strId;
+                this.error = err;
+                config.onError(err);
+            }
+            this.dependencies = null;
+            this._callback = null;
+            this._errorback = null;
+            this.moduleIdResolver = null;
+        };
+        /**
+         * One of the direct dependencies or a transitive dependency has failed to load.
+         */
+        Module.prototype.onDependencyError = function (err) {
+            this._isComplete = true;
+            this.error = err;
+            if (this._errorback) {
+                this._errorback(err);
+                return true;
+            }
+            return false;
+        };
+        /**
+         * Is the current module complete?
+         */
+        Module.prototype.isComplete = function () {
+            return this._isComplete;
+        };
+        return Module;
+    }());
+    AMDLoader.Module = Module;
+    var ModuleIdProvider = /** @class */ (function () {
+        function ModuleIdProvider() {
+            this._nextId = 0;
+            this._strModuleIdToIntModuleId = new Map();
+            this._intModuleIdToStrModuleId = [];
+            // Ensure values 0, 1, 2 are assigned accordingly with ModuleId
+            this.getModuleId('exports');
+            this.getModuleId('module');
+            this.getModuleId('require');
+        }
+        ModuleIdProvider.prototype.getMaxModuleId = function () {
+            return this._nextId;
+        };
+        ModuleIdProvider.prototype.getModuleId = function (strModuleId) {
+            var id = this._strModuleIdToIntModuleId.get(strModuleId);
+            if (typeof id === 'undefined') {
+                id = this._nextId++;
+                this._strModuleIdToIntModuleId.set(strModuleId, id);
+                this._intModuleIdToStrModuleId[id] = strModuleId;
+            }
+            return id;
+        };
+        ModuleIdProvider.prototype.getStrModuleId = function (moduleId) {
+            return this._intModuleIdToStrModuleId[moduleId];
+        };
+        return ModuleIdProvider;
+    }());
+    var RegularDependency = /** @class */ (function () {
+        function RegularDependency(id) {
+            this.id = id;
+        }
+        RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
+        RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
+        RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
+        return RegularDependency;
+    }());
+    AMDLoader.RegularDependency = RegularDependency;
+    var PluginDependency = /** @class */ (function () {
+        function PluginDependency(id, pluginId, pluginParam) {
+            this.id = id;
+            this.pluginId = pluginId;
+            this.pluginParam = pluginParam;
+        }
+        return PluginDependency;
+    }());
+    AMDLoader.PluginDependency = PluginDependency;
+    var ModuleManager = /** @class */ (function () {
+        function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {
+            if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }
+            this._env = env;
+            this._scriptLoader = scriptLoader;
+            this._loaderAvailableTimestamp = loaderAvailableTimestamp;
+            this._defineFunc = defineFunc;
+            this._requireFunc = requireFunc;
+            this._moduleIdProvider = new ModuleIdProvider();
+            this._config = new AMDLoader.Configuration(this._env);
+            this._modules2 = [];
+            this._knownModules2 = [];
+            this._inverseDependencies2 = [];
+            this._inversePluginDependencies2 = new Map();
+            this._currentAnnonymousDefineCall = null;
+            this._recorder = null;
+            this._buildInfoPath = [];
+            this._buildInfoDefineStack = [];
+            this._buildInfoDependencies = [];
+        }
+        ModuleManager.prototype.reset = function () {
+            return new ModuleManager(this._env, this._scriptLoader, this._defineFunc, this._requireFunc, this._loaderAvailableTimestamp);
+        };
+        ModuleManager.prototype.getGlobalAMDDefineFunc = function () {
+            return this._defineFunc;
+        };
+        ModuleManager.prototype.getGlobalAMDRequireFunc = function () {
+            return this._requireFunc;
+        };
+        ModuleManager._findRelevantLocationInStack = function (needle, stack) {
+            var normalize = function (str) { return str.replace(/\\/g, '/'); };
+            var normalizedPath = normalize(needle);
+            var stackPieces = stack.split(/\n/);
+            for (var i = 0; i < stackPieces.length; i++) {
+                var m = stackPieces[i].match(/(.*):(\d+):(\d+)\)?$/);
+                if (m) {
+                    var stackPath = m[1];
+                    var stackLine = m[2];
+                    var stackColumn = m[3];
+                    var trimPathOffset = Math.max(stackPath.lastIndexOf(' ') + 1, stackPath.lastIndexOf('(') + 1);
+                    stackPath = stackPath.substr(trimPathOffset);
+                    stackPath = normalize(stackPath);
+                    if (stackPath === normalizedPath) {
+                        var r = {
+                            line: parseInt(stackLine, 10),
+                            col: parseInt(stackColumn, 10)
+                        };
+                        if (r.line === 1) {
+                            r.col -= '(function (require, define, __filename, __dirname) { '.length;
+                        }
+                        return r;
+                    }
+                }
+            }
+            throw new Error('Could not correlate define call site for needle ' + needle);
+        };
+        ModuleManager.prototype.getBuildInfo = function () {
+            if (!this._config.isBuild()) {
+                return null;
+            }
+            var result = [], resultLen = 0;
+            for (var i = 0, len = this._modules2.length; i < len; i++) {
+                var m = this._modules2[i];
+                if (!m) {
+                    continue;
+                }
+                var location_1 = this._buildInfoPath[m.id] || null;
+                var defineStack = this._buildInfoDefineStack[m.id] || null;
+                var dependencies = this._buildInfoDependencies[m.id];
+                result[resultLen++] = {
+                    id: m.strId,
+                    path: location_1,
+                    defineLocation: (location_1 && defineStack ? ModuleManager._findRelevantLocationInStack(location_1, defineStack) : null),
+                    dependencies: dependencies,
+                    shim: null,
+                    exports: m.exports
+                };
+            }
+            return result;
+        };
+        ModuleManager.prototype.getRecorder = function () {
+            if (!this._recorder) {
+                if (this._config.shouldRecordStats()) {
+                    this._recorder = new AMDLoader.LoaderEventRecorder(this._loaderAvailableTimestamp);
+                }
+                else {
+                    this._recorder = AMDLoader.NullLoaderEventRecorder.INSTANCE;
+                }
+            }
+            return this._recorder;
+        };
+        ModuleManager.prototype.getLoaderEvents = function () {
+            return this.getRecorder().getEvents();
+        };
+        /**
+         * Defines an anonymous module (without an id). Its name will be resolved as we receive a callback from the scriptLoader.
+         * @param dependecies @see defineModule
+         * @param callback @see defineModule
+         */
+        ModuleManager.prototype.enqueueDefineAnonymousModule = function (dependencies, callback) {
+            if (this._currentAnnonymousDefineCall !== null) {
+                throw new Error('Can only have one anonymous define call per script file');
+            }
+            var stack = null;
+            if (this._config.isBuild()) {
+                stack = new Error('StackLocation').stack || null;
+            }
+            this._currentAnnonymousDefineCall = {
+                stack: stack,
+                dependencies: dependencies,
+                callback: callback
+            };
+        };
+        /**
+         * Creates a module and stores it in _modules. The manager will immediately begin resolving its dependencies.
+         * @param strModuleId An unique and absolute id of the module. This must not collide with another module's id
+         * @param dependencies An array with the dependencies of the module. Special keys are: "require", "exports" and "module"
+         * @param callback if callback is a function, it will be called with the resolved dependencies. if callback is an object, it will be considered as the exports of the module.
+         */
+        ModuleManager.prototype.defineModule = function (strModuleId, dependencies, callback, errorback, stack, moduleIdResolver) {
+            var _this = this;
+            if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(strModuleId); }
+            var moduleId = this._moduleIdProvider.getModuleId(strModuleId);
+            if (this._modules2[moduleId]) {
+                if (!this._config.isDuplicateMessageIgnoredFor(strModuleId)) {
+                    console.warn('Duplicate definition of module \'' + strModuleId + '\'');
+                }
+                // Super important! Completely ignore duplicate module definition
+                return;
+            }
+            var m = new Module(moduleId, strModuleId, this._normalizeDependencies(dependencies, moduleIdResolver), callback, errorback, moduleIdResolver);
+            this._modules2[moduleId] = m;
+            if (this._config.isBuild()) {
+                this._buildInfoDefineStack[moduleId] = stack;
+                this._buildInfoDependencies[moduleId] = (m.dependencies || []).map(function (dep) { return _this._moduleIdProvider.getStrModuleId(dep.id); });
+            }
+            // Resolving of dependencies is immediate (not in a timeout). If there's a need to support a packer that concatenates in an
+            // unordered manner, in order to finish processing the file, execute the following method in a timeout
+            this._resolve(m);
+        };
+        ModuleManager.prototype._normalizeDependency = function (dependency, moduleIdResolver) {
+            if (dependency === 'exports') {
+                return RegularDependency.EXPORTS;
+            }
+            if (dependency === 'module') {
+                return RegularDependency.MODULE;
+            }
+            if (dependency === 'require') {
+                return RegularDependency.REQUIRE;
+            }
+            // Normalize dependency and then request it from the manager
+            var bangIndex = dependency.indexOf('!');
+            if (bangIndex >= 0) {
+                var strPluginId = moduleIdResolver.resolveModule(dependency.substr(0, bangIndex));
+                var pluginParam = moduleIdResolver.resolveModule(dependency.substr(bangIndex + 1));
+                var dependencyId = this._moduleIdProvider.getModuleId(strPluginId + '!' + pluginParam);
+                var pluginId = this._moduleIdProvider.getModuleId(strPluginId);
+                return new PluginDependency(dependencyId, pluginId, pluginParam);
+            }
+            return new RegularDependency(this._moduleIdProvider.getModuleId(moduleIdResolver.resolveModule(dependency)));
+        };
+        ModuleManager.prototype._normalizeDependencies = function (dependencies, moduleIdResolver) {
+            var result = [], resultLen = 0;
+            for (var i = 0, len = dependencies.length; i < len; i++) {
+                result[resultLen++] = this._normalizeDependency(dependencies[i], moduleIdResolver);
+            }
+            return result;
+        };
+        ModuleManager.prototype._relativeRequire = function (moduleIdResolver, dependencies, callback, errorback) {
+            if (typeof dependencies === 'string') {
+                return this.synchronousRequire(dependencies, moduleIdResolver);
+            }
+            this.defineModule(AMDLoader.Utilities.generateAnonymousModule(), dependencies, callback, errorback, null, moduleIdResolver);
+        };
+        /**
+         * Require synchronously a module by its absolute id. If the module is not loaded, an exception will be thrown.
+         * @param id The unique and absolute id of the required module
+         * @return The exports of module 'id'
+         */
+        ModuleManager.prototype.synchronousRequire = function (_strModuleId, moduleIdResolver) {
+            if (moduleIdResolver === void 0) { moduleIdResolver = new ModuleIdResolver(_strModuleId); }
+            var dependency = this._normalizeDependency(_strModuleId, moduleIdResolver);
+            var m = this._modules2[dependency.id];
+            if (!m) {
+                throw new Error('Check dependency list! Synchronous require cannot resolve module \'' + _strModuleId + '\'. This is the first mention of this module!');
+            }
+            if (!m.isComplete()) {
+                throw new Error('Check dependency list! Synchronous require cannot resolve module \'' + _strModuleId + '\'. This module has not been resolved completely yet.');
+            }
+            if (m.error) {
+                throw m.error;
+            }
+            return m.exports;
+        };
+        ModuleManager.prototype.configure = function (params, shouldOverwrite) {
+            var oldShouldRecordStats = this._config.shouldRecordStats();
+            if (shouldOverwrite) {
+                this._config = new AMDLoader.Configuration(this._env, params);
+            }
+            else {
+                this._config = this._config.cloneAndMerge(params);
+            }
+            if (this._config.shouldRecordStats() && !oldShouldRecordStats) {
+                this._recorder = null;
+            }
+        };
+        ModuleManager.prototype.getConfig = function () {
+            return this._config;
+        };
+        /**
+         * Callback from the scriptLoader when a module has been loaded.
+         * This means its code is available and has been executed.
+         */
+        ModuleManager.prototype._onLoad = function (moduleId) {
+            if (this._currentAnnonymousDefineCall !== null) {
+                var defineCall = this._currentAnnonymousDefineCall;
+                this._currentAnnonymousDefineCall = null;
+                // Hit an anonymous define call
+                this.defineModule(this._moduleIdProvider.getStrModuleId(moduleId), defineCall.dependencies, defineCall.callback, null, defineCall.stack);
+            }
+        };
+        ModuleManager.prototype._createLoadError = function (moduleId, _err) {
+            var _this = this;
+            var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);
+            var neededBy = (this._inverseDependencies2[moduleId] || []).map(function (intModuleId) { return _this._moduleIdProvider.getStrModuleId(intModuleId); });
+            var err = AMDLoader.ensureError(_err);
+            err.phase = 'loading';
+            err.moduleId = strModuleId;
+            err.neededBy = neededBy;
+            return err;
+        };
+        /**
+         * Callback from the scriptLoader when a module hasn't been loaded.
+         * This means that the script was not found (e.g. 404) or there was an error in the script.
+         */
+        ModuleManager.prototype._onLoadError = function (moduleId, err) {
+            var error = this._createLoadError(moduleId, err);
+            if (!this._modules2[moduleId]) {
+                this._modules2[moduleId] = new Module(moduleId, this._moduleIdProvider.getStrModuleId(moduleId), [], function () { }, function () { }, null);
+            }
+            // Find any 'local' error handlers, walk the entire chain of inverse dependencies if necessary.
+            var seenModuleId = [];
+            for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {
+                seenModuleId[i] = false;
+            }
+            var someoneNotified = false;
+            var queue = [];
+            queue.push(moduleId);
+            seenModuleId[moduleId] = true;
+            while (queue.length > 0) {
+                var queueElement = queue.shift();
+                var m = this._modules2[queueElement];
+                if (m) {
+                    someoneNotified = m.onDependencyError(error) || someoneNotified;
+                }
+                var inverseDeps = this._inverseDependencies2[queueElement];
+                if (inverseDeps) {
+                    for (var i = 0, len = inverseDeps.length; i < len; i++) {
+                        var inverseDep = inverseDeps[i];
+                        if (!seenModuleId[inverseDep]) {
+                            queue.push(inverseDep);
+                            seenModuleId[inverseDep] = true;
+                        }
+                    }
+                }
+            }
+            if (!someoneNotified) {
+                this._config.onError(error);
+            }
+        };
+        /**
+         * Walks (recursively) the dependencies of 'from' in search of 'to'.
+         * Returns true if there is such a path or false otherwise.
+         * @param from Module id to start at
+         * @param to Module id to look for
+         */
+        ModuleManager.prototype._hasDependencyPath = function (fromId, toId) {
+            var from = this._modules2[fromId];
+            if (!from) {
+                return false;
+            }
+            var inQueue = [];
+            for (var i = 0, len = this._moduleIdProvider.getMaxModuleId(); i < len; i++) {
+                inQueue[i] = false;
+            }
+            var queue = [];
+            // Insert 'from' in queue
+            queue.push(from);
+            inQueue[fromId] = true;
+            while (queue.length > 0) {
+                // Pop first inserted element of queue
+                var element = queue.shift();
+                var dependencies = element.dependencies;
+                if (dependencies) {
+                    // Walk the element's dependencies
+                    for (var i = 0, len = dependencies.length; i < len; i++) {
+                        var dependency = dependencies[i];
+                        if (dependency.id === toId) {
+                            // There is a path to 'to'
+                            return true;
+                        }
+                        var dependencyModule = this._modules2[dependency.id];
+                        if (dependencyModule && !inQueue[dependency.id]) {
+                            // Insert 'dependency' in queue
+                            inQueue[dependency.id] = true;
+                            queue.push(dependencyModule);
+                        }
+                    }
+                }
+            }
+            // There is no path to 'to'
+            return false;
+        };
+        /**
+         * Walks (recursively) the dependencies of 'from' in search of 'to'.
+         * Returns cycle as array.
+         * @param from Module id to start at
+         * @param to Module id to look for
+         */
+        ModuleManager.prototype._findCyclePath = function (fromId, toId, depth) {
+            if (fromId === toId || depth === 50) {
+                return [fromId];
+            }
+            var from = this._modules2[fromId];
+            if (!from) {
+                return null;
+            }
+            // Walk the element's dependencies
+            var dependencies = from.dependencies;
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var path = this._findCyclePath(dependencies[i].id, toId, depth + 1);
+                    if (path !== null) {
+                        path.push(fromId);
+                        return path;
+                    }
+                }
+            }
+            return null;
+        };
+        /**
+         * Create the local 'require' that is passed into modules
+         */
+        ModuleManager.prototype._createRequire = function (moduleIdResolver) {
+            var _this = this;
+            var result = (function (dependencies, callback, errorback) {
+                return _this._relativeRequire(moduleIdResolver, dependencies, callback, errorback);
+            });
+            result.toUrl = function (id) {
+                return _this._config.requireToUrl(moduleIdResolver.resolveModule(id));
+            };
+            result.getStats = function () {
+                return _this.getLoaderEvents();
+            };
+            result.__$__nodeRequire = AMDLoader.global.nodeRequire;
+            return result;
+        };
+        ModuleManager.prototype._loadModule = function (moduleId) {
+            var _this = this;
+            if (this._modules2[moduleId] || this._knownModules2[moduleId]) {
+                // known module
+                return;
+            }
+            this._knownModules2[moduleId] = true;
+            var strModuleId = this._moduleIdProvider.getStrModuleId(moduleId);
+            var paths = this._config.moduleIdToPaths(strModuleId);
+            var scopedPackageRegex = /^@[^\/]+\/[^\/]+$/; // matches @scope/package-name
+            if (this._env.isNode && (strModuleId.indexOf('/') === -1 || scopedPackageRegex.test(strModuleId))) {
+                paths.push('node|' + strModuleId);
+            }
+            var lastPathIndex = -1;
+            var loadNextPath = function (err) {
+                lastPathIndex++;
+                if (lastPathIndex >= paths.length) {
+                    // No more paths to try
+                    _this._onLoadError(moduleId, err);
+                }
+                else {
+                    var currentPath_1 = paths[lastPathIndex];
+                    var recorder_1 = _this.getRecorder();
+                    if (_this._config.isBuild() && currentPath_1 === 'empty:') {
+                        _this._buildInfoPath[moduleId] = currentPath_1;
+                        _this.defineModule(_this._moduleIdProvider.getStrModuleId(moduleId), [], null, null, null);
+                        _this._onLoad(moduleId);
+                        return;
+                    }
+                    recorder_1.record(10 /* BeginLoadingScript */, currentPath_1);
+                    _this._scriptLoader.load(_this, currentPath_1, function () {
+                        if (_this._config.isBuild()) {
+                            _this._buildInfoPath[moduleId] = currentPath_1;
+                        }
+                        recorder_1.record(11 /* EndLoadingScriptOK */, currentPath_1);
+                        _this._onLoad(moduleId);
+                    }, function (err) {
+                        recorder_1.record(12 /* EndLoadingScriptError */, currentPath_1);
+                        loadNextPath(err);
+                    });
+                }
+            };
+            loadNextPath(null);
+        };
+        /**
+         * Resolve a plugin dependency with the plugin loaded & complete
+         * @param module The module that has this dependency
+         * @param pluginDependency The semi-normalized dependency that appears in the module. e.g. 'vs/css!./mycssfile'. Only the plugin part (before !) is normalized
+         * @param plugin The plugin (what the plugin exports)
+         */
+        ModuleManager.prototype._loadPluginDependency = function (plugin, pluginDependency) {
+            var _this = this;
+            if (this._modules2[pluginDependency.id] || this._knownModules2[pluginDependency.id]) {
+                // known module
+                return;
+            }
+            this._knownModules2[pluginDependency.id] = true;
+            // Delegate the loading of the resource to the plugin
+            var load = (function (value) {
+                _this.defineModule(_this._moduleIdProvider.getStrModuleId(pluginDependency.id), [], value, null, null);
+            });
+            load.error = function (err) {
+                _this._config.onError(_this._createLoadError(pluginDependency.id, err));
+            };
+            plugin.load(pluginDependency.pluginParam, this._createRequire(ModuleIdResolver.ROOT), load, this._config.getOptionsLiteral());
+        };
+        /**
+         * Examine the dependencies of module 'module' and resolve them as needed.
+         */
+        ModuleManager.prototype._resolve = function (module) {
+            var _this = this;
+            var dependencies = module.dependencies;
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var dependency = dependencies[i];
+                    if (dependency === RegularDependency.EXPORTS) {
+                        module.exportsPassedIn = true;
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.MODULE) {
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.REQUIRE) {
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    var dependencyModule = this._modules2[dependency.id];
+                    if (dependencyModule && dependencyModule.isComplete()) {
+                        if (dependencyModule.error) {
+                            module.onDependencyError(dependencyModule.error);
+                            return;
+                        }
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    if (this._hasDependencyPath(dependency.id, module.id)) {
+                        console.warn('There is a dependency cycle between \'' + this._moduleIdProvider.getStrModuleId(dependency.id) + '\' and \'' + this._moduleIdProvider.getStrModuleId(module.id) + '\'. The cyclic path follows:');
+                        var cyclePath = this._findCyclePath(dependency.id, module.id, 0) || [];
+                        cyclePath.reverse();
+                        cyclePath.push(dependency.id);
+                        console.warn(cyclePath.map(function (id) { return _this._moduleIdProvider.getStrModuleId(id); }).join(' => \n'));
+                        // Break the cycle
+                        module.unresolvedDependenciesCount--;
+                        continue;
+                    }
+                    // record inverse dependency
+                    this._inverseDependencies2[dependency.id] = this._inverseDependencies2[dependency.id] || [];
+                    this._inverseDependencies2[dependency.id].push(module.id);
+                    if (dependency instanceof PluginDependency) {
+                        var plugin = this._modules2[dependency.pluginId];
+                        if (plugin && plugin.isComplete()) {
+                            this._loadPluginDependency(plugin.exports, dependency);
+                            continue;
+                        }
+                        // Record dependency for when the plugin gets loaded
+                        var inversePluginDeps = this._inversePluginDependencies2.get(dependency.pluginId);
+                        if (!inversePluginDeps) {
+                            inversePluginDeps = [];
+                            this._inversePluginDependencies2.set(dependency.pluginId, inversePluginDeps);
+                        }
+                        inversePluginDeps.push(dependency);
+                        this._loadModule(dependency.pluginId);
+                        continue;
+                    }
+                    this._loadModule(dependency.id);
+                }
+            }
+            if (module.unresolvedDependenciesCount === 0) {
+                this._onModuleComplete(module);
+            }
+        };
+        ModuleManager.prototype._onModuleComplete = function (module) {
+            var _this = this;
+            var recorder = this.getRecorder();
+            if (module.isComplete()) {
+                // already done
+                return;
+            }
+            var dependencies = module.dependencies;
+            var dependenciesValues = [];
+            if (dependencies) {
+                for (var i = 0, len = dependencies.length; i < len; i++) {
+                    var dependency = dependencies[i];
+                    if (dependency === RegularDependency.EXPORTS) {
+                        dependenciesValues[i] = module.exports;
+                        continue;
+                    }
+                    if (dependency === RegularDependency.MODULE) {
+                        dependenciesValues[i] = {
+                            id: module.strId,
+                            config: function () {
+                                return _this._config.getConfigForModule(module.strId);
+                            }
+                        };
+                        continue;
+                    }
+                    if (dependency === RegularDependency.REQUIRE) {
+                        dependenciesValues[i] = this._createRequire(module.moduleIdResolver);
+                        continue;
+                    }
+                    var dependencyModule = this._modules2[dependency.id];
+                    if (dependencyModule) {
+                        dependenciesValues[i] = dependencyModule.exports;
+                        continue;
+                    }
+                    dependenciesValues[i] = null;
+                }
+            }
+            module.complete(recorder, this._config, dependenciesValues);
+            // Fetch and clear inverse dependencies
+            var inverseDeps = this._inverseDependencies2[module.id];
+            this._inverseDependencies2[module.id] = null;
+            if (inverseDeps) {
+                // Resolve one inverse dependency at a time, always
+                // on the lookout for a completed module.
+                for (var i = 0, len = inverseDeps.length; i < len; i++) {
+                    var inverseDependencyId = inverseDeps[i];
+                    var inverseDependency = this._modules2[inverseDependencyId];
+                    inverseDependency.unresolvedDependenciesCount--;
+                    if (inverseDependency.unresolvedDependenciesCount === 0) {
+                        this._onModuleComplete(inverseDependency);
+                    }
+                }
+            }
+            var inversePluginDeps = this._inversePluginDependencies2.get(module.id);
+            if (inversePluginDeps) {
+                // This module is used as a plugin at least once
+                // Fetch and clear these inverse plugin dependencies
+                this._inversePluginDependencies2.delete(module.id);
+                // Resolve plugin dependencies one at a time
+                for (var i = 0, len = inversePluginDeps.length; i < len; i++) {
+                    this._loadPluginDependency(module.exports, inversePluginDeps[i]);
+                }
+            }
+        };
+        return ModuleManager;
+    }());
+    AMDLoader.ModuleManager = ModuleManager;
+})(AMDLoader || (AMDLoader = {}));
+var define;
+var AMDLoader;
+(function (AMDLoader) {
+    var env = new AMDLoader.Environment();
+    var moduleManager = null;
+    var DefineFunc = function (id, dependencies, callback) {
+        if (typeof id !== 'string') {
+            callback = dependencies;
+            dependencies = id;
+            id = null;
+        }
+        if (typeof dependencies !== 'object' || !Array.isArray(dependencies)) {
+            callback = dependencies;
+            dependencies = null;
+        }
+        if (!dependencies) {
+            dependencies = ['require', 'exports', 'module'];
+        }
+        if (id) {
+            moduleManager.defineModule(id, dependencies, callback, null, null);
+        }
+        else {
+            moduleManager.enqueueDefineAnonymousModule(dependencies, callback);
+        }
+    };
+    DefineFunc.amd = {
+        jQuery: true
+    };
+    var _requireFunc_config = function (params, shouldOverwrite) {
+        if (shouldOverwrite === void 0) { shouldOverwrite = false; }
+        moduleManager.configure(params, shouldOverwrite);
+    };
+    var RequireFunc = function () {
+        if (arguments.length === 1) {
+            if ((arguments[0] instanceof Object) && !Array.isArray(arguments[0])) {
+                _requireFunc_config(arguments[0]);
+                return;
+            }
+            if (typeof arguments[0] === 'string') {
+                return moduleManager.synchronousRequire(arguments[0]);
+            }
+        }
+        if (arguments.length === 2 || arguments.length === 3) {
+            if (Array.isArray(arguments[0])) {
+                moduleManager.defineModule(AMDLoader.Utilities.generateAnonymousModule(), arguments[0], arguments[1], arguments[2], null);
+                return;
+            }
+        }
+        throw new Error('Unrecognized require call');
+    };
+    RequireFunc.config = _requireFunc_config;
+    RequireFunc.getConfig = function () {
+        return moduleManager.getConfig().getOptionsLiteral();
+    };
+    RequireFunc.reset = function () {
+        moduleManager = moduleManager.reset();
+    };
+    RequireFunc.getBuildInfo = function () {
+        return moduleManager.getBuildInfo();
+    };
+    RequireFunc.getStats = function () {
+        return moduleManager.getLoaderEvents();
+    };
+    RequireFunc.define = function () {
+        return DefineFunc.apply(null, arguments);
+    };
+    function init() {
+        if (typeof AMDLoader.global.require !== 'undefined' || typeof require !== 'undefined') {
+            var _nodeRequire_1 = (AMDLoader.global.require || require);
+            if (typeof _nodeRequire_1 === 'function' && typeof _nodeRequire_1.resolve === 'function') {
+                // re-expose node's require function
+                var nodeRequire = function (what) {
+                    moduleManager.getRecorder().record(33 /* NodeBeginNativeRequire */, what);
+                    try {
+                        return _nodeRequire_1(what);
+                    }
+                    finally {
+                        moduleManager.getRecorder().record(34 /* NodeEndNativeRequire */, what);
+                    }
+                };
+                AMDLoader.global.nodeRequire = nodeRequire;
+                RequireFunc.nodeRequire = nodeRequire;
+                RequireFunc.__$__nodeRequire = nodeRequire;
+            }
+        }
+        if (env.isNode && !env.isElectronRenderer) {
+            module.exports = RequireFunc;
+            require = RequireFunc;
+        }
+        else {
+            if (!env.isElectronRenderer) {
+                AMDLoader.global.define = DefineFunc;
+            }
+            AMDLoader.global.require = RequireFunc;
+        }
+    }
+    AMDLoader.init = init;
+    if (typeof AMDLoader.global.define !== 'function' || !AMDLoader.global.define.amd) {
+        moduleManager = new AMDLoader.ModuleManager(env, AMDLoader.createScriptLoader(env), DefineFunc, RequireFunc, AMDLoader.Utilities.getHighPerformanceTimestamp());
+        // The global variable require can configure the loader
+        if (typeof AMDLoader.global.require !== 'undefined' && typeof AMDLoader.global.require !== 'function') {
+            RequireFunc.config(AMDLoader.global.require);
+        }
+        // This define is for the local closure defined in node in the case that the loader is concatenated
+        define = function () {
+            return DefineFunc.apply(null, arguments);
+        };
+        define.amd = DefineFunc.amd;
+        if (typeof doNotInitLoader === 'undefined') {
+            init();
+        }
+    }
+})(AMDLoader || (AMDLoader = {}));
+
+//# sourceMappingURL=loader.js.map

+ 9 - 0
o2web/source/x_component_cms_ScriptDesigner/$Main/default/toolbars.html

@@ -63,6 +63,15 @@
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
 
 
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
 
 
 </div>
 </div>

+ 55 - 9
o2web/source/x_component_cms_ScriptDesigner/Main.js

@@ -366,17 +366,57 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.scriptTab.pages.each(function(page){
+            var editor = page.script.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.script.editor.editor;
+            var editor = page.script.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -384,6 +424,7 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -397,26 +438,31 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
     changeEditorStyle: function(node){
     changeEditorStyle: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
-        var editorData = null;
+        //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
-            if (!editorData) editorData = page.script.editor.editorData;
-            var editor = page.script.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            //if (!editorData) editorData = page.script.editor.editorData;
+            var editor = page.script.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
-
+        //if (!editorData) editorData = MWF.editorData;
+        //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
 
 
-        editorData.javascriptEditor.theme = value;
-
-        MWF.UD.putData("editor", editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 33 - 3
o2web/source/x_component_cms_ScriptDesigner/Script.js

@@ -104,12 +104,20 @@ MWF.xApplication.cms.ScriptDesigner.Script = new Class({
             if (this.data.text) {
             if (this.data.text) {
                 this.editor.editor.setValue(this.data.text);
                 this.editor.editor.setValue(this.data.text);
             }
             }
-            this.editor.editor.on("change", function (e) {
-                if (!this.isChanged) {
+            this.editor.addEditorEvent("change", function(){
+                if (!this.isChanged){
                     this.isChanged = true;
                     this.isChanged = true;
-                    this.page.textNode.set("text", " * " + this.page.textNode.get("text"));
+                    this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
                 }
                 }
             }.bind(this));
             }.bind(this));
+
+            // this.editor.editor.on("change", function (e) {
+            //     if (!this.isChanged) {
+            //         this.isChanged = true;
+            //         this.page.textNode.set("text", " * " + this.page.textNode.get("text"));
+            //     }
+            // }.bind(this));
+
             this.editor.addEvent("save", function () {
             this.editor.addEvent("save", function () {
                 this.save();
                 this.save();
             }.bind(this));
             }.bind(this));
@@ -151,6 +159,28 @@ MWF.xApplication.cms.ScriptDesigner.Script = new Class({
                     }
                     }
                 }
                 }
             }
             }
+
+            if(this.designer.editorSelectNode) {
+                var options = this.designer.editorSelectNode.options;
+                for (var i = 0; i < options.length; i++) {
+                    var option = options[i];
+                    if (option.value == this.editor.options.type) {
+                        option.set("selected", true);
+                        break;
+                    }
+                }
+            }
+
+            if (this.designer.styleSelectNode && this.designer.monacoStyleSelectNode){
+                if (this.editor.options.type=="ace"){
+                    this.designer.monacoStyleSelectNode.hide();
+                    this.designer.styleSelectNode.show();
+                }else{
+                    this.designer.monacoStyleSelectNode.show();
+                    this.designer.styleSelectNode.hide();
+                }
+            }
+
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

+ 22 - 4
o2web/source/x_component_portal_PageDesigner/Script.js

@@ -545,10 +545,18 @@ MWF.xApplication.portal.PageDesigner.Script = new Class({
             },
             },
             "onPostLoad": function(){
             "onPostLoad": function(){
                 this.editor = this.jsEditor.editor;
                 this.editor = this.jsEditor.editor;
-                this.editor.on("change", function() {
+
+                this.jsEditor.addEditorEvent("change", function() {
                     this.fireEvent("change");
                     this.fireEvent("change");
                 }.bind(this));
                 }.bind(this));
-                this.editor.resize();
+                this.jsEditor.addEditorEvent("blur", function() {
+                    this.fireEvent("blur");
+                }.bind(this));
+
+                // this.editor.on("change", function() {
+                //     this.fireEvent("change");
+                // }.bind(this));
+                this.jsEditor.resize();
                 if (callback) callback();
                 if (callback) callback();
                 this.fireEvent("postLoad");
                 this.fireEvent("postLoad");
             }.bind(this),
             }.bind(this),
@@ -842,12 +850,22 @@ MWF.xApplication.portal.PageDesigner.Script.Item = new Class({
             "onPostLoad": function(){
             "onPostLoad": function(){
                 this.editor = this.jsEditor.editor;
                 this.editor = this.jsEditor.editor;
                 this.editor.id = "1";
                 this.editor.id = "1";
-                this.editor.on("change", function() {
+
+                this.jsEditor.addEditorEvent("change", function() {
                     var text = this.scriptPage.textNode.get("text");
                     var text = this.scriptPage.textNode.get("text");
                     if (text.substr(0,1)!=="*") this.scriptPage.textNode.set("text","*"+ text);
                     if (text.substr(0,1)!=="*") this.scriptPage.textNode.set("text","*"+ text);
                     this.change();
                     this.change();
                 }.bind(this));
                 }.bind(this));
-                this.editor.resize();
+                this.jsEditor.addEditorEvent("blur", function() {
+                    this.fireEvent("blur");
+                }.bind(this));
+
+                // this.editor.on("change", function() {
+                //     var text = this.scriptPage.textNode.get("text");
+                //     if (text.substr(0,1)!=="*") this.scriptPage.textNode.set("text","*"+ text);
+                //     this.change();
+                // }.bind(this));
+                this.jsEditor.resize();
             }.bind(this),
             }.bind(this),
             "onSave": function(){
             "onSave": function(){
                 this.save();
                 this.save();

+ 20 - 0
o2web/source/x_component_portal_ScriptDesigner/$Main/default/toolbars.html

@@ -25,6 +25,15 @@
         <option value="16px">16px</option>
         <option value="16px">16px</option>
         <option value="17px">17px</option>
         <option value="17px">17px</option>
         <option value="18px">18px</option>
         <option value="18px">18px</option>
+        <option value="20px">20px</option>
+        <option value="22px">22px</option>
+        <option value="24px">24px</option>
+        <option value="26px">26px</option>
+        <option value="28px">28px</option>
+        <option value="30px">30px</option>
+        <option value="32px">32px</option>
+        <option value="34px">34px</option>
+        <option value="36px">36px</option>
     </select></div>
     </select></div>
 
 
     <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="theme">
     <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="theme">
@@ -63,6 +72,17 @@
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="vibrant_ink">vibrant_ink</option>
         <option value="xcode">xcode</option>
         <option value="xcode">xcode</option>
     </select></div>
     </select></div>
+    <div style="float: right; margin-right: 20px">样式:<select MWFnodetype="monaco-theme">
+        <option value="vs">Visual Studio</option>
+        <option value="vs-dark">Visual Studio Dark</option>
+        <option value="hc-black">High Contrast Dark</option>
+    </select></div>
+
+    <div style="float: right; margin-right: 20px">脚本编辑器:<select MWFnodetype="editor">
+        <option selected value="ace">ace</option>
+        <option value="monaco">monaco</option>
+    </select></div>
+
 
 
 
 
 </div>
 </div>

+ 51 - 5
o2web/source/x_component_portal_ScriptDesigner/Main.js

@@ -358,17 +358,57 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
                     _self.changeFontSize(this);
                     _self.changeFontSize(this);
                 });
                 });
 
 
+                this.editorSelectNode = toolbarNode.getElement("select[MWFnodetype='editor']");
+                this.editorSelectNode.addEvent("change", function(){
+                    _self.changeEditor(this);
+                });
+
+                this.monacoStyleSelectNode = toolbarNode.getElement("select[MWFnodetype='monaco-theme']");
+                this.monacoStyleSelectNode.addEvent("change", function(){
+                    _self.changeEditorStyle(this);
+                });
+
 				if (callback) callback();
 				if (callback) callback();
 			}.bind(this));
 			}.bind(this));
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+    changeEditor: function(node){
+        var idx = node.selectedIndex;
+        var value = node.options[idx].value;
+
+        if (!MWF.editorData){
+            MWF.editorData = {
+                "javascriptEditor": {
+                    "monaco_theme": "vs",
+                    "theme": "tomorrow",
+                    "fontSize" : "12px"
+                }
+            };
+        }
+        MWF.editorData.javascriptEditor["editor"] = value;
+        MWF.UD.putData("editor", MWF.editorData);
+
+        this.scriptTab.pages.each(function(page){
+            var editor = page.script.editor;
+            if (editor) editor.changeEditor(value);
+        }.bind(this));
+
+        if (value=="ace"){
+            this.monacoStyleSelectNode.hide();
+            this.styleSelectNode.show();
+        }else{
+            this.monacoStyleSelectNode.show();
+            this.styleSelectNode.hide();
+        }
+
+    },
     changeFontSize: function(node){
     changeFontSize: function(node){
         var idx = node.selectedIndex;
         var idx = node.selectedIndex;
         var value = node.options[idx].value;
         var value = node.options[idx].value;
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.invoke.editor.editorData;
             //if (!editorData) editorData = page.invoke.editor.editorData;
-            var editor = page.script.editor.editor;
+            var editor = page.script.editor;
             if (editor) editor.setFontSize(value);
             if (editor) editor.setFontSize(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
@@ -376,6 +416,7 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
@@ -392,23 +433,28 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
         //var editorData = null;
         //var editorData = null;
         this.scriptTab.pages.each(function(page){
         this.scriptTab.pages.each(function(page){
             //if (!editorData) editorData = page.script.editor.editorData;
             //if (!editorData) editorData = page.script.editor.editorData;
-            var editor = page.script.editor.editor;
-            if (editor) editor.setTheme("ace/theme/"+value);
+            var editor = page.script.editor;
+            if (editor) editor.setTheme(value);
         }.bind(this));
         }.bind(this));
         //if (!editorData) editorData = MWF.editorData;
         //if (!editorData) editorData = MWF.editorData;
         //editorData.javascriptEditor.theme = value;
         //editorData.javascriptEditor.theme = value;
         if (!MWF.editorData){
         if (!MWF.editorData){
             MWF.editorData = {
             MWF.editorData = {
                 "javascriptEditor": {
                 "javascriptEditor": {
+                    "monaco_theme": "vs",
                     "theme": "tomorrow",
                     "theme": "tomorrow",
                     "fontSize" : "12px"
                     "fontSize" : "12px"
                 }
                 }
             };
             };
         }
         }
-        MWF.editorData.javascriptEditor.theme = value;
 
 
-        MWF.UD.putData("editor", MWF.editorData);
+        if (MWF.editorData.javascriptEditor.editor === "monaco"){
+            MWF.editorData.javascriptEditor.monaco_theme = value;
+        }else{
+            MWF.editorData.javascriptEditor.theme = value;
+        }
 
 
+        MWF.UD.putData("editor", MWF.editorData);
     },
     },
 	getFormToolbarHTML: function(callback){
 	getFormToolbarHTML: function(callback){
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";
 		var toolbarUrl = this.path+this.options.style+"/toolbars.html";

+ 24 - 2
o2web/source/x_component_portal_ScriptDesigner/Script.js

@@ -102,12 +102,18 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
             if (this.data.text){
             if (this.data.text){
                 this.editor.editor.setValue(this.data.text);
                 this.editor.editor.setValue(this.data.text);
             }
             }
-            this.editor.editor.on("change", function(e){
+            this.editor.addEditorEvent("change", function(){
                 if (!this.isChanged){
                 if (!this.isChanged){
                     this.isChanged = true;
                     this.isChanged = true;
                     this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
                     this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
                 }
                 }
             }.bind(this));
             }.bind(this));
+            // this.editor.editor.on("change", function(e){
+            //     if (!this.isChanged){
+            //         this.isChanged = true;
+            //         this.page.textNode.set("text", " * "+this.page.textNode.get("text"));
+            //     }
+            // }.bind(this));
             this.editor.addEvent("save", function(){
             this.editor.addEvent("save", function(){
                 this.save();
                 this.save();
             }.bind(this));
             }.bind(this));
@@ -135,7 +141,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
                 }
                 }
             }
             }
 
 
-            var options = this.designer.fontsizeSelectNode.options;
+            options = this.designer.fontsizeSelectNode.options;
             for (var i=0; i<options.length; i++){
             for (var i=0; i<options.length; i++){
                 var option = options[i];
                 var option = options[i];
                 if (option.value==this.editor.fontSize){
                 if (option.value==this.editor.fontSize){
@@ -143,6 +149,22 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
                     break;
                     break;
                 }
                 }
             }
             }
+            options = this.designer.editorSelectNode.options;
+            for (var i=0; i<options.length; i++){
+                var option = options[i];
+                if (option.value==this.editor.options.type){
+                    option.set("selected", true);
+                    break;
+                }
+            }
+
+            if (this.editor.options.type=="ace"){
+                this.designer.monacoStyleSelectNode.hide();
+                this.designer.styleSelectNode.show();
+            }else{
+                this.designer.monacoStyleSelectNode.show();
+                this.designer.styleSelectNode.hide();
+            }
         }.bind(this));
         }.bind(this));
 
 
         if (this.options.showTab) this.page.showTabIm();
         if (this.options.showTab) this.page.showTabIm();

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä