提交 9c12f10a 编写于 作者: NoSubject's avatar NoSubject

修复流程脚本在使用monaco编辑器时,点击保存按钮无法保存的问题

上级 4ce7a8fd
......@@ -373,7 +373,7 @@ o2.widget.JavascriptEditor = new Class({
var ev = name;
switch (ev) {
case "change": ev = "onDidChangeModelContent"; break;
case "blue": ev = "onDidBlurEditorText"; break;
case "blur": ev = "onDidBlurEditorText"; break;
}
if (this.editor[ev]) this.editor[ev](fun);
......
<div id="MWFFormToolbar">
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="save.gif" title="保存数据字典" MWFButtonAction="saveScript" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="saveNew.gif" title="数据字典另存为" MWFButtonAction="saveScriptAs" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formExplode.gif" title="数据字典导出" MWFButtonAction="scriptExplode" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formImplode.gif" title="数据字典导入" MWFButtonAction="scriptImplode" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="save.gif" title="保存脚本" MWFButtonAction="saveScript" MWFButtonText=""></span>
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="saveNew.gif" title="数据字典另存为" MWFButtonAction="saveScriptAs" MWFButtonText=""></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarSeparator"></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="formExplode.gif" title="数据字典导出" MWFButtonAction="scriptExplode" MWFButtonText=""></span>-->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="formImplode.gif" title="数据字典导入" MWFButtonAction="scriptImplode" MWFButtonText=""></span>-->
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="scriptHelp" MWFButtonText="" id="MWFScriptAutoCode"></span>
<!-- <span MWFnodetype="MWFToolBarSeparator"></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="scriptHelp" MWFButtonText="" id="MWFScriptAutoCode"></span>-->
<span MWFnodetype="MWFToolBarSeparator"></span>
<input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
......@@ -85,4 +85,4 @@
</div>
\ No newline at end of file
</div>
......@@ -83,8 +83,8 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
this.setPropertyContent();
this.setIncludeNode();
if (this.editor.editor){
this.editor.editor.focus();
if (this.editor){
this.editor.focus();
//this.editor.editor.navigateFileStart();
}
}.bind(this));
......@@ -100,7 +100,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
this.editor.load(function(){
if (this.data.text){
this.editor.editor.setValue(this.data.text);
this.editor.setValue(this.data.text);
}
this.editor.addEditorEvent("change", function(){
if (!this.isChanged){
......@@ -117,20 +117,20 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
this.editor.addEvent("save", function(){
this.save();
}.bind(this));
this.editor.addEvent("reference", function(editor, e, e1){
if (!this.scriptReferenceMenu){
MWF.require("MWF.widget.ScriptHelp", function(){
this.scriptReferenceMenu = new MWF.widget.ScriptHelp(null, this.editor.editor, {
"onPostLoad": function(){
this.showReferenceMenu();
}.bind(this)
});
this.scriptReferenceMenu.getEditor = function(){return this.editor.editor;}.bind(this)
}.bind(this));
}else{
this.showReferenceMenu();
}
}.bind(this));
// this.editor.addEvent("reference", function(editor, e, e1){
// if (!this.scriptReferenceMenu){
// MWF.require("MWF.widget.ScriptHelp", function(){
// this.scriptReferenceMenu = new MWF.widget.ScriptHelp(null, this.editor.editor, {
// "onPostLoad": function(){
// this.showReferenceMenu();
// }.bind(this)
// });
// this.scriptReferenceMenu.getEditor = function(){return this.editor.editor;}.bind(this)
// }.bind(this));
// }else{
// this.showReferenceMenu();
// }
// }.bind(this));
var options = this.designer.styleSelectNode.options;
for (var i=0; i<options.length; i++){
......@@ -202,7 +202,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
var tabSize = this.tab.tabNodeContainer.getSize();
var y = size.y - tabSize.y;
this.areaNode.setStyle("height", ""+y+"px");
if (this.editor) if (this.editor.editor) this.editor.editor.resize();
if (this.editor) this.editor.resize();
},
addInclude: function(){
......@@ -234,7 +234,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
this.data.alias = alias;
this.data.description = description;
this.data.validated = validated;
this.data.text = this.editor.editor.getValue();
this.data.text = this.editor.getValue();
this.isSave = true;
this.designer.actions.saveScript(this.data, function(json){
......@@ -262,17 +262,17 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
},
saveSilence: function(callback){
if (!this.isSave){
var session = this.editor.editor.getSession();
var annotations = session.getAnnotations();
var validated = true;
for (var i=0; i<annotations.length; i++){
if (annotations[i].type=="error"){
validated = false;
break;
}
}
// var session = this.editor.editor.getSession();
// var annotations = session.getAnnotations();
// var validated = true;
// for (var i=0; i<annotations.length; i++){
// if (annotations[i].type=="error"){
// validated = false;
// break;
// }
// }
var validated = this.editor.validated();
if( this.designer.currentScript == this ){
var name = this.designer.propertyNameNode.get("value");
var alias = this.designer.propertyAliasNode.get("value");
......@@ -286,7 +286,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
this.data.description = description;
this.data.validated = validated;
}
this.data.text = this.editor.editor.getValue();
this.data.text = this.editor.getValue();
this.isSave = true;
this.designer.actions.saveScript(this.data, function(json){
......
......@@ -74,15 +74,15 @@ MWF.xApplication.process.ProcessDesigner.widget.ScriptText = new Class({
// this.fireEvent("change", [value]);
// }.bind(this));
this.createScriptReferenceMenu();
this.editor.addEvent("reference", function(editor, e, e1){
if (!this.scriptReferenceMenu){
this.createScriptReferenceMenu(this.showReferenceMenu.bind(this));
}else{
this.showReferenceMenu();
}
}.bind(this));
// this.createScriptReferenceMenu();
//
// this.editor.addEvent("reference", function(editor, e, e1){
// if (!this.scriptReferenceMenu){
// this.createScriptReferenceMenu(this.showReferenceMenu.bind(this));
// }else{
// this.showReferenceMenu();
// }
// }.bind(this));
if (callback) callback();
......@@ -167,4 +167,4 @@ MWF.xApplication.process.ProcessDesigner.widget.ScriptText = new Class({
//getValue()
});
\ No newline at end of file
});
<div id="MWFFormToolbar">
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="save.gif" title="保存数据字典" MWFButtonAction="saveScript" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="saveNew.gif" title="数据字典另存为" MWFButtonAction="saveScriptAs" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formExplode.gif" title="数据字典导出" MWFButtonAction="scriptExplode" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="formImplode.gif" title="数据字典导入" MWFButtonAction="scriptImplode" MWFButtonText=""></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="save.gif" title="保存脚本" MWFButtonAction="saveScript" MWFButtonText=""></span>
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="saveNew.gif" title="数据字典另存为" MWFButtonAction="saveScriptAs" MWFButtonText=""></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarSeparator"></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="formExplode.gif" title="数据字典导出" MWFButtonAction="scriptExplode" MWFButtonText=""></span>-->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="formImplode.gif" title="数据字典导入" MWFButtonAction="scriptImplode" MWFButtonText=""></span>-->
<span MWFnodetype="MWFToolBarSeparator"></span>
<span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="scriptHelp" MWFButtonText="" id="MWFScriptAutoCode"></span>
<!-- <span MWFnodetype="MWFToolBarSeparator"></span>-->
<!-- -->
<!-- <span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="scriptHelp" MWFButtonText="" id="MWFScriptAutoCode"></span>-->
<span MWFnodetype="MWFToolBarSeparator"></span>
<input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
......@@ -74,4 +74,4 @@
<option value="monaco">monaco</option>
</select></div>
</div>
\ No newline at end of file
</div>
......@@ -278,17 +278,17 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
},
saveSilence: function(callback){
if (!this.isSave){
var session = this.editor.editor.getSession();
var annotations = session.getAnnotations();
var validated = true;
for (var i=0; i<annotations.length; i++){
if (annotations[i].type=="error"){
validated = false;
break;
}
}
// var session = this.editor.editor.getSession();
// var annotations = session.getAnnotations();
// var validated = true;
// for (var i=0; i<annotations.length; i++){
// if (annotations[i].type=="error"){
// validated = false;
// break;
// }
// }
var validated = this.editor.validated();
if( this.designer.currentScript == this ) {
var name = this.designer.propertyNameNode.get("value");
var alias = this.designer.propertyAliasNode.get("value");
......@@ -302,7 +302,7 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
this.data.description = description;
this.data.validated = validated;
}
this.data.text = this.editor.editor.getValue();
this.data.text = this.editor.getValue();
this.isSave = true;
this.designer.actions.saveScript(this.data, function(json){
......@@ -331,4 +331,4 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
explode: function(){},
implode: function(){}
});
\ No newline at end of file
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册