提交 1da88ff4 编写于 作者: NoSubject's avatar NoSubject

新政脚本编辑器monaco

上级 6cddaa67
......@@ -147,6 +147,7 @@
var MSXML = function(){ return new ActiveXObject('Microsoft.XMLHTTP'); };
return _attempt(XMLHTTP, MSXML2, MSXML);
})();
this.o2.request = _request;
var _returnBase = function(number, base) {
return (number).toString(base).toUpperCase();
......@@ -290,13 +291,13 @@
_removeListener(xhr, 'load', _checkCssLoaded);
_removeListener(xhr, 'error', _checkCssErrorLoaded);
if (err) {failure(xhr); return}
if (err) {if (failure) failure(xhr); return}
var status = xhr.status;
status = (status == 1223) ? 204 : status;
if ((status >= 200 && status < 300))
success(xhr);
if (success) success(xhr);
else if ((status >= 300 && status < 400))
failure(xhr);
if (failure) failure(xhr);
else
failure(xhr);
if (completed) completed(xhr);
......@@ -308,7 +309,7 @@
_addListener(xhr, "readystatechange", _checkCssLoaded);
xhr.send();
};
this.o2.xhr_get = _xhr_get;
var _loadSequence = function(ms, cb, op, n, thisLoaded, loadSingle, uuid, fun){
loadSingle(ms[n], function(module){
if (module) thisLoaded.push(module);
......@@ -343,7 +344,7 @@
"mootools": ["/o2_lib/mootools/mootools-1.6.0_all.js"],
"ckeditor": ["/o2_lib/htmleditor/ckeditor4114/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"],
"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"],
......
......@@ -4,10 +4,18 @@ o2.widget.MWFRaphael = MWFRaphael = {
if (window.Raphael){
if (callback) callback();
}else{
COMMON.AjaxModule.load("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(){
......
......@@ -68,6 +68,7 @@ o2.widget.ScriptArea = new Class({
}
},
maxSize: function(){
debugger;
var obj = this.options.maxObj;
var coordinates = obj.getCoordinates(obj.getOffsetParent());
......@@ -80,8 +81,8 @@ o2.widget.ScriptArea = new Class({
"position": "absolute",
// "top": coordinates.top,
// "left": coordinates.left,
"top": "0px",
"left": "0px",
"top": coordinates.top+"px",
"left": coordinates.left+"px",
"width": coordinates.width,
"height": coordinates.height-2,
"z-index": 20001
......@@ -97,7 +98,8 @@ o2.widget.ScriptArea = new Class({
returnSize: function(){
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.setStyles({
"position": "static",
......
......@@ -2,15 +2,20 @@ o2.widget = o2.widget || {};
o2.widget.ace = {
//"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
//"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
"callbackList": [],
"load": function(callback){
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{
if (callback) callback();
}
......
......@@ -11,8 +11,8 @@ o2.widget.codemirror = {
"php": COMMON.contentPath+"/res/framework/codemirror/mode/php/php.js"
},
"addon": {
},
"load": function(callback){
var jsLoaded = false;
......@@ -42,9 +42,5 @@ o2.widget.codemirror = {
if (callback) callback();
}
}
};
};
\ No newline at end of file
o2.widget = o2.widget || {};
o2.widget.monaco = {
//"ace": COMMON.contentPath+"/res/framework/ace/src-min/ace.js",
//"tools": COMMON.contentPath+"/res/framework/ace/src-min/ext-language_tools.js",
"callbackList": [],
"load": 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();
// var editor = monaco.editor.create(document.getElementById('container'), {
// value: [
// 'function x() {',
// '\tconsole.log("Hello world!");',
// '}'
// ].join('\n'),
// language: 'javascript'
// });
});
}.bind(this));
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();
}
......
此差异已折叠。
......@@ -63,6 +63,15 @@
<option value="vibrant_ink">vibrant_ink</option>
<option value="xcode">xcode</option>
</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>
\ No newline at end of file
......@@ -366,17 +366,57 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
_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();
}.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){
var idx = node.selectedIndex;
var value = node.options[idx].value;
//var editorData = null;
this.scriptTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.script.editor.editor;
var editor = page.script.editor;
if (editor) editor.setFontSize(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
......@@ -384,6 +424,7 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"fontSize" : "12px"
}
......@@ -397,26 +438,31 @@ MWF.xApplication.cms.ScriptDesigner.Main = new Class({
changeEditorStyle: function(node){
var idx = node.selectedIndex;
var value = node.options[idx].value;
var editorData = null;
//var editorData = null;
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));
//if (!editorData) editorData = MWF.editorData;
//editorData.javascriptEditor.theme = value;
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"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){
var toolbarUrl = this.path+this.options.style+"/toolbars.html";
......
......@@ -159,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));
if (this.options.showTab) this.page.showTabIm();
......
......@@ -25,6 +25,15 @@
<option value="16px">16px</option>
<option value="17px">17px</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>
<div style="float: right; margin-right: 20px">样式:<select MWFnodetype="theme">
......@@ -63,6 +72,17 @@
<option value="vibrant_ink">vibrant_ink</option>
<option value="xcode">xcode</option>
</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>
\ No newline at end of file
......@@ -358,17 +358,57 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
_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();
}.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){
var idx = node.selectedIndex;
var value = node.options[idx].value;
//var editorData = null;
this.scriptTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.script.editor.editor;
var editor = page.script.editor;
if (editor) editor.setFontSize(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
......@@ -376,6 +416,7 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"fontSize" : "12px"
}
......@@ -392,23 +433,28 @@ MWF.xApplication.portal.ScriptDesigner.Main = new Class({
//var editorData = null;
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);
var editor = page.script.editor;
if (editor) editor.setTheme(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
//editorData.javascriptEditor.theme = value;
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"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){
var toolbarUrl = this.path+this.options.style+"/toolbars.html";
......
......@@ -141,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++){
var option = options[i];
if (option.value==this.editor.fontSize){
......@@ -149,6 +149,22 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
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));
if (this.options.showTab) this.page.showTabIm();
......
......@@ -63,6 +63,15 @@
<option value="vibrant_ink">vibrant_ink</option>
<option value="xcode">xcode</option>
</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>
\ No newline at end of file
......@@ -370,17 +370,57 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
_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();
}.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){
var idx = node.selectedIndex;
var value = node.options[idx].value;
//var editorData = null;
this.scriptTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.script.editor.editor;
var editor = page.script.editor;
if (editor) editor.setFontSize(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
......@@ -388,6 +428,7 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"fontSize" : "12px"
}
......@@ -404,23 +445,28 @@ MWF.xApplication.process.ScriptDesigner.Main = new Class({
//var editorData = null;
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);
var editor = page.script.editor;
if (editor) editor.setTheme(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
//editorData.javascriptEditor.theme = value;
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"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){
var toolbarUrl = this.path+this.options.style+"/toolbars.html";
......
......@@ -159,6 +159,23 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
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));
},
......
......@@ -6,6 +6,7 @@ MWF.APPDSMD = MWF.xApplication.query.StatementDesigner;
MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, false);
//MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
MWF.xDesktop.requireApp("query.TableDesigner", "Property", null, false);
o2.require("o2.widget.JavascriptEditor", null, false);
MWF.xApplication.query.StatementDesigner.Statement = new Class({
Extends: MWF.widget.Common,
......@@ -156,10 +157,11 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
},
loadStatementScriptEditor: function(){
if (! this.scriptEditor){
debugger;
o2.require("o2.widget.ScriptArea", function(){
this.scriptEditor = new o2.widget.ScriptArea(this.scriptArea, {
"isbind": false,
"maxObj": this.designer.content,
"maxObj": this.designer.designNode,
"title": this.designer.lp.scriptTitle,
"onChange": function(){
this.json.scriptText = this.scriptEditor.toJson().code;
......@@ -209,6 +211,7 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
this.json.data = this.editor.editor.getValue();
this.editor.addEditorEvent("change", function(){
debugger;
this.data.data = this.editor.getValue();
this.checkJpqlType();
}.bind(this));
......
......@@ -64,5 +64,14 @@
<option value="xcode">xcode</option>
</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>
\ No newline at end of file
......@@ -96,7 +96,7 @@ MWF.xApplication.service.AgentDesigner.Agent = new Class({
this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
this.editor = new MWF.widget.JavascriptEditor(this.areaNode, {"runtime": "service"});
this.editor.load(function(){
if (this.data.text){
this.editor.editor.setValue(this.data.text);
......@@ -165,6 +165,23 @@ MWF.xApplication.service.AgentDesigner.Agent = new Class({
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));
if (this.options.showTab) this.page.showTabIm();
......
......@@ -350,17 +350,57 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
_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();
}.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.agentTab.pages.each(function(page){
var editor = page.agent.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){
var idx = node.selectedIndex;
var value = node.options[idx].value;
//var editorData = null;
this.agentTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.agent.editor.editor;
var editor = page.agent.editor;
if (editor) editor.setFontSize(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
......@@ -368,6 +408,7 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"fontSize" : "12px"
}
......@@ -383,24 +424,29 @@ MWF.xApplication.service.AgentDesigner.Main = new Class({
var value = node.options[idx].value;
//var editorData = null;
this.agentTab.pages.each(function(page){
//if (!editorData) editorData = page.agent.editor.editorData;
var editor = page.agent.editor.editor;
if (editor) editor.setTheme("ace/theme/"+value);
//if (!editorData) editorData = page.script.editor.editorData;
var editor = page.agent.editor;
if (editor) editor.setTheme(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
//editorData.javaagentEditor.theme = value;
//editorData.javascriptEditor.theme = value;
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"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){
var toolbarUrl = this.path+this.options.style+"/toolbars.html";
......
......@@ -62,4 +62,14 @@
<option value="xcode">xcode</option>
</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>
\ No newline at end of file
......@@ -95,7 +95,7 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
this.editor = new MWF.widget.JavascriptEditor(this.areaNode, {"runtime": "service"});
this.editor.load(function(){
if (this.data.text){
this.editor.editor.setValue(this.data.text);
......@@ -172,6 +172,22 @@ MWF.xApplication.service.InvokeDesigner.Invoke = new Class({
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));
if (this.options.showTab) this.page.showTabIm();
......
......@@ -350,17 +350,58 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
_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();
}.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.invokeTab.pages.each(function(page){
var editor = page.invoke.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){
var idx = node.selectedIndex;
var value = node.options[idx].value;
//var editorData = null;
this.invokeTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.invoke.editor.editor;
var editor = page.invoke.editor;
if (editor) editor.setFontSize(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
......@@ -368,6 +409,7 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"fontSize" : "12px"
}
......@@ -383,24 +425,29 @@ MWF.xApplication.service.InvokeDesigner.Main = new Class({
var value = node.options[idx].value;
//var editorData = null;
this.invokeTab.pages.each(function(page){
//if (!editorData) editorData = page.invoke.editor.editorData;
var editor = page.invoke.editor.editor;
if (editor) editor.setTheme("ace/theme/"+value);
//if (!editorData) editorData = page.script.editor.editorData;
var editor = page.invoke.editor;
if (editor) editor.setTheme(value);
}.bind(this));
//if (!editorData) editorData = MWF.editorData;
//editorData.javainvokeEditor.theme = value;
//editorData.javascriptEditor.theme = value;
if (!MWF.editorData){
MWF.editorData = {
"javascriptEditor": {
"monaco_theme": "vs",
"theme": "tomorrow",
"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){
var toolbarUrl = this.path+this.options.style+"/toolbars.html";
......
var resources = {
"getEntityManagerContainer": function(){ return {}; },
"getContext": function(){ return {}; },
"getApplications": function(){ return {}; },
"getOrganization": function(){
return {
group: function(){ return {}; },
identity: function(){ return {}; },
person: function(){ return {}; },
personAttribute: function(){ return {}; },
role: function(){ return {}; },
unit: function(){ return {}; },
unitAttribute: function(){ return {}; },
unitDuty: function(){ return {}; }
};
},
"getWebservicesClient": function(){ return {}; }
};
var effectivePerson = this.effectivePerson = {};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册