@guodun/antdv 1.4.2 → 1.4.4

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.
Files changed (59) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +304 -293
  2. package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +66 -13
  3. package/dist/es/components/contract-signing-location/src/constants.mjs +27 -17
  4. package/dist/es/components/contract-signing-location/src/coordinates.mjs +23 -23
  5. package/dist/es/components/contract-signing-location/src/location-rules.mjs +20 -10
  6. package/dist/es/components/contract-signing-location/src/page-layout.mjs +12 -9
  7. package/dist/es/components/contract-signing-location/src/template-source.mjs +52 -34
  8. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  9. package/dist/es/components/index.mjs +1 -1
  10. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -1
  11. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +186 -148
  12. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +4 -4
  13. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.mjs +5 -0
  14. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.mjs +179 -0
  15. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +149 -126
  16. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1229 -1059
  17. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +34 -34
  18. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +17 -17
  19. package/dist/es/components/pro-contract-template-designer/src/utils/signing-placement.mjs +14 -14
  20. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +89 -89
  21. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  22. package/dist/es/index.mjs +25 -25
  23. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  24. package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
  25. package/dist/lib/components/contract-signing-location/src/constants.cjs +1 -1
  26. package/dist/lib/components/contract-signing-location/src/coordinates.cjs +1 -1
  27. package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
  28. package/dist/lib/components/contract-signing-location/src/page-layout.cjs +1 -1
  29. package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
  30. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  31. package/dist/lib/components/index.cjs +1 -1
  32. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  33. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
  34. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  35. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.cjs +1 -0
  36. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.cjs +1 -0
  37. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  38. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  39. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +3 -3
  40. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/utils/signing-placement.cjs +1 -1
  42. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +2 -2
  43. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  44. package/dist/lib/index.cjs +1 -1
  45. package/dist/theme/contract-signing-location.css +1 -1
  46. package/dist/theme/icon.css +1 -1
  47. package/dist/theme/index.css +1 -1
  48. package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +3 -1
  49. package/dist/types/components/contract-signing-location/src/constants.d.ts +18 -0
  50. package/dist/types/components/contract-signing-location/src/coordinates.d.ts +8 -2
  51. package/dist/types/components/contract-signing-location/src/page-layout.d.ts +2 -2
  52. package/dist/types/components/contract-signing-location/src/template-source.d.ts +19 -0
  53. package/dist/types/components/contract-signing-location/src/types.d.ts +3 -0
  54. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +10 -0
  55. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.d.ts +43 -0
  56. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +22 -0
  57. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +90 -0
  58. package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +3 -0
  59. package/package.json +5 -3
@@ -1,14 +1,14 @@
1
- import { SIGNING_PLACEMENT_MIME as e, canMutateSigningPlacements as t, getSigningPlacementDefaultSize as n, parseSigningPlacementDragPayload as r } from "./utils/signing-placement.mjs";
2
- import { CONTRACT_TEXT_STYLE_PRESETS as i } from "./constants.mjs";
3
- import { CONTRACT_PAGE_BASE_PADDING as a, getPageDecorationSafePadding as o, hasEnabledPageFooter as s, hasEnabledPageHeader as c, normalizePageDecorations as l } from "./utils/page-decorations.mjs";
4
- import { DEFAULT_FIELD_STYLE as ee, resolvePageSize as te, splitPageContentByMeasurements as ne } from "./composables/use-template-designer.mjs";
5
- import { buildTemplateVariableAttrs as re, insertTemplateVariableNode as ie } from "./extensions/template-variable.mjs";
1
+ import { CONTRACT_TEXT_STYLE_PRESETS as e } from "./constants.mjs";
2
+ import { CONTRACT_PAGE_BASE_PADDING as t, getPageDecorationSafePadding as n, hasEnabledPageFooter as r, hasEnabledPageHeader as i, normalizePageDecorations as a } from "./utils/page-decorations.mjs";
3
+ import o from "./ContractTemplatePageDecorations.mjs";
4
+ import { SIGNING_PLACEMENT_MIME as s, canMutateSigningPlacements as c, getSigningPlacementDefaultSize as ee, parseSigningPlacementDragPayload as te } from "./utils/signing-placement.mjs";
5
+ import { DEFAULT_FIELD_STYLE as ne, resolvePageSize as re, splitPageContentByMeasurements as ie } from "./composables/use-template-designer.mjs";
6
+ import { buildTemplateVariableAttrs as l, insertTemplateVariableNode as ae } from "./extensions/template-variable.mjs";
6
7
  import { normalizeContractImageDimension as u } from "./utils/content-image.mjs";
