xh-htmlword 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
package/dist/counter.js CHANGED
@@ -5386,7 +5386,7 @@ const gt = /* @__PURE__ */ it(at), ot = "data:image/png;base64,iVBORw0KGgoAAAANS
5386
5386
  });
5387
5387
  };
5388
5388
  function st(oA, cA) {
5389
- return [...Et(cA)].forEach((c) => {
5389
+ return cA && [...Et(cA)].forEach((c) => {
5390
5390
  if (oA.includes($A(c.selectorText))) {
5391
5391
  let S = new RegExp(`class="${$A(c.selectorText)}"`, "g");
5392
5392
  oA = oA.replace(S, `style="${c.style.cssText}"`);
@@ -79,4 +79,4 @@ Content-Location: `+((a=I.contentLocation)==null?"":a)+`
79
79
  <body>
80
80
  ${o.outerHTML}
81
81
  </body>
82
- </html>`,B=Et(C,a),d=nt.asBlob(B,p);gt(d,`${cA}.docx`),S&&S()})};function Et(oA,cA){return[...ft(cA)].forEach(c=>{if(oA.includes(At(c.selectorText))){let S=new RegExp(`class="${At(c.selectorText)}"`,"g");oA=oA.replace(S,`style="${c.style.cssText}"`)}}),oA}function At(oA){let cA=oA.match(/\.(\w+)/);if(cA)return cA[1];console.log("没有找到匹配的部分")}function ft(oA){return[...document.styleSheets].reverse().find(({cssRules:S})=>[...S].find(p=>p.selectorText.includes(oA))).cssRules}const lt=()=>{const oA=new Date,cA=oA.getFullYear(),c=("0"+(oA.getMonth()+1)).slice(-2),S=("0"+oA.getDate()).slice(-2);return`${cA}${c}${S}`};return st});
82
+ </html>`,B=Et(C,a),d=nt.asBlob(B,p);gt(d,`${cA}.docx`),S&&S()})};function Et(oA,cA){return cA&&[...ft(cA)].forEach(c=>{if(oA.includes(At(c.selectorText))){let S=new RegExp(`class="${At(c.selectorText)}"`,"g");oA=oA.replace(S,`style="${c.style.cssText}"`)}}),oA}function At(oA){let cA=oA.match(/\.(\w+)/);if(cA)return cA[1];console.log("没有找到匹配的部分")}function ft(oA){return[...document.styleSheets].reverse().find(({cssRules:S})=>[...S].find(p=>p.selectorText.includes(oA))).cssRules}const lt=()=>{const oA=new Date,cA=oA.getFullYear(),c=("0"+(oA.getMonth()+1)).slice(-2),S=("0"+oA.getDate()).slice(-2);return`${cA}${c}${S}`};return st});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xh-htmlword",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "description": "用于html页转word文档的工具",
6
6
  "files": [