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