7
- import { createEditorExtensions as ae, runContractTemplateEditorCommand as d } from "./extensions/editor-extensions.mjs";
8
+ import { createEditorExtensions as oe, runContractTemplateEditorCommand as d } from "./extensions/editor-extensions.mjs";
8
9
  import { resolveEditorContextMenuKind as f } from "./utils/context-variable.mjs";
9
- import { applyContractTemplateBlockStyle as oe } from "./utils/block-style.mjs";
10
- import se from "./SigningPlacementLayer.mjs";
11
- import ce from "./ContractTemplatePageDecorations.mjs";
10
+ import { applyContractTemplateBlockStyle as se } from "./utils/block-style.mjs";
11
+ import ce from "./SigningPlacementLayer.mjs";
12
12
  import { computed as p, createBlock as le, createCommentVNode as ue, createElementBlock as de, createElementVNode as m, createVNode as h, defineComponent as g, nextTick as fe, normalizeClass as pe, normalizeStyle as _, onBeforeUnmount as me, openBlock as v, ref as he, toDisplayString as y, unref as b, watch as x, withModifiers as ge } from "vue";
13
13
  import { EditorContent as _e, useEditor as ve } from "@tiptap/vue-3";
14
14
  import { generateHTML as ye } from "@tiptap/core";
@@ -60,7 +60,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
60
60
  "editor-context-menu"
61
61
  ],
62
62
  setup(g, { expose: T, emit: Te }) {
63
- let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A = ae("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
63
+ let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A = oe("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
64
64
  processImageFile: E.processImageFile,
65
65
  getZoom: () => Math.max(.1, E.zoom || 1)
66
66
  }), j = ve({
@@ -78,7 +78,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
78
78
  handleDOMEvents: {
79
79
  contextmenu: (e, t) => {
80
80
  if (O.value) return !1;
81
- let n = Fe(e, t.target);
81
+ let n = Le(e, t.target);
82
82
  if (n) return t.preventDefault(), L({
83
83
  pageId: E.page.id,
84
84
  clientX: t.clientX,
@@ -89,7 +89,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
89
89
  selectionEmpty: !r || r.empty,
90
90
  inTable: a
91
91
  });
92
- return t.preventDefault(), o === "table" && (i || Ne(t.clientX, t.clientY, t.target)) ? (B({
92
+ return t.preventDefault(), o === "table" && (i || Pe(t.clientX, t.clientY, t.target)) ? (B({
93
93
  pageId: E.page.id,
94
94
  clientX: t.clientX,
95
95
  clientY: t.clientY
@@ -108,7 +108,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
108
108
  }
109
109
  },
110
110
  handleKeyDown: (e, t) => {
111
- if (O.value || !Ae(t)) return !1;
111
+ if (O.value || !je(t)) return !1;
112
112
  let n = j.value;
113
113
  if (!n) return !1;
114
114
  t.preventDefault();
@@ -128,7 +128,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
128
128
  inTable: n.isActive("table")
129
129
  }) === "table") {
130
130
  if (!a) {
131
- let e = Me();
131
+ let e = Ne();
132
132
  typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(S.create(n.state.doc, e)));
133
133
  }
134
134
  let e = n.view.coordsAtPos(n.state.selection.from);
@@ -182,6 +182,20 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
182
182
  }
183
183
  }
184
184
  function ke() {
185
+ let e = j.value, t = e?.state.selection;
186
+ if (!(!e || !t || t.empty) && !(t instanceof S || t instanceof C)) try {
187
+ let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
188
+ return {
189
+ top: Math.min(n.top, r.top),
190
+ bottom: Math.max(n.bottom, r.bottom),
191
+ left: Math.min(n.left, r.left),
192
+ right: Math.max(n.left, r.right)
193
+ };
194
+ } catch {
195
+ return;
196
+ }
197
+ }
198
+ function Ae() {
185
199
  let e = j.value;
186
200
  if (!e) return "";
187
201
  let t = e.state.selection.$from, n = t.pos;
@@ -194,7 +208,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
194
208
  }
195
209
  return e.state.doc.textBetween(n, e.state.selection.from, "");
196
210
  }
197
- function Ae(e) {
211
+ function je(e) {
198
212
  return e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
199
213
  }
200
214
  function M(e) {
@@ -203,22 +217,22 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
203
217
  if (n === "cell" || n === "header_cell") return e.before(t);
204
218
  }
205
219
  }
206
- function je(e, t) {
220
+ function Me(e, t) {
207
221
  let n = j.value, r = n?.view.posAtCoords({
208
222
  left: e,
209
223
  top: t
210
224
  })?.pos;
211
225
  if (!(!n || typeof r != "number")) return M(n.state.doc.resolve(r));
212
226
  }
213
- function Me() {
227
+ function Ne() {
214
228
  let e = j.value;
215
229
  if (e) return M(e.state.selection.$from);
216
230
  }
217
- function Ne(e, t, n) {
231
+ function Pe(e, t, n) {
218
232
  let r = j.value, i = n instanceof HTMLElement ? n : null;
219
233
  if (!r || !i?.closest("td,th")) return !1;
220
234
  if (r.state.selection instanceof S && i.closest("td.selectedCell,th.selectedCell")) return !0;
221
- let a = je(e, t);
235
+ let a = Me(e, t);
222
236
  return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(S.create(r.state.doc, a))), !0) : !1;
223
237
  }
224
238
  function N() {
@@ -240,7 +254,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
240
254
  deleteTable: n((e) => e.deleteTable())
241
255
  };
242
256
  }
243
- function Pe() {
257
+ function Fe() {
244
258
  let e = j.value, t = e?.state.selection;
245
259
  if (!e || !(t instanceof S)) return "left";
246
260
  let n = /* @__PURE__ */ new Set();
@@ -270,7 +284,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
270
284
  ...e,
271
285
  hasSelection: n,
272
286
  selectionWidth: n ? Oe() : void 0,
273
- leadingText: ke()
287
+ leadingText: Ae()
288
+ });
289
+ }
290
+ function Ie(e, t) {
291
+ I({
292
+ pageId: E.page.id,
293
+ clientX: e,
294
+ clientY: t
274
295
  });
275
296
  }
276
297
  function L(e, t) {
@@ -294,7 +315,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
294
315
  let e = j.value?.state.selection;
295
316
  if (e instanceof C) return R(e.node, e.from);
296
317
  }
297
- function Fe(e, t) {
318
+ function Le(e, t) {
298
319
  let n = t instanceof HTMLElement ? t.closest("[data-template-variable], img[src]") : null;
299
320
  if (n) try {
300
321
  let t = e.posAtDOM(n, 0), r = e.state.doc.nodeAt(t);
@@ -308,7 +329,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
308
329
  type: "table",
309
330
  ...e,
310
331
  capabilities: N(),
311
- activeAlignment: Pe(),
332
+ activeAlignment: Fe(),
312
333
  affectedVariableCounts: {
313
334
  deleteRow: F("delete-table-row"),
314
335
  deleteColumn: F("delete-table-column"),
@@ -316,14 +337,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
316
337
  }
317
338
  });
318
339
  }
319
- function Ie(e) {
340
+ function Re(e) {
320
341
  return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
321
342
  }
322
343
  function V() {
323
344
  let e = j.value;
324
345
  if (!e) return [];
325
346
  let { doc: t, selection: n } = e.state, r = [], i = (e) => {
326
- e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Ie(e.attrs.level) && r.push(e.attrs.level);
347
+ e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Re(e.attrs.level) && r.push(e.attrs.level);
327
348
  };
328
349
  if (n.empty) for (let e = n.$from.depth; e > 0; e--) {
329
350
  let t = n.$from.node(e);
@@ -335,14 +356,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
335
356
  else t.nodesBetween(n.from, n.to, (e) => (i(e), !0));
336
357
  return Array.from(new Set(r));
337
358
  }
338
- function Le() {
359
+ function ze() {
339
360
  let e = V();
340
361
  return e.length === 1 && e[0] !== "paragraph" ? e[0] : void 0;
341
362
  }
342
- function Re() {
363
+ function Be() {
343
364
  return V().length > 1;
344
365
  }
345
- function ze() {
366
+ function Ve() {
346
367
  return ["center", "right"].find((e) => j.value?.isActive("heading", { textAlign: e }) || j.value?.isActive("paragraph", { textAlign: e })) ?? "left";
347
368
  }
348
369
  function H() {
@@ -357,9 +378,9 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
357
378
  isBulletList: t("bulletList"),
358
379
  isOrderedList: t("orderedList"),
359
380
  isTableActive: t("table"),
360
- currentHeadingLevel: Le(),
361
- hasMixedBlockFormats: Re(),
362
- textAlign: ze(),
381
+ currentHeadingLevel: ze(),
382
+ hasMixedBlockFormats: Be(),
383
+ textAlign: Ve(),
363
384
  fontFamily: typeof n.fontFamily == "string" ? n.fontFamily : void 0,
364
385
  fontSize: Ee(n.fontSize),
365
386
  textColor: typeof n.color == "string" ? n.color : void 0,
@@ -375,19 +396,19 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
375
396
  }), x(() => E.page.contentHtml, (e) => {
376
397
  !j.value || e === j.value.getHTML() || (j.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
377
398
  });
378
- let Be = p(() => {
379
- let e = l(E.pageDecorations), t = E.pageIndex + 1, n = c(e, t) ? o(e.header) : a.top, r = s(e, t) ? o(e.footer) : a.bottom;
399
+ let He = p(() => {
400
+ let e = a(E.pageDecorations), o = E.pageIndex + 1, s = i(e, o) ? n(e.header) : t.top, c = r(e, o) ? n(e.footer) : t.bottom;
380
401
  return {
381
402
  width: `${E.pageSize.width}px`,
382
403
  height: `${E.pageSize.height}px`,
383
- paddingTop: `${n}px`,
384
- paddingBottom: `${r}px`,
385
- "--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - n - r)}px`
404
+ paddingTop: `${s}px`,
405
+ paddingBottom: `${c}px`,
406
+ "--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - s - c)}px`
386
407
  };
387
- }), W = p(() => Math.max(.1, E.zoom || 1)), Ve = p(() => ({
408
+ }), W = p(() => Math.max(.1, E.zoom || 1)), Ue = p(() => ({
388
409
  width: `${Math.ceil((E.pageSize.width + 10) * W.value)}px`,
389
410
  height: `${Math.ceil((E.pageSize.height + 40) * W.value)}px`
390
- })), He = p(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ue = p(() => te(E.pageSize));
411
+ })), We = p(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ge = p(() => re(E.pageSize));
391
412
  function G(e, t) {
392
413
  let n = k.value?.getBoundingClientRect();
393
414
  return n ? {
@@ -398,43 +419,43 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
398
419
  y: E.pageSize.height / 2
399
420
  };
400
421
  }
401
- function We(e) {
402
- let t = k.value?.getBoundingClientRect(), r = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), i = n(e);
403
- if (!t || !r) return {
404
- x: Math.max(0, (E.pageSize.width - i.width) / 2),
405
- y: Math.max(0, (E.pageSize.height - i.height) / 2)
422
+ function Ke(e) {
423
+ let t = k.value?.getBoundingClientRect(), n = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), r = ee(e);
424
+ if (!t || !n) return {
425
+ x: Math.max(0, (E.pageSize.width - r.width) / 2),
426
+ y: Math.max(0, (E.pageSize.height - r.height) / 2)
406
427
  };
407
- let a = Math.max(t.left, r.left), o = Math.max(t.top, r.top), s = Math.min(t.right, r.right), c = Math.min(t.bottom, r.bottom), l = G(s > a ? (a + s) / 2 : (t.left + t.right) / 2, c > o ? (o + c) / 2 : (t.top + t.bottom) / 2);
428
+ let i = Math.max(t.left, n.left), a = Math.max(t.top, n.top), o = Math.min(t.right, n.right), s = Math.min(t.bottom, n.bottom), c = G(o > i ? (i + o) / 2 : (t.left + t.right) / 2, s > a ? (a + s) / 2 : (t.top + t.bottom) / 2);
408
429
  return {
409
- x: l.x - i.width / 2,
410
- y: l.y - i.height / 2
430
+ x: c.x - r.width / 2,
431
+ y: c.y - r.height / 2
411
432
  };
412
433
  }
413
- function Ge(n) {
414
- if (!t(E.readonly, E.disabled)) {
415
- n.preventDefault(), n.stopPropagation();
434
+ function qe(e) {
435
+ if (!c(E.readonly, E.disabled)) {
436
+ e.preventDefault(), e.stopPropagation();
416
437
  return;
417
438
  }
418
- let i = r(n.dataTransfer?.getData(e));
419
- if (i) {
420
- n.preventDefault(), n.stopPropagation();
421
- let e = G(n.clientX, n.clientY);
422
- D("signing-placement-drop", E.page.id, i, e.x, e.y);
439
+ let t = te(e.dataTransfer?.getData(s));
440
+ if (t) {
441
+ e.preventDefault(), e.stopPropagation();
442
+ let n = G(e.clientX, e.clientY);
443
+ D("signing-placement-drop", E.page.id, t, n.x, n.y);
423
444
  return;
424
445
  }
425
- let a = n.dataTransfer?.getData("application/x-gd-contract-variable");
426
- if (a) {
427
- n.preventDefault(), n.stopPropagation(), D("variable-drop", E.page.id, a, n.clientX, n.clientY);
446
+ let n = e.dataTransfer?.getData("application/x-gd-contract-variable");
447
+ if (n) {
448
+ e.preventDefault(), e.stopPropagation(), D("variable-drop", E.page.id, n, e.clientX, e.clientY);
428
449
  return;
429
450
  }
430
- let o = n.dataTransfer?.getData(w);
431
- o && o !== E.page.id && (n.preventDefault(), n.stopPropagation(), D("variable-move-blocked", E.page.id));
451
+ let r = e.dataTransfer?.getData(w);
452
+ r && r !== E.page.id && (e.preventDefault(), e.stopPropagation(), D("variable-move-blocked", E.page.id));
432
453
  }
433
- function Ke(e, t) {
454
+ function Je(e, t) {
434
455
  let n = j.value;
435
- return n ? (ie(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
456
+ return n ? (ae(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
436
457
  }
437
- function qe(e, t) {
458
+ function Ye(e, t) {
438
459
  let n = j.value;
439
460
  if (n) return d(n, {
440
461
  type: "insert-content-image",
@@ -442,7 +463,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
442
463
  position: t
443
464
  }), K();
444
465
  }
445
- function Je(e) {
466
+ function Xe(e) {
446
467
  let t = j.value, n = t?.state.selection;
447
468
  if (!t || !(n instanceof C) || n.node.type.name !== "image") return;
448
469
  let r = { ...n.node.attrs }, i = !1;
@@ -454,7 +475,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
454
475
  let a = t.state.tr.setNodeMarkup(n.from, void 0, r);
455
476
  return a.setSelection(C.create(a.doc, n.from)), t.view.dispatch(a), K();
456
477
  }
457
- function Ye() {
478
+ function Ze() {
458
479
  let e = j.value?.state.selection;
459
480
  return e ? {
460
481
  from: e.from,
@@ -464,7 +485,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
464
485
  function K() {
465
486
  return {
466
487
  ...E.page,
467
- pageSize: Ue.value,
488
+ pageSize: Ge.value,
468
489
  contentHtml: j.value?.getHTML() ?? E.page.contentHtml,
469
490
  contentJson: j.value?.getJSON() ?? E.page.contentJson
470
491
  };
@@ -475,23 +496,23 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
475
496
  content: e.length ? e : [{ type: "paragraph" }]
476
497
  };
477
498
  }
478
- function Xe(e) {
499
+ function Qe(e) {
479
500
  return e?.length ? e.length === 1 && e[0].type === "paragraph" && !e[0].content?.length : !0;
480
501
  }
481
- function Ze(e) {
502
+ function $e(e) {
482
503
  return ye(q(e), A);
483
504
  }
484
- function Qe() {
505
+ function et() {
485
506
  if (E.pageDecorations) {
486
- let e = l(E.pageDecorations), t = E.pageIndex + 1, n = c(e, t) ? o(e.header) : a.top, r = s(e, t) ? o(e.footer) : a.bottom;
487
- return Math.max(120, E.pageSize.height - n - r);
507
+ let e = a(E.pageDecorations), o = E.pageIndex + 1, s = i(e, o) ? n(e.header) : t.top, c = r(e, o) ? n(e.footer) : t.bottom;
508
+ return Math.max(120, E.pageSize.height - s - c);
488
509
  }
489
510
  let e = k.value;
490
511
  if (!e) return E.pageSize.height - 108;
491
- let t = window.getComputedStyle(e), n = Number.parseFloat(t.paddingTop) || 0, r = Number.parseFloat(t.paddingBottom) || 0;
492
- return Math.max(120, E.pageSize.height - n - r);
512
+ let o = window.getComputedStyle(e), s = Number.parseFloat(o.paddingTop) || 0, c = Number.parseFloat(o.paddingBottom) || 0;
513
+ return Math.max(120, E.pageSize.height - s - c);
493
514
  }
494
- function $e() {
515
+ function tt() {
495
516
  let e = k.value?.querySelector(".gd-contract-template-designer__editor-prose");
496
517
  if (!e) return [];
497
518
  let t = e.getBoundingClientRect(), n = W.value;
@@ -504,23 +525,23 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
504
525
  });
505
526
  }
506
527
  function J() {
507
- return j.value ? ne(j.value.getJSON().content, $e(), Qe()) : void 0;
528
+ return j.value ? ie(j.value.getJSON().content, tt(), et()) : void 0;
508
529
  }
509
- function et() {
530
+ function nt() {
510
531
  return !!J();
511
532
  }
512
- function tt() {
533
+ function rt() {
513
534
  if (!j.value) return;
514
535
  let e = J();
515
536
  if (e) return j.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
516
537
  page: K(),
517
538
  overflowContent: e.overflowContent,
518
- overflowHtml: Ze(e.overflowContent)
539
+ overflowHtml: $e(e.overflowContent)
519
540
  };
520
541
  }
521
- function nt(e) {
542
+ function it(e) {
522
543
  if (!j.value || !e.length) return;
523
- let t = j.value.getJSON().content, n = [...e, ...Xe(t) ? [] : t ?? []];
544
+ let t = j.value.getJSON().content, n = [...e, ...Qe(t) ? [] : t ?? []];
524
545
  return j.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
525
546
  }
526
547
  function Y(e, t) {
@@ -532,9 +553,9 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
532
553
  });
533
554
  }), n;
534
555
  }
535
- function rt(e, t = e.key) {
556
+ function X(e, t = e.key) {
536
557
  if (!j.value) return;
537
- let n = re(e), r = !1;
558
+ let n = l(e), r = !1;
538
559
  return j.value.commands.command(({ tr: e, state: i, dispatch: a }) => (Y(i.doc, t).forEach(({ node: t, pos: i }) => {
539
560
  e.setNodeMarkup(i, void 0, {
540
561
  ...t.attrs,
@@ -542,7 +563,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
542
563
  }), r = !0;
543
564
  }), r && a?.(e), r)), $(), r ? K() : void 0;
544
565
  }
545
- function it(e) {
566
+ function at(e) {
546
567
  if (!j.value) return;
547
568
  let t = 0;
548
569
  return j.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
@@ -553,22 +574,22 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
553
574
  return a.forEach((e) => n.delete(e.from, e.to)), t = a.length, t && i?.(n), t > 0;
554
575
  }), t ? K() : void 0;
555
576
  }
556
- function X() {
577
+ function Z() {
557
578
  k.value?.querySelectorAll(".gd-contract-template-variable.is-active").forEach((e) => e.classList.remove("is-active"));
558
579
  }
559
- function Z(e) {
580
+ function Q(e) {
560
581
  if (e) return Array.from(k.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
561
582
  }
562
- function at(e) {
563
- X();
564
- let t = Z(e);
583
+ function ot(e) {
584
+ Z();
585
+ let t = Q(e);
565
586
  return t ? (t.classList.add("is-active"), t.scrollIntoView({
566
587
  behavior: "smooth",
567
588
  block: "center",
568
589
  inline: "center"
569
590
  }), j.value?.commands.focus(), !0) : !1;
570
591
  }
571
- function Q(e) {
592
+ function st(e) {
572
593
  let t = Array.from(k.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
573
594
  return t?.scrollIntoView({
574
595
  behavior: "smooth",
@@ -577,13 +598,13 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
577
598
  }), !!t;
578
599
  }
579
600
  function $() {
580
- X(), Z(E.selectedVariableKey)?.classList.add("is-active");
601
+ Z(), Q(E.selectedVariableKey)?.classList.add("is-active");
581
602
  }
582
- function ot(e) {
583
- let t = i.find((t) => t.key === e), n = j.value;
584
- if (!t || !n) return;
585
- let r = n.chain().focus().clearNodes();
586
- t.headingLevel ? r.setHeading({ level: t.headingLevel }) : r.setParagraph(), r.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(t.textAlign).setFontSize(`${t.fontSize}px`).setFontFamily(t.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif").setColor(ee.color || "#1f2937"), t.bold ? r.setBold() : r.unsetBold(), t.italic ? r.setItalic() : r.unsetItalic(), t.underline ? r.setUnderline() : r.unsetUnderline(), r.run();
603
+ function ct(t) {
604
+ let n = e.find((e) => e.key === t), r = j.value;
605
+ if (!n || !r) return;
606
+ let i = r.chain().focus().clearNodes();
607
+ n.headingLevel ? i.setHeading({ level: n.headingLevel }) : i.setParagraph(), i.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(n.textAlign).setFontSize(`${n.fontSize}px`).setFontFamily(n.fontFamily || "Noto Serif SC, Source Han Serif SC, Songti SC, STSong, SimSun, serif").setColor(ne.color || "#1f2937"), n.bold ? i.setBold() : i.unsetBold(), n.italic ? i.setItalic() : i.unsetItalic(), n.underline ? i.setUnderline() : i.unsetUnderline(), i.run();
587
608
  }
588
609
  x([() => E.selectedVariableKey, () => E.variables], () => {
589
610
  fe($);
@@ -591,26 +612,26 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
591
612
  deep: !0,
592
613
  flush: "post"
593
614
  });
594
- function st(e) {
595
- e.type === "apply-block-style" ? j.value && oe(j.value, e.format) : e.type === "apply-text-style-preset" ? ot(e.preset) : d(j.value, e), U();
615
+ function lt(e) {
616
+ e.type === "apply-block-style" ? j.value && se(j.value, e.format) : e.type === "apply-text-style-preset" ? ct(e.preset) : d(j.value, e), U();
596
617
  }
597
- function ct() {
618
+ function ut() {
598
619
  j.value?.commands.focus();
599
620
  }
600
- function lt() {
621
+ function dt() {
601
622
  return j.value?.getJSON();
602
623
  }
603
- function ut() {
624
+ function ft() {
604
625
  return j.value?.getHTML() ?? E.page.contentHtml;
605
626
  }
606
- function dt(e) {
607
- let t = E.variables.find((t) => t.id === e || t.key === e), n = t ? Z(t.key) : void 0;
627
+ function pt(e) {
628
+ let t = E.variables.find((t) => t.id === e || t.key === e), n = t ? Q(t.key) : void 0;
608
629
  $(), n?.scrollIntoView({
609
630
  behavior: "smooth",
610
631
  block: "center"
611
632
  });
612
633
  }
613
- function ft() {
634
+ function mt() {
614
635
  k.value?.scrollIntoView({
615
636
  behavior: "smooth",
616
637
  block: "start",
@@ -620,43 +641,45 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
620
641
  return me(() => {
621
642
  j.value?.destroy();
622
643
  }), T({
623
- focus: ct,
624
- getHTML: ut,
625
- getJSON: lt,
644
+ focus: ut,
645
+ getHTML: ft,
646
+ getJSON: dt,
626
647
  getEditorState: H,
627
648
  getTableCommandCapabilities: N,
628
649
  getAffectedVariableCount: F,
629
- getVisibleSigningPlacementPosition: We,
630
- insertVariable: Ke,
631
- insertContentImage: qe,
632
- updateSelectedContentImage: Je,
633
- getSelectionRange: Ye,
634
- hasOverflowContent: et,
635
- updateVariable: rt,
636
- removeVariable: it,
637
- splitOverflowContent: tt,
638
- prependContent: nt,
639
- runCommand: st,
640
- scrollIntoField: dt,
641
- scrollIntoVariable: at,
642
- scrollIntoSigningPlacement: Q,
643
- scrollIntoPage: ft
650
+ getVisibleSigningPlacementPosition: Ke,
651
+ insertVariable: Je,
652
+ insertContentImage: Ye,
653
+ updateSelectedContentImage: Xe,
654
+ getSelectionRange: Ze,
655
+ getSelectionViewportRect: ke,
656
+ requestTextContextMenu: Ie,
657
+ hasOverflowContent: nt,
658
+ updateVariable: X,
659
+ removeVariable: at,
660
+ splitOverflowContent: rt,
661
+ prependContent: it,
662
+ runCommand: lt,
663
+ scrollIntoField: pt,
664
+ scrollIntoVariable: ot,
665
+ scrollIntoSigningPlacement: st,
666
+ scrollIntoPage: mt
644
667
  }), (e, t) => (v(), de("section", {
645
668
  class: "gd-contract-template-designer__page-shell",
646
- style: _(Ve.value)
669
+ style: _(Ue.value)
647
670
  }, [m("div", {
648
671
  class: pe(["gd-contract-template-designer__page-zoom", { "is-active": g.active }]),
649
- style: _(He.value)
672
+ style: _(We.value)
650
673
  }, [m("header", Ce, [m("span", null, y(g.page.title || `第 ${g.pageIndex + 1} 页`), 1), m("span", null, "第 " + y(g.pageIndex + 1) + " 页 · " + y(g.pageSize.label || "A4") + " · " + y(g.pageSize.width) + " × " + y(g.pageSize.height), 1)]), m("div", {
651
674
  ref_key: "pageElement",
652
675
  ref: k,
653
676
  class: "gd-contract-template-designer__page",
654
- style: _(Be.value),
677
+ style: _(He.value),
655
678
  onDragover: t[3] ||= ge(() => {}, ["prevent"]),
656
- onDrop: Ge,
679
+ onDrop: qe,
657
680
  onClick: t[4] ||= (e) => D("editor-focus", g.page.id)
658
681
  }, [
659
- h(ce, {
682
+ h(o, {
660
683
  decorations: g.pageDecorations,
661
684
  "page-number": g.pageIndex + 1,
662
685
  "total-pages": g.totalPages,
@@ -672,7 +695,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
672
695
  class: "gd-contract-template-page__content",
673
696
  editor: b(j)
674
697
  }, null, 8, ["editor"])) : ue("", !0),
675
- h(se, {
698
+ h(ce, {
676
699
  "page-size": g.pageSize,
677
700
  placements: g.signingPlacements,
678
701
  "selected-id": g.selectedSigningPlacementId,