hoeditor-web 3.2.22 → 3.2.24

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/lib/hoeditor.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { H as i, d as r, b as e, a as l, e as t, T as H, f as d, i as f } from "./index-DKojninQ.mjs";
2
+ import { H as i, d as r, b as e, a as l, e as t, T as H, f as d, i as f } from "./index-CvB8n_xM.mjs";
3
3
  export {
4
4
  i as HoDocs,
5
5
  r as HoEditorProvide,
@@ -14897,7 +14897,7 @@ class DrawSignNode extends DrawCombineNode {
14897
14897
  }
14898
14898
  }
14899
14899
  }
14900
- const version = "3.2.22";
14900
+ const version = "3.2.24";
14901
14901
  var FingerPosition = /* @__PURE__ */ ((a) => (a[a.left = 0] = "left", a[a.center = 1] = "center", a[a.right = 2] = "right", a))(FingerPosition || {});
14902
14902
  class SignNode extends BaseNode {
14903
14903
  constructor(hoEditorFactoryID, rootNodes, pNode, nodeType, number, type, name, signType, signFormat, signor, signTime, signTimeFormat, imgSrc, imgWidth, imgHeight, customProperty, isTemplate, styleIndex, connectMode, isFront, allowEditSignTime, fingerPrintSrc, fingerPosition, attribute, connectChar, otherProperties, dataId, associatedElement, isTemp, innerIdentifier) {
@@ -27184,6 +27184,12 @@ class Print {
27184
27184
  f && f.document.write(c);
27185
27185
  } else
27186
27186
  try {
27187
+ if (window.localStorage.getItem("specialPrint") == "1") {
27188
+ document.querySelector("#Ho_Editor_Print_Iframe") && document.body.removeChild(document.querySelector("#Ho_Editor_Print_Iframe")), this.printPageV2(t).catch((p) => {
27189
+ t.autoPrint(), t.output("dataurlnewwindow");
27190
+ });
27191
+ return;
27192
+ }
27187
27193
  (u = (d = window.top) == null ? void 0 : d.chrome) != null && u.webview && n ? window.top.chrome.webview.postMessage({
27188
27194
  exec: "printpdf",
27189
27195
  data: {
@@ -27193,7 +27199,7 @@ class Print {
27193
27199
  paperSize: l == null ? void 0 : l.toUpperCase(),
27194
27200
  base64: t.output("datauristring").replace(/^data:application\/pdf;filename=generated.pdf;base64,/, "")
27195
27201
  }
27196
- }) : (document.querySelector("#Ho_Editor_Print_Iframe") && document.body.removeChild(document.querySelector("#Ho_Editor_Print_Iframe")), this.printPage(t).catch((f) => {
27202
+ }) : (document.querySelector("#Ho_Editor_Print_Iframe") && document.body.removeChild(document.querySelector("#Ho_Editor_Print_Iframe")), this.printPage(t).catch((p) => {
27197
27203
  t.autoPrint(), t.output("dataurlnewwindow");
27198
27204
  }));
27199
27205
  } catch {
@@ -27213,7 +27219,46 @@ class Print {
27213
27219
  }
27214
27220
  };
27215
27221
  });
27216
- r.id = "Ho_Editor_Print_Iframe", r.style.position = "fixed", r.style.right = "0", r.style.bottom = "0", r.style.width = "0", r.style.height = "0", r.style.border = "0", r.src = t.output("bloburl"), document.body.appendChild(r), await o;
27222
+ r.id = "Ho_Editor_Print_Iframe", r.style.position = "fixed", r.style.right = "0", r.style.bottom = "0", r.style.width = "0", r.style.height = "0", r.style.border = "0", r.src = t.output("bloburl"), (window.top || window).document.body.appendChild(r), await o;
27223
+ }
27224
+ static async printPageV2(t) {
27225
+ var n;
27226
+ const r = (n = window.top) == null ? void 0 : n.open("", "_blank");
27227
+ if (!r) throw new Error("Failed to open print window");
27228
+ const o = "printFrame_" + Math.random().toString(36).substring(2);
27229
+ return r.document.write(`
27230
+ <html>
27231
+ <head><title>Print</title></head>
27232
+ <body>
27233
+ <iframe
27234
+ id="${o}"
27235
+ style="width:100%;height:100%;border:0;"
27236
+ src="${t.output("bloburl")}"
27237
+ onload="
27238
+ const frame = document.getElementById('${o}');
27239
+ if (frame?.contentWindow) {
27240
+ frame.contentWindow.print();
27241
+
27242
+ // **轮询检查是否打印完成**
27243
+ let printAttempts = 0;
27244
+ const maxAttempts = 40; // 最大重试次数(防止无限等待)
27245
+ const checkPrintFinished = () => {
27246
+ printAttempts++;
27247
+ if (!document.hasFocus() && printAttempts < maxAttempts) {
27248
+ // 窗口失去焦点(可能正在打印),继续等待
27249
+ setTimeout(checkPrintFinished, 2000);
27250
+ } else {
27251
+ // 3秒后关闭(确保打印对话框已消失)
27252
+ setTimeout(() => window.close(), 2000);
27253
+ }
27254
+ };
27255
+ setTimeout(checkPrintFinished, 2000); // 延迟启动检查
27256
+ }
27257
+ "
27258
+ ></iframe>
27259
+ </body>
27260
+ </html>
27261
+ `), r.document.close(), new Promise((s) => s("print_triggered"));
27217
27262
  }
27218
27263
  static async printHTMLPage(t, r) {
27219
27264
  const o = document.createElement("iframe"), n = new Promise((s, l) => {
@@ -29357,11 +29402,13 @@ class TextNode extends BaseNode {
29357
29402
  continue;
29358
29403
  }
29359
29404
  if (C.dWidth = C.dText.dWidth, n.addChild(C), n.drawItems.push(C), this._drawNodes.push(C), g = C.endIndex, g < this.text.length - 1) {
29360
- if (n.fitLines(), n = n.paragraphNode.getNextDline(n), n.paragraphNode.parentNode instanceof TextInputFieldNode) {
29361
- const _ = n.paragraphNode.drawlines.indexOf(n), S = n.paragraphNode.drawlines[_ - 1];
29362
- if (S && S instanceof DrawLine) {
29363
- const [E, T, I] = n.paragraphNode.parentNode.getLeftWidth();
29364
- S.x = n.paragraphNode.combineParagraph.leftMarginPixes + E, S.dWidth = T - n.paragraphNode.combineParagraph.leftMarginPixes - n.paragraphNode.combineParagraph.rightMarginPixes, S.updateLineStyle();
29405
+ n.fitLines();
29406
+ const _ = n;
29407
+ if (n = n.paragraphNode.getNextDline(n), _.updateLineStyle(), n.paragraphNode.parentNode instanceof TextInputFieldNode) {
29408
+ const S = n.paragraphNode.drawlines.indexOf(n), E = n.paragraphNode.drawlines[S - 1];
29409
+ if (E && E instanceof DrawLine) {
29410
+ const [T, I, M] = n.paragraphNode.parentNode.getLeftWidth();
29411
+ E.x = n.paragraphNode.combineParagraph.leftMarginPixes + T, E.dWidth = I - n.paragraphNode.combineParagraph.leftMarginPixes - n.paragraphNode.combineParagraph.rightMarginPixes, E.updateLineStyle();
29365
29412
  }
29366
29413
  }
29367
29414
  this.adjustRectAlignLine(n);
@@ -64108,7 +64155,7 @@ WebPDecoder.prototype.getData = function() {
64108
64155
  (function(a) {
64109
64156
  function t() {
64110
64157
  return function() {
64111
- return globalObject.canvg ? Promise.resolve(globalObject.canvg) : import("./index.es-BPeVb3Cc.mjs");
64158
+ return globalObject.canvg ? Promise.resolve(globalObject.canvg) : import("./index.es-DU1rLzgX.mjs");
64112
64159
  }().catch(function(r) {
64113
64160
  return Promise.reject(new Error("Could not load canvg: " + r));
64114
64161
  }).then(function(r) {
@@ -1,4 +1,4 @@
1
- import { c as Ma, _ as qa, g as Zu } from "./index-DKojninQ.mjs";
1
+ import { c as Ma, _ as qa, g as Zu } from "./index-CvB8n_xM.mjs";
2
2
  var un = {}, ln = {}, lr, hn;
3
3
  function Z() {
4
4
  if (hn) return lr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hoeditor-web",
3
- "version": "3.2.22",
3
+ "version": "3.2.24",
4
4
  "private": false,
5
5
  "main": "lib/hoeditor.mjs",
6
6
  "typings": "types/index.d.ts",