@guodun/antdv 1.7.6 → 1.7.7

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