@guodun/antdv 1.5.2 → 1.5.3

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 (28) hide show
  1. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  2. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.mjs +190 -169
  3. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +43 -43
  4. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +114 -98
  5. package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +29 -18
  6. package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +4 -1
  7. package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +62 -34
  8. package/dist/es/components/pro-contract-template-designer/src/utils/clipboard.mjs +24 -0
  9. package/dist/es/components/pro-contract-template-designer/src/utils/toolbar-overflow.mjs +4 -1
  10. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  11. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.cjs +1 -1
  12. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -1
  13. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  14. package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -1
  15. package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
  16. package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
  17. package/dist/lib/components/pro-contract-template-designer/src/utils/clipboard.cjs +1 -0
  18. package/dist/lib/components/pro-contract-template-designer/src/utils/toolbar-overflow.cjs +1 -1
  19. package/dist/theme/contract-signing-location.css +1 -1
  20. package/dist/theme/icon.css +1 -1
  21. package/dist/theme/index.css +1 -1
  22. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +2 -1
  23. package/dist/types/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.d.ts +1 -1
  24. package/dist/types/components/pro-contract-template-designer/src/extensions/editor-extensions.d.ts +2 -0
  25. package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +2 -0
  26. package/dist/types/components/pro-contract-template-designer/src/utils/clipboard.d.ts +7 -0
  27. package/dist/types/components/pro-contract-template-designer/src/utils/toolbar-overflow.d.ts +2 -2
  28. package/package.json +3 -3
@@ -10,12 +10,13 @@ import { applyContractTemplateBlockStyle as ce } from "./utils/block-style.mjs";
10
10
  import le from "./SigningPlacementLayer.mjs";
11
11
  import ue from "./ContractTemplatePageDecorations.mjs";
12
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";
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 x, deleteColumn as Ce, deleteRow as we, deleteTable as Te } from "@tiptap/pm/tables";
16
17
  import { NodeSelection as S } 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 Te = { class: "gd-contract-template-designer__page-title" }, C = "application/x-gd-contract-variable-move", Ee = 8, w = /* @__PURE__ */ h({
19
+ var Ee = { class: "gd-contract-template-designer__page-title" }, C = "application/x-gd-contract-variable-move", De = 8, w = /* @__PURE__ */ h({
19
20
  name: "ProContractTemplateDesignerPage",
20
21
  __name: "DesignerPage",
21
22
  props: {
@@ -60,11 +61,26 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
60
61
  "editor-context-menu",
61
62
  "word-paste"
62
63
  ],
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 粘贴合同内容", {
64
+ setup(h, { expose: w, emit: Oe }) {
65
+ let T = h, E = Oe, D = f(() => T.readonly || T.disabled), O = _e();
66
+ function ke(e) {
67
+ let t = e.filter(Boolean).join("、");
68
+ return typeof window > "u" ? !1 : new Promise((e) => {
69
+ ye.confirm({
70
+ title: "粘贴内容包含不兼容字体",
71
+ content: `检测到 ${t || "外部"} 字体。为保证 Mac 与 Windows 排版一致,将统一转换为合同标准字体(GD Contract Latin + 系统宋体)。是否继续粘贴?`,
72
+ okText: "继续粘贴",
73
+ cancelText: "取消粘贴",
74
+ onOk: () => e(!0),
75
+ onCancel: () => e(!1)
76
+ });
77
+ });
78
+ }
79
+ let k = se("请输入合同正文,或从 WPS / Word 粘贴合同内容", {
65
80
  processImageFile: T.processImageFile,
81
+ confirmExternalFontPaste: ke,
66
82
  getZoom: () => Math.max(.1, T.zoom || 1)
67
- }), A = be({
83
+ }), A = xe({
68
84
  content: T.page.contentHtml,
69
85
  editable: !D.value,
70
86
  extensions: k,
@@ -79,7 +95,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
79
95
  handleDOMEvents: {
80
96
  contextmenu: (e, t) => {
81
97
  if (D.value) return !1;
82
- let n = ze(e, t.target);
98
+ let n = Ve(e, t.target);
83
99
  if (n) return t.preventDefault(), L({
84
100
  pageId: T.page.id,
85
101
  clientX: t.clientX,
@@ -90,7 +106,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
90
106
  selectionEmpty: !r || r.empty,
91
107
  inTable: a
92
108
  });
93
- return t.preventDefault(), o === "table" && (i || Ie(t.clientX, t.clientY, t.target)) ? (B({
109
+ return t.preventDefault(), o === "table" && (i || Re(t.clientX, t.clientY, t.target)) ? (B({
94
110
  pageId: T.page.id,
95
111
  clientX: t.clientX,
96
112
  clientY: t.clientY
@@ -109,7 +125,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
109
125
  }
110
126
  },
111
127
  handleKeyDown: (e, t) => {
112
- if (D.value || !Ne(t)) return !1;
128
+ if (D.value || !Fe(t)) return !1;
113
129
  let n = A.value;
114
130
  if (!n) return !1;
115
131
  t.preventDefault();
@@ -129,7 +145,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
129
145
  inTable: n.isActive("table")
130
146
  }) === "table") {
131
147
  if (!a) {
132
- let e = Fe();
148
+ let e = Le();
133
149
  typeof e == "number" && n.view.dispatch(n.state.tr.setSelection(x.create(n.state.doc, e)));
134
150
  }
135
151
  let e = n.view.coordsAtPos(n.state.selection.from);
@@ -166,28 +182,28 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
166
182
  function j(e) {
167
183
  E("word-paste", e);
168
184
  }
169
- function Oe(e) {
185
+ function Ae(e) {
170
186
  if (typeof e == "number" && Number.isFinite(e)) return e;
171
187
  let t = String(e || "").match(/(\d+(\.\d+)?)/);
172
188
  return t ? Number(t[1]) : void 0;
173
189
  }
174
- function ke() {
190
+ function je() {
175
191
  if (!A.value) return "";
176
192
  let { from: e, to: t } = A.value.state.selection;
177
193
  return A.value.state.doc.textBetween(e, t, "\n");
178
194
  }
179
- function Ae() {
195
+ function Me() {
180
196
  let e = A.value, t = e?.state.selection;
181
197
  if (!(!e || !t || t.empty)) try {
182
198
  let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
183
- if (Math.abs(r.top - n.top) > Ee) return;
199
+ if (Math.abs(r.top - n.top) > De) return;
184
200
  let i = Math.abs(r.left - n.left) / W.value;
185
201
  return Number.isFinite(i) && i > 0 ? i : void 0;
186
202
  } catch {
187
203
  return;
188
204
  }
189
205
  }
190
- function je() {
206
+ function Ne() {
191
207
  let e = A.value, t = e?.state.selection;
192
208
  if (!(!e || !t || t.empty) && !(t instanceof x || t instanceof S)) try {
193
209
  let n = e.view.coordsAtPos(t.from), r = e.view.coordsAtPos(t.to, -1);
@@ -201,7 +217,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
201
217
  return;
202
218
  }
203
219
  }
204
- function Me() {
220
+ function Pe() {
205
221
  let e = A.value;
206
222
  if (!e) return "";
207
223
  let t = e.state.selection.$from, n = t.pos;
@@ -214,7 +230,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
214
230
  }
215
231
  return e.state.doc.textBetween(n, e.state.selection.from, "");
216
232
  }
217
- function Ne(e) {
233
+ function Fe(e) {
218
234
  return e.key === "ContextMenu" || e.shiftKey && e.key === "F10";
219
235
  }
220
236
  function M(e) {
@@ -223,22 +239,22 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
223
239
  if (n === "cell" || n === "header_cell") return e.before(t);
224
240
  }
225
241
  }
226
- function Pe(e, t) {
242
+ function Ie(e, t) {
227
243
  let n = A.value, r = n?.view.posAtCoords({
228
244
  left: e,
229
245
  top: t
230
246
  })?.pos;
231
247
  if (!(!n || typeof r != "number")) return M(n.state.doc.resolve(r));
232
248
  }
233
- function Fe() {
249
+ function Le() {
234
250
  let e = A.value;
235
251
  if (e) return M(e.state.selection.$from);
236
252
  }
237
- function Ie(e, t, n) {
253
+ function Re(e, t, n) {
238
254
  let r = A.value, i = n instanceof HTMLElement ? n : null;
239
255
  if (!r || !i?.closest("td,th")) return !1;
240
256
  if (r.state.selection instanceof x && i.closest("td.selectedCell,th.selectedCell")) return !0;
241
- let a = Pe(e, t);
257
+ let a = Ie(e, t);
242
258
  return typeof a == "number" ? (r.view.dispatch(r.state.tr.setSelection(x.create(r.state.doc, a))), !0) : !1;
243
259
  }
244
260
  function N() {
@@ -260,7 +276,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
260
276
  deleteTable: n((e) => e.deleteTable())
261
277
  };
262
278
  }
263
- function Le() {
279
+ function ze() {
264
280
  let e = A.value, t = e?.state.selection;
265
281
  if (!e || !(t instanceof x)) return "left";
266
282
  let n = /* @__PURE__ */ new Set();
@@ -281,7 +297,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
281
297
  let n = P(t.state.doc), r = n, i = (e) => {
282
298
  r = P(e.doc);
283
299
  };
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);
300
+ 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);
285
301
  }
286
302
  function I(e) {
287
303
  let t = A.value?.state.selection, n = !!(t && !t.empty);
@@ -289,11 +305,11 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
289
305
  type: "text",
290
306
  ...e,
291
307
  hasSelection: n,
292
- selectionWidth: n ? Ae() : void 0,
293
- leadingText: Me()
308
+ selectionWidth: n ? Me() : void 0,
309
+ leadingText: Pe()
294
310
  });
295
311
  }
296
- function Re(e, t) {
312
+ function Be(e, t) {
297
313
  I({
298
314
  pageId: T.page.id,
299
315
  clientX: e,
@@ -321,7 +337,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
321
337
  let e = A.value?.state.selection;
322
338
  if (e instanceof S) return R(e.node, e.from);
323
339
  }
324
- function ze(e, t) {
340
+ function Ve(e, t) {
325
341
  let n = t instanceof HTMLElement ? t.closest("[data-template-variable], img[src]") : null;
326
342
  if (n) try {
327
343
  let t = e.posAtDOM(n, 0), r = e.state.doc.nodeAt(t);
@@ -335,7 +351,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
335
351
  type: "table",
336
352
  ...e,
337
353
  capabilities: N(),
338
- activeAlignment: Le(),
354
+ activeAlignment: ze(),
339
355
  affectedVariableCounts: {
340
356
  deleteRow: F("delete-table-row"),
341
357
  deleteColumn: F("delete-table-column"),
@@ -343,14 +359,14 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
343
359
  }
344
360
  });
345
361
  }
346
- function Be(e) {
362
+ function He(e) {
347
363
  return typeof e == "number" && Number.isInteger(e) && e >= 1 && e <= 6;
348
364
  }
349
365
  function V() {
350
366
  let e = A.value;
351
367
  if (!e) return [];
352
368
  let { doc: t, selection: n } = e.state, r = [], i = (e) => {
353
- e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && Be(e.attrs.level) && r.push(e.attrs.level);
369
+ e.type.name === "paragraph" ? r.push("paragraph") : e.type.name === "heading" && He(e.attrs.level) && r.push(e.attrs.level);
354
370
  };
355
371
  if (n.empty) for (let e = n.$from.depth; e > 0; e--) {
356
372
  let t = n.$from.node(e);
@@ -362,14 +378,14 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
362
378
  else t.nodesBetween(n.from, n.to, (e) => (i(e), !0));
363
379
  return Array.from(new Set(r));
364
380
  }
365
- function Ve() {
381
+ function Ue() {
366
382
  let e = V();
367
383
  return e.length === 1 && e[0] !== "paragraph" ? e[0] : void 0;
368
384
  }
369
- function He() {
385
+ function We() {
370
386
  return V().length > 1;
371
387
  }
372
- function Ue() {
388
+ function Ge() {
373
389
  return ["center", "right"].find((e) => A.value?.isActive("heading", { textAlign: e }) || A.value?.isActive("paragraph", { textAlign: e })) ?? "left";
374
390
  }
375
391
  function H() {
@@ -384,13 +400,13 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
384
400
  isBulletList: t("bulletList"),
385
401
  isOrderedList: t("orderedList"),
386
402
  isTableActive: t("table"),
387
- currentHeadingLevel: Ve(),
388
- hasMixedBlockFormats: He(),
389
- textAlign: Ue(),
403
+ currentHeadingLevel: Ue(),
404
+ hasMixedBlockFormats: We(),
405
+ textAlign: Ge(),
390
406
  fontFamily: typeof n.fontFamily == "string" ? n.fontFamily : void 0,
391
- fontSize: Oe(n.fontSize),
407
+ fontSize: Ae(n.fontSize),
392
408
  textColor: typeof n.color == "string" ? n.color : void 0,
393
- selectionText: ke(),
409
+ selectionText: je(),
394
410
  selectedContentImage: z()
395
411
  };
396
412
  }
@@ -402,7 +418,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
402
418
  }), b(() => T.page.contentHtml, (e) => {
403
419
  !A.value || e === A.value.getHTML() || (A.value.commands.setContent(e || "<p></p>", { emitUpdate: !1 }), U());
404
420
  });
405
- let We = f(() => {
421
+ let Ke = f(() => {
406
422
  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;
407
423
  return {
408
424
  width: `${T.pageSize.width}px`,
@@ -411,10 +427,10 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
411
427
  paddingBottom: `${c}px`,
412
428
  "--gd-contract-page-content-height": `${Math.max(120, T.pageSize.height - s - c)}px`
413
429
  };
414
- }), W = f(() => Math.max(.1, T.zoom || 1)), Ge = f(() => ({
430
+ }), W = f(() => Math.max(.1, T.zoom || 1)), qe = f(() => ({
415
431
  width: `${Math.ceil((T.pageSize.width + 10) * W.value)}px`,
416
432
  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));
433
+ })), Je = f(() => ({ "--gd-contract-page-zoom": String(W.value) })), Ye = f(() => re(T.pageSize));
418
434
  function G(e, t) {
419
435
  let n = O.value?.getBoundingClientRect();
420
436
  return n ? {
@@ -425,7 +441,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
425
441
  y: T.pageSize.height / 2
426
442
  };
427
443
  }
428
- function Je(e) {
444
+ function Xe(e) {
429
445
  let t = O.value?.getBoundingClientRect(), n = O.value?.closest(".gd-contract-template-designer__canvas")?.getBoundingClientRect(), r = ee(e);
430
446
  if (!t || !n) return {
431
447
  x: Math.max(0, (T.pageSize.width - r.width) / 2),
@@ -437,7 +453,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
437
453
  y: c.y - r.height / 2
438
454
  };
439
455
  }
440
- function Ye(e) {
456
+ function Ze(e) {
441
457
  if (!c(T.readonly, T.disabled)) {
442
458
  e.preventDefault(), e.stopPropagation();
443
459
  return;
@@ -457,11 +473,11 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
457
473
  let r = e.dataTransfer?.getData(C);
458
474
  r && r !== T.page.id && (e.preventDefault(), e.stopPropagation(), E("variable-move-blocked", T.page.id));
459
475
  }
460
- function Xe(e, t) {
476
+ function Qe(e, t) {
461
477
  let n = A.value;
462
478
  return n ? (oe(n, e, t ? n.view.posAtCoords(t)?.pos : void 0), $(), K()) : void 0;
463
479
  }
464
- function Ze(e, t) {
480
+ function $e(e, t) {
465
481
  let n = A.value;
466
482
  if (n) return u(n, {
467
483
  type: "insert-content-image",
@@ -469,7 +485,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
469
485
  position: t
470
486
  }), K();
471
487
  }
472
- function Qe(e) {
488
+ function et(e) {
473
489
  let t = A.value, n = t?.state.selection;
474
490
  if (!t || !(n instanceof S) || n.node.type.name !== "image") return;
475
491
  let r = { ...n.node.attrs }, i = !1;
@@ -481,7 +497,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
481
497
  let a = t.state.tr.setNodeMarkup(n.from, void 0, r);
482
498
  return a.setSelection(S.create(a.doc, n.from)), t.view.dispatch(a), K();
483
499
  }
484
- function $e() {
500
+ function tt() {
485
501
  let e = A.value?.state.selection;
486
502
  return e ? {
487
503
  from: e.from,
@@ -491,7 +507,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
491
507
  function K() {
492
508
  return {
493
509
  ...T.page,
494
- pageSize: qe.value,
510
+ pageSize: Ye.value,
495
511
  contentHtml: A.value?.getHTML() ?? T.page.contentHtml,
496
512
  contentJson: A.value?.getJSON() ?? T.page.contentJson
497
513
  };
@@ -502,13 +518,13 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
502
518
  content: e.length ? e : [{ type: "paragraph" }]
503
519
  };
504
520
  }
505
- function et(e) {
521
+ function nt(e) {
506
522
  return e?.length ? e.length === 1 && e[0].type === "paragraph" && !e[0].content?.length : !0;
507
523
  }
508
- function tt(e) {
509
- return xe(q(e), k);
524
+ function rt(e) {
525
+ return Se(q(e), k);
510
526
  }
511
- function nt() {
527
+ function it() {
512
528
  if (T.pageDecorations) {
513
529
  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
530
  return Math.max(120, T.pageSize.height - s - c);
@@ -518,7 +534,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
518
534
  let t = window.getComputedStyle(e), s = Number.parseFloat(t.paddingTop) || 0, c = Number.parseFloat(t.paddingBottom) || 0;
519
535
  return Math.max(120, T.pageSize.height - s - c);
520
536
  }
521
- function rt() {
537
+ function at() {
522
538
  let e = O.value?.querySelector(".gd-contract-template-designer__editor-prose");
523
539
  if (!e) return [];
524
540
  let t = e.getBoundingClientRect(), n = W.value;
@@ -531,23 +547,23 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
531
547
  });
532
548
  }
533
549
  function J() {
534
- return A.value ? ie(A.value.getJSON().content, rt(), nt()) : void 0;
550
+ return A.value ? ie(A.value.getJSON().content, at(), it()) : void 0;
535
551
  }
536
- function it() {
552
+ function Y() {
537
553
  return !!J();
538
554
  }
539
- function at() {
555
+ function ot() {
540
556
  if (!A.value) return;
541
557
  let e = J();
542
558
  if (e) return A.value.commands.setContent(q(e.currentContent), { emitUpdate: !1 }), {
543
559
  page: K(),
544
560
  overflowContent: e.overflowContent,
545
- overflowHtml: tt(e.overflowContent)
561
+ overflowHtml: rt(e.overflowContent)
546
562
  };
547
563
  }
548
- function Y(e) {
564
+ function st(e) {
549
565
  if (!A.value || !e.length) return;
550
- let t = A.value.getJSON().content, n = [...e, ...et(t) ? [] : t ?? []];
566
+ let t = A.value.getJSON().content, n = [...e, ...nt(t) ? [] : t ?? []];
551
567
  return A.value.commands.setContent(q(n), { emitUpdate: !1 }), K();
552
568
  }
553
569
  function X(e, t) {
@@ -559,7 +575,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
559
575
  });
560
576
  }), n;
561
577
  }
562
- function ot(e, t = e.key) {
578
+ function ct(e, t = e.key) {
563
579
  if (!A.value) return;
564
580
  let n = ae(e), r = !1;
565
581
  return A.value.commands.command(({ tr: e, state: i, dispatch: a }) => (X(i.doc, t).forEach(({ node: t, pos: i }) => {
@@ -569,7 +585,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
569
585
  }), r = !0;
570
586
  }), r && a?.(e), r)), $(), r ? K() : void 0;
571
587
  }
572
- function st(e) {
588
+ function lt(e) {
573
589
  if (!A.value) return;
574
590
  let t = 0;
575
591
  return A.value.commands.command(({ tr: n, state: r, dispatch: i }) => {
@@ -586,7 +602,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
586
602
  function Q(e) {
587
603
  if (e) return Array.from(O.value?.querySelectorAll("[data-template-variable]") ?? []).find((t) => t.dataset.key === e);
588
604
  }
589
- function ct(e) {
605
+ function ut(e) {
590
606
  Z();
591
607
  let t = Q(e);
592
608
  return t ? (t.classList.add("is-active"), t.scrollIntoView({
@@ -595,7 +611,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
595
611
  inline: "center"
596
612
  }), A.value?.commands.focus(), !0) : !1;
597
613
  }
598
- function lt(e) {
614
+ function dt(e) {
599
615
  let t = Array.from(O.value?.querySelectorAll("[data-signing-placement-id]") ?? []).find((t) => t.dataset.signingPlacementId === e);
600
616
  return t?.scrollIntoView({
601
617
  behavior: "smooth",
@@ -606,7 +622,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
606
622
  function $() {
607
623
  Z(), Q(T.selectedVariableKey)?.classList.add("is-active");
608
624
  }
609
- function ut(n) {
625
+ function ft(n) {
610
626
  let r = e.find((e) => e.key === n), i = A.value;
611
627
  if (!r || !i) return;
612
628
  let a = i.chain().focus().clearNodes();
@@ -618,26 +634,26 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
618
634
  deep: !0,
619
635
  flush: "post"
620
636
  });
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();
637
+ function pt(e) {
638
+ e.type === "apply-block-style" ? A.value && ce(A.value, e.format) : e.type === "apply-text-style-preset" ? ft(e.preset) : u(A.value, e), U();
623
639
  }
624
- function ft() {
640
+ function mt() {
625
641
  A.value?.commands.focus();
626
642
  }
627
- function pt() {
643
+ function ht() {
628
644
  return A.value?.getJSON();
629
645
  }
630
- function mt() {
646
+ function gt() {
631
647
  return A.value?.getHTML() ?? T.page.contentHtml;
632
648
  }
633
- function ht(e) {
649
+ function _t(e) {
634
650
  let t = T.variables.find((t) => t.id === e || t.key === e), n = t ? Q(t.key) : void 0;
635
651
  $(), n?.scrollIntoView({
636
652
  behavior: "smooth",
637
653
  block: "center"
638
654
  });
639
655
  }
640
- function gt() {
656
+ function vt() {
641
657
  O.value?.scrollIntoView({
642
658
  behavior: "smooth",
643
659
  block: "start",
@@ -647,42 +663,42 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
647
663
  return ge(() => {
648
664
  A.value?.off("contract-word-paste", j), A.value?.destroy();
649
665
  }), w({
650
- focus: ft,
651
- getHTML: mt,
652
- getJSON: pt,
666
+ focus: mt,
667
+ getHTML: gt,
668
+ getJSON: ht,
653
669
  getEditorState: H,
654
670
  getTableCommandCapabilities: N,
655
671
  getAffectedVariableCount: F,
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
672
+ getVisibleSigningPlacementPosition: Xe,
673
+ insertVariable: Qe,
674
+ insertContentImage: $e,
675
+ updateSelectedContentImage: et,
676
+ getSelectionRange: tt,
677
+ getSelectionViewportRect: Ne,
678
+ requestTextContextMenu: Be,
679
+ hasOverflowContent: Y,
680
+ updateVariable: ct,
681
+ removeVariable: lt,
682
+ splitOverflowContent: ot,
683
+ prependContent: st,
684
+ runCommand: pt,
685
+ scrollIntoField: _t,
686
+ scrollIntoVariable: ut,
687
+ scrollIntoSigningPlacement: dt,
688
+ scrollIntoPage: vt
673
689
  }), (e, t) => (_(), pe("section", {
674
690
  class: "gd-contract-template-designer__page-shell",
675
- style: g(Ge.value)
691
+ style: g(qe.value)
676
692
  }, [p("div", {
677
693
  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", {
694
+ style: g(Je.value)
695
+ }, [p("header", Ee, [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", {
680
696
  ref_key: "pageElement",
681
697
  ref: O,
682
698
  class: "gd-contract-template-designer__page",
683
- style: g(We.value),
699
+ style: g(Ke.value),
684
700
  onDragover: t[3] ||= ve(() => {}, ["prevent"]),
685
- onDrop: Ye,
701
+ onDrop: Ze,
686
702
  onClick: t[4] ||= (e) => E("editor-focus", h.page.id)
687
703
  }, [
688
704
  m(ue, {
@@ -696,7 +712,7 @@ var Te = { class: "gd-contract-template-designer__page-title" }, C = "applicatio
696
712
  "total-pages",
697
713
  "variables"
698
714
  ]),
699
- y(A) ? (_(), de(y(ye), {
715
+ y(A) ? (_(), de(y(be), {
700
716
  key: 0,
701
717
  class: "gd-contract-template-page__content",
702
718
  editor: y(A)
@@ -3,19 +3,32 @@ import { computed as n, nextTick as r, onBeforeUnmount as i, onMounted as a, ref
3
3
  //#region src/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.ts
4
4
  var c = 43, l = 6, u = 4;
5
5
  function d(d) {
6
- let f = o([]), p = /* @__PURE__ */ new Map(), m = 0, h = n(() => f.value.length > 0);
7
- function g(e) {
6
+ let f = o([]), p = /* @__PURE__ */ new Map(), m = 0, h, g = n(() => f.value.length > 0);
7
+ function _(e) {
8
8
  return f.value.includes(e);
9
9
  }
10
- function _(e, t) {
10
+ function v(e, t) {
11
11
  let n = f.value;
12
- n.length === e.length && e.every((e) => n.includes(e)) || (f.value = e, e.length || (d.toolbarMoreOpen.value = !1), !(t >= u) && r(() => v(t + 1)));
12
+ n.length === e.length && e.every((e) => n.includes(e)) || (f.value = e, e.length || (d.toolbarMoreOpen.value = !1), !(t >= u) && y(t + 1));
13
13
  }
14
- function v(n = 0) {
14
+ function y(e = 0) {
15
+ r(() => {
16
+ if (!(d.isDisposed() || !d.toolbarMainElement.value)) {
17
+ if (typeof window > "u") {
18
+ b(e);
19
+ return;
20
+ }
21
+ h !== void 0 && window.cancelAnimationFrame(h), h = window.requestAnimationFrame(() => {
22
+ h = void 0, d.isDisposed() || b(e);
23
+ });
24
+ }
25
+ });
26
+ }
27
+ function b(n = 0) {
15
28
  let r = d.toolbarMainElement.value;
16
29
  if (!r) return;
17
30
  if (typeof window < "u" && window.matchMedia("(max-width: 760px)").matches) {
18
- _([], n);
31
+ v([], n);
19
32
  return;
20
33
  }
21
34
  let i = r.clientWidth;
@@ -35,7 +48,7 @@ function d(d) {
35
48
  o += e.offsetWidth;
36
49
  }
37
50
  let s = Object.fromEntries(e.map((e) => [e, p.get(e) ?? 0]));
38
- _(t({
51
+ v(t({
39
52
  availableWidth: i,
40
53
  fixedWidth: o,
41
54
  groupWidths: s,
@@ -44,27 +57,25 @@ function d(d) {
44
57
  }), n);
45
58
  }
46
59
  s(() => d.measureDependencies(), () => {
47
- r(() => v());
60
+ y();
48
61
  }, { immediate: !0 }), a(() => {
49
- r(() => v()), typeof document < "u" && document.fonts?.ready && document.fonts.ready.then(() => {
50
- d.isDisposed() || !d.toolbarMainElement.value || r(() => {
51
- d.isDisposed() || v();
52
- });
62
+ y(), typeof document < "u" && document.fonts?.ready && document.fonts.ready.then(() => {
63
+ d.isDisposed() || !d.toolbarMainElement.value || y();
53
64
  });
54
65
  }), i(() => {
55
- typeof document > "u" || document.removeEventListener("mousedown", y, !0);
66
+ typeof window < "u" && h !== void 0 && window.cancelAnimationFrame(h), !(typeof document > "u") && document.removeEventListener("mousedown", x, !0);
56
67
  });
57
- function y(e) {
68
+ function x(e) {
58
69
  let t = e.target instanceof HTMLElement ? e.target : null;
59
70
  t && (t.closest(".gd-contract-template-designer__toolbar-more, .ant-popover, .ant-select-dropdown") || (d.toolbarMoreOpen.value = !1));
60
71
  }
61
72
  return s(d.toolbarMoreOpen, (e) => {
62
- typeof document > "u" || (e ? document.addEventListener("mousedown", y, !0) : document.removeEventListener("mousedown", y, !0));
73
+ typeof document > "u" || (e ? document.addEventListener("mousedown", x, !0) : document.removeEventListener("mousedown", x, !0));
63
74
  }), {
64
75
  toolbarOverflowKeys: f,
65
- toolbarHasOverflow: h,
66
- isToolbarGroupOverflowed: g,
67
- measureToolbarOverflow: v
76
+ toolbarHasOverflow: g,
77
+ isToolbarGroupOverflowed: _,
78
+ measureToolbarOverflow: b
68
79
  };
69
80
  }
70
81
  //#endregion
@@ -52,7 +52,10 @@ function C(e = "请输入合同正文", C = {}) {
52
52
  S(v),
53
53
  r.configure({ getZoom: C.getZoom }),
54
54
  t,
55
- s.configure({ processImageFile: C.processImageFile })
55
+ s.configure({
56
+ processImageFile: C.processImageFile,
57
+ confirmExternalFontPaste: C.confirmExternalFontPaste
58
+ })
56
59
  ];
57
60
  }
58
61
  function w(e) {