xh-htmlword 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,7 +31,7 @@ handleExportWord({
31
31
  console.log("导出成功"); //res 文档流
32
32
  },
33
33
  defultImg: "",
34
- className: "export-box",
34
+ className: "export-box", //一般给导出文件的最外层盒子的class 用于标记
35
35
  drawCanvas: [".tree", "#btn"],
36
36
  });
37
37
  ```
@@ -45,13 +45,7 @@ handleExportWord({
45
45
  <div id="main1"></div>
46
46
  <p style="text-align: center">
47
47
  <span
48
- style="
49
- font-family: 宋体;
50
- font-weight: bold;
51
- color: rgb(0, 0, 0);
52
- min-height: 16pt;
53
- font-size: 16pt;
54
- "
48
+ class="title"
55
49
  >深水汴北配套管网运维日报表</span
56
50
  >
57
51
  </p>
@@ -290,6 +284,18 @@ const handleExport = () => {
290
284
  };
291
285
  </script>
292
286
 
287
+ <style scoped lang="scss">
288
+ .export-box {
289
+ .title {
290
+ font-family: 宋体;
291
+ font-weight: bold;
292
+ color: red;
293
+ min-height: 16pt;
294
+ font-size: 16pt;
295
+ }
296
+ }
297
+ </style>
298
+
293
299
 
294
300
  ```
295
301
 
package/dist/xh.js CHANGED
@@ -10323,13 +10323,18 @@ function tQ(r, e) {
10323
10323
  }), r;
10324
10324
  }
10325
10325
  function fi(r) {
10326
- let e = r.match(/\.(\w+)/);
10327
- if (e)
10328
- return e[1];
10329
- console.log("没有找到匹配的部分");
10326
+ const e = r.match(/(.*?)(?=\[)/);
10327
+ if (e) {
10328
+ const A = e[0].split(" ").map((t) => t.replace(/\./g, ""));
10329
+ return A[A.length - 1];
10330
+ } else
10331
+ console.log("没有找到匹配的部分");
10330
10332
  }
10331
10333
  function rQ(r) {
10332
- return [...document.styleSheets].reverse().find(({ cssRules: t }) => [...t].find((n) => n.selectorText.includes(r))).cssRules;
10334
+ return [...document.styleSheets].reverse().find(({ cssRules: t }) => [...t].find((n) => {
10335
+ if (n.selectorText)
10336
+ return n.selectorText.includes(r);
10337
+ })).cssRules;
10333
10338
  }
10334
10339
  const nQ = () => {
10335
10340
  const r = /* @__PURE__ */ new Date(), e = r.getFullYear(), A = ("0" + (r.getMonth() + 1)).slice(-2), t = ("0" + r.getDate()).slice(-2);
package/dist/xh.umd.cjs CHANGED
@@ -104,4 +104,4 @@ Content-Location: `+((a=i.contentLocation)==null?"":a)+`
104
104
  <body>
105
105
  ${tQ(g.outerHTML)}
106
106
  </body>
107
- </html>`,p=rQ(U,a),v=Ua.asBlob(p,n);va(v,`${e}.docx`),t&&t(v)})};function tQ(r){let e="";for(var A=0;A<r.length;A++){var t=r.charCodeAt(A);t>127?e+="&#x"+t.toString(16)+";":e+=r[A]}return e}function rQ(r,e){return r=r.replace(/break-before: page/g,"page-break-before: always"),e&&[...nQ(e)].forEach(A=>{if(r.includes(ha(A.selectorText))){let t=new RegExp(`class="${ha(A.selectorText)}"`,"g");r=r.replace(t,`style="${A.style.cssText}"`)}}),r}function ha(r){let e=r.match(/\.(\w+)/);if(e)return e[1];console.log("没有找到匹配的部分")}function nQ(r){return[...document.styleSheets].reverse().find(({cssRules:t})=>[...t].find(n=>n.selectorText.includes(r))).cssRules}const iQ=()=>{const r=new Date,e=r.getFullYear(),A=("0"+(r.getMonth()+1)).slice(-2),t=("0"+r.getDate()).slice(-2);return`${e}${A}${t}`};return eQ});
107
+ </html>`,p=rQ(U,a),v=Ua.asBlob(p,n);va(v,`${e}.docx`),t&&t(v)})};function tQ(r){let e="";for(var A=0;A<r.length;A++){var t=r.charCodeAt(A);t>127?e+="&#x"+t.toString(16)+";":e+=r[A]}return e}function rQ(r,e){return r=r.replace(/break-before: page/g,"page-break-before: always"),e&&[...nQ(e)].forEach(A=>{if(r.includes(ha(A.selectorText))){let t=new RegExp(`class="${ha(A.selectorText)}"`,"g");r=r.replace(t,`style="${A.style.cssText}"`)}}),r}function ha(r){const e=r.match(/(.*?)(?=\[)/);if(e){const A=e[0].split(" ").map(t=>t.replace(/\./g,""));return A[A.length-1]}else console.log("没有找到匹配的部分")}function nQ(r){return[...document.styleSheets].reverse().find(({cssRules:t})=>[...t].find(n=>{if(n.selectorText)return n.selectorText.includes(r)})).cssRules}const iQ=()=>{const r=new Date,e=r.getFullYear(),A=("0"+(r.getMonth()+1)).slice(-2),t=("0"+r.getDate()).slice(-2);return`${e}${A}${t}`};return eQ});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xh-htmlword",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "type": "module",
5
5
  "description": "用于html页转word文档的工具",
6
6
  "files": [