@guodun/antdv 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  2. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.mjs +3 -5
  3. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue.mjs +7 -0
  4. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.mjs +190 -169
  5. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +43 -43
  6. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +114 -98
  7. package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +29 -18
  8. package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +4 -1
  9. package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +62 -34
  10. package/dist/es/components/pro-contract-template-designer/src/utils/clipboard.mjs +24 -0
  11. package/dist/es/components/pro-contract-template-designer/src/utils/toolbar-overflow.mjs +4 -1
  12. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  13. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  14. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.cjs +1 -1
  15. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue.cjs +1 -1
  16. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.cjs +1 -1
  17. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -1
  18. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  19. package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -1
  20. package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
  21. package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
  22. package/dist/lib/components/pro-contract-template-designer/src/utils/clipboard.cjs +1 -0
  23. package/dist/lib/components/pro-contract-template-designer/src/utils/toolbar-overflow.cjs +1 -1
  24. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  25. package/dist/theme/contract-signing-location.css +1 -1
  26. package/dist/theme/icon.css +1 -1
  27. package/dist/theme/index.css +1 -1
  28. package/dist/types/components/pro-contract-template-designer/src/ContractPrintIframe.vue.d.ts +1 -1
  29. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +2 -1
  30. package/dist/types/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.d.ts +1 -1
  31. package/dist/types/components/pro-contract-template-designer/src/extensions/editor-extensions.d.ts +2 -0
  32. package/dist/types/components/pro-contract-template-designer/src/extensions/word-paste.d.ts +2 -0
  33. package/dist/types/components/pro-contract-template-designer/src/utils/clipboard.d.ts +7 -0
  34. package/dist/types/components/pro-contract-template-designer/src/utils/toolbar-overflow.d.ts +2 -2
  35. package/package.json +1 -1
  36. package/dist/es/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +0 -1
  37. package/dist/lib/components/pro-contract-template-designer/src/ContractPrintIframe.vue_vue_type_style_index_0_scoped_a9912ff0_lang.css +0 -1
@@ -18,10 +18,10 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
18
18
  rtf: t?.rtf,
19
19
  trustedInternal: t?.trustedInternal
20
20
  });
21
- return t && (t.source = n.source, t.recoveredRtfImages = n.recoveredImageCount), m(this.editor, this.storage, n.replacedFontFamilies), n.html;
21
+ return t && (t.source = n.source, t.recoveredRtfImages = n.recoveredImageCount, t.replacedFontFamilies = n.replacedFontFamilies), m(this.editor, this.storage, n.replacedFontFamilies), n.html;
22
22
  },
