@guodun/antdv 1.4.1 → 1.4.2

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