@guodun/antdv 1.4.8 → 1.5.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.
Files changed (70) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +315 -286
  2. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +316 -285
  3. package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +62 -54
  4. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  5. package/dist/es/components/index.mjs +1 -0
  6. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  7. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.mjs +7 -0
  8. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue.mjs +129 -0
  9. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +1 -0
  10. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +10 -5
  11. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +64 -43
  12. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +82 -53
  13. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +271 -265
  14. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +762 -751
  15. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +217 -197
  16. package/dist/es/components/pro-contract-template-designer/src/constants.mjs +29 -51
  17. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +103 -103
  18. package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +24 -21
  19. package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +314 -0
  20. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +1 -1
  21. package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +47 -47
  22. package/dist/es/components/pro-contract-template-designer/src/utils/word-paste.mjs +216 -148
  23. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  24. package/dist/es/index.mjs +27 -26
  25. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  26. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  27. package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
  28. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  29. package/dist/lib/components/index.cjs +1 -1
  30. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  31. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.cjs +1 -0
  32. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue.cjs +1 -0
  33. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +1 -0
  34. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.cjs +1 -1
  35. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  36. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
  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/ProContractTemplateRenderer.vue.cjs +1 -1
  40. package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  42. package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
  43. package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +211 -0
  44. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
  45. package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
  46. package/dist/lib/components/pro-contract-template-designer/src/utils/word-paste.cjs +2 -2
  47. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  48. package/dist/lib/index.cjs +1 -1
  49. package/dist/theme/contract-signing-location.css +1 -1
  50. package/dist/theme/icon.css +1 -1
  51. package/dist/theme/index.css +1 -1
  52. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +7 -0
  53. package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +4 -0
  54. package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +9 -3
  55. package/dist/types/components/contract-signing-location/src/types.d.ts +5 -0
  56. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  57. package/dist/types/components/pro-contract-template-designer/src/ContractPrintIframe.vue.d.ts +35 -0
  58. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +2 -2
  59. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +1 -0
  60. package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +1 -0
  61. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.d.ts +13 -1
  62. package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +6 -0
  63. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +1 -0
  64. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +1 -0
  65. package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +4 -4
  66. package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +8 -0
  67. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +10 -0
  68. package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +119 -0
  69. package/dist/types/components/pro-contract-template-designer/src/utils/word-paste.d.ts +2 -0
  70. package/package.json +4 -3
@@ -1,21 +1,21 @@
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";
1
+ import { CONTRACT_TEXT_STYLE_PRESETS as e, DEFAULT_CONTRACT_FONT_FAMILY as t } from "./constants.mjs";
2
+ import { CONTRACT_PAGE_BASE_PADDING as n, getPageDecorationSafePadding as r, hasEnabledPageFooter as i, hasEnabledPageHeader as a, normalizePageDecorations as o } from "./utils/page-decorations.mjs";
4
3
  import { SIGNING_PLACEMENT_MIME as s, canMutateSigningPlacements as c, getSigningPlacementDefaultSize as ee, parseSigningPlacementDragPayload as te } from "./utils/signing-placement.mjs";
5
4
  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";
7
- import { normalizeContractImageDimension as u } from "./utils/content-image.mjs";
8
- import { createEditorExtensions as oe, runContractTemplateEditorCommand as d } from "./extensions/editor-extensions.mjs";
9
- import { resolveEditorContextMenuKind as f } from "./utils/context-variable.mjs";
10
- import { applyContractTemplateBlockStyle as se } from "./utils/block-style.mjs";
11
- import ce from "./SigningPlacementLayer.mjs";
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
- import { EditorContent as _e, useEditor as ve } from "@tiptap/vue-3";
14
- import { generateHTML as ye } from "@tiptap/core";
15
- import { CellSelection as S, deleteColumn as be, deleteRow as xe, deleteTable as Se } from "@tiptap/pm/tables";
16
- import { NodeSelection as C } from "@tiptap/pm/state";
5
+ import { buildTemplateVariableAttrs as ae, insertTemplateVariableNode as oe } from "./extensions/template-variable.mjs";
6
+ import { normalizeContractImageDimension as l } from "./utils/content-image.mjs";
7
+ import { createEditorExtensions as se, runContractTemplateEditorCommand as u } from "./extensions/editor-extensions.mjs";
8
+ import { resolveEditorContextMenuKind as d } from "./utils/context-variable.mjs";
9
+ import { applyContractTemplateBlockStyle as ce } from "./utils/block-style.mjs";
10
+ import le from "./SigningPlacementLayer.mjs";
11
+ import ue from "./ContractTemplatePageDecorations.mjs";
12
+ import { computed as f, createBlock as de, createCommentVNode as fe, createElementBlock as pe, createElementVNode as p, createVNode as m, defineComponent as h, nextTick as me, normalizeClass as he, normalizeStyle as g, onBeforeUnmount as ge, openBlock as _, ref as _e, toDisplayString as v, unref as y, watch as b, withModifiers as ve } from "vue";
13
+ import { EditorContent as ye, useEditor as be } from "@tiptap/vue-3";
14
+ import { generateHTML as xe } from "@tiptap/core";
15
+ import { CellSelection as x, deleteColumn as Se, deleteRow as Ce, deleteTable as we } from "@tiptap/pm/tables";
16
+ import { NodeSelection as S } from "@tiptap/pm/state";
17
17
  //#region src/components/pro-contract-template-designer/src/DesignerPage.vue?vue&type=script&setup=true&lang.ts
18
- var Ce = { class: "gd-contract-template-designer__page-title" }, w = "application/x-gd-contract-variable-move", we = 8, T = /* @__PURE__ */ g({
18
+ var Te = { class: "gd-contract-template-designer__page-title" }, C = "application/x-gd-contract-variable-move", Ee = 8, w = /* @__PURE__ */ h({
19
19
  name: "ProContractTemplateDesignerPage",
20
20
  __name: "DesignerPage",
21
21
  props: {
@@ -57,133 +57,139 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
57
57
  "variable-move-blocked",
58
58
  "editor-focus",
59
59
  "editor-state-change",
60
- "editor-context-menu"
60
+ "editor-context-menu",
61
+ "word-paste"
61
62
  ],
62
- setup(g, { expose: T, emit: Te }) {
63
- let E = g, D = Te, O = p(() => E.readonly || E.disabled), k = he(), A = oe("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
64
- processImageFile: E.processImageFile,
65
- getZoom: () => Math.max(.1, E.zoom || 1)
66
- }), j = ve({
67
- content: E.page.contentHtml,
68
- editable: !O.value,
69
- extensions: A,
63
+ setup(h, { expose: w, emit: De }) {
64
+ let T = h, E = De, D = f(() => T.readonly || T.disabled), O = _e(), k = se("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
65
+ processImageFile: T.processImageFile,
66
+ getZoom: () => Math.max(.1, T.zoom || 1)
67
+ }), A = be({
68
+ content: T.page.contentHtml,
69
+ editable: !D.value,
70
+ extensions: k,
70
71
  editorProps: {
71
72
  attributes: { class: "gd-contract-template-designer__editor-prose" },
72
73
  handleClick: (e, t, n) => {
73
74
  let r = (n.target instanceof HTMLElement ? n.target.closest("[data-template-variable]") : void 0)?.dataset.key;
74
75
  if (!r) return !1;
75
- let i = E.variables.find((e) => e.key === r);
76
- return i && D("variable-select", i.key), !1;
76
+ let i = T.variables.find((e) => e.key === r);
77
+ return i && E("variable-select", i.key), !1;
77
78
  },
78
79
  handleDOMEvents: {
79
80
  contextmenu: (e, t) => {
80
- if (O.value) return !1;
81
- let n = Le(e, t.target);
81
+ if (D.value) return !1;
82
+ let n = ze(e, t.target);
82
83
  if (n) return t.preventDefault(), L({
83
- pageId: E.page.id,
84
+ pageId: T.page.id,
84
85
  clientX: t.clientX,
85
86
  clientY: t.clientY
86
87
  }, n), !0;
87
- let r = j.value?.state.selection, i = r instanceof S, a = t.target instanceof HTMLElement ? !!t.target.closest("td, th") : !1, o = f({
88
+ let r = A.value?.state.selection, i = r instanceof x, a = t.target instanceof HTMLElement ? !!t.target.closest("td, th") : !1, o = d({
88
89
  isCellSelection: i,
89
90
  selectionEmpty: !r || r.empty,
90
91
  inTable: a
91
92
  });
92
- return t.preventDefault(), o === "table" && (i || Pe(t.clientX, t.clientY, t.target)) ? (B({
93
- pageId: E.page.id,
93
+ return t.preventDefault(), o === "table" && (i || Ie(t.clientX, t.clientY, t.target)) ? (B({
94
+ pageId: T.page.id,
94
95
  clientX: t.clientX,
95
96
  clientY: t.clientY
96
97
  }), !0) : (I({
97
- pageId: E.page.id,
98
+ pageId: T.page.id,
98
99
  clientX: t.clientX,
99
100
  clientY: t.clientY
100
101
  }), !0);
101
102
  },
102
- dragstart: (e, t) => O.value ? (t.preventDefault(), !0) : (t.target instanceof HTMLElement ? t.target : null)?.closest("[data-template-variable]") ? (t.dataTransfer?.setData(w, E.page.id), t.dataTransfer && (t.dataTransfer.effectAllowed = "move"), k.value?.classList.add("is-variable-dragging"), !1) : !1,
103
- dragend: () => (k.value?.classList.remove("is-variable-dragging"), !1),
103
+ dragstart: (e, t) => D.value ? (t.preventDefault(), !0) : (t.target instanceof HTMLElement ? t.target : null)?.closest("[data-template-variable]") ? (t.dataTransfer?.setData(C, T.page.id), t.dataTransfer && (t.dataTransfer.effectAllowed = "move"), O.value?.classList.add("is-variable-dragging"), !1) : !1,
104
+ dragend: () => (O.value?.classList.remove("is-variable-dragging"), !1),
104
105
  drop: (e, t) => {
105
- if (O.value) return t.preventDefault(), t.stopPropagation(), !0;
106
- let n = t.dataTransfer?.getData(w);
107
- return !n || n === E.page.id ? !1 : (t.preventDefault(), D("variable-move-blocked", E.page.id), !0);
106
+ if (D.value) return t.preventDefault(), t.stopPropagation(), !0;
107
+ let n = t.dataTransfer?.getData(C);
108
+ return !n || n === T.page.id ? !1 : (t.preventDefault(), E("variable-move-blocked", T.page.id), !0);
108
109
  }
109
110
  },
110
111
  handleKeyDown: (e, t) => {
111
- if (O.value || !je(t)) return !1;
112
- let n = j.value;
112
+ if (D.value || !Ne(t)) return !1;
113
+ let n = A.value;
113
114
  if (!n) return !1;
114
115
  t.preventDefault();
115
116
  let r = n.state.selection, i = z();
116
117
  if (i) {
117
118
  let e = n.view.coordsAtPos(r.from);
118
119
  return L({
119
- pageId: E.page.id,
120
+ pageId: T.page.id,
120
121
  clientX: e.left,
121
122
  clientY: e.bottom
122
123
  }, i), !0;
123
124
  }
124
- let a = r instanceof S;
125
- if (f({
125
+ let a = r instanceof x;
126
+ if (d({
126
127
  isCellSelection: a,
127
128
  selectionEmpty: r.empty,
128
129
  inTable: n.isActive("table")
129
130
  }) === "table") {
130
131
  if (!a) {
131
- let e = Ne();
132
- typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(S.create(n.state.doc, e)));
132
+ let e = Fe();
133
+ typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(x.create(n.state.doc, e)));
133
134
  }
134
135
  let e = n.view.coordsAtPos(n.state.selection.from);
135
136
  return B({
136
- pageId: E.page.id,
137
+ pageId: T.page.id,
137
138
  clientX: e.left,
138
139
  clientY: e.bottom
139
140
  }), !0;
140
141
  }
141
142
  let o = n.view.coordsAtPos(n.state.selection.from);
142
143
  return I({
143
- pageId: E.page.id,
144
+ pageId: T.page.id,
144
145
  clientX: o.left,
145
146
  clientY: o.bottom
146
147
  }), !0;
147
148
  }
148
149
  },
149
150
  onUpdate: ({ editor: e }) => {
150
- D("page-update", {
151
- ...E.page,
151
+ E("page-update", {
152
+ ...T.page,
152
153
  contentHtml: e.getHTML(),
153
154
  contentJson: e.getJSON()
154
155
  }), U();
155
156
  },
156
157
  onFocus: () => {
157
- D("editor-focus", E.page.id), U();
158
+ E("editor-focus", T.page.id), U();
158
159
  },
159
160
  onBlur: U,
160
161
  onSelectionUpdate: U,
161
- onCreate: U
162
+ onCreate: ({ editor: e }) => {
163
+ e.on("contract-word-paste", j), U();
164
+ }
162
165
  });
163
- function Ee(e) {
166
+ function j(e) {
167
+ E("word-paste", e);
168
+ }
169
+ function Oe(e) {
164
170
  if (typeof e == "number" && Number.isFinite(e)) return e;
165
171
  let t = String(e || "").match(/(\d+(\.\d+)?)/);
166
172
  return t ? Number(t[1]) : void 0;
167
173
  }
168
- function De() {
169
- if (!j.value) return "";
170
- let { from: e, to: t } = j.value.state.selection;
171
- return j.value.state.doc.textBetween(e, t, "\n");
174
+ function ke() {
175
+ if (!A.value) return "";
176
+ let { from: e, to: t } = A.value.state.selection;
177
+ return A.value.state.doc.textBetween(e, t, "\n");
172
178
  }
173
- function Oe() {
174
- let e = j.value, t = e?.state.selection;
179
+ function Ae() {
180
+ let e = A.value, t = e?.state.selection;
175
181
  if (!(!e || !t || t.empty)) try {
176
182
  let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
177
- if (Math.abs(r.top - n.top) > we) return;
183
+ if (Math.abs(r.top - n.top) > Ee) return;
178
184
  let i = Math.abs(r.left - n.left) / W.value;
179
185
  return Number.isFinite(i) && i > 0 ? i : void 0;
180
186
  } catch {
181
187
  return;
182
188
  }
183
189
  }
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 {
190
+ function je() {
191
+ let e = A.value, t = e?.state.selection;
192
+ if (!(!e || !t || t.empty) && !(t instanceof x || t instanceof S)) try {
187
193
  let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
188
194
  return {
189
195
  top: Math.min(n.top, r.top),
@@ -195,8 +201,8 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
195
201
  return;
196
202
  }
197
203
  }
198
- function Ae() {
199
- let e = j.value;
204
+ function Me() {
205
+ let e = A.value;
200
206
  if (!e) return "";
201
207
  let t = e.state.selection.$from, n = t.pos;
202
208
  for (let e = t.depth; e > 0; --e) {
@@ -208,7 +214,7 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
208
214
  }
209
215
  return e.state.doc.textBetween(n, e.state.selection.from, "");
210
216
  }
211
- function je(e) {
217
+ function Ne(e) {
212
218
  return e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
213
219
  }
214
220
  function M(e) {
@@ -217,26 +223,26 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
217
223
  if (n === "cell" || n === "header_cell") return e.before(t);
218
224
  }
219
225
  }
220
- function Me(e, t) {
221
- let n = j.value, r = n?.view.posAtCoords({
226
+ function Pe(e, t) {
227
+ let n = A.value, r = n?.view.posAtCoords({
222
228
  left: e,
223
229
  top: t
224
230
  })?.pos;
225
231
  if (!(!n || typeof r != "number")) return M(n.state.doc.resolve(r));
226
232
  }
227
- function Ne() {
228
- let e = j.value;
233
+ function Fe() {
234
+ let e = A.value;
229
235
  if (e) return M(e.state.selection.$from);
230
236
  }
231
- function Pe(e, t, n) {
232
- let r = j.value, i = n instanceof HTMLElement ? n : null;
237
+ function Ie(e, t, n) {
238
+ let r = A.value, i = n instanceof HTMLElement ? n : null;
233
239
  if (!r || !i?.closest("td,th")) return !1;
234
- if (r.state.selection instanceof S && i.closest("td.selectedCell,th.selectedCell")) return !0;
235
- let a = Me(e, t);
236
- return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(S.create(r.state.doc, a))), !0) : !1;
240
+ if (r.state.selection instanceof x && i.closest("td.selectedCell,th.selectedCell")) return !0;
241
+ let a = Pe(e, t);
242
+ return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(x.create(r.state.doc, a))), !0) : !1;
237
243
  }
238
244
  function N() {
239
- let e = j.value, t = e?.isActive("table") ? e.can() : void 0, n = (e) => !!(t && e(t));
245
+ let e = A.value, t = e?.isActive("table") ? e.can() : void 0, n = (e) => !!(t && e(t));
240
246
  return {
241
247
  addRowBefore: n((e) => e.addRowBefore()),
242
248
  addRowAfter: n((e) => e.addRowAfter()),
@@ -254,48 +260,48 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
254
260
  deleteTable: n((e) => e.deleteTable())
255
261
  };
256
262
  }
257
- function Fe() {
258
- let e = j.value, t = e?.state.selection;
259
- if (!e || !(t instanceof S)) return "left";
263
+ function Le() {
264
+ let e = A.value, t = e?.state.selection;
265
+ if (!e || !(t instanceof x)) return "left";
260
266
  let n = /* @__PURE__ */ new Set();
261
267
  return t.forEachCell((e) => {
262
268
  let t = e.attrs.textAlign;
263
269
  n.add(t === "center" || t === "right" ? t : "left");
264
270
  }), n.size === 1 ? n.values().next().value ?? "left" : "mixed";
265
271
  }
266
- function P(e = j.value?.state.doc) {
272
+ function P(e = A.value?.state.doc) {
267
273
  let t = 0;
268
274
  return e?.descendants((e) => {
269
275
  e.type.name === "templateVariable" && (t += 1);
270
276
  }), t;
271
277
  }
272
278
  function F(e) {
273
- let t = j.value;
279
+ let t = A.value;
274
280
  if (!t) return 0;
275
281
  let n = P(t.state.doc), r = n, i = (e) => {
276
282
  r = P(e.doc);
277
283
  };
278
- return e === "delete-table-row" ? xe(t.state, i) : e === "delete-table-column" ? be(t.state, i) : Se(t.state, i), Math.max(0, n - r);
284
+ return e === "delete-table-row" ? Ce(t.state, i) : e === "delete-table-column" ? Se(t.state, i) : we(t.state, i), Math.max(0, n - r);
279
285
  }
280
286
  function I(e) {
281
- let t = j.value?.state.selection, n = !!(t && !t.empty);
282
- D("editor-context-menu", {
287
+ let t = A.value?.state.selection, n = !!(t && !t.empty);
288
+ E("editor-context-menu", {
283
289
  type: "text",
284
290
  ...e,
285
291
  hasSelection: n,
286
- selectionWidth: n ? Oe() : void 0,
287
- leadingText: Ae()
292
+ selectionWidth: n ? Ae() : void 0,
293
+ leadingText: Me()
288
294
  });
289
295
  }
290
- function Ie(e, t) {
296
+ function Re(e, t) {
291
297
  I({
292
- pageId: E.page.id,
298
+ pageId: T.page.id,
293
299
  clientX: e,
294
300
  clientY: t
295
301
  });
296
302
  }
297
303
  function L(e, t) {
298
- D("editor-context-menu", {
304
+ E("editor-context-menu", {
299
305
  type: "image",
300
306
  ...e,
301
307
  image: t
@@ -307,29 +313,29 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
307
313
  src: e.attrs.src,
308
314
  alt: typeof e.attrs.alt == "string" ? e.attrs.alt : void 0,
309
315
  title: typeof e.attrs.title == "string" ? e.attrs.title : void 0,
310
- width: u(e.attrs.width),
311
- height: u(e.attrs.height)
316
+ width: l(e.attrs.width),
317
+ height: l(e.attrs.height)
312
318
  };
313
319
  }
314
320
  function z() {
315
- let e = j.value?.state.selection;
316
- if (e instanceof C) return R(e.node, e.from);
321
+ let e = A.value?.state.selection;
322
+ if (e instanceof S) return R(e.node, e.from);
317
323
  }
318
- function Le(e, t) {
324
+ function ze(e, t) {
319
325
  let n = t instanceof HTMLElement ? t.closest("[data-template-variable], img[src]") : null;
320
326
  if (n) try {
321
327
  let t = e.posAtDOM(n, 0), r = e.state.doc.nodeAt(t);
322
- return !r || r.type.name !== "templateVariable" && r.type.name !== "image" ? void 0 : (r.type.name === "templateVariable" && typeof r.attrs.key == "string" && D("variable-select", r.attrs.key), (!(e.state.selection instanceof C) || e.state.selection.from !== t) && e.dispatch(e.state.tr.setSelection(C.create(e.state.doc, t))), R(r, t));
328
+ return !r || r.type.name !== "templateVariable" && r.type.name !== "image" ? void 0 : (r.type.name === "templateVariable" && typeof r.attrs.key == "string" && E("variable-select", r.attrs.key), (!(e.state.selection instanceof S) || e.state.selection.from !== t) && e.dispatch(e.state.tr.setSelection(S.create(e.state.doc, t))), R(r, t));
323
329
  } catch {
324
330
  return;
325
331
  }
326
332
  }
327
333
  function B(e) {
328
- D("editor-context-menu", {
334
+ E("editor-context-menu", {
329
335
  type: "table",
330
336
  ...e,
331
337
  capabilities: N(),
332
- activeAlignment: Fe(),
338
+ activeAlignment: Le(),
333
339
  affectedVariableCounts: {
334
340
  deleteRow: F("delete-table-row"),
335
341
  deleteColumn: F("delete-table-column"),
@@ -337,14 +343,14 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
337
343
  }
338
344
  });
339
345
  }
340
- function Re(e) {
346
+ function Be(e) {
341
347
  return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
342
348
  }
343
349
  function V() {
344
- let e = j.value;
350
+ let e = A.value;
345
351
  if (!e) return [];
346
352
  let { doc: t, selection: n } = e.state, r = [], i = (e) => {
347
- e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Re(e.attrs.level) && r.push(e.attrs.level);
353
+ e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Be(e.attrs.level) && r.push(e.attrs.level);
348
354
  };
349
355
  if (n.empty) for (let e = n.$from.depth; e > 0; e--) {
350
356
  let t = n.$from.node(e);
@@ -356,18 +362,18 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
356
362
  else t.nodesBetween(n.from, n.to, (e) => (i(e), !0));
357
363
  return Array.from(new Set(r));
358
364
  }
359
- function ze() {
365
+ function Ve() {
360
366
  let e = V();
361
367
  return e.length === 1 && e[0] !== "paragraph" ? e[0] : void 0;
362
368
  }
363
- function Be() {
369
+ function He() {
364
370
  return V().length > 1;
365
371
  }
366
- function Ve() {
367
- return ["center", "right"].find((e) => j.value?.isActive("heading", { textAlign: e }) || j.value?.isActive("paragraph", { textAlign: e })) ?? "left";
372
+ function Ue() {
373
+ return ["center", "right"].find((e) => A.value?.isActive("heading", { textAlign: e }) || A.value?.isActive("paragraph", { textAlign: e })) ?? "left";
368
374
  }
369
375
  function H() {
370
- let e = j.value, t = (t) => !!e?.isActive(t), n = e?.getAttributes("textStyle") ?? {};
376
+ let e = A.value, t = (t) => !!e?.isActive(t), n = e?.getAttributes("textStyle") ?? {};
371
377
  return {
372
378
  isFocused: !!e?.isFocused,
373
379
  canUndo: !!e?.can().undo(),
@@ -378,52 +384,52 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
378
384
  isBulletList: t("bulletList"),
379
385
  isOrderedList: t("orderedList"),
380
386
  isTableActive: t("table"),
381
- currentHeadingLevel: ze(),
382
- hasMixedBlockFormats: Be(),
383
- textAlign: Ve(),
387
+ currentHeadingLevel: Ve(),
388
+ hasMixedBlockFormats: He(),
389
+ textAlign: Ue(),
384
390
  fontFamily: typeof n.fontFamily == "string" ? n.fontFamily : void 0,
385
- fontSize: Ee(n.fontSize),
391
+ fontSize: Oe(n.fontSize),
386
392
  textColor: typeof n.color == "string" ? n.color : void 0,
387
- selectionText: De(),
393
+ selectionText: ke(),
388
394
  selectedContentImage: z()
389
395
  };
390
396
  }
391
397
  function U() {
392
- D("editor-state-change", E.page.id, H());
398
+ E("editor-state-change", T.page.id, H());
393
399
  }
394
- x(O, (e) => {
395
- j.value?.setEditable(!e), U();
396
- }), x(() => E.page.contentHtml, (e) => {
397
- !j.value || e === j.value.getHTML() || (j.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
400
+ b(D, (e) => {
401
+ A.value?.setEditable(!e), U();
402
+ }), b(() => T.page.contentHtml, (e) => {
403
+ !A.value || e === A.value.getHTML() || (A.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
398
404
  });
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;
405
+ let We = f(() => {
406
+ let e = o(T.pageDecorations), t = T.pageIndex + 1, s = a(e, t) ? r(e.header) : n.top, c = i(e, t) ? r(e.footer) : n.bottom;
401
407
  return {
402
- width: `${E.pageSize.width}px`,
403
- height: `${E.pageSize.height}px`,
408
+ width: `${T.pageSize.width}px`,
409
+ height: `${T.pageSize.height}px`,
404
410
  paddingTop: `${s}px`,
405
411
  paddingBottom: `${c}px`,
406
- "--gd-contract-page-content-height": `${Math.max(120, E.pageSize.height - s - c)}px`
412
+ "--gd-contract-page-content-height": `${Math.max(120, T.pageSize.height - s - c)}px`
407
413
  };
408
- }), W = p(() => Math.max(.1, E.zoom || 1)), Ue = p(() => ({
409
- width: `${Math.ceil((E.pageSize.width + 10) * W.value)}px`,
410
- height: `${Math.ceil((E.pageSize.height + 40) * W.value)}px`
411
- })), We = p(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ge = p(() => re(E.pageSize));
414
+ }), W = f(() => Math.max(.1, T.zoom || 1)), Ge = f(() => ({
415
+ width: `${Math.ceil((T.pageSize.width + 10) * W.value)}px`,
416
+ height: `${Math.ceil((T.pageSize.height + 40) * W.value)}px`
417
+ })), Ke = f(() => ({ "--gd-contract-page-zoom": String(W.value) })), qe = f(() => re(T.pageSize));
412
418
  function G(e, t) {
413
- let n = k.value?.getBoundingClientRect();
419
+ let n = O.value?.getBoundingClientRect();
414
420
  return n ? {
415
- x: Math.min(E.pageSize.width, Math.max(0, (e - n.left) / W.value)),
416
- y: Math.min(E.pageSize.height, Math.max(0, (t - n.top) / W.value))
421
+ x: Math.min(T.pageSize.width, Math.max(0, (e - n.left) / W.value)),
422
+ y: Math.min(T.pageSize.height, Math.max(0, (t - n.top) / W.value))
417
423
  } : {
418
- x: E.pageSize.width / 2,
419
- y: E.pageSize.height / 2
424
+ x: T.pageSize.width / 2,
425
+ y: T.pageSize.height / 2
420
426
  };
421
427
  }
422
- function Ke(e) {
423
- let t = k.value?.getBoundingClientRect(), n = k.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), r = ee(e);
428
+ function Je(e) {
429
+ let t = O.value?.getBoundingClientRect(), n = O.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), r = ee(e);
424
430
  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)
431
+ x: Math.max(0, (T.pageSize.width - r.width) / 2),
432
+ y: Math.max(0, (T.pageSize.height - r.height) / 2)
427
433
  };
428
434
  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);
429
435
  return {
@@ -431,8 +437,8 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
431
437
  y: c.y - r.height / 2
432
438
  };
433
439
  }
434
- function qe(e) {
435
- if (!c(E.readonly, E.disabled)) {
440
+ function Ye(e) {
441
+ if (!c(T.readonly, T.disabled)) {
436
442
  e.preventDefault(), e.stopPropagation();
437
443
  return;
438
444
  }
@@ -440,43 +446,43 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
440
446
  if (t) {
441
447
  e.preventDefault(), e.stopPropagation();
442
448
  let n = G(e.clientX, e.clientY);
443
- D("signing-placement-drop", E.page.id, t, n.x, n.y);
449
+ E("signing-placement-drop", T.page.id, t, n.x, n.y);
444
450
  return;
445
451
  }
446
452
  let n = e.dataTransfer?.getData("application/x-gd-contract-variable");
447
453
  if (n) {
448
- e.preventDefault(), e.stopPropagation(), D("variable-drop", E.page.id, n, e.clientX, e.clientY);
454
+ e.preventDefault(), e.stopPropagation(), E("variable-drop", T.page.id, n, e.clientX, e.clientY);
449
455
  return;
450
456
  }
451
- let r = e.dataTransfer?.getData(w);
452
- r && r !== E.page.id && (e.preventDefault(), e.stopPropagation(), D("variable-move-blocked", E.page.id));
457
+ let r = e.dataTransfer?.getData(C);
458
+ r && r !== T.page.id && (e.preventDefault(), e.stopPropagation(), E("variable-move-blocked", T.page.id));
453
459
  }
454
- function Je(e, t) {
455
- let n = j.value;
456
- return n ? (ae(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
460
+ function Xe(e, t) {
461
+ let n = A.value;
462
+ return n ? (oe(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
457
463
  }
458
- function Ye(e, t) {
459
- let n = j.value;
460
- if (n) return d(n, {
464
+ function Ze(e, t) {
465
+ let n = A.value;
466
+ if (n) return u(n, {
461
467
  type: "insert-content-image",
462
468
  image: e,
463
469
  position: t
464
470
  }), K();
465
471
  }
466
- function Xe(e) {
467
- let t = j.value, n = t?.state.selection;
468
- if (!t || !(n instanceof C) || n.node.type.name !== "image") return;
472
+ function Qe(e) {
473
+ let t = A.value, n = t?.state.selection;
474
+ if (!t || !(n instanceof S) || n.node.type.name !== "image") return;
469
475
  let r = { ...n.node.attrs }, i = !1;
470
476
  if (["width", "height"].forEach((t) => {
471
477
  if (!Object.prototype.hasOwnProperty.call(e, t)) return;
472
- let n = e[t] === void 0 ? null : u(e[t]) ?? null;
478
+ let n = e[t] === void 0 ? null : l(e[t]) ?? null;
473
479
  r[t] !== n && (r[t] = n, i = !0);
474
480
  }), !i) return;
475
481
  let a = t.state.tr.setNodeMarkup(n.from, void 0, r);
476
- return a.setSelection(C.create(a.doc, n.from)), t.view.dispatch(a), K();
482
+ return a.setSelection(S.create(a.doc, n.from)), t.view.dispatch(a), K();
477
483
  }
478
- function Ze() {
479
- let e = j.value?.state.selection;
484
+ function $e() {
485
+ let e = A.value?.state.selection;
480
486
  return e ? {
481
487
  from: e.from,
482
488
  to: e.to
@@ -484,10 +490,10 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
484
490
  }
485
491
  function K() {
486
492
  return {
487
- ...E.page,
488
- pageSize: Ge.value,
489
- contentHtml: j.value?.getHTML() ?? E.page.contentHtml,
490
- contentJson: j.value?.getJSON() ?? E.page.contentJson
493
+ ...T.page,
494
+ pageSize: qe.value,
495
+ contentHtml: A.value?.getHTML() ?? T.page.contentHtml,
496
+ contentJson: A.value?.getJSON() ?? T.page.contentJson
491
497
  };
492
498
  }
493
499
  function q(e) {
@@ -496,24 +502,24 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
496
502
  content: e.length ? e : [{ type: "paragraph" }]
497
503
  };
498
504
  }
499
- function Qe(e) {
505
+ function et(e) {
500
506
  return e?.length ? e.length === 1 && e[0].type === "paragraph" && !e[0].content?.length : !0;
501
507
  }
502
- function $e(e) {
503
- return ye(q(e), A);
508
+ function tt(e) {
509
+ return xe(q(e), k);
504
510
  }
505
- function et() {
506
- if (E.pageDecorations) {
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);
511
+ function nt() {
512
+ if (T.pageDecorations) {
513
+ let e = o(T.pageDecorations), t = T.pageIndex + 1, s = a(e, t) ? r(e.header) : n.top, c = i(e, t) ? r(e.footer) : n.bottom;
514
+ return Math.max(120, T.pageSize.height - s - c);
509
515
  }
510
- let e = k.value;
511
- if (!e) return E.pageSize.height - 108;
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);
516
+ let e = O.value;
517
+ if (!e) return T.pageSize.height - 108;
518
+ let t = window.getComputedStyle(e), s = Number.parseFloat(t.paddingTop) || 0, c = Number.parseFloat(t.paddingBottom) || 0;
519
+ return Math.max(120, T.pageSize.height - s - c);
514
520
  }
515
- function tt() {
516
- let e = k.value?.querySelector(".gd-contract-template-designer__editor-prose");
521
+ function rt() {
522
+ let e = O.value?.querySelector(".gd-contract-template-designer__editor-prose");
517
523
  if (!e) return [];
518
524
  let t = e.getBoundingClientRect(), n = W.value;
519
525
  return Array.from(e.children).map((e) => {
@@ -525,26 +531,26 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
525
531
  });
526
532
  }
527
533
  function J() {
528
- return j.value ? ie(j.value.getJSON().content, tt(), et()) : void 0;
534
+ return A.value ? ie(A.value.getJSON().content, rt(), nt()) : void 0;
529
535
  }
530
- function nt() {
536
+ function it() {
531
537
  return !!J();
532
538
  }
533
- function rt() {
534
- if (!j.value) return;
539
+ function at() {
540
+ if (!A.value) return;
535
541
  let e = J();
536
- if (e) return j.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
542
+ if (e) return A.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
537
543
  page: K(),
538
544
  overflowContent: e.overflowContent,
539
- overflowHtml: $e(e.overflowContent)
545
+ overflowHtml: tt(e.overflowContent)
540
546
  };
541
547
  }
542
- function it(e) {
543
- if (!j.value || !e.length) return;
544
- let t = j.value.getJSON().content, n = [...e, ...Qe(t) ? [] : t ?? []];
545
- return j.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
548
+ function Y(e) {
549
+ if (!A.value || !e.length) return;
550
+ let t = A.value.getJSON().content, n = [...e, ...et(t) ? [] : t ?? []];
551
+ return A.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
546
552
  }
547
- function Y(e, t) {
553
+ function X(e, t) {
548
554
  let n = [];
549
555
  return e.descendants((e, r) => {
550
556
  e.type.name === "templateVariable" && e.attrs.key === t && n.push({
@@ -553,21 +559,21 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
553
559
  });
554
560
  }), n;
555
561
  }
556
- function X(e, t = e.key) {
557
- if (!j.value) return;
558
- let n = l(e), r = !1;
559
- return j.value.commands.command(({ tr: e, state: i, dispatch: a }) => (Y(i.doc, t).forEach(({ node: t, pos: i }) => {
562
+ function ot(e, t = e.key) {
563
+ if (!A.value) return;
564
+ let n = ae(e), r = !1;
565
+ return A.value.commands.command(({ tr: e, state: i, dispatch: a }) => (X(i.doc, t).forEach(({ node: t, pos: i }) => {
560
566
  e.setNodeMarkup(i, void 0, {
561
567
  ...t.attrs,
562
568
  ...n
563
569
  }), r = !0;
564
570
  }), r && a?.(e), r)), $(), r ? K() : void 0;
565
571
  }
566
- function at(e) {
567
- if (!j.value) return;
572
+ function st(e) {
573
+ if (!A.value) return;
568
574
  let t = 0;
569
- return j.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
570
- let a = Y(r.doc, e).map(({ node: e, pos: t }) => ({
575
+ return A.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
576
+ let a = X(r.doc, e).map(({ node: e, pos: t }) => ({
571
577
  from: t,
572
578
  to: t + e.nodeSize
573
579
  })).sort((e, t) => t.from - e.from);
@@ -575,22 +581,22 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
575
581
  }), t ? K() : void 0;
576
582
  }
577
583
  function Z() {
578
- k.value?.querySelectorAll(".gd-contract-template-variable.is-active").forEach((e) => e.classList.remove("is-active"));
584
+ O.value?.querySelectorAll(".gd-contract-template-variable.is-active").forEach((e) => e.classList.remove("is-active"));
579
585
  }
580
586
  function Q(e) {
581
- if (e) return Array.from(k.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
587
+ if (e) return Array.from(O.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
582
588
  }
583
- function ot(e) {
589
+ function ct(e) {
584
590
  Z();
585
591
  let t = Q(e);
586
592
  return t ? (t.classList.add("is-active"), t.scrollIntoView({
587
593
  behavior: "smooth",
588
594
  block: "center",
589
595
  inline: "center"
590
- }), j.value?.commands.focus(), !0) : !1;
596
+ }), A.value?.commands.focus(), !0) : !1;
591
597
  }
592
- function st(e) {
593
- let t = Array.from(k.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
598
+ function lt(e) {
599
+ let t = Array.from(O.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
594
600
  return t?.scrollIntoView({
595
601
  behavior: "smooth",
596
602
  block: "center",
@@ -598,113 +604,113 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
598
604
  }), !!t;
599
605
  }
600
606
  function $() {
601
- Z(), Q(E.selectedVariableKey)?.classList.add("is-active");
607
+ Z(), Q(T.selectedVariableKey)?.classList.add("is-active");
602
608
  }
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();
609
+ function ut(n) {
610
+ let r = e.find((e) => e.key === n), i = A.value;
611
+ if (!r || !i) return;
612
+ let a = i.chain().focus().clearNodes();
613
+ r.headingLevel ? a.setHeading({ level: r.headingLevel }) : a.setParagraph(), a.unsetAllMarks().unsetTextAlign().unsetFontSize().unsetFontFamily().unsetColor().setTextAlign(r.textAlign).setFontSize(`${r.fontSize}px`).setFontFamily(r.fontFamily || t).setColor(ne.color || "#1f2937"), r.bold ? a.setBold() : a.unsetBold(), r.italic ? a.setItalic() : a.unsetItalic(), r.underline ? a.setUnderline() : a.unsetUnderline(), a.run();
608
614
  }
609
- x([() => E.selectedVariableKey, () => E.variables], () => {
610
- fe($);
615
+ b([() => T.selectedVariableKey, () => T.variables], () => {
616
+ me($);
611
617
  }, {
612
618
  deep: !0,
613
619
  flush: "post"
614
620
  });
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();
621
+ function dt(e) {
622
+ e.type === "apply-block-style" ? A.value && ce(A.value, e.format) : e.type === "apply-text-style-preset" ? ut(e.preset) : u(A.value, e), U();
617
623
  }
618
- function ut() {
619
- j.value?.commands.focus();
624
+ function ft() {
625
+ A.value?.commands.focus();
620
626
  }
621
- function dt() {
622
- return j.value?.getJSON();
627
+ function pt() {
628
+ return A.value?.getJSON();
623
629
  }
624
- function ft() {
625
- return j.value?.getHTML() ?? E.page.contentHtml;
630
+ function mt() {
631
+ return A.value?.getHTML() ?? T.page.contentHtml;
626
632
  }
627
- function pt(e) {
628
- let t = E.variables.find((t) => t.id === e || t.key === e), n = t ? Q(t.key) : void 0;
633
+ function ht(e) {
634
+ let t = T.variables.find((t) => t.id === e || t.key === e), n = t ? Q(t.key) : void 0;
629
635
  $(), n?.scrollIntoView({
630
636
  behavior: "smooth",
631
637
  block: "center"
632
638
  });
633
639
  }
634
- function mt() {
635
- k.value?.scrollIntoView({
640
+ function gt() {
641
+ O.value?.scrollIntoView({
636
642
  behavior: "smooth",
637
643
  block: "start",
638
644
  inline: "center"
639
645
  });
640
646
  }
641
- return me(() => {
642
- j.value?.destroy();
643
- }), T({
644
- focus: ut,
645
- getHTML: ft,
646
- getJSON: dt,
647
+ return ge(() => {
648
+ A.value?.off("contract-word-paste", j), A.value?.destroy();
649
+ }), w({
650
+ focus: ft,
651
+ getHTML: mt,
652
+ getJSON: pt,
647
653
  getEditorState: H,
648
654
  getTableCommandCapabilities: N,
649
655
  getAffectedVariableCount: F,
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
667
- }), (e, t) => (v(), de("section", {
656
+ getVisibleSigningPlacementPosition: Je,
657
+ insertVariable: Xe,
658
+ insertContentImage: Ze,
659
+ updateSelectedContentImage: Qe,
660
+ getSelectionRange: $e,
661
+ getSelectionViewportRect: je,
662
+ requestTextContextMenu: Re,
663
+ hasOverflowContent: it,
664
+ updateVariable: ot,
665
+ removeVariable: st,
666
+ splitOverflowContent: at,
667
+ prependContent: Y,
668
+ runCommand: dt,
669
+ scrollIntoField: ht,
670
+ scrollIntoVariable: ct,
671
+ scrollIntoSigningPlacement: lt,
672
+ scrollIntoPage: gt
673
+ }), (e, t) => (_(), pe("section", {
668
674
  class: "gd-contract-template-designer__page-shell",
669
- style: _(Ue.value)
670
- }, [m("div", {
671
- class: pe(["gd-contract-template-designer__page-zoom", { "is-active": g.active }]),
672
- style: _(We.value)
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", {
675
+ style: g(Ge.value)
676
+ }, [p("div", {
677
+ class: he(["gd-contract-template-designer__page-zoom", { "is-active": h.active }]),
678
+ style: g(Ke.value)
679
+ }, [p("header", Te, [p("span", null, v(h.page.title || `第 ${h.pageIndex + 1} 页`), 1), p("span", null, "第 " + v(h.pageIndex + 1) + " 页 · " + v(h.pageSize.label || "A4") + " · " + v(h.pageSize.width) + " × " + v(h.pageSize.height), 1)]), p("div", {
674
680
  ref_key: "pageElement",
675
- ref: k,
681
+ ref: O,
676
682
  class: "gd-contract-template-designer__page",
677
- style: _(He.value),
678
- onDragover: t[3] ||= ge(() => {}, ["prevent"]),
679
- onDrop: qe,
680
- onClick: t[4] ||= (e) => D("editor-focus", g.page.id)
683
+ style: g(We.value),
684
+ onDragover: t[3] ||= ve(() => {}, ["prevent"]),
685
+ onDrop: Ye,
686
+ onClick: t[4] ||= (e) => E("editor-focus", h.page.id)
681
687
  }, [
682
- h(o, {
683
- decorations: g.pageDecorations,
684
- "page-number": g.pageIndex + 1,
685
- "total-pages": g.totalPages,
686
- variables: g.variables
688
+ m(ue, {
689
+ decorations: h.pageDecorations,
690
+ "page-number": h.pageIndex + 1,
691
+ "total-pages": h.totalPages,
692
+ variables: h.variables
687
693
  }, null, 8, [
688
694
  "decorations",
689
695
  "page-number",
690
696
  "total-pages",
691
697
  "variables"
692
698
  ]),
693
- b(j) ? (v(), le(b(_e), {
699
+ y(A) ? (_(), de(y(ye), {
694
700
  key: 0,
695
701
  class: "gd-contract-template-page__content",
696
- editor: b(j)
697
- }, null, 8, ["editor"])) : ue("", !0),
698
- h(ce, {
699
- "page-size": g.pageSize,
700
- placements: g.signingPlacements,
701
- "selected-id": g.selectedSigningPlacementId,
702
+ editor: y(A)
703
+ }, null, 8, ["editor"])) : fe("", !0),
704
+ m(le, {
705
+ "page-size": h.pageSize,
706
+ placements: h.signingPlacements,
707
+ "selected-id": h.selectedSigningPlacementId,
702
708
  zoom: W.value,
703
- readonly: g.readonly,
704
- disabled: g.disabled,
705
- onSelect: t[0] ||= (e) => D("signing-placement-select", e),
706
- onMove: t[1] ||= (e) => D("signing-placement-move", e),
707
- onRemove: t[2] ||= (e) => D("signing-placement-remove", e)
709
+ readonly: h.readonly,
710
+ disabled: h.disabled,
711
+ onSelect: t[0] ||= (e) => E("signing-placement-select", e),
712
+ onMove: t[1] ||= (e) => E("signing-placement-move", e),
713
+ onRemove: t[2] ||= (e) => E("signing-placement-remove", e)
708
714
  }, null, 8, [
709
715
  "page-size",
710
716
  "placements",
@@ -717,4 +723,4 @@ var Ce = { class: "gd-contract-template-designer__page-title" }, w = "applicatio
717
723
  }
718
724
  });
719
725
  //#endregion
720
- export { T as default };
726
+ export { w as default };