@agilehub/docx-converter 0.2.0 → 0.2.1

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.
@@ -5650,13 +5650,15 @@ var wr = class {
5650
5650
  this.resolver = new wr(e, t, n);
5651
5651
  }
5652
5652
  async render(e, t) {
5653
- let n = () => `<span class="unsupported-content" data-type="${e.formula ? "formula" : "image"}"${e.path ? ` data-resource="${A(e.path)}"` : ""}>${A(`[${e.alt}:无可显示图片]`)}</span>`, r = await this.resolver.resolve(e);
5654
- if (!r) return n();
5655
- let i = {
5653
+ let n = e.formula ? "formula" : "image", r = () => `<span class="unsupported-content" data-type="${n}"${e.path ? ` data-resource="${A(e.path)}"` : ""}>${A(`[${e.alt}:无可显示图片]`)}</span>`, i = await this.resolver.resolve(e);
5654
+ if (!i) return r();
5655
+ let a = {
5656
5656
  "max-width": "100%",
5657
5657
  ...e.css
5658
5658
  };
5659
- return e.width && (i.width = `${Math.round(e.width * 100) / 100}px`), e.height && (i.height = `${Math.round(e.height * 100) / 100}px`), i["object-fit"] = "contain", (e.formula || t) && (i["vertical-align"] = "middle"), `<img src="${A(r)}" alt="${A(e.alt)}" class="${e.formula ? "formula-item formula-image" : `image-item image-${t ? "inline" : "block"}`}" data-type="${e.formula ? "formula" : "image"}"${e.formula && e.latex ? ` data-latex="${A(e.latex)}"` : ""}${Ie(i)}>`;
5659
+ e.width && (a.width = `${Math.round(e.width * 100) / 100}px`), e.height && (a.height = `${Math.round(e.height * 100) / 100}px`), a["object-fit"] = "contain", (e.formula || t) && (a["vertical-align"] = "middle");
5660
+ let o = e.formula ? `formula-item formula-image image-${t ? "inline" : "block"}` : `image-item image-${t ? "inline" : "block"}`;
5661
+ return `<img src="${A(i)}" alt="${A(e.alt)}" class="${o}" data-type="${n}"${e.formula && e.latex ? ` data-latex="${A(e.latex)}"` : ""}${Ie(a)}>`;
5660
5662
  }
5661
5663
  }, Er = "4.1.3", Dr = class e {
5662
5664
  constructor() {
@@ -56428,8 +56430,8 @@ async function fu(t, n, r) {
56428
56430
  async function pu(e, t, n) {
56429
56431
  let r = await fu(e, t, n);
56430
56432
  if (!r) return "<span class=\"unsupported-content\" data-type=\"formula\">[公式图片生成失败]</span>";
56431
- let i = r.verticalAlignEx === void 0 ? "middle" : `${r.verticalAlignEx}ex`, a = e.display ? "display:block;margin:.6em 0;" : `vertical-align:${i};`;
56432
- return `<img src="${r.src}" alt="${A(e.latex || "公式")}" class="formula-item formula-image" data-type="formula"${e.latex === void 0 ? "" : ` data-latex="${A(e.latex)}"`} style="max-width:100%;width:${r.widthEx}ex;height:${r.heightEx}ex;${a}">`;
56433
+ let i = r.verticalAlignEx === void 0 ? "middle" : `${r.verticalAlignEx}ex`, a = e.display ? "display:block;margin:.6em 0;" : `vertical-align:${i};`, o = `formula-item formula-image image-${e.display ? "block" : "inline"}`;
56434
+ return `<img src="${r.src}" alt="${A(e.latex || "公式")}" class="${o}" data-type="formula"${e.latex === void 0 ? "" : ` data-latex="${A(e.latex)}"`} style="max-width:100%;width:${r.widthEx}ex;height:${r.heightEx}ex;${a}">`;
56433
56435
  }
56434
56436
  // src/rendering/html/html-renderer.ts
56435
56437
  var mu = class {
@@ -56762,7 +56764,7 @@ async function wu(e, t = {}) {
56762
56764
  }
56763
56765
  });
56764
56766
  if (t.signal?.aborted) throw new h("ABORTED", "转换已取消");
56765
- let i = await ("document" in globalThis ? await import("./pdf-renderer-D5aBQswF.js") : await import("./pdf-renderer-DG-eDzRb.js")).renderPdf(r.html, t);
56767
+ let i = await ("document" in globalThis ? await import("./pdf-renderer-B240GmbE.js") : await import("./pdf-renderer-CAGo1KfA.js")).renderPdf(r.html, t);
56766
56768
  if (t.signal?.aborted) throw new h("ABORTED", "转换已取消");
56767
56769
  return t.onProgress?.({ stage: "complete" }), {
56768
56770
  bytes: i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilehub/docx-converter",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "TypeScript DOCX to HTML JSON And Pdf converter with fonts, tables, images and OMML math",
5
5
  "type": "module",
6
6
  "author": "lytdev <lytdev@outlook.com>",