diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html index f23cb09362294b78f4bf82f2526eadda75f743f4..d631ab1b9f4a0de9f7aeee54883274f895551f70 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html @@ -82,6 +82,17 @@
+ + + + + +
全角转换: + 是 + 否 +
选择“是”自动将输入的半角空格转换为全角
+
+ diff --git a/o2web/source/x_component_process_Xform/Documenteditor.js b/o2web/source/x_component_process_Xform/Documenteditor.js index 9e2325b95899ef8e82d3347e43f984879a509219..f7dc5765e5ab2570aaf8eea907dffeb3c82428ef 100644 --- a/o2web/source/x_component_process_Xform/Documenteditor.js +++ b/o2web/source/x_component_process_Xform/Documenteditor.js @@ -935,7 +935,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (this.allowEdit) { var button = this.toolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdoc); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png"); + //this.getFullWidthFlagNode().dispose(); } this.editMode = false; }else{ @@ -943,7 +944,9 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (this.allowEdit) { var button = this.toolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdocCompleted); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png"); + //this.toolbar.node.inject(this.getFullWidthFlagNode()); + } this.editMode = true; } @@ -955,11 +958,14 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (!layout.mobile) { var button = this.sideToolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdoc); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png"); + //this.getFullWidthFlagNode().dispose(); } button = this.toolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdoc); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc.png"); + //this.getFullWidthFlagNode().dispose(); + // if (!layout.mobile)this.sideToolbar.childrenButton[0].setText(MWF.xApplication.process.Xform.LP.editdoc); // this.toolbar.childrenButton[0].setText(MWF.xApplication.process.Xform.LP.editdoc); @@ -971,17 +977,32 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (!layout.mobile) { var button = this.sideToolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdocCompleted); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png"); + //this.toolbar.node.inject(this.getFullWidthFlagNode()); } button = this.toolbar.childrenButton[0]; button.setText(MWF.xApplication.process.Xform.LP.editdocCompleted); - button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png") + button.picNode.getElement("img").set("src", "../x_component_process_Xform/$Form/default/icon/editdoc_completed.png"); + //this.toolbar.node.inject(this.getFullWidthFlagNode()); // if (!layout.mobile) this.sideToolbar.childrenButton[0].setText(MWF.xApplication.process.Xform.LP.editdocCompleted); // this.toolbar.childrenButton[0].setText(MWF.xApplication.process.Xform.LP.editdocCompleted); } this.editMode = true; } }, + // getFullWidthFlagNode: function(){ + // if (!this.fullWidthFlagNode){ + // this.fullWidthFlagNode = new Element("span", { + // "styles": { + // "line-height": "26px", + // "color": "#999999", + // "font-size": "12px" + // }, + // "text": MWF.xApplication.process.Xform.LP.fullWidth + // }); + // } + // return this.fullWidthFlagNode; + // }, _printDoc: function(){ this.toWord(function(data){ if (this.form.businessData.work && !this.form.businessData.work.completedTime){ @@ -1228,6 +1249,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (this.allowHistory){ html += ""; } + + // if (this.json.fullWidth=="y"){ + // html += "已启用半角空格自动转换为全角空格,如需输入半角空格,请使用:SHIFT+空格" + // } this.toolbarNode = new Element("div", {"styles": this.css.doc_toolbar_node}).inject(this.toolNode); this.toolbarNode.set("html", html); @@ -1689,6 +1714,20 @@ debugger; } }, + transWidth: function(node){ + if (!node) return ''; + while (node){ + if (node.nodeType==3){ + node.nodeValue = node.nodeValue.replace(/\x20/g, " "); + }else if (node.nodeType==8){ + //nothing + }else{ + this.transWidth(node.firstChild); + } + node = node.nextSibling; + } + }, + loadCkeditorFiletext: function(callback, inline){ if (this.layout_filetext){ o2.load("../o2_lib/htmleditor/ckeditor4130/ckeditor.js", function(){ @@ -1708,25 +1747,48 @@ debugger; }.bind(this) ); this.filetextEditor.on( 'paste', function( e ) { + debugger; var html = e.data.dataValue; + //if (this.json.fullWidth=="y") html = html.replace(/\x20/g, " "); var tmp = new Element("div") tmp.set("html", html); var pList = tmp.getElements("p"); pList.each(function(p, i){ - if (Browser.name=="ie"){ - p.appendText("  ","top"); - }else{ - var textIndent = p.getStyle("text-indent"); - if (textIndent.toInt()) p.appendText("  ","top"); + //if (Browser.name=="ie"){ + if (this.json.fullWidth=="y") this.transWidth(p); + if (!p.getParent("table")){ + var text = p.get("text"); + var rex = /^\u3000*/; + var m = text.match(rex); + var l = (m[0]) ? Math.max((2-m[0].length), 0): 2; + for (var i=0; i
WORD转换: