Procházet zdrojové kódy

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

huqi před 5 roky
rodič
revize
6a03adf311

+ 1 - 1
o2web/source/o2_core/o2/widget/JavascriptEditor.js

@@ -373,7 +373,7 @@ o2.widget.JavascriptEditor = new Class({
                     var ev = name;
                     var ev = name;
                     switch (ev) {
                     switch (ev) {
                         case "change": ev = "onDidChangeModelContent"; break;
                         case "change": ev = "onDidChangeModelContent"; break;
-                        case "blue": ev = "onDidBlurEditorText"; break;
+                        case "blur": ev = "onDidBlurEditorText"; break;
 
 
                     }
                     }
                     if (this.editor[ev]) this.editor[ev](fun);
                     if (this.editor[ev]) this.editor[ev](fun);

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

@@ -1,16 +1,16 @@
 <div id="MWFFormToolbar">
 <div id="MWFFormToolbar">
 	<span MWFnodetype="MWFToolBarSeparator"></span>
 	<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>
     <span MWFnodetype="MWFToolBarSeparator"></span>
     <input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
     <input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
@@ -85,4 +85,4 @@
 
 
 
 
 
 
-</div>
+</div>

+ 30 - 30
o2web/source/x_component_portal_ScriptDesigner/Script.js

@@ -83,8 +83,8 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
             this.setPropertyContent();
             this.setPropertyContent();
             this.setIncludeNode();
             this.setIncludeNode();
 
 
-            if (this.editor.editor){
-                this.editor.editor.focus();
+            if (this.editor){
+                this.editor.focus();
                 //this.editor.editor.navigateFileStart();
                 //this.editor.editor.navigateFileStart();
             }
             }
         }.bind(this));
         }.bind(this));
@@ -100,7 +100,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
         this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
         this.editor = new MWF.widget.JavascriptEditor(this.areaNode);
         this.editor.load(function(){
         this.editor.load(function(){
             if (this.data.text){
             if (this.data.text){
-                this.editor.editor.setValue(this.data.text);
+                this.editor.setValue(this.data.text);
             }
             }
             this.editor.addEditorEvent("change", function(){
             this.editor.addEditorEvent("change", function(){
                 if (!this.isChanged){
                 if (!this.isChanged){
@@ -117,20 +117,20 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
             this.editor.addEvent("save", function(){
             this.editor.addEvent("save", function(){
                 this.save();
                 this.save();
             }.bind(this));
             }.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;
             var options = this.designer.styleSelectNode.options;
             for (var i=0; i<options.length; i++){
             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 tabSize = this.tab.tabNodeContainer.getSize();
         var y = size.y - tabSize.y;
         var y = size.y - tabSize.y;
         this.areaNode.setStyle("height", ""+y+"px");
         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(){
     addInclude: function(){
@@ -234,7 +234,7 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
             this.data.alias = alias;
             this.data.alias = alias;
             this.data.description = description;
             this.data.description = description;
             this.data.validated = validated;
             this.data.validated = validated;
-            this.data.text = this.editor.editor.getValue();
+            this.data.text = this.editor.getValue();
 
 
             this.isSave = true;
             this.isSave = true;
             this.designer.actions.saveScript(this.data, function(json){
             this.designer.actions.saveScript(this.data, function(json){
@@ -262,17 +262,17 @@ MWF.xApplication.portal.ScriptDesigner.Script = new Class({
     },
     },
     saveSilence: function(callback){
     saveSilence: function(callback){
         if (!this.isSave){
         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 ){
             if( this.designer.currentScript == this ){
                 var name = this.designer.propertyNameNode.get("value");
                 var name = this.designer.propertyNameNode.get("value");
                 var alias = this.designer.propertyAliasNode.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.description = description;
                 this.data.validated = validated;
                 this.data.validated = validated;
             }
             }
-            this.data.text = this.editor.editor.getValue();
+            this.data.text = this.editor.getValue();
 
 
             this.isSave = true;
             this.isSave = true;
             this.designer.actions.saveScript(this.data, function(json){
             this.designer.actions.saveScript(this.data, function(json){

+ 10 - 10
o2web/source/x_component_process_ProcessDesigner/widget/ScriptText.js

@@ -74,15 +74,15 @@ MWF.xApplication.process.ProcessDesigner.widget.ScriptText = new Class({
                 //     this.fireEvent("change", [value]);
                 //     this.fireEvent("change", [value]);
                 // }.bind(this));
                 // }.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();
                 if (callback) callback();
 
 
@@ -167,4 +167,4 @@ MWF.xApplication.process.ProcessDesigner.widget.ScriptText = new Class({
     //getValue()
     //getValue()
 
 
 
 
-});
+});

+ 11 - 11
o2web/source/x_component_process_ScriptDesigner/$Main/default/toolbars.html

@@ -1,16 +1,16 @@
 <div id="MWFFormToolbar">
 <div id="MWFFormToolbar">
 	<span MWFnodetype="MWFToolBarSeparator"></span>
 	<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>
     <span MWFnodetype="MWFToolBarSeparator"></span>
     <input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
     <input type="checkbox" value="autoSave" id="MWFScriptAutoSaveCheck">自动保存
@@ -74,4 +74,4 @@
         <option value="monaco">monaco</option>
         <option value="monaco">monaco</option>
     </select></div>
     </select></div>
 
 
-</div>
+</div>

+ 12 - 12
o2web/source/x_component_process_ScriptDesigner/Script.js

@@ -278,17 +278,17 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
     },
     },
     saveSilence: function(callback){
     saveSilence: function(callback){
         if (!this.isSave){
         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 ) {
             if( this.designer.currentScript == this ) {
                 var name = this.designer.propertyNameNode.get("value");
                 var name = this.designer.propertyNameNode.get("value");
                 var alias = this.designer.propertyAliasNode.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.description = description;
                 this.data.validated = validated;
                 this.data.validated = validated;
             }
             }
-            this.data.text = this.editor.editor.getValue();
+            this.data.text = this.editor.getValue();
 
 
             this.isSave = true;
             this.isSave = true;
             this.designer.actions.saveScript(this.data, function(json){
             this.designer.actions.saveScript(this.data, function(json){
@@ -331,4 +331,4 @@ MWF.xApplication.process.ScriptDesigner.Script = new Class({
     explode: function(){},
     explode: function(){},
     implode: function(){}
     implode: function(){}
 
 
-});
+});