@guodun/antdv 1.7.4 → 1.7.6
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/pro-contract-template-designer/src/ContractTemplateAuthoringBar.vue.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.mjs +45 -37
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +266 -264
- package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +37 -35
- package/dist/es/components/pro-contract-template-designer/src/extensions/paragraph-enter.mjs +28 -0
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateAuthoringBar.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/paragraph-enter.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/extensions/paragraph-enter.d.ts +6 -0
- package/package.json +4 -4
package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs
CHANGED
|
@@ -6,17 +6,18 @@ import { ContractContentImage as i, ContractSubscript as a, ContractSuperscript
|
|
|
6
6
|
import { WordPaste as c } from "./word-paste.mjs";
|
|
7
7
|
import { SigningMark as l } from "./signing-mark.mjs";
|
|
8
8
|
import { buildSigningLayoutContent as u, buildSigningLayoutPresetContent as d, isSigningLayoutAttributeValue as f, isSigningLayoutPresetKey as p } from "../utils/signing-layout-presets.mjs";
|
|
9
|
-
import m from "
|
|
10
|
-
import h from "@tiptap/
|
|
11
|
-
import
|
|
12
|
-
import y from "@tiptap/extension-
|
|
13
|
-
import b from "@tiptap/extension-
|
|
14
|
-
import
|
|
15
|
-
import C from "@tiptap/extension-table
|
|
16
|
-
import w from "@tiptap/extension-table-
|
|
17
|
-
import T from "@tiptap/extension-table-
|
|
9
|
+
import { ContractParagraphEnter as m } from "./paragraph-enter.mjs";
|
|
10
|
+
import h from "@tiptap/starter-kit";
|
|
11
|
+
import g from "@tiptap/extension-text-align";
|
|
12
|
+
import { BackgroundColor as _, FontFamily as v, TextStyle as y } from "@tiptap/extension-text-style";
|
|
13
|
+
import b from "@tiptap/extension-color";
|
|
14
|
+
import x from "@tiptap/extension-placeholder";
|
|
15
|
+
import { Table as S, TableView as C } from "@tiptap/extension-table";
|
|
16
|
+
import w from "@tiptap/extension-table-row";
|
|
17
|
+
import T from "@tiptap/extension-table-header";
|
|
18
|
+
import E from "@tiptap/extension-table-cell";
|
|
18
19
|
//#region src/components/pro-contract-template-designer/src/extensions/editor-extensions.ts
|
|
19
|
-
var
|
|
20
|
+
var D = ["heading", "paragraph"], O = ["textStyle"], k = [
|
|
20
21
|
1,
|
|
21
22
|
2,
|
|
22
23
|
3,
|
|
@@ -24,7 +25,7 @@ var E = ["heading", "paragraph"], D = ["textStyle"], O = [
|
|
|
24
25
|
5,
|
|
25
26
|
6
|
|
26
27
|
];
|
|
27
|
-
function
|
|
28
|
+
function A(e) {
|
|
28
29
|
return e.extend({ addAttributes() {
|
|
29
30
|
return {
|
|
30
31
|
...this.parent?.(),
|
|
@@ -36,7 +37,7 @@ function k(e) {
|
|
|
36
37
|
};
|
|
37
38
|
} });
|
|
38
39
|
}
|
|
39
|
-
var
|
|
40
|
+
var j = class extends C {
|
|
40
41
|
constructor(e, t, n, r = {}) {
|
|
41
42
|
super(e, t, n, r), this.syncSigningLayoutAttribute(e);
|
|
42
43
|
}
|
|
@@ -47,7 +48,7 @@ var A = class extends S {
|
|
|
47
48
|
let t = f(e.attrs.signingLayout) ? e.attrs.signingLayout : "";
|
|
48
49
|
t ? this.table.getAttribute("data-signing-layout") !== t && this.table.setAttribute("data-signing-layout", t) : this.table.hasAttribute("data-signing-layout") && this.table.removeAttribute("data-signing-layout");
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
+
}, M = S.extend({ addAttributes() {
|
|
51
52
|
return {
|
|
52
53
|
...this.parent?.(),
|
|
53
54
|
signingLayout: {
|
|
@@ -60,42 +61,43 @@ var A = class extends S {
|
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
} });
|
|
63
|
-
function
|
|
64
|
+
function N(e, t) {
|
|
64
65
|
return t ? u(t, p(e) ? e : void 0) : d(p(e) ? e : "dual-party");
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function P(e = "请输入合同正文", t = {}) {
|
|
67
68
|
return [
|
|
68
|
-
|
|
69
|
-
h.configure({ types: E }),
|
|
70
|
-
v,
|
|
71
|
-
_.configure({ types: D }),
|
|
72
|
-
y.configure({ types: D }),
|
|
69
|
+
h.configure({ heading: { levels: k } }),
|
|
73
70
|
g.configure({ types: D }),
|
|
71
|
+
y,
|
|
72
|
+
v.configure({ types: O }),
|
|
73
|
+
b.configure({ types: O }),
|
|
74
|
+
_.configure({ types: O }),
|
|
74
75
|
r,
|
|
75
76
|
o,
|
|
76
77
|
a,
|
|
77
78
|
s,
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
x.configure({ placeholder: e }),
|
|
80
|
+
M.configure({
|
|
80
81
|
resizable: !0,
|
|
81
|
-
View:
|
|
82
|
+
View: j
|
|
82
83
|
}),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
w,
|
|
85
|
+
A(T),
|
|
86
|
+
A(E),
|
|
86
87
|
i.configure({ getZoom: t.getZoom }),
|
|
87
88
|
l.configure({ getZoom: t.getZoom }),
|
|
88
89
|
n,
|
|
89
90
|
c.configure({
|
|
90
91
|
processImageFile: t.processImageFile,
|
|
91
92
|
confirmExternalFontPaste: t.confirmExternalFontPaste
|
|
92
|
-
})
|
|
93
|
+
}),
|
|
94
|
+
m
|
|
93
95
|
];
|
|
94
96
|
}
|
|
95
|
-
function
|
|
97
|
+
function F(e) {
|
|
96
98
|
return Number.isFinite(e) ? `${Math.max(10, Math.round(e))}px` : "14px";
|
|
97
99
|
}
|
|
98
|
-
function
|
|
100
|
+
function I(n, r) {
|
|
99
101
|
switch (r.type) {
|
|
100
102
|
case "undo": return n.undo();
|
|
101
103
|
case "redo": return n.redo();
|
|
@@ -119,13 +121,13 @@ function F(n, r) {
|
|
|
119
121
|
case "unset-text-align": return n.unsetTextAlign();
|
|
120
122
|
case "set-color": return r.value.trim() ? n.setColor(r.value) : n.unsetColor();
|
|
121
123
|
case "unset-color": return n.unsetColor();
|
|
122
|
-
case "set-font-size": return n.setFontSize(
|
|
124
|
+
case "set-font-size": return n.setFontSize(F(r.value));
|
|
123
125
|
case "unset-font-size": return n.unsetFontSize();
|
|
124
126
|
case "set-font-family": return r.value.trim() ? n.setFontFamily(r.value) : n.unsetFontFamily();
|
|
125
127
|
case "unset-font-family": return n.unsetFontFamily();
|
|
126
128
|
case "clear-text-format": return n.unsetBold().unsetItalic().unsetUnderline().unsetColor().unsetFontSize().unsetFontFamily();
|
|
127
129
|
case "clear-block-format": return n.setParagraph().unsetTextAlign();
|
|
128
|
-
case "apply-text-style-preset": return t(r.preset).reduce(
|
|
130
|
+
case "apply-text-style-preset": return t(r.preset).reduce(I, n);
|
|
129
131
|
case "insert-horizontal-rule": return n.setHorizontalRule();
|
|
130
132
|
case "insert-content-image": return r.position === void 0 ? n.insertContent({
|
|
131
133
|
type: "image",
|
|
@@ -141,7 +143,7 @@ function F(n, r) {
|
|
|
141
143
|
};
|
|
142
144
|
return r.position === void 0 ? n.insertContent(t) : n.insertContentAt(r.position, t);
|
|
143
145
|
}
|
|
144
|
-
case "insert-signing-layout": return n.insertContent(
|
|
146
|
+
case "insert-signing-layout": return n.insertContent(N(r.preset, r.options));
|
|
145
147
|
case "insert-table": return n.insertTable({
|
|
146
148
|
rows: Math.max(1, Math.round(r.options.rows)),
|
|
147
149
|
cols: Math.max(1, Math.round(r.options.cols)),
|
|
@@ -162,8 +164,8 @@ function F(n, r) {
|
|
|
162
164
|
case "delete-table": return n.deleteTable();
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
|
-
function
|
|
166
|
-
return e ?
|
|
167
|
+
function L(e, t, n = {}) {
|
|
168
|
+
return e ? I(n.focus === !1 ? e.chain() : e.chain().focus(), t).run() : !1;
|
|
167
169
|
}
|
|
168
170
|
//#endregion
|
|
169
|
-
export {
|
|
171
|
+
export { P as createEditorExtensions, L as runContractTemplateEditorCommand };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Extension as e } from "@tiptap/core";
|
|
2
|
+
import { TextSelection as t } from "@tiptap/pm/state";
|
|
3
|
+
//#region src/components/pro-contract-template-designer/src/extensions/paragraph-enter.ts
|
|
4
|
+
var n = ["heading", "paragraph"], r = e.create({
|
|
5
|
+
name: "contractParagraphEnter",
|
|
6
|
+
addKeyboardShortcuts() {
|
|
7
|
+
return { Enter: () => {
|
|
8
|
+
let { selection: e } = this.editor.state, { $from: r, $to: i } = e;
|
|
9
|
+
return !(e instanceof t) || r.depth !== 1 || i.depth !== 1 || r.parent !== i.parent || !n.includes(r.parent.type.name) ? !1 : this.editor.chain().command(({ commands: e, tr: t }) => {
|
|
10
|
+
if (!e.splitBlock()) return !1;
|
|
11
|
+
let { $from: r } = t.selection;
|
|
12
|
+
if (r.depth === 1 && n.includes(r.parent.type.name)) {
|
|
13
|
+
let e = r.before(), n = t.doc.nodeAt(e);
|
|
14
|
+
if (n) {
|
|
15
|
+
let r = t.storedMarks;
|
|
16
|
+
t.setNodeMarkup(e, void 0, {
|
|
17
|
+
...n.attrs,
|
|
18
|
+
textAlign: null
|
|
19
|
+
}), t.setStoredMarks(r);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return !0;
|
|
23
|
+
}).run();
|
|
24
|
+
} };
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { r as ContractParagraphEnter };
|