提交 162b0580 编写于 作者: NoSubject's avatar NoSubject

公文编辑器,增加附件内容编辑,以及转word的一些优化

上级 8eefa4ca
...@@ -739,6 +739,23 @@ ...@@ -739,6 +739,23 @@
</div> </div>
<!-----------------------------------------------附件-------------------------------------------------------------------> <!-----------------------------------------------附件------------------------------------------------------------------->
<!-----------------------------------------------附件内容------------------------------------------------------------------->
<div onclick="var node = this.getNext(); node.setStyle('display', ((node.getStyle('display')=='none') ? 'block' : 'none'));" style="cursor: pointer; height: 24px; padding-left:5px; text-align: left; line-height: 24px; border-top: 1px solid #cccccc; border-bottom: 1px solid #999999; font-weight: bold; background-color: #eeeeee;">{{$.lp.attachmentText}} (attachment)</div>
<div style="display: none">
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitle">{{$.lp.allowEdit}}:</td>
<td class="editTableValue">
<input class="editTableRadio" onclick="if (this.checked) $('text{$.pid}attachmentTextEditScriptArea').setStyle('display', 'none');" name="attachmentTextEdit" text{($.attachmentTextEdit=='y')?'checked':''} type="radio" value="y"/>{{$.lp.allow}}
<input class="editTableRadio" onclick="if (this.checked) $('text{$.pid}attachmentTextEditScriptArea').setStyle('display', 'none');" name="attachmentTextEdit" text{($.attachmentTextEdit!='y' && $.attachmentTextEdit!='s')?'checked':''} type="radio" value="n"/>{{$.lp.notAllow}}
<input class="editTableRadio" onclick="if (this.checked) $('text{$.pid}attachmentTextEditScriptArea').setStyle('display', 'block');" name="attachmentTextEdit" text{($.attachmentTextEdit=='s')?'checked':''} type="radio" value="s"/>{{$.lp.byScript}}
</td>
</tr>
</table>
<div id="text{$.pid}attachmentTextEditScriptArea" style="display: text{($.attachmentTextEdit=='s')?'block':'none'}" class="MWFFormulaArea" name="attachmentTextEditScript" title="{{$.lp.editScript}} (S)"></div>
</div>
<!-----------------------------------------------附件内容------------------------------------------------------------------->
<!-----------------------------------------------成文单位-------------------------------------------------------------------> <!-----------------------------------------------成文单位------------------------------------------------------------------->
<div onclick="var node = this.getNext(); node.setStyle('display', ((node.getStyle('display')=='none') ? 'block' : 'none'));" style="cursor: pointer; height: 24px; padding-left:5px; text-align: left; line-height: 24px; border-top: 1px solid #cccccc; border-bottom: 1px solid #999999; font-weight: bold; background-color: #eeeeee;">{{$.lp.issuanceUnit}} (issuanceUnit)</div> <div onclick="var node = this.getNext(); node.setStyle('display', ((node.getStyle('display')=='none') ? 'block' : 'none'));" style="cursor: pointer; height: 24px; padding-left:5px; text-align: left; line-height: 24px; border-top: 1px solid #cccccc; border-bottom: 1px solid #999999; font-weight: bold; background-color: #eeeeee;">{{$.lp.issuanceUnit}} (issuanceUnit)</div>
<div style="display: none"> <div style="display: none">
......
...@@ -109,6 +109,11 @@ ...@@ -109,6 +109,11 @@
mso-border-top-alt: solid windowtext 1.3px; mso-border-top-alt: solid windowtext 1.3px;
border-top: solid windowtext 2px; border-top: solid windowtext 2px;
} }
p.pageBreak {
border-bottom: 1px solid #eeeeee;
margin-bottom: 24px;
margin-top: 24px;
}
</style> </style>
<div class=WordSection1 style='layout-grid:15.6pt; font-size:16.0pt;font-family:仿宋'> <div class=WordSection1 style='layout-grid:15.6pt; font-size:16.0pt;font-family:仿宋'>
...@@ -289,7 +294,7 @@ ...@@ -289,7 +294,7 @@
</p> </p>
</div> </div>
<div class="doc_block doc_layout_attachment_text"></div> <div class="MsoNormal doc_block doc_layout_attachment_text" style="margin: 16pt 0; font-family:仿宋;text-align:justify;font-size: 16pt;"></div>
<div class="doc_block doc_layout_editionArea"> <div class="doc_block doc_layout_editionArea">
<P class=MsoNormal style='font-size:16.0pt;font-family:仿宋'><span>&nbsp</span></P> <P class=MsoNormal style='font-size:16.0pt;font-family:仿宋'><span>&nbsp</span></P>
......
...@@ -808,6 +808,8 @@ MWF.xApplication.process.FormDesigner.LP = { ...@@ -808,6 +808,8 @@ MWF.xApplication.process.FormDesigner.LP = {
"editSubjectInfo": "When the title allows editing, please do not bind value", "editSubjectInfo": "When the title allows editing, please do not bind value",
"mainSend": "Main Send", "mainSend": "Main Send",
"attachment": "Attachment", "attachment": "Attachment",
"attachmentText": "Attachment Text",
"attachmentInfor": "[Click here to edit the content of attachments]",
"issuanceUnit": "Issuance Unit", "issuanceUnit": "Issuance Unit",
"issuanceDate": "Issuance Date", "issuanceDate": "Issuance Date",
"annotation": "Annotation", "annotation": "Annotation",
......
...@@ -813,6 +813,8 @@ MWF.xApplication.process.FormDesigner.LP = { ...@@ -813,6 +813,8 @@ MWF.xApplication.process.FormDesigner.LP = {
"editSubjectInfo": "标题允许编辑时,请不要绑定数据", "editSubjectInfo": "标题允许编辑时,请不要绑定数据",
"mainSend": "主送", "mainSend": "主送",
"attachment": "附件", "attachment": "附件",
"attachmentText": "附件内容",
"attachmentInfor": "[点击此处编辑附件内容]",
"issuanceUnit": "成文单位", "issuanceUnit": "成文单位",
"issuanceDate": "成文日期", "issuanceDate": "成文日期",
"annotation": "附注", "annotation": "附注",
......
...@@ -246,7 +246,8 @@ MWF.xApplication.process.Xform.LP = { ...@@ -246,7 +246,8 @@ MWF.xApplication.process.Xform.LP = {
"copyto":"[抄送]", "copyto":"[抄送]",
"editionUnit":"[印发机关]", "editionUnit":"[印发机关]",
"editionDate":"[印发日期]", "editionDate":"[印发日期]",
"historyList": "历史版本文档" "historyList": "历史版本文档",
"attachmentInfor": "[Click here to edit the content of attachments]",
}, },
"documentHistory": { "documentHistory": {
"diffContent": "<div>{time}</div>{name} modified content at \"{activity}\"", "diffContent": "<div>{time}</div>{name} modified content at \"{activity}\"",
......
...@@ -247,7 +247,8 @@ MWF.xApplication.process.Xform.LP = { ...@@ -247,7 +247,8 @@ MWF.xApplication.process.Xform.LP = {
"copyto":"[抄送]", "copyto":"[抄送]",
"editionUnit":"[印发机关]", "editionUnit":"[印发机关]",
"editionDate":"[印发日期]", "editionDate":"[印发日期]",
"historyList": "历史版本文档" "historyList": "历史版本文档",
"attachmentInfor": "[点击此处编辑附件内容]"
}, },
"documentHistory": { "documentHistory": {
"diffContent": "<div>{time}</div>{name} 在 ”{activity}“ 时修改的内容", "diffContent": "<div>{time}</div>{name} 在 ”{activity}“ 时修改的内容",
......
...@@ -308,6 +308,8 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -308,6 +308,8 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
}else if (dom.hasClass("doc_layout_filetext")){ }else if (dom.hasClass("doc_layout_filetext")){
this.processFiletext(dom, oo_body, append); this.processFiletext(dom, oo_body, append);
}else if (dom.hasClass("doc_layout_attachment_text")){
this.processFiletext(dom, oo_body, append);
}else if (dom.hasClass("doc_layout_editionArea")){ }else if (dom.hasClass("doc_layout_editionArea")){
var h = dom.getSize().y; var h = dom.getSize().y;
...@@ -388,16 +390,17 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -388,16 +390,17 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
node = node.firstChild; node = node.firstChild;
while (node){ while (node){
if (node.nodeType===Node.TEXT_NODE){ if (node.nodeType===Node.TEXT_NODE){
if (node.nodeValue.trim()) this.processRun(node.parentElement || node.parentNode, oo_p, p, node.nodeValue); if (node.nodeValue) this.processRun(node.parentElement || node.parentNode, oo_p, p, node.nodeValue);
}else if (node.nodeType===Node.ELEMENT_NODE){ }else if (node.nodeType===Node.ELEMENT_NODE){
if (node.tagName.toLowerCase() === "span") { if (node.tagName.toLowerCase() === "span") {
this.processRun(node, oo_p, p); this.processRun(node, oo_p, p);
}else if (node.tagName.toLowerCase() === "br") { }else if (node.tagName.toLowerCase() === "br") {
this.processRun(node, oo_p, p, "", "br"); if (node.nextSibling) this.processRun(node, oo_p, p, "", "br");
}else if (node.tagName.toLowerCase() === "div" || node.tagName.toLowerCase() === "p") { }else if (node.tagName.toLowerCase() === "div" || node.tagName.toLowerCase() === "p") {
if (!this.isEmptyP(oo_p)){ if (!this.isEmptyP(oo_p)){
oo_p = this.createParagraphFromDom(node, oo_body, append); oo_p = this.createParagraphFromDom(node, oo_body, append);
}else{ }else{
this.setParagraphAttrFromDom(node, oo_p); this.setParagraphAttrFromDom(node, oo_p);
} }
this.processParagraphRun(node, oo_p, p, oo_body, append, ilvl); this.processParagraphRun(node, oo_p, p, oo_body, append, ilvl);
...@@ -520,10 +523,18 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -520,10 +523,18 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
} }
Object.keys(pPrs).each(function(k){ Object.keys(pPrs).each(function(k){
var node = oo_pPr.querySelector(k); if (k=="pageBreak") {
if (!node) node = this.createEl(oo_p.ownerDocument, k); var oo_r = this.createEl(oo_p.ownerDocument, "r");
this.setAttrs(node, pPrs[k]); var oo_br = this.createEl(oo_p.ownerDocument, "br");
oo_pPr.appendChild(node); this.setAttrs(oo_br, {"type": "page"});
oo_r.appendChild(oo_br);
oo_p.appendChild(oo_r);
}else{
var node = oo_pPr.querySelector(k);
if (!node) node = this.createEl(oo_p.ownerDocument, k);
this.setAttrs(node, pPrs[k]);
oo_pPr.appendChild(node);
}
}.bind(this)); }.bind(this));
}, },
createParagraphFromDom: function(dom, oo_body, append){ createParagraphFromDom: function(dom, oo_body, append){
...@@ -1257,9 +1268,9 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -1257,9 +1268,9 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
var oo_drawing = this.createEl(oo_doc, "drawing"); var oo_drawing = this.createEl(oo_doc, "drawing");
var msoStyle = this.getMsoStyle(img); var msoStyle = this.getMsoStyle(img);
debugger;
var position = img.getStyle("position"); var position = img.getStyle("position");
var p = (position==="absolute" || msoStyle["mso-position-vertical"]==="absolute") ? "anchor" : "inline"; var p = (msoStyle["mso-position-vertical"]==="absolute") ? "anchor" : "inline";
var oo_position; var oo_position;
if (p==="anchor"){ if (p==="anchor"){
...@@ -1615,6 +1626,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -1615,6 +1626,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
var font = null; var font = null;
var styles = span.getStyles("font-size", "color", "letter-spacing", "font-weight", "font-family", "line-height"); var styles = span.getStyles("font-size", "color", "letter-spacing", "font-weight", "font-family", "line-height");
var keys = Object.keys(styles); var keys = Object.keys(styles);
var msoStyle = this.getMsoStyle(span);
for (var i = 0; i<keys.length; i++){ for (var i = 0; i<keys.length; i++){
switch (keys[i]){ switch (keys[i]){
...@@ -1671,6 +1683,9 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -1671,6 +1683,9 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
//nothing //nothing
} }
} }
if (msoStyle["mso-letter-spacing"]){
rPrs.spacing = {"val": (msoStyle["mso-letter-spacing"].toFloat()*20 || 0)};
}
if (p) this.processRunFont(p, rPrs, font); if (p) this.processRunFont(p, rPrs, font);
this.processRunFont(span, rPrs, font); this.processRunFont(span, rPrs, font);
...@@ -1684,6 +1699,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -1684,6 +1699,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
runPrs.br = br; runPrs.br = br;
var oo_run = this.createRun(oo_p.ownerDocument, runPrs); var oo_run = this.createRun(oo_p.ownerDocument, runPrs);
if (text){ if (text){
text = text.replace(/[\u200B-\u200D\uFEFF]/g, '');
var oo_t = this.createEl(oo_run.ownerDocument,"t"); var oo_t = this.createEl(oo_run.ownerDocument,"t");
oo_t.appendChild(oo_run.ownerDocument.createTextNode(text)); oo_t.appendChild(oo_run.ownerDocument.createTextNode(text));
oo_run.appendChild(oo_t); oo_run.appendChild(oo_t);
...@@ -1858,6 +1874,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new ...@@ -1858,6 +1874,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new
if (options && options.text){ if (options && options.text){
var t = this.createEl(xmlDoc,"t"); var t = this.createEl(xmlDoc,"t");
options.text = options.text.replace(/[\u200B-\u200D\uFEFF]/g, '');
t.appendChild(xmlDoc.createTextNode(options.text)); t.appendChild(xmlDoc.createTextNode(options.text));
r.appendChild(t); r.appendChild(t);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册