23
23
  addProseMirrorPlugins() {
24
- let n = this.editor, o = this.storage, c = this.options.processImageFile;
24
+ let n = this.editor, o = this.storage, c = this.options.processImageFile, p = this.options.confirmExternalFontPaste;
25
25
  return [new s({
26
26
  key: f,
27
27
  state: {
@@ -48,42 +48,63 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
48
48
  },
49
49
  props: {
50
50
  handleDOMEvents: {
51
- copy: (e, t) => h(e, t, !1),
52
- cut: (e, t) => h(e, t, !0),
53
- paste: (e, n) => {
54
- let r = n.clipboardData;
55
- if (!r) return !1;
56
- let i = r.getData("text/html"), a = {
57
- html: i,
58
- plainText: r.getData("text/plain"),
59
- rtf: r.getData("text/rtf") || r.getData("application/rtf"),
60
- files: v(r),
61
- source: t(i),
51
+ copy: (e, t) => g(e, t, !1),
52
+ cut: (e, t) => g(e, t, !0),
53
+ paste: (e, i) => {
54
+ let a = i.clipboardData;
55
+ if (!a) return !1;
56
+ let s = a.getData("text/html"), c = a.getData("text/plain"), l = a.getData("text/rtf") || a.getData("application/rtf"), f = y(a), g = t(s), _ = a.getData(u) === d || s.includes(`data-gd-contract-copy="${d}"`) || s.includes(`data-gd-contract-copy='${d}'`), v = {
57
+ html: s,
58
+ plainText: c,
59
+ rtf: l,
60
+ files: f,
61
+ source: g,
62
62
  recoveredRtfImages: 0,
63
- trustedInternal: r.getData(u) === d || i.includes(`data-gd-contract-copy="${d}"`) || i.includes(`data-gd-contract-copy='${d}'`)
63
+ trustedInternal: _,
64
+ replacedFontFamilies: []
64
65
  };
65
- return o.pending = a, queueMicrotask(() => {
66
- o.pending === a && (o.pending = void 0);
66
+ if (!_ && s && !f.length && typeof p == "function") {
67
+ let e = r(s, {
68
+ plainText: c,
69
+ rtf: l
70
+ });
71
+ if (e.replacedFontFamilies.length) return i.preventDefault(), h(p, e.replacedFontFamilies).then((t) => {
72
+ !t || n.isDestroyed || (o.pending = void 0, m(n, o, e.replacedFontFamilies), n.chain().focus().insertContent(e.html).run());
73
+ }), !0;
74
+ }
75
+ return o.pending = v, queueMicrotask(() => {
76
+ o.pending === v && (o.pending = void 0);
67
77
  }), !1;
68
78
  }
69
79
  },
70
80
  handlePaste: (t, s) => {
71
81
  let u = o.pending;
72
82
  if (!u) return !1;
73
- let d = u.files.length ? u.files : v(s.clipboardData), p = u.recoveredRtfImages || y(u.rtf), h = d.length > 0 && p === 0 && !u.trustedInternal;
74
- if (o.pending = void 0, !h) return !1;
83
+ let d = u.files.length ? u.files : y(s.clipboardData), g = u.recoveredRtfImages || b(u.rtf), x = d.length > 0 && g === 0 && !u.trustedInternal;
84
+ if (o.pending = void 0, !x) return !1;
75
85
  s.preventDefault();
76
- let b = `word-paste-${++l}`, x = {
77
- token: b,
86
+ let S = `word-paste-${++l}`, C = {
87
+ token: S,
78
88
  from: t.state.selection.from,
79
89
  to: t.state.selection.to
80
90
  };
81
- return t.dispatch(t.state.tr.setMeta(f, {
91
+ t.dispatch(t.state.tr.setMeta(f, {
82
92
  type: "set",
83
- ...x
84
- }).setMeta("addToHistory", !1)), a(d, c).then((t) => {
85
- if (n.isDestroyed) return;
86
- let a = f.getState(n.state)?.get(b);
93
+ ...C
94
+ }).setMeta("addToHistory", !1));
95
+ let w = u.replacedFontFamilies.length ? u.replacedFontFamilies : u.html ? r(u.html, {
96
+ plainText: u.plainText,
97
+ rtf: u.rtf
98
+ }).replacedFontFamilies : [];
99
+ return (w.length && typeof p == "function" ? h(p, w).then((e) => {
100
+ if (!e) {
101
+ _(n, S);
102
+ return;
103
+ }
104
+ return a(d, c);
105
+ }) : a(d, c)).then((t) => {
106
+ if (!t || n.isDestroyed) return;
107
+ let a = f.getState(n.state)?.get(S);
87
108
  if (!a) return;
88
109
  let s = t.filter((e) => !!e), c = u.html ? r(u.html, {
89
110
  plainText: u.plainText,
@@ -92,11 +113,11 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
92
113
  preferClipboardImages: !0,
93
114
  trustedInternal: u.trustedInternal
94
115
  }) : void 0, l = c?.html || (s.length ? `<p>${s.map((t) => `<img src="${e(t)}" alt="">`).join("")}</p>` : i(u.plainText));
95
- c && m(n, o, c.replacedFontFamilies), _(n, a, l || i(u.plainText));
116
+ c && m(n, o, c.replacedFontFamilies), v(n, a, l || i(u.plainText));
96
117
  }).catch(() => {
97
118
  if (n.isDestroyed) return;
98
- let e = f.getState(n.state)?.get(b);
99
- e ? _(n, e, i(u.plainText)) : g(n, b);
119
+ let e = f.getState(n.state)?.get(S);
120
+ e ? v(n, e, i(u.plainText)) : _(n, S);
100
121
  }), !0;
101
122
  }
102
123
  }
@@ -106,7 +127,14 @@ var l = 0, u = "application/x-gd-contract-template", d = `contract-template-${Da
106
127
  function m(e, t, n) {
107
128
  t.lastReplacedFontFamilies = n, n.length && e.emit("contract-word-paste", { replacedFontFamilies: n });
108
129
  }
109
- function h(e, t, n) {
130
+ function h(e, t) {
131
+ try {
132
+ return Promise.resolve(e(t)).catch(() => !1);
133
+ } catch {
134
+ return Promise.resolve(!1);
135
+ }
136
+ }
137
+ function g(e, t, n) {
110
138
  if (e.state.selection.empty || !t.clipboardData) return !1;
111
139
  let { dom: r, text: i } = e.serializeForClipboard(e.state.selection.content());
112
140
  r.firstElementChild?.setAttribute("data-gd-contract-copy", d), t.preventDefault(), t.clipboardData.clearData(), t.clipboardData.setData("text/html", r.innerHTML), t.clipboardData.setData("text/plain", i);
@@ -115,22 +143,22 @@ function h(e, t, n) {
115
143
  } catch {}
116
144
  return n && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut")), !0;
117
145
  }
118
- function g(e, t) {
146
+ function _(e, t) {
119
147
  e.isDestroyed || e.view.dispatch(e.state.tr.setMeta(f, {
120
148
  type: "clear",
121
149
  token: t
122
150
  }).setMeta("addToHistory", !1));
123
151
  }
124
- function _(e, t, n) {
152
+ function v(e, t, n) {
125
153
  e.chain().insertContentAt({
126
154
  from: t.from,
127
155
  to: t.to
128
156
  }, n, { updateSelection: !1 }).command(({ tr: e }) => (e.setMeta(f, {
129
157
  type: "clear",
130
158
  token: t.token
131
- }), e.setMeta("paste", !0), e.setMeta("uiEvent", "paste"), !0)).run() || g(e, t.token);
159
+ }), e.setMeta("paste", !0), e.setMeta("uiEvent", "paste"), !0)).run() || _(e, t.token);
132
160
  }
133
- function v(e) {
161
+ function y(e) {
134
162
  if (!e) return [];
135
163
  let t = [];
136
164
  for (let n of Array.from(e.items)) {
@@ -141,7 +169,7 @@ function v(e) {
141
169
  if (!t.length) for (let n of Array.from(e.files)) n.type.toLowerCase().startsWith("image/") && t.push(n);
142
170
  return t;
143
171
  }
144
- function y(e) {
172
+ function b(e) {
145
173
  return n(e).length;
146
174
  }
147
175
  //#endregion
@@ -0,0 +1,24 @@
1
+ //#region src/components/pro-contract-template-designer/src/utils/clipboard.ts
2
+ async function e(e) {
3
+ let t;
4
+ if (typeof navigator < "u" && typeof navigator.clipboard?.writeText == "function") try {
5
+ await navigator.clipboard.writeText(e);
6
+ return;
7
+ } catch (e) {
8
+ t = e;
9
+ }
10
+ if (typeof document < "u" && typeof document.execCommand == "function") {
11
+ let t = document.createElement("textarea");
12
+ t.value = e, t.setAttribute("readonly", ""), t.setAttribute("aria-hidden", "true"), t.style.position = "fixed", t.style.top = "0", t.style.left = "-9999px", t.style.opacity = "0", document.body?.appendChild(t);
13
+ let n = document.getSelection?.(), r = n ? Array.from({ length: n.rangeCount }, (e, t) => n.getRangeAt(t).cloneRange()) : [];
14
+ try {
15
+ if (t.focus({ preventScroll: !0 }), t.select(), document.execCommand("copy")) return;
16
+ } finally {
17
+ t.remove(), n && (n.removeAllRanges(), r.forEach((e) => n.addRange(e)));
18
+ }
19
+ }
20
+ let n = t instanceof Error ? t.message : "当前浏览器未授权剪贴板操作";
21
+ throw Error(n);
22
+ }
23
+ //#endregion
24
+ export { e as writeContractClipboardText };
@@ -2,7 +2,10 @@
2
2
  var e = [
3
3
  "table",
4
4
  "cleanup",
5
- "typography",
5
+ "list",
6
+ "font-family",
7
+ "alignment",
8
+ "font-appearance",
6
9
  "insert"
7
10
  ];
8
11
  function t(t) {