@freecallai/pro 0.0.11 → 0.0.12
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/README.md +1 -1
- package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js} +1470 -1455
- package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-FGgCcubh.js} +1 -1
- package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js} +523 -519
- package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-CHmdyhjh.js} +1 -1
- package/dist/agent-prompt-editor/index.js +304 -293
- package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
- package/dist/{choice-BqjECVyx.js → choice-CUCsR2dN.js} +1 -1
- package/dist/{guard-BmLOamCj.js → guard-DgExtfXo.js} +199 -185
- package/dist/{index-BDinNJn_.js → index-BwZXmefJ.js} +1 -1
- package/dist/{index-6VSUucFX.js → index-C54ce9Tn.js} +1 -1
- package/dist/index-CMl5mgFR.js +5 -0
- package/dist/index-Cs38tTe4.js +5 -0
- package/dist/{index-CCwmXuSJ.js → index-DIMONp3g.js} +1 -1
- package/dist/{index-CN2knQcE.js → index-DaGfiqBX.js} +1 -1
- package/dist/{index-gS1h8iW8.js → index-DqJvaPTD.js} +1 -1
- package/dist/{index-0BXLYaKG.js → index-dnsGFj0F.js} +2 -2
- package/dist/{index-B1rTu0jX.js → index-pdr6mUf0.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CRGzAti7.js → inline-BpwAryXp.js} +1 -1
- package/dist/{knowledge-DNDouB-s.js → knowledge-DIzYk2iM.js} +1 -1
- package/dist/media-extensions-YYbGuUQa.js +341 -0
- package/dist/{media-migration-D1KoHKoP.js → media-migration-Bnfn27i9.js} +1 -1
- package/dist/media-policy-tG5OHWSj.js +215 -0
- package/dist/{media-upload-C5N6YWHu.js → media-upload-_xeZtn3i.js} +1 -1
- package/dist/{model-BVh9EZ9G.js → model-DlAjlPai.js} +1 -1
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +357 -355
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +4 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +2 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +2 -2
- package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +1 -0
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +19 -10
- package/package.json +3 -3
- package/dist/index-CAczgwau.js +0 -5
- package/dist/index-faGbB8v6.js +0 -5
- package/dist/media-extensions-wlcCEdtg.js +0 -324
- package/dist/media-policy-D3-Qglzz.js +0 -158
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { defineComponent as Dt, shallowRef as Rt, ref as Y, onBeforeUnmount as Le, watch as ne, nextTick as $e, onMounted as Bt, openBlock as L, createElementBlock as
|
|
1
|
+
import { defineComponent as Dt, shallowRef as Rt, ref as Y, onBeforeUnmount as Le, watch as ne, nextTick as $e, onMounted as Bt, openBlock as L, createElementBlock as q, createVNode as Fe, unref as W, createBlock as Ot, withCtx as pe, createElementVNode as D, normalizeStyle as me, createCommentVNode as re, toDisplayString as He, createTextVNode as Pt } from "vue";
|
|
2
2
|
import { EditorContent as zt, Editor as Vt } from "@tiptap/vue-3";
|
|
3
3
|
import { Popover as Lt, Tag as $t } from "@freecallai/ui";
|
|
4
|
-
import { Plugin as Ge, PluginKey as Ft, TextSelection as $, NodeSelection as Ht, Selection as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { Plugin as Ge, PluginKey as Ft, TextSelection as $, NodeSelection as Ht, Selection as qt } from "@tiptap/pm/state";
|
|
5
|
+
import Ut from "@tiptap/starter-kit";
|
|
6
|
+
import _t from "@tiptap/extension-placeholder";
|
|
7
7
|
import { Extension as Kt, Node as he } from "@tiptap/core";
|
|
8
8
|
import { DOMSerializer as je, DOMParser as Jt } from "@tiptap/pm/model";
|
|
9
9
|
import { DecorationSet as Yt, Decoration as ge } from "@tiptap/pm/view";
|
|
10
10
|
import { c as ae } from "./media-id-b2dgniSy.js";
|
|
11
11
|
import { icons as Xt } from "@freecallai/icons";
|
|
12
|
-
import { g as be, d as Q, t as
|
|
13
|
-
import { a as nn, c as
|
|
14
|
-
function X(
|
|
12
|
+
import { g as be, d as Q, t as U, q as ke, r as Gt, c as jt, u as We, b as Qe, i as Z, v as oe, C as Wt, w as Qt, x as Zt, y as en, z as qe, A as tn } from "./guard-DgExtfXo.js";
|
|
13
|
+
import { a as nn, c as Ue } from "./media-policy-tG5OHWSj.js";
|
|
14
|
+
function X(r, o) {
|
|
15
15
|
const d = (c) => [
|
|
16
16
|
`http://www.w3.org/2000/svg ${c.tag}`,
|
|
17
17
|
c.attrs,
|
|
18
18
|
...c.children.map(d)
|
|
19
|
-
], s = Xt[
|
|
19
|
+
], s = Xt[r];
|
|
20
20
|
return [
|
|
21
21
|
"http://www.w3.org/2000/svg svg",
|
|
22
22
|
{
|
|
@@ -28,28 +28,28 @@ function X(a, o) {
|
|
|
28
28
|
...s.children.map(d)
|
|
29
29
|
];
|
|
30
30
|
}
|
|
31
|
-
function rn(
|
|
32
|
-
var
|
|
33
|
-
const o = (
|
|
31
|
+
function rn(r) {
|
|
32
|
+
var y;
|
|
33
|
+
const o = (y = be(r.kind)) == null ? void 0 : y.present(r), d = String(r.kind || ""), s = (o == null ? void 0 : o.label) || String(r.label || r.key || ""), c = (i) => [
|
|
34
34
|
"span",
|
|
35
35
|
{ class: i },
|
|
36
36
|
s
|
|
37
37
|
];
|
|
38
|
-
let
|
|
39
|
-
return (o == null ? void 0 : o.layout) === "choice" && (
|
|
38
|
+
let g = [s];
|
|
39
|
+
return (o == null ? void 0 : o.layout) === "choice" && (g = [
|
|
40
40
|
X(o.icon, `fkp-choice-token-icon fkp-${d}-token-icon`),
|
|
41
41
|
c(`fkp-choice-token-label fkp-${d}-token-label`),
|
|
42
42
|
X(
|
|
43
43
|
"arrow-down",
|
|
44
44
|
`fkp-choice-token-arrow fkp-${d}-token-arrow`
|
|
45
45
|
)
|
|
46
|
-
]), (o == null ? void 0 : o.layout) === "inline" && (
|
|
46
|
+
]), (o == null ? void 0 : o.layout) === "inline" && (g = [
|
|
47
47
|
X(o.icon, "fkp-inline-token-icon"),
|
|
48
48
|
c("fkp-inline-token-label")
|
|
49
|
-
]), (o == null ? void 0 : o.layout) === "tool" && (
|
|
49
|
+
]), (o == null ? void 0 : o.layout) === "tool" && (g = [
|
|
50
50
|
X(o.icon, "fkp-tool-token-icon"),
|
|
51
51
|
c("fkp-tool-token-label")
|
|
52
|
-
]), (o == null ? void 0 : o.layout) === "toolNote" && (
|
|
52
|
+
]), (o == null ? void 0 : o.layout) === "toolNote" && (g = [
|
|
53
53
|
X(o.icon, "fkp-tool-note-icon"),
|
|
54
54
|
c("fkp-tool-note-label"),
|
|
55
55
|
...o.summary ? [
|
|
@@ -68,65 +68,65 @@ function rn(a) {
|
|
|
68
68
|
{
|
|
69
69
|
"data-business-token": "",
|
|
70
70
|
"data-fkp-node": "business-token",
|
|
71
|
-
"data-kind":
|
|
72
|
-
"data-key":
|
|
73
|
-
"data-node-id":
|
|
74
|
-
"data-token":
|
|
75
|
-
...
|
|
76
|
-
...o ? { "data-label":
|
|
71
|
+
"data-kind": r.kind,
|
|
72
|
+
"data-key": r.key,
|
|
73
|
+
"data-node-id": r.id,
|
|
74
|
+
"data-token": r.token,
|
|
75
|
+
...r.params ? { "data-fkp-params": JSON.stringify(r.params) } : {},
|
|
76
|
+
...o ? { "data-label": r.label, "aria-label": o.ariaLabel } : {},
|
|
77
77
|
class: `fk-token fk-token--${d} fkp-knowledge-tag fkp-knowledge-tag--${d}${(o == null ? void 0 : o.layout) === "choice" ? " fkp-choice-token" : ""}${o != null && o.className ? ` ${o.className}` : ""}`,
|
|
78
78
|
contenteditable: "false"
|
|
79
79
|
},
|
|
80
|
-
...
|
|
80
|
+
...g
|
|
81
81
|
];
|
|
82
82
|
}
|
|
83
|
-
function Ze(
|
|
83
|
+
function Ze(r) {
|
|
84
84
|
var o;
|
|
85
|
-
return ((o = be(
|
|
85
|
+
return ((o = be(r.kind)) == null ? void 0 : o.serialize(r)) || String(r.label || r.key || "");
|
|
86
86
|
}
|
|
87
87
|
const an = Kt.create({
|
|
88
88
|
name: "uniqueExtensionNodeIds",
|
|
89
89
|
addProseMirrorPlugins() {
|
|
90
90
|
return [
|
|
91
91
|
new Ge({
|
|
92
|
-
appendTransaction(
|
|
93
|
-
if (!
|
|
92
|
+
appendTransaction(r, o, d) {
|
|
93
|
+
if (!r.some((p) => p.docChanged))
|
|
94
94
|
return null;
|
|
95
95
|
const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
96
|
-
o.doc.descendants((
|
|
97
|
-
if (!Q(
|
|
98
|
-
c.set(String(
|
|
99
|
-
let v =
|
|
100
|
-
for (const M of
|
|
96
|
+
o.doc.descendants((p, h) => {
|
|
97
|
+
if (!Q(p.type.name) || !p.attrs.id) return;
|
|
98
|
+
c.set(String(p.attrs.id), p);
|
|
99
|
+
let v = h;
|
|
100
|
+
for (const M of r)
|
|
101
101
|
v = M.mapping.mapResult(v, 1).pos;
|
|
102
102
|
const u = d.doc.nodeAt(v);
|
|
103
|
-
(u == null ? void 0 : u.type.name) ===
|
|
103
|
+
(u == null ? void 0 : u.type.name) === p.type.name && u.attrs.id === p.attrs.id && s.set(String(p.attrs.id), v);
|
|
104
104
|
});
|
|
105
|
-
const
|
|
106
|
-
for (const
|
|
107
|
-
const
|
|
108
|
-
Array.isArray(
|
|
109
|
-
typeof v == "string" && v &&
|
|
105
|
+
const g = /* @__PURE__ */ new Set();
|
|
106
|
+
for (const p of r) {
|
|
107
|
+
const h = p.getMeta(U);
|
|
108
|
+
Array.isArray(h) && h.forEach((v) => {
|
|
109
|
+
typeof v == "string" && v && g.add(v);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
const
|
|
113
|
-
d.doc.descendants((
|
|
114
|
-
Q(
|
|
112
|
+
const y = /* @__PURE__ */ new Set();
|
|
113
|
+
d.doc.descendants((p) => {
|
|
114
|
+
Q(p.type.name) && p.attrs.id && y.add(String(p.attrs.id));
|
|
115
115
|
});
|
|
116
|
-
const i = /* @__PURE__ */ new Set(), { tr:
|
|
117
|
-
(
|
|
116
|
+
const i = /* @__PURE__ */ new Set(), { tr: S } = d, T = r.some(
|
|
117
|
+
(p) => p.getMeta("uiEvent") === "drop"
|
|
118
118
|
);
|
|
119
|
-
return d.doc.descendants((
|
|
119
|
+
return d.doc.descendants((p, h) => {
|
|
120
120
|
var N;
|
|
121
|
-
if (!Q(
|
|
122
|
-
let v = String(
|
|
121
|
+
if (!Q(p.type.name)) return;
|
|
122
|
+
let v = String(p.attrs.id || "");
|
|
123
123
|
const u = s.get(v);
|
|
124
|
-
!!v && !i.has(v) && (u ===
|
|
125
|
-
...
|
|
124
|
+
!!v && !i.has(v) && (u === h || T && u === void 0 && ((N = c.get(v)) == null ? void 0 : N.eq(p)) || u === void 0 && g.has(v)) || (v = ke(y, ae), S.setNodeMarkup(h, void 0, {
|
|
125
|
+
...p.attrs,
|
|
126
126
|
id: v,
|
|
127
127
|
nodeVersion: 0
|
|
128
|
-
}),
|
|
129
|
-
}),
|
|
128
|
+
}), y.add(v)), i.add(v);
|
|
129
|
+
}), S.docChanged ? S.setMeta("addToHistory", !1) : null;
|
|
130
130
|
}
|
|
131
131
|
})
|
|
132
132
|
];
|
|
@@ -152,13 +152,13 @@ const an = Kt.create({
|
|
|
152
152
|
return [
|
|
153
153
|
{
|
|
154
154
|
tag: "span[data-business-token]",
|
|
155
|
-
getAttrs: (
|
|
156
|
-
kind:
|
|
157
|
-
key:
|
|
158
|
-
label:
|
|
159
|
-
token:
|
|
155
|
+
getAttrs: (r) => ({
|
|
156
|
+
kind: r.getAttribute("data-kind"),
|
|
157
|
+
key: r.getAttribute("data-key"),
|
|
158
|
+
label: r.getAttribute("data-label") || r.textContent,
|
|
159
|
+
token: r.getAttribute("data-token"),
|
|
160
160
|
params: (() => {
|
|
161
|
-
const o =
|
|
161
|
+
const o = r.getAttribute("data-fkp-params");
|
|
162
162
|
if (!o || o.length > 8192) return null;
|
|
163
163
|
try {
|
|
164
164
|
return JSON.parse(o);
|
|
@@ -170,23 +170,23 @@ const an = Kt.create({
|
|
|
170
170
|
}
|
|
171
171
|
];
|
|
172
172
|
},
|
|
173
|
-
renderHTML: ({ node:
|
|
174
|
-
renderText: ({ node:
|
|
175
|
-
}),
|
|
173
|
+
renderHTML: ({ node: r }) => rn(r.attrs),
|
|
174
|
+
renderText: ({ node: r }) => Ze(r.attrs)
|
|
175
|
+
}), _e = new Ft(
|
|
176
176
|
"inlineReplyNeighbors"
|
|
177
177
|
);
|
|
178
|
-
function Ke(
|
|
178
|
+
function Ke(r) {
|
|
179
179
|
const o = [];
|
|
180
|
-
|
|
180
|
+
r.forEach((s, c) => {
|
|
181
181
|
o.push({ node: s, position: c });
|
|
182
182
|
});
|
|
183
183
|
const d = /* @__PURE__ */ new Set();
|
|
184
184
|
return o.forEach(({ node: s }, c) => {
|
|
185
|
-
var
|
|
186
|
-
if (!(s.type.name !== "originalReply" || s.childCount !== 1 || ((
|
|
187
|
-
for (const
|
|
188
|
-
(
|
|
189
|
-
}), Yt.create(
|
|
185
|
+
var g;
|
|
186
|
+
if (!(s.type.name !== "originalReply" || s.childCount !== 1 || ((g = s.firstChild) == null ? void 0 : g.type.name) !== "paragraph"))
|
|
187
|
+
for (const y of [o[c - 1], o[c + 1]])
|
|
188
|
+
(y == null ? void 0 : y.node.type.name) === "paragraph" && d.add(y.position);
|
|
189
|
+
}), Yt.create(r, [
|
|
190
190
|
...o.filter(({ node: s }) => s.type.name === "originalReply").map(
|
|
191
191
|
({ position: s }) => ge.widget(
|
|
192
192
|
s + 1,
|
|
@@ -200,20 +200,20 @@ function Ke(a) {
|
|
|
200
200
|
)
|
|
201
201
|
),
|
|
202
202
|
...[...d].flatMap((s) => {
|
|
203
|
-
const c =
|
|
203
|
+
const c = r.nodeAt(s), g = ge.node(
|
|
204
204
|
s,
|
|
205
205
|
s + c.nodeSize,
|
|
206
206
|
{
|
|
207
207
|
class: c.content.size ? "fk-inline-reply-neighbor" : "fk-inline-reply-neighbor fk-inline-reply-neighbor--empty"
|
|
208
208
|
}
|
|
209
209
|
);
|
|
210
|
-
return c.content.size ? [
|
|
211
|
-
|
|
210
|
+
return c.content.size ? [g] : [
|
|
211
|
+
g,
|
|
212
212
|
ge.widget(
|
|
213
213
|
s + 1,
|
|
214
214
|
() => {
|
|
215
|
-
const
|
|
216
|
-
return
|
|
215
|
+
const y = document.createElement("span");
|
|
216
|
+
return y.className = "fkp-reply-caret-anchor", y.setAttribute("aria-hidden", "true"), y.textContent = "", y;
|
|
217
217
|
},
|
|
218
218
|
{ side: -1, ignoreSelection: !0 }
|
|
219
219
|
)
|
|
@@ -221,46 +221,46 @@ function Ke(a) {
|
|
|
221
221
|
})
|
|
222
222
|
]);
|
|
223
223
|
}
|
|
224
|
-
function Je(
|
|
224
|
+
function Je(r) {
|
|
225
225
|
var o;
|
|
226
|
-
return
|
|
226
|
+
return r.type.name === "originalReply" && r.childCount === 1 && ((o = r.firstChild) == null ? void 0 : o.type.name) === "paragraph" && r.firstChild.content.size === 0;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
var
|
|
230
|
-
const { state: d } =
|
|
231
|
-
if (!
|
|
228
|
+
function ye(r, o) {
|
|
229
|
+
var h;
|
|
230
|
+
const { state: d } = r, { empty: s, $from: c } = d.selection;
|
|
231
|
+
if (!r.editable || r.composing || !s || !(d.selection instanceof $) || c.parent.type.name !== "paragraph")
|
|
232
232
|
return !1;
|
|
233
|
-
const
|
|
233
|
+
const g = (v, u) => {
|
|
234
234
|
const M = d.tr.delete(v, v + u.nodeSize);
|
|
235
235
|
return M.setSelection(
|
|
236
236
|
$.near(
|
|
237
237
|
M.doc.resolve(Math.min(v, M.doc.content.size)),
|
|
238
238
|
o ? -1 : 1
|
|
239
239
|
)
|
|
240
|
-
),
|
|
241
|
-
},
|
|
242
|
-
if (
|
|
240
|
+
), r.dispatch(M.scrollIntoView()), !0;
|
|
241
|
+
}, y = c.depth - 1;
|
|
242
|
+
if (y < 1 || c.node(y).type.name !== "originalReply") {
|
|
243
243
|
if (c.parentOffset !== (o ? 0 : c.parent.content.size))
|
|
244
244
|
return !1;
|
|
245
245
|
const v = o ? c.before() : c.after(), u = d.doc.resolve(v), M = o ? u.nodeBefore : u.nodeAfter;
|
|
246
246
|
if ((M == null ? void 0 : M.type.name) !== "originalReply") return !1;
|
|
247
247
|
const N = o ? v - M.nodeSize : v;
|
|
248
|
-
return Je(M) ?
|
|
248
|
+
return Je(M) ? g(N, M) : (r.dispatch(
|
|
249
249
|
d.tr.setSelection(Ht.create(d.doc, N)).scrollIntoView()
|
|
250
250
|
), !0);
|
|
251
251
|
}
|
|
252
|
-
const i = c.node(
|
|
253
|
-
if (Je(i)) return
|
|
254
|
-
if (c.parent.childCount !== 1 || !((
|
|
252
|
+
const i = c.node(y);
|
|
253
|
+
if (Je(i)) return g(c.before(y), i);
|
|
254
|
+
if (c.parent.childCount !== 1 || !((h = c.parent.firstChild) != null && h.isText) || c.parentOffset !== (o ? c.parent.content.size : 0))
|
|
255
255
|
return !1;
|
|
256
|
-
const
|
|
256
|
+
const S = c.parent.textContent;
|
|
257
257
|
if ((typeof Intl.Segmenter == "function" ? [
|
|
258
258
|
...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
|
|
259
|
-
|
|
259
|
+
S
|
|
260
260
|
)
|
|
261
|
-
] : Array.from(
|
|
262
|
-
const
|
|
263
|
-
return
|
|
261
|
+
] : Array.from(S)).length !== 1) return !1;
|
|
262
|
+
const p = d.tr.delete(c.start(), c.end());
|
|
263
|
+
return p.setSelection($.create(p.doc, c.start())), r.dispatch(p.scrollIntoView()), !0;
|
|
264
264
|
}
|
|
265
265
|
const sn = he.create({
|
|
266
266
|
name: "originalReply",
|
|
@@ -286,76 +286,76 @@ const sn = he.create({
|
|
|
286
286
|
];
|
|
287
287
|
},
|
|
288
288
|
addKeyboardShortcuts() {
|
|
289
|
-
const
|
|
290
|
-
const { state: d, view: s } = this.editor, { empty: c, $from:
|
|
291
|
-
if (!this.editor.isEditable || s.composing || !c || !(d.selection instanceof $) ||
|
|
289
|
+
const r = (o) => {
|
|
290
|
+
const { state: d, view: s } = this.editor, { empty: c, $from: g } = d.selection, { paragraph: y } = d.schema.nodes;
|
|
291
|
+
if (!this.editor.isEditable || s.composing || !c || !(d.selection instanceof $) || g.parent.type !== y || g.parentOffset !== (o === 1 ? g.parent.content.size : 0))
|
|
292
292
|
return !1;
|
|
293
|
-
const { tr: i } = d,
|
|
294
|
-
if (
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
const
|
|
293
|
+
const { tr: i } = d, S = g.depth - 1;
|
|
294
|
+
if (S > 0 && g.node(S).type === this.type) {
|
|
295
|
+
const T = o === 1 ? g.end(S) - 1 : g.start(S) + 1;
|
|
296
|
+
if (g.pos !== T) return !1;
|
|
297
|
+
const p = o === 1 ? g.after(S) : g.before(S), h = d.doc.resolve(p), v = o === 1 ? h.nodeAfter : h.nodeBefore;
|
|
298
298
|
let u;
|
|
299
|
-
if ((v == null ? void 0 : v.type) ===
|
|
300
|
-
u = o === 1 ?
|
|
299
|
+
if ((v == null ? void 0 : v.type) === y)
|
|
300
|
+
u = o === 1 ? p + 1 : p - 1;
|
|
301
301
|
else {
|
|
302
|
-
const M =
|
|
303
|
-
if (!
|
|
302
|
+
const M = h.index();
|
|
303
|
+
if (!h.parent.canReplaceWith(M, M, y))
|
|
304
304
|
return !1;
|
|
305
|
-
i.insert(
|
|
305
|
+
i.insert(p, y.create()), u = p + 1;
|
|
306
306
|
}
|
|
307
307
|
i.setSelection($.create(i.doc, u));
|
|
308
308
|
} else {
|
|
309
|
-
const
|
|
310
|
-
if ((
|
|
311
|
-
const v = o === 1 ?
|
|
312
|
-
if ((v == null ? void 0 : v.type) !==
|
|
313
|
-
const u = o === 1 ?
|
|
309
|
+
const T = o === 1 ? g.after() : g.before(), p = d.doc.resolve(T), h = o === 1 ? p.nodeAfter : p.nodeBefore;
|
|
310
|
+
if ((h == null ? void 0 : h.type) !== this.type) return !1;
|
|
311
|
+
const v = o === 1 ? h.firstChild : h.lastChild;
|
|
312
|
+
if ((v == null ? void 0 : v.type) !== y) return !1;
|
|
313
|
+
const u = o === 1 ? T + 2 : T - 2;
|
|
314
314
|
i.setSelection($.create(i.doc, u));
|
|
315
315
|
}
|
|
316
316
|
return s.dispatch(i.scrollIntoView()), !0;
|
|
317
317
|
};
|
|
318
318
|
return {
|
|
319
|
-
Backspace: () =>
|
|
320
|
-
Delete: () =>
|
|
321
|
-
ArrowLeft: () =>
|
|
322
|
-
ArrowRight: () =>
|
|
319
|
+
Backspace: () => ye(this.editor.view, !0),
|
|
320
|
+
Delete: () => ye(this.editor.view, !1),
|
|
321
|
+
ArrowLeft: () => r(-1),
|
|
322
|
+
ArrowRight: () => r(1)
|
|
323
323
|
};
|
|
324
324
|
},
|
|
325
325
|
addProseMirrorPlugins() {
|
|
326
326
|
return [
|
|
327
327
|
new Ge({
|
|
328
|
-
key:
|
|
328
|
+
key: _e,
|
|
329
329
|
state: {
|
|
330
|
-
init: (
|
|
331
|
-
apply: (
|
|
330
|
+
init: (r, o) => Ke(o.doc),
|
|
331
|
+
apply: (r, o) => r.docChanged ? Ke(r.doc) : o
|
|
332
332
|
},
|
|
333
333
|
props: {
|
|
334
334
|
handleDOMEvents: {
|
|
335
|
-
beforeinput: (
|
|
335
|
+
beforeinput: (r, o) => {
|
|
336
336
|
if (!o.cancelable || o.isComposing) return !1;
|
|
337
337
|
const d = o.inputType === "deleteContentBackward";
|
|
338
|
-
return !d && o.inputType !== "deleteContentForward" || !
|
|
338
|
+
return !d && o.inputType !== "deleteContentForward" || !ye(r, d) ? !1 : (o.preventDefault(), !0);
|
|
339
339
|
},
|
|
340
|
-
mousedown: (
|
|
341
|
-
var
|
|
342
|
-
if (!
|
|
340
|
+
mousedown: (r, o) => {
|
|
341
|
+
var g;
|
|
342
|
+
if (!r.editable || r.composing || o.button !== 0 || o.shiftKey || o.ctrlKey || o.metaKey || o.altKey || o.detail > 1 || !(o.target instanceof Element))
|
|
343
343
|
return !1;
|
|
344
344
|
const d = o.target.closest("p");
|
|
345
|
-
if (!d || !
|
|
345
|
+
if (!d || !r.dom.contains(d) || !((g = d.parentElement) != null && g.matches(
|
|
346
346
|
"section[data-original-reply]"
|
|
347
347
|
)))
|
|
348
348
|
return !1;
|
|
349
|
-
const s =
|
|
350
|
-
return c.parent.type !==
|
|
351
|
-
|
|
352
|
-
$.create(
|
|
349
|
+
const s = r.posAtDOM(d, 0), c = r.state.doc.resolve(s);
|
|
350
|
+
return c.parent.type !== r.state.schema.nodes.paragraph || c.parent.content.size !== 0 || c.node(c.depth - 1).type !== this.type ? !1 : (o.preventDefault(), r.dispatch(
|
|
351
|
+
r.state.tr.setSelection(
|
|
352
|
+
$.create(r.state.doc, s)
|
|
353
353
|
)
|
|
354
|
-
),
|
|
354
|
+
), r.focus(), !0);
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
|
-
decorations(
|
|
358
|
-
return
|
|
357
|
+
decorations(r) {
|
|
358
|
+
return _e.getState(r);
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
})
|
|
@@ -409,261 +409,264 @@ const sn = he.create({
|
|
|
409
409
|
"OL",
|
|
410
410
|
"LI"
|
|
411
411
|
]);
|
|
412
|
-
function pn(
|
|
412
|
+
function pn(r, o, d, s) {
|
|
413
413
|
if (!o.content.size) return !1;
|
|
414
414
|
const c = document.createElement("div");
|
|
415
415
|
c.appendChild(
|
|
416
416
|
je.fromSchema(d).serializeFragment(o.content)
|
|
417
417
|
);
|
|
418
|
-
const
|
|
418
|
+
const g = o.content.textBetween(
|
|
419
419
|
0,
|
|
420
420
|
o.content.size,
|
|
421
421
|
`
|
|
422
422
|
`,
|
|
423
|
-
(
|
|
424
|
-
var
|
|
425
|
-
if (
|
|
426
|
-
return `[${
|
|
427
|
-
if (
|
|
428
|
-
return Ze(
|
|
429
|
-
const i = (
|
|
430
|
-
return i !== void 0 ? i :
|
|
423
|
+
(y) => {
|
|
424
|
+
var S;
|
|
425
|
+
if (y.type.name === "mediaBlock")
|
|
426
|
+
return y.attrs.sourceType === "qianniuVideo" ? y.attrs.src : `[${y.attrs.kind === "video" ? "视频" : "图片"}:${y.attrs.name || ""}]`;
|
|
427
|
+
if (y.type.name === "businessToken")
|
|
428
|
+
return Ze(y.attrs);
|
|
429
|
+
const i = (S = s == null ? void 0 : s.serializeNode) == null ? void 0 : S.call(s, y);
|
|
430
|
+
return i !== void 0 ? i : y.type.name === "messageSeparator" ? "{分隔符}" : "";
|
|
431
431
|
}
|
|
432
432
|
);
|
|
433
433
|
try {
|
|
434
|
-
return
|
|
434
|
+
return r.setData("text/plain", g), r.setData("text/html", c.innerHTML), !0;
|
|
435
435
|
} catch {
|
|
436
436
|
return !1;
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
function mn(
|
|
439
|
+
function mn(r, o, d, s) {
|
|
440
440
|
var v;
|
|
441
|
-
const c =
|
|
442
|
-
if (!Gt(c) || !
|
|
441
|
+
const c = r.getAttribute("data-kind"), g = r.getAttribute("data-key"), y = r.getAttribute("data-label"), i = r.getAttribute("data-token");
|
|
442
|
+
if (!Gt(c) || !g || !y || s != null && s.allowBusinessToken && !s.allowBusinessToken(c, g) || d && ((v = be(c)) == null ? void 0 : v.allowInOriginalReply) === !1 || !o.has(`${c}:knowledgeInline`))
|
|
443
443
|
return null;
|
|
444
|
-
const
|
|
445
|
-
let
|
|
446
|
-
if (
|
|
447
|
-
if (
|
|
444
|
+
const S = r.getAttribute("data-fkp-params");
|
|
445
|
+
let T = null;
|
|
446
|
+
if (S != null) {
|
|
447
|
+
if (S.length > 8192) return null;
|
|
448
448
|
try {
|
|
449
|
-
const u = JSON.parse(
|
|
449
|
+
const u = JSON.parse(S);
|
|
450
450
|
if (!u || typeof u != "object" || Array.isArray(u))
|
|
451
451
|
return null;
|
|
452
|
-
|
|
452
|
+
T = u;
|
|
453
453
|
} catch {
|
|
454
454
|
return null;
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
if (c === "tool" && (!
|
|
457
|
+
if (c === "tool" && (!T || g === "small_payment" && !jt(T.amount) || g === "order_note" && !We(T)) || Qe({
|
|
458
458
|
type: "doc",
|
|
459
459
|
content: [
|
|
460
|
-
{ type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key:
|
|
460
|
+
{ type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: g, label: y, token: i, params: T } }] }
|
|
461
461
|
]
|
|
462
462
|
}))
|
|
463
463
|
return null;
|
|
464
|
-
const
|
|
465
|
-
return
|
|
464
|
+
const h = document.createElement("span");
|
|
465
|
+
return h.setAttribute("data-business-token", ""), h.setAttribute("data-fkp-node", "business-token"), h.setAttribute("data-kind", c), h.setAttribute("data-key", g), h.setAttribute("data-label", y), i && h.setAttribute("data-token", i), T && h.setAttribute("data-fkp-params", JSON.stringify(T)), h.textContent = r.textContent, h;
|
|
466
466
|
}
|
|
467
|
-
function gn(
|
|
468
|
-
var
|
|
469
|
-
const s =
|
|
467
|
+
function gn(r, o, d) {
|
|
468
|
+
var T, p;
|
|
469
|
+
const s = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video");
|
|
470
470
|
if (!s) return !1;
|
|
471
|
-
const c = s.tagName === "VIDEO" ? "video" : "image",
|
|
472
|
-
let
|
|
473
|
-
if (Z(
|
|
471
|
+
const c = s.tagName === "VIDEO" ? "video" : "image", g = s.getAttribute("src") || (c === "video" ? (T = s.querySelector("source[src]")) == null ? void 0 : T.getAttribute("src") : null);
|
|
472
|
+
let y = "";
|
|
473
|
+
if (Z(g))
|
|
474
474
|
try {
|
|
475
|
-
|
|
476
|
-
new URL(
|
|
475
|
+
y = decodeURIComponent(
|
|
476
|
+
new URL(g).pathname.split("/").pop() || ""
|
|
477
477
|
);
|
|
478
478
|
} catch {
|
|
479
|
-
|
|
479
|
+
y = "";
|
|
480
480
|
}
|
|
481
481
|
const i = [
|
|
482
|
-
|
|
483
|
-
(
|
|
482
|
+
r.getAttribute("data-name"),
|
|
483
|
+
(p = r.querySelector("figcaption")) == null ? void 0 : p.textContent,
|
|
484
484
|
s.getAttribute("alt"),
|
|
485
|
-
|
|
486
|
-
].filter((
|
|
485
|
+
y
|
|
486
|
+
].filter((h) => !!(h != null && h.trim())).map((h) => h.trim().toLowerCase());
|
|
487
487
|
if (!i.length) return !1;
|
|
488
|
-
const
|
|
489
|
-
(
|
|
488
|
+
const S = o.findIndex(
|
|
489
|
+
(h, v) => {
|
|
490
490
|
var u;
|
|
491
|
-
return !d.has(v) && ((u = nn(
|
|
491
|
+
return !d.has(v) && ((u = nn(h)) == null ? void 0 : u.kind) === c && i.includes(h.name.toLowerCase());
|
|
492
492
|
}
|
|
493
493
|
);
|
|
494
|
-
return
|
|
494
|
+
return S < 0 ? !1 : (d.add(S), !0);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
497
|
-
var
|
|
498
|
-
const d =
|
|
499
|
-
if (
|
|
496
|
+
function yn(r, o) {
|
|
497
|
+
var u, M;
|
|
498
|
+
const d = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video") || (r.getAttribute("data-source-type") === "qianniuVideo" ? r.querySelector("a[href]") : null), s = r.getAttribute("data-kind") || ((d == null ? void 0 : d.tagName) === "VIDEO" ? "video" : "image"), c = (d == null ? void 0 : d.getAttribute("src")) || (d == null ? void 0 : d.getAttribute("href")) || ((d == null ? void 0 : d.tagName) === "VIDEO" ? (u = d.querySelector("source[src]")) == null ? void 0 : u.getAttribute("src") : null), g = d == null ? void 0 : d.getAttribute("poster");
|
|
499
|
+
if (r.getAttribute("data-fkp-node") === "media-block" && r.hasAttribute("status") && r.getAttribute("status") !== "ready" || d && (s === "image" && d.tagName !== "IMG" || s === "video" && d.tagName !== "VIDEO" && !(r.getAttribute("data-source-type") === "qianniuVideo" && d.tagName === "A")) || !["image", "video"].includes(s) || !o.has(`${s}:knowledgeBlock`) || !Z(c) || g && !Z(g))
|
|
500
500
|
return null;
|
|
501
|
-
const
|
|
501
|
+
const y = r.getAttribute("data-name") || ((M = r.querySelector("figcaption")) == null ? void 0 : M.textContent) || (d == null ? void 0 : d.getAttribute("alt")) || "", i = r.getAttribute("data-asset-id"), S = r.getAttribute("data-source-type"), T = {
|
|
502
502
|
id: ae(),
|
|
503
503
|
kind: s,
|
|
504
504
|
src: c,
|
|
505
|
-
name:
|
|
505
|
+
name: y,
|
|
506
506
|
status: "ready",
|
|
507
|
-
...
|
|
508
|
-
...i ? { assetId: i } : {}
|
|
507
|
+
...g ? { poster: g } : {},
|
|
508
|
+
...i ? { assetId: i } : {},
|
|
509
|
+
...S ? { sourceType: S } : {}
|
|
509
510
|
};
|
|
510
511
|
if (Qe({
|
|
511
512
|
type: "doc",
|
|
512
513
|
content: [{ type: "mediaBlock", attrs: T }]
|
|
513
514
|
}))
|
|
514
515
|
return null;
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
516
|
+
const p = document.createElement("figure");
|
|
517
|
+
p.setAttribute("data-media-block", ""), p.setAttribute("data-fkp-node", "media-block"), p.setAttribute("data-id", T.id), p.setAttribute("data-kind", s), i && p.setAttribute("data-asset-id", i), T.sourceType && p.setAttribute("data-source-type", T.sourceType);
|
|
518
|
+
const h = document.createElement(
|
|
519
|
+
T.sourceType === "qianniuVideo" ? "a" : s === "video" ? "video" : "img"
|
|
520
|
+
);
|
|
521
|
+
h.setAttribute(T.sourceType === "qianniuVideo" ? "href" : "src", c), T.sourceType === "qianniuVideo" && (h.textContent = c), g && h.setAttribute("poster", g), p.appendChild(h);
|
|
522
|
+
const v = document.createElement("figcaption");
|
|
523
|
+
return v.textContent = y, p.appendChild(v), p;
|
|
521
524
|
}
|
|
522
|
-
function
|
|
525
|
+
function kn(r, o, d, s = [], c) {
|
|
523
526
|
var v;
|
|
524
|
-
if (!
|
|
527
|
+
if (!r || r.length > cn)
|
|
525
528
|
return { slice: null, handled: !1 };
|
|
526
|
-
const
|
|
529
|
+
const g = new Set(
|
|
527
530
|
d.map((u) => `${u.id}:${u.slot}`)
|
|
528
|
-
),
|
|
529
|
-
|
|
531
|
+
), y = new DOMParser().parseFromString(
|
|
532
|
+
r.replace(
|
|
530
533
|
/<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
|
|
531
534
|
"<video$1></video>"
|
|
532
535
|
),
|
|
533
536
|
"text/html"
|
|
534
|
-
), i = document.createElement("div"),
|
|
535
|
-
let
|
|
536
|
-
const
|
|
537
|
-
var
|
|
538
|
-
if (++
|
|
537
|
+
), i = document.createElement("div"), S = /* @__PURE__ */ new Set();
|
|
538
|
+
let T = 0, p = !1;
|
|
539
|
+
const h = (u, M = !1) => {
|
|
540
|
+
var _;
|
|
541
|
+
if (++T > dn)
|
|
539
542
|
throw new Error("Clipboard HTML is too large");
|
|
540
543
|
if (u.nodeType === Node.TEXT_NODE)
|
|
541
544
|
return document.createTextNode(u.textContent || "");
|
|
542
545
|
if (!(u instanceof Element) || un.has(u.tagName))
|
|
543
546
|
return null;
|
|
544
|
-
const N = (
|
|
547
|
+
const N = (_ = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : _.call(c, u);
|
|
545
548
|
if (N !== void 0)
|
|
546
|
-
return N || (
|
|
549
|
+
return N || (p = !0), N;
|
|
547
550
|
if (u.hasAttribute("data-agent-size-chart"))
|
|
548
|
-
return
|
|
551
|
+
return p = !0, null;
|
|
549
552
|
if (u.getAttribute("data-fkp-node") === "business-token") {
|
|
550
|
-
const w = mn(u,
|
|
551
|
-
return w || (
|
|
553
|
+
const w = mn(u, g, M, c);
|
|
554
|
+
return w || (p = !0), w;
|
|
552
555
|
}
|
|
553
556
|
if (u.getAttribute("data-fkp-node") === "media-block" || u.tagName === "IMG" || u.tagName === "VIDEO" || u.tagName === "FIGURE" && u.querySelector("img,video")) {
|
|
554
|
-
if (gn(u, s,
|
|
555
|
-
return
|
|
556
|
-
const w =
|
|
557
|
-
return w || (
|
|
557
|
+
if (gn(u, s, S))
|
|
558
|
+
return p = !0, null;
|
|
559
|
+
const w = yn(u, g);
|
|
560
|
+
return w || (p = !0), w;
|
|
558
561
|
}
|
|
559
562
|
if (u.getAttribute("data-fkp-node") === "message-separator") {
|
|
560
|
-
if (!
|
|
561
|
-
return
|
|
563
|
+
if (!g.has("separator:knowledgeInline"))
|
|
564
|
+
return p = !0, null;
|
|
562
565
|
const w = document.createElement("div");
|
|
563
566
|
return w.setAttribute("data-message-separator", ""), w;
|
|
564
567
|
}
|
|
565
568
|
if (u.getAttribute("data-fkp-node") === "original-reply") {
|
|
566
|
-
const w =
|
|
567
|
-
w || (
|
|
569
|
+
const w = g.has("originalReply:knowledgeBlock");
|
|
570
|
+
w || (p = !0);
|
|
568
571
|
const O = w ? document.createElement("section") : document.createDocumentFragment();
|
|
569
572
|
return O instanceof HTMLElement && O.setAttribute("data-original-reply", ""), u.childNodes.forEach((K) => {
|
|
570
|
-
const B =
|
|
573
|
+
const B = h(K, w);
|
|
571
574
|
B && O.appendChild(B);
|
|
572
575
|
}), O;
|
|
573
576
|
}
|
|
574
577
|
if (u.hasAttribute("data-fkp-node") || u.hasAttribute("data-business-token") || u.hasAttribute("data-message-separator") || u.getAttribute("data-tag") === "true" || u.getAttribute("data-variable") === "true" || u.getAttribute("data-divider") === "true")
|
|
575
|
-
return
|
|
578
|
+
return p = !0, null;
|
|
576
579
|
const F = fn.has(u.tagName) ? document.createElement(u.tagName.toLowerCase()) : u.tagName === "BR" ? document.createElement("br") : document.createDocumentFragment();
|
|
577
580
|
return u.childNodes.forEach((w) => {
|
|
578
|
-
const O =
|
|
581
|
+
const O = h(w, M);
|
|
579
582
|
O && F.appendChild(O);
|
|
580
583
|
}), F;
|
|
581
584
|
};
|
|
582
585
|
try {
|
|
583
|
-
if (
|
|
584
|
-
const N =
|
|
586
|
+
if (y.body.childNodes.forEach((M) => {
|
|
587
|
+
const N = h(M);
|
|
585
588
|
N && i.appendChild(N);
|
|
586
589
|
}), !((v = i.textContent) != null && v.trim()) && !i.querySelector(
|
|
587
590
|
"figure, [data-message-separator], [data-original-reply]"
|
|
588
591
|
))
|
|
589
|
-
return { slice: null, handled:
|
|
592
|
+
return { slice: null, handled: p };
|
|
590
593
|
const u = Jt.fromSchema(o).parseSlice(i, {
|
|
591
594
|
preserveWhitespace: !0
|
|
592
595
|
});
|
|
593
|
-
return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled:
|
|
596
|
+
return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled: p };
|
|
594
597
|
} catch {
|
|
595
598
|
return { slice: null, handled: !1 };
|
|
596
599
|
}
|
|
597
600
|
}
|
|
598
|
-
function hn(
|
|
599
|
-
return et(
|
|
601
|
+
function hn(r) {
|
|
602
|
+
return et(r, r.state.selection.getBookmark());
|
|
600
603
|
}
|
|
601
|
-
function Ye(
|
|
602
|
-
if (
|
|
604
|
+
function Ye(r, o) {
|
|
605
|
+
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
603
606
|
return null;
|
|
604
607
|
let d = o, s = !0, c = !0;
|
|
605
|
-
const
|
|
606
|
-
const i =
|
|
608
|
+
const g = ({ transaction: y }) => {
|
|
609
|
+
const i = y.mapping.mapResult(d, 1);
|
|
607
610
|
i.deletedAcross && (c = !1), d = i.pos;
|
|
608
611
|
};
|
|
609
|
-
return
|
|
612
|
+
return r.on("transaction", g), {
|
|
610
613
|
status() {
|
|
611
|
-
return !s ||
|
|
614
|
+
return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
612
615
|
},
|
|
613
|
-
insert(
|
|
614
|
-
if (!s || !c ||
|
|
616
|
+
insert(y) {
|
|
617
|
+
if (!s || !c || r.isDestroyed) return !1;
|
|
615
618
|
try {
|
|
616
|
-
return
|
|
619
|
+
return r.chain().setMeta(U, oe(y)).insertContentAt(d, y).run();
|
|
617
620
|
} catch {
|
|
618
621
|
return !1;
|
|
619
622
|
}
|
|
620
623
|
},
|
|
621
624
|
dispose() {
|
|
622
|
-
s && (s = !1,
|
|
625
|
+
s && (s = !1, r.off("transaction", g));
|
|
623
626
|
}
|
|
624
627
|
};
|
|
625
628
|
}
|
|
626
|
-
function Xe(
|
|
627
|
-
if (
|
|
629
|
+
function Xe(r, o) {
|
|
630
|
+
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
628
631
|
return null;
|
|
629
632
|
try {
|
|
630
|
-
const d =
|
|
631
|
-
|
|
633
|
+
const d = qt.near(
|
|
634
|
+
r.state.doc.resolve(o)
|
|
632
635
|
).getBookmark();
|
|
633
|
-
return et(
|
|
636
|
+
return et(r, d);
|
|
634
637
|
} catch {
|
|
635
638
|
return null;
|
|
636
639
|
}
|
|
637
640
|
}
|
|
638
|
-
function et(
|
|
639
|
-
let d = o, s = !0, c = !0,
|
|
640
|
-
const
|
|
641
|
-
const
|
|
642
|
-
!
|
|
641
|
+
function et(r, o) {
|
|
642
|
+
let d = o, s = !0, c = !0, g = !1, { from: y, to: i } = o.resolve(r.state.doc);
|
|
643
|
+
const S = ({ transaction: T }) => {
|
|
644
|
+
const p = T.mapping.mapResult(y, 1), h = T.mapping.mapResult(i, -1);
|
|
645
|
+
!g && (p.deletedAcross || h.deletedAcross) && (c = !1), y = p.pos, i = h.pos, d = d.map(T.mapping);
|
|
643
646
|
};
|
|
644
|
-
return
|
|
647
|
+
return r.on("transaction", S), {
|
|
645
648
|
status() {
|
|
646
|
-
return !s ||
|
|
649
|
+
return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
647
650
|
},
|
|
648
|
-
insert(
|
|
649
|
-
if (!s || !c ||
|
|
651
|
+
insert(T) {
|
|
652
|
+
if (!s || !c || r.isDestroyed) return !1;
|
|
650
653
|
try {
|
|
651
|
-
const
|
|
652
|
-
|
|
654
|
+
const p = d.resolve(r.state.doc);
|
|
655
|
+
g = !0;
|
|
653
656
|
try {
|
|
654
|
-
return
|
|
655
|
-
{ from:
|
|
656
|
-
|
|
657
|
+
return r.chain().setMeta(U, oe(T)).insertContentAt(
|
|
658
|
+
{ from: p.from, to: p.to },
|
|
659
|
+
T
|
|
657
660
|
).run();
|
|
658
661
|
} finally {
|
|
659
|
-
|
|
662
|
+
g = !1;
|
|
660
663
|
}
|
|
661
664
|
} catch {
|
|
662
665
|
return !1;
|
|
663
666
|
}
|
|
664
667
|
},
|
|
665
668
|
dispose() {
|
|
666
|
-
s && (s = !1,
|
|
669
|
+
s && (s = !1, r.off("transaction", S));
|
|
667
670
|
}
|
|
668
671
|
};
|
|
669
672
|
}
|
|
@@ -674,7 +677,7 @@ const bn = {
|
|
|
674
677
|
}, vn = { class: "fkp-order-remark-detail-title" }, An = {
|
|
675
678
|
key: 0,
|
|
676
679
|
class: "fkp-order-remark-extract"
|
|
677
|
-
},
|
|
680
|
+
}, Tn = { class: "fkp-order-remark-detail-content" }, Sn = { class: "fkp-order-remark-detail-row" }, Cn = { key: 0 }, Mn = ["aria-label"], En = { class: "fkp-order-remark-detail-row" }, Nn = {
|
|
678
681
|
key: 2,
|
|
679
682
|
class: "fkp-reference-placeholder",
|
|
680
683
|
"aria-hidden": "true"
|
|
@@ -691,20 +694,20 @@ const bn = {
|
|
|
691
694
|
documentAdapter: {}
|
|
692
695
|
},
|
|
693
696
|
emits: ["update:modelValue", "retry-media", "load-error", "edit-tool", "choice-menu", "leave-choice"],
|
|
694
|
-
setup(
|
|
695
|
-
const s =
|
|
697
|
+
setup(r, { expose: o, emit: d }) {
|
|
698
|
+
const s = r;
|
|
696
699
|
let c = !1;
|
|
697
|
-
const
|
|
698
|
-
let
|
|
700
|
+
const g = d, y = /* @__PURE__ */ new Map(), i = Rt();
|
|
701
|
+
let S = () => {
|
|
699
702
|
};
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
}),
|
|
703
|
+
const T = new Promise((e) => {
|
|
704
|
+
S = e;
|
|
705
|
+
}), p = Y(), h = Y(!0), v = Y(!1), u = Y(null), M = Y({});
|
|
703
706
|
let N = null;
|
|
704
707
|
function F() {
|
|
705
708
|
N && clearTimeout(N), N = null;
|
|
706
709
|
}
|
|
707
|
-
function
|
|
710
|
+
function _() {
|
|
708
711
|
F(), N = setTimeout(() => {
|
|
709
712
|
u.value = null;
|
|
710
713
|
}, 150);
|
|
@@ -715,10 +718,10 @@ const bn = {
|
|
|
715
718
|
const n = t.closest(
|
|
716
719
|
'[data-business-token][data-key="order_note"]'
|
|
717
720
|
);
|
|
718
|
-
n != null && n.dataset.nodeId && (F(), i.value.state.doc.descendants((
|
|
719
|
-
if (
|
|
721
|
+
n != null && n.dataset.nodeId && (F(), i.value.state.doc.descendants((a) => {
|
|
722
|
+
if (a.type.name !== "businessToken" || a.attrs.id !== n.dataset.nodeId)
|
|
720
723
|
return !0;
|
|
721
|
-
u.value = We(
|
|
724
|
+
u.value = We(a.attrs.params) ? a.attrs.params : null;
|
|
722
725
|
const l = n.getBoundingClientRect();
|
|
723
726
|
return M.value = {
|
|
724
727
|
left: `${l.left}px`,
|
|
@@ -732,17 +735,17 @@ const bn = {
|
|
|
732
735
|
const { target: t } = e;
|
|
733
736
|
if (!(t instanceof Element)) return;
|
|
734
737
|
const n = t.closest('[data-business-token][data-key="order_note"]');
|
|
735
|
-
n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) &&
|
|
738
|
+
n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) && _();
|
|
736
739
|
}
|
|
737
740
|
Le(F);
|
|
738
741
|
let K = !1, B = null;
|
|
739
|
-
const
|
|
742
|
+
const I = Y(null);
|
|
740
743
|
let P = null, H = null;
|
|
741
744
|
function ee() {
|
|
742
745
|
P = null, H !== null && cancelAnimationFrame(H), H = null;
|
|
743
746
|
}
|
|
744
747
|
function z() {
|
|
745
|
-
ee(), B = null,
|
|
748
|
+
ee(), B = null, I.value = null;
|
|
746
749
|
}
|
|
747
750
|
function ve(e) {
|
|
748
751
|
e.key === "Escape" && z();
|
|
@@ -752,8 +755,8 @@ const bn = {
|
|
|
752
755
|
const e = Ee({
|
|
753
756
|
clientX: P.x,
|
|
754
757
|
clientY: P.y
|
|
755
|
-
}), t = e === null ? null : Me(e, "file"), n =
|
|
756
|
-
(t == null ? void 0 : t.pos) === (n == null ? void 0 : n.pos) && (t == null ? void 0 : t.top) === (n == null ? void 0 : n.top) && (t == null ? void 0 : t.left) === (n == null ? void 0 : n.left) && (t == null ? void 0 : t.width) === (n == null ? void 0 : n.width) && (t == null ? void 0 : t.kind) === (n == null ? void 0 : n.kind) || (
|
|
758
|
+
}), t = e === null ? null : Me(e, "file"), n = I.value;
|
|
759
|
+
(t == null ? void 0 : t.pos) === (n == null ? void 0 : n.pos) && (t == null ? void 0 : t.top) === (n == null ? void 0 : n.top) && (t == null ? void 0 : t.left) === (n == null ? void 0 : n.left) && (t == null ? void 0 : t.width) === (n == null ? void 0 : n.width) && (t == null ? void 0 : t.kind) === (n == null ? void 0 : n.kind) || (I.value = t);
|
|
757
760
|
}
|
|
758
761
|
ne(
|
|
759
762
|
() => s.editable,
|
|
@@ -763,40 +766,40 @@ const bn = {
|
|
|
763
766
|
);
|
|
764
767
|
function Ae() {
|
|
765
768
|
H = null;
|
|
766
|
-
const e =
|
|
769
|
+
const e = p.value, t = P;
|
|
767
770
|
if (!e || !t || !s.editable) return;
|
|
768
|
-
const n = e.getBoundingClientRect(),
|
|
769
|
-
if (
|
|
770
|
-
const l = t.y < n.top +
|
|
771
|
+
const n = e.getBoundingClientRect(), a = Math.min(40, n.height / 3);
|
|
772
|
+
if (a <= 0) return;
|
|
773
|
+
const l = t.y < n.top + a ? -Math.ceil(12 * Math.min(1, (n.top + a - t.y) / a)) : t.y > n.bottom - a ? Math.ceil(12 * Math.min(1, (t.y - n.bottom + a) / a)) : 0, f = e.scrollHeight - e.clientHeight;
|
|
771
774
|
if (!l || f <= 0) return;
|
|
772
|
-
const
|
|
773
|
-
|
|
775
|
+
const k = Math.max(0, Math.min(f, e.scrollTop + l));
|
|
776
|
+
k !== e.scrollTop && (e.scrollTop = k, H = requestAnimationFrame(Ae));
|
|
774
777
|
}
|
|
775
778
|
function tt() {
|
|
776
|
-
u.value = null, P ? se() :
|
|
779
|
+
u.value = null, P ? se() : I.value = null;
|
|
777
780
|
}
|
|
778
781
|
let te = null, ie = !1;
|
|
779
|
-
const
|
|
782
|
+
const Te = `[data-business-token]:is(${Wt.map(
|
|
780
783
|
(e) => `[data-kind="${e}"]`
|
|
781
784
|
).join(", ")})`;
|
|
782
785
|
function G(e) {
|
|
783
|
-
const t =
|
|
784
|
-
t && (URL.revokeObjectURL(t),
|
|
786
|
+
const t = y.get(e);
|
|
787
|
+
t && (URL.revokeObjectURL(t), y.delete(e));
|
|
785
788
|
}
|
|
786
789
|
function le(e) {
|
|
787
|
-
return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(
|
|
790
|
+
return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(Te);
|
|
788
791
|
}
|
|
789
792
|
function nt(e) {
|
|
790
793
|
const t = le(e);
|
|
791
|
-
!t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) ||
|
|
794
|
+
!t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) || Se(t);
|
|
792
795
|
}
|
|
793
796
|
function rt(e) {
|
|
794
797
|
const t = le(e);
|
|
795
|
-
t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) &&
|
|
798
|
+
t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) && g("leave-choice");
|
|
796
799
|
}
|
|
797
|
-
function
|
|
800
|
+
function Se(e) {
|
|
798
801
|
const { nodeId: t } = e.dataset;
|
|
799
|
-
!t || !i.value || i.value.state.doc.descendants((n) => n.type.name !== "businessToken" || n.attrs.id !== t ? !0 : (en(n.attrs.kind) &&
|
|
802
|
+
!t || !i.value || i.value.state.doc.descendants((n) => n.type.name !== "businessToken" || n.attrs.id !== t ? !0 : (en(n.attrs.kind) && g("choice-menu", {
|
|
800
803
|
nodeId: t,
|
|
801
804
|
nodeVersion: Number(n.attrs.nodeVersion) || 0,
|
|
802
805
|
key: String(n.attrs.key),
|
|
@@ -810,31 +813,31 @@ const bn = {
|
|
|
810
813
|
if (!(t instanceof Element)) return;
|
|
811
814
|
const n = le(e);
|
|
812
815
|
if (n) {
|
|
813
|
-
|
|
816
|
+
Se(n);
|
|
814
817
|
return;
|
|
815
818
|
}
|
|
816
|
-
const
|
|
819
|
+
const a = t.closest(
|
|
817
820
|
'[data-business-token][data-kind="tool"]'
|
|
818
821
|
);
|
|
819
|
-
|
|
820
|
-
const l =
|
|
822
|
+
a && (u.value = null);
|
|
823
|
+
const l = a == null ? void 0 : a.dataset.nodeId;
|
|
821
824
|
l && i.value.state.doc.descendants((f) => {
|
|
822
825
|
if (f.type.name !== "businessToken" || f.attrs.id !== l)
|
|
823
826
|
return !0;
|
|
824
|
-
const { params:
|
|
825
|
-
return
|
|
827
|
+
const { params: k } = f.attrs;
|
|
828
|
+
return g("edit-tool", {
|
|
826
829
|
nodeId: l,
|
|
827
830
|
nodeVersion: Number(f.attrs.nodeVersion) || 0,
|
|
828
831
|
key: String(f.attrs.key),
|
|
829
832
|
label: String(f.attrs.label || f.attrs.key),
|
|
830
|
-
params:
|
|
833
|
+
params: k && typeof k == "object" && !Array.isArray(k) ? k : null
|
|
831
834
|
}), !1;
|
|
832
835
|
});
|
|
833
836
|
}
|
|
834
837
|
function ot(e) {
|
|
835
838
|
if (!s.editable || !i.value) return;
|
|
836
839
|
const { target: t } = e;
|
|
837
|
-
if (t ===
|
|
840
|
+
if (t === p.value || t === i.value.view.dom.parentElement) {
|
|
838
841
|
i.value.commands.focus("end");
|
|
839
842
|
return;
|
|
840
843
|
}
|
|
@@ -842,7 +845,7 @@ const bn = {
|
|
|
842
845
|
}
|
|
843
846
|
function Ce() {
|
|
844
847
|
var e;
|
|
845
|
-
(e =
|
|
848
|
+
(e = p.value) == null || e.querySelectorAll(Te).forEach(
|
|
846
849
|
(t) => t.classList.toggle(
|
|
847
850
|
"is-menu-open",
|
|
848
851
|
!!s.activeChoiceId && t.dataset.nodeId === s.activeChoiceId
|
|
@@ -856,18 +859,18 @@ const bn = {
|
|
|
856
859
|
function st(e) {
|
|
857
860
|
var n;
|
|
858
861
|
const t = e.target instanceof Element ? e.target.closest(".fk-media[data-drag-handle]") : null;
|
|
859
|
-
!s.editable || !(t != null && t.dataset.mediaId) || (B = t.dataset.mediaId,
|
|
862
|
+
!s.editable || !(t != null && t.dataset.mediaId) || (B = t.dataset.mediaId, I.value = null, (n = e.dataTransfer) == null || n.setData("application/x-fkp-media-id", B), e.dataTransfer && (e.dataTransfer.effectAllowed = "move"), e.stopPropagation());
|
|
860
863
|
}
|
|
861
864
|
function Me(e, t) {
|
|
862
|
-
const n = i.value,
|
|
863
|
-
if (!n || !
|
|
864
|
-
const { doc: l } = n.state, f = e === l.content.size,
|
|
865
|
-
if (!(
|
|
866
|
-
const A =
|
|
865
|
+
const n = i.value, a = p.value;
|
|
866
|
+
if (!n || !a) return null;
|
|
867
|
+
const { doc: l } = n.state, f = e === l.content.size, k = l.lastChild, m = f && k ? e - k.nodeSize : e, b = n.view.nodeDOM(m);
|
|
868
|
+
if (!(b instanceof HTMLElement)) return null;
|
|
869
|
+
const A = b.getBoundingClientRect(), C = a.getBoundingClientRect();
|
|
867
870
|
return {
|
|
868
|
-
top: (f ? A.bottom : A.top) - C.top +
|
|
869
|
-
left:
|
|
870
|
-
width:
|
|
871
|
+
top: (f ? A.bottom : A.top) - C.top + a.scrollTop,
|
|
872
|
+
left: a.scrollLeft,
|
|
873
|
+
width: a.clientWidth || C.right - C.left,
|
|
871
874
|
pos: e,
|
|
872
875
|
kind: t
|
|
873
876
|
};
|
|
@@ -875,42 +878,42 @@ const bn = {
|
|
|
875
878
|
function Ee(e) {
|
|
876
879
|
const t = i.value;
|
|
877
880
|
if (!t) return null;
|
|
878
|
-
const { view: n } = t,
|
|
879
|
-
if (!
|
|
881
|
+
const { view: n } = t, a = n.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
882
|
+
if (!a) {
|
|
880
883
|
const C = n.dom.children;
|
|
881
|
-
let E = 0,
|
|
882
|
-
for (; E <
|
|
883
|
-
const V = Math.floor((E +
|
|
884
|
-
e.clientY > R.top + R.height / 2 ? E = V + 1 :
|
|
884
|
+
let E = 0, x = C.length;
|
|
885
|
+
for (; E < x; ) {
|
|
886
|
+
const V = Math.floor((E + x) / 2), R = C[V].getBoundingClientRect();
|
|
887
|
+
e.clientY > R.top + R.height / 2 ? E = V + 1 : x = V;
|
|
885
888
|
}
|
|
886
889
|
if (E === C.length) return n.state.doc.content.size;
|
|
887
890
|
const J = n.state.doc.resolve(n.posAtDOM(C[E], 0));
|
|
888
891
|
return J.depth ? J.before(1) : J.pos;
|
|
889
892
|
}
|
|
890
|
-
const { doc: l } = n.state, f = l.resolve(
|
|
891
|
-
let
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
if (!
|
|
895
|
-
const A =
|
|
896
|
-
return e.clientY > A.top + A.height / 2 ?
|
|
893
|
+
const { doc: l } = n.state, f = l.resolve(a.pos);
|
|
894
|
+
let k = f.depth ? f.before(1) : a.pos;
|
|
895
|
+
k === l.content.size && l.lastChild && (k -= l.lastChild.nodeSize);
|
|
896
|
+
const m = l.nodeAt(k), b = n.nodeDOM(k);
|
|
897
|
+
if (!m || !(b instanceof HTMLElement)) return null;
|
|
898
|
+
const A = b.getBoundingClientRect();
|
|
899
|
+
return e.clientY > A.top + A.height / 2 ? k + m.nodeSize : k;
|
|
897
900
|
}
|
|
898
901
|
function Ne(e, t) {
|
|
899
902
|
const n = i.value;
|
|
900
903
|
if (!n) return null;
|
|
901
|
-
const
|
|
904
|
+
const a = /* @__PURE__ */ new Map();
|
|
902
905
|
n.state.doc.descendants((A, C) => {
|
|
903
|
-
A.type.name === "mediaBlock" && typeof A.attrs.id == "string" &&
|
|
906
|
+
A.type.name === "mediaBlock" && typeof A.attrs.id == "string" && a.set(A.attrs.id, { pos: C, size: A.nodeSize });
|
|
904
907
|
});
|
|
905
|
-
const l =
|
|
908
|
+
const l = a.get(t);
|
|
906
909
|
if (!l) return null;
|
|
907
|
-
const f = e.target instanceof Element ? e.target.closest(".fk-media[data-media-id]") : null,
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
let
|
|
911
|
-
if (
|
|
912
|
-
const A = l.pos <
|
|
913
|
-
|
|
910
|
+
const f = e.target instanceof Element ? e.target.closest(".fk-media[data-media-id]") : null, k = f == null ? void 0 : f.dataset.mediaId;
|
|
911
|
+
if (k === t) return null;
|
|
912
|
+
const m = k ? a.get(k) : void 0;
|
|
913
|
+
let b;
|
|
914
|
+
if (m && f) {
|
|
915
|
+
const A = l.pos < m.pos;
|
|
916
|
+
b = m.pos + (A ? m.size : 0);
|
|
914
917
|
} else {
|
|
915
918
|
const A = n.view.posAtCoords({
|
|
916
919
|
left: e.clientX,
|
|
@@ -918,13 +921,13 @@ const bn = {
|
|
|
918
921
|
});
|
|
919
922
|
if (!A) return null;
|
|
920
923
|
const C = [0];
|
|
921
|
-
n.state.doc.forEach((E,
|
|
922
|
-
C.push(
|
|
923
|
-
}),
|
|
924
|
-
(E,
|
|
924
|
+
n.state.doc.forEach((E, x) => {
|
|
925
|
+
C.push(x + E.nodeSize);
|
|
926
|
+
}), b = C.reduce(
|
|
927
|
+
(E, x) => Math.abs(x - A.pos) < Math.abs(E - A.pos) ? x : E
|
|
925
928
|
);
|
|
926
929
|
}
|
|
927
|
-
return
|
|
930
|
+
return b === l.pos || b === l.pos + l.size ? null : { source: l, insertion: b };
|
|
928
931
|
}
|
|
929
932
|
function it(e) {
|
|
930
933
|
var t;
|
|
@@ -932,65 +935,65 @@ const bn = {
|
|
|
932
935
|
if (B) {
|
|
933
936
|
e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
|
|
934
937
|
const n = Ne(e, B);
|
|
935
|
-
|
|
938
|
+
I.value = n ? Me(n.insertion, "media") : null;
|
|
936
939
|
return;
|
|
937
940
|
}
|
|
938
941
|
!s.schemaPlan.mediaBlock || !Array.from(((t = e.dataTransfer) == null ? void 0 : t.types) || []).includes("Files") || (e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"), P = { x: e.clientX, y: e.clientY }, se(), H === null && (H = requestAnimationFrame(Ae)));
|
|
939
942
|
}
|
|
940
943
|
}
|
|
941
944
|
function lt(e) {
|
|
942
|
-
var
|
|
945
|
+
var m;
|
|
943
946
|
ee();
|
|
944
947
|
const t = B;
|
|
945
948
|
if (!t) {
|
|
946
|
-
(
|
|
949
|
+
(m = e.dataTransfer) != null && m.files.length || (I.value = null);
|
|
947
950
|
return;
|
|
948
951
|
}
|
|
949
|
-
B = null,
|
|
952
|
+
B = null, I.value = null, e.preventDefault(), e.stopPropagation();
|
|
950
953
|
const n = i.value;
|
|
951
954
|
if (!s.editable || !n || n.isDestroyed) return;
|
|
952
|
-
const
|
|
953
|
-
if (!
|
|
954
|
-
const { source: l, insertion: f } =
|
|
955
|
-
if (!(!
|
|
955
|
+
const a = Ne(e, t);
|
|
956
|
+
if (!a) return;
|
|
957
|
+
const { source: l, insertion: f } = a, k = n.state.doc.nodeAt(l.pos);
|
|
958
|
+
if (!(!k || k.type.name !== "mediaBlock"))
|
|
956
959
|
try {
|
|
957
|
-
const
|
|
960
|
+
const b = n.state.tr.delete(
|
|
958
961
|
l.pos,
|
|
959
962
|
l.pos + l.size
|
|
960
963
|
);
|
|
961
|
-
|
|
964
|
+
b.insert(b.mapping.map(f), k), b.setMeta("uiEvent", "drop"), b.setMeta(U, [t]), n.view.dispatch(b);
|
|
962
965
|
} catch {
|
|
963
966
|
}
|
|
964
967
|
}
|
|
965
968
|
function ct(e) {
|
|
966
|
-
const t =
|
|
967
|
-
if (!t || !
|
|
969
|
+
const t = p.value;
|
|
970
|
+
if (!t || !I.value || e.relatedTarget instanceof Node && t.contains(e.relatedTarget))
|
|
968
971
|
return;
|
|
969
972
|
const n = t.getBoundingClientRect();
|
|
970
|
-
e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom || (ee(),
|
|
973
|
+
e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom || (ee(), I.value = null);
|
|
971
974
|
}
|
|
972
975
|
function dt() {
|
|
973
976
|
z();
|
|
974
977
|
}
|
|
975
978
|
function ce(e) {
|
|
976
|
-
const t = /* @__PURE__ */ new Set(), n = (
|
|
979
|
+
const t = /* @__PURE__ */ new Set(), n = (a) => {
|
|
977
980
|
var l, f;
|
|
978
|
-
|
|
981
|
+
a.type === "mediaBlock" && typeof ((l = a.attrs) == null ? void 0 : l.id) == "string" && t.add(a.attrs.id), (f = a.content) == null || f.forEach(n);
|
|
979
982
|
};
|
|
980
983
|
n(e);
|
|
981
|
-
for (const
|
|
984
|
+
for (const a of y.keys()) t.has(a) || G(a);
|
|
982
985
|
}
|
|
983
986
|
function we(e) {
|
|
984
987
|
i.value = new Vt({
|
|
985
988
|
content: s.modelValue,
|
|
986
989
|
editable: s.editable,
|
|
987
990
|
extensions: [
|
|
988
|
-
|
|
991
|
+
Ut.configure({
|
|
989
992
|
heading: !1,
|
|
990
993
|
dropcursor: { color: "#4884e4", width: 2 },
|
|
991
994
|
link: { openOnClick: !1, isAllowedUri: (t) => Z(t) }
|
|
992
995
|
}),
|
|
993
|
-
|
|
996
|
+
_t.configure({
|
|
994
997
|
placeholder: () => s.referencePlaceholder ? "" : s.placeholder || s.documentAdapter.placeholder
|
|
995
998
|
}),
|
|
996
999
|
an,
|
|
@@ -1009,21 +1012,21 @@ const bn = {
|
|
|
1009
1012
|
}
|
|
1010
1013
|
},
|
|
1011
1014
|
onUpdate: ({ editor: t }) => {
|
|
1012
|
-
|
|
1015
|
+
h.value = t.isEmpty;
|
|
1013
1016
|
const n = t.getJSON();
|
|
1014
|
-
ce(n), c ||
|
|
1017
|
+
ce(n), c || g("update:modelValue", n);
|
|
1015
1018
|
}
|
|
1016
|
-
}),
|
|
1019
|
+
}), h.value = i.value.isEmpty, S(!0), Ce(), ze();
|
|
1017
1020
|
}
|
|
1018
1021
|
Bt(() => {
|
|
1019
1022
|
if (document.addEventListener("keydown", ve), document.addEventListener("dragend", z), document.addEventListener("drop", z), !s.schemaPlan.mediaBlock) {
|
|
1020
1023
|
we([]);
|
|
1021
1024
|
return;
|
|
1022
1025
|
}
|
|
1023
|
-
import("./media-extensions-
|
|
1026
|
+
import("./media-extensions-YYbGuUQa.js").then(({ MediaBlock: e }) => {
|
|
1024
1027
|
K || we([e.configure({ sceneStyle: !0 })]);
|
|
1025
1028
|
}).catch(() => {
|
|
1026
|
-
K || (v.value = !0,
|
|
1029
|
+
K || (v.value = !0, S(!1), g("load-error", "媒体编辑器加载失败,请刷新页面重试"));
|
|
1027
1030
|
});
|
|
1028
1031
|
}), ne(
|
|
1029
1032
|
() => s.editable,
|
|
@@ -1034,40 +1037,40 @@ const bn = {
|
|
|
1034
1037
|
), ne(
|
|
1035
1038
|
() => s.modelValue,
|
|
1036
1039
|
(e) => {
|
|
1037
|
-
if (i.value &&
|
|
1040
|
+
if (i.value && Ue(e) !== Ue(i.value.getJSON())) {
|
|
1038
1041
|
const t = Oe();
|
|
1039
|
-
i.value.chain().setMeta(
|
|
1042
|
+
i.value.chain().setMeta(U, oe(e)).setContent(e, { emitUpdate: !1 }).run(), h.value = i.value.isEmpty, ce(e), P && se(), t && Pe(i.value, t);
|
|
1040
1043
|
}
|
|
1041
1044
|
},
|
|
1042
1045
|
{ deep: !0 }
|
|
1043
1046
|
), Le(() => {
|
|
1044
1047
|
var e;
|
|
1045
|
-
K = !0,
|
|
1046
|
-
for (const t of
|
|
1048
|
+
K = !0, S(!1), document.removeEventListener("keydown", ve), document.removeEventListener("dragend", z), document.removeEventListener("drop", z), z();
|
|
1049
|
+
for (const t of y.keys()) G(t);
|
|
1047
1050
|
(e = i.value) == null || e.destroy();
|
|
1048
1051
|
});
|
|
1049
|
-
function de(e, t, n,
|
|
1052
|
+
function de(e, t, n, a, l) {
|
|
1050
1053
|
var f;
|
|
1051
1054
|
return !s.editable || !s.schemaPlan.businessToken ? !1 : !!((f = i.value) != null && f.chain().focus().insertContent([
|
|
1052
|
-
{ type: "businessToken", attrs: { kind: e, key: t, label: n, token:
|
|
1055
|
+
{ type: "businessToken", attrs: { kind: e, key: t, label: n, token: a, params: l } },
|
|
1053
1056
|
{ type: "text", text: " " }
|
|
1054
1057
|
]).run());
|
|
1055
1058
|
}
|
|
1056
|
-
function ut(e, t, n,
|
|
1059
|
+
function ut(e, t, n, a) {
|
|
1057
1060
|
const l = i.value;
|
|
1058
1061
|
if (!s.editable || !s.schemaPlan.businessToken || !l)
|
|
1059
1062
|
return !1;
|
|
1060
1063
|
const f = [];
|
|
1061
|
-
if (l.state.doc.descendants((
|
|
1062
|
-
|
|
1064
|
+
if (l.state.doc.descendants((b, A) => {
|
|
1065
|
+
b.type.name === "businessToken" && b.attrs.kind === e && b.attrs.key === t && f.push(A);
|
|
1063
1066
|
}), f.length > 1) return !1;
|
|
1064
|
-
if (!f.length) return de(e, t, n, void 0,
|
|
1065
|
-
const
|
|
1066
|
-
return
|
|
1067
|
-
l.state.tr.setNodeMarkup(
|
|
1068
|
-
...
|
|
1069
|
-
params:
|
|
1070
|
-
nodeVersion: Number(
|
|
1067
|
+
if (!f.length) return de(e, t, n, void 0, a);
|
|
1068
|
+
const k = f[0], m = l.state.doc.nodeAt(k);
|
|
1069
|
+
return m ? (l.view.dispatch(
|
|
1070
|
+
l.state.tr.setNodeMarkup(k, void 0, {
|
|
1071
|
+
...m.attrs,
|
|
1072
|
+
params: a,
|
|
1073
|
+
nodeVersion: Number(m.attrs.nodeVersion || 0) + 1
|
|
1071
1074
|
})
|
|
1072
1075
|
), !0) : !1;
|
|
1073
1076
|
}
|
|
@@ -1076,19 +1079,19 @@ const bn = {
|
|
|
1076
1079
|
const e = i.value;
|
|
1077
1080
|
if (!e) return !1;
|
|
1078
1081
|
e.commands.focus();
|
|
1079
|
-
const { from: t, to: n } = e.state.selection,
|
|
1082
|
+
const { from: t, to: n } = e.state.selection, a = e.commands.insertContentAt(
|
|
1080
1083
|
{ from: t, to: n },
|
|
1081
1084
|
{ type: "originalReply", content: [{ type: "paragraph" }] }
|
|
1082
1085
|
);
|
|
1083
|
-
return
|
|
1086
|
+
return a && xe(), a;
|
|
1084
1087
|
}
|
|
1085
1088
|
function pt() {
|
|
1086
1089
|
return de("separator", "separator", "分隔符", "{分隔符}");
|
|
1087
1090
|
}
|
|
1088
1091
|
function mt(e, t) {
|
|
1089
|
-
var
|
|
1092
|
+
var a;
|
|
1090
1093
|
const n = i.value;
|
|
1091
|
-
return !s.editable || !n || !((
|
|
1094
|
+
return !s.editable || !n || !((a = s.documentAdapter.extensions) != null && a.some(
|
|
1092
1095
|
(l) => l.name === e
|
|
1093
1096
|
)) ? !1 : n.chain().focus().insertContent([
|
|
1094
1097
|
{ type: e, attrs: t },
|
|
@@ -1097,74 +1100,75 @@ const bn = {
|
|
|
1097
1100
|
}
|
|
1098
1101
|
function gt(e, t = "lastCaret", n = !1) {
|
|
1099
1102
|
var l;
|
|
1100
|
-
const
|
|
1101
|
-
if (!s.editable || !
|
|
1103
|
+
const a = i.value;
|
|
1104
|
+
if (!s.editable || !a || !e) return !1;
|
|
1102
1105
|
if (t === "end") {
|
|
1103
|
-
const f =
|
|
1106
|
+
const f = a.state.doc.childCount === 1 && ((l = a.state.doc.firstChild) == null ? void 0 : l.isTextblock) && a.state.doc.firstChild.content.size === 0, k = f ? 0 : a.state.doc.content.size, m = e.split(/\r\n?|\n/u).map((b) => ({
|
|
1104
1107
|
type: "paragraph",
|
|
1105
|
-
...
|
|
1108
|
+
...b ? { content: [{ type: "text", text: b }] } : {}
|
|
1106
1109
|
}));
|
|
1107
|
-
if (!
|
|
1108
|
-
f ? { from: 0, to:
|
|
1109
|
-
|
|
1110
|
+
if (!a.commands.insertContentAt(
|
|
1111
|
+
f ? { from: 0, to: a.state.doc.content.size } : k,
|
|
1112
|
+
m
|
|
1110
1113
|
))
|
|
1111
1114
|
return !1;
|
|
1112
1115
|
if (n) {
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1115
|
-
from: Math.min(
|
|
1116
|
-
to: Math.max(
|
|
1116
|
+
const b = a.state.doc.content.size;
|
|
1117
|
+
a.commands.setTextSelection({
|
|
1118
|
+
from: Math.min(k + 1, b),
|
|
1119
|
+
to: Math.max(k + 1, b - 1)
|
|
1117
1120
|
});
|
|
1118
1121
|
}
|
|
1119
|
-
return
|
|
1122
|
+
return a.commands.focus(), !0;
|
|
1120
1123
|
}
|
|
1121
|
-
return
|
|
1124
|
+
return a.chain().focus().insertContent(e).run();
|
|
1122
1125
|
}
|
|
1123
|
-
function
|
|
1126
|
+
function xe() {
|
|
1124
1127
|
const e = i.value;
|
|
1125
1128
|
if (!e) return;
|
|
1126
1129
|
const t = e.state.selection.from;
|
|
1127
1130
|
let n = null;
|
|
1128
|
-
e.state.doc.descendants((
|
|
1129
|
-
|
|
1131
|
+
e.state.doc.descendants((a, l) => {
|
|
1132
|
+
a.type.name === "originalReply" && l < t && (n = l);
|
|
1130
1133
|
}), n !== null && e.commands.setTextSelection(n + 2);
|
|
1131
1134
|
}
|
|
1132
|
-
function
|
|
1135
|
+
function Ie(e, t, n) {
|
|
1133
1136
|
if (!s.editable || !i.value || !e.length) return null;
|
|
1134
1137
|
c = !0;
|
|
1135
1138
|
try {
|
|
1136
|
-
const
|
|
1137
|
-
return
|
|
1139
|
+
const a = t.insert(e);
|
|
1140
|
+
return a && e.some((l) => l.type === "originalReply") && xe(), a && n && i.value.commands.focus(), a ? i.value.getJSON() : null;
|
|
1138
1141
|
} finally {
|
|
1139
1142
|
c = !1;
|
|
1140
1143
|
}
|
|
1141
1144
|
}
|
|
1142
|
-
function
|
|
1145
|
+
function yt(e) {
|
|
1143
1146
|
if (!(!i.value || i.value.isDestroyed)) {
|
|
1144
1147
|
c = !0;
|
|
1145
1148
|
try {
|
|
1146
|
-
i.value.chain().setMeta("addToHistory", !1).setMeta(
|
|
1149
|
+
i.value.chain().setMeta("addToHistory", !1).setMeta(U, oe(e)).setContent(e, { emitUpdate: !1 }).run(), h.value = i.value.isEmpty, ce(e);
|
|
1147
1150
|
} finally {
|
|
1148
1151
|
c = !1;
|
|
1149
1152
|
}
|
|
1150
1153
|
}
|
|
1151
1154
|
}
|
|
1152
|
-
function
|
|
1155
|
+
function kt() {
|
|
1153
1156
|
var t;
|
|
1154
|
-
const e = new Set(
|
|
1157
|
+
const e = new Set(y.keys());
|
|
1155
1158
|
return (t = i.value) == null || t.state.doc.descendants((n) => {
|
|
1156
1159
|
n.attrs.id && e.add(String(n.attrs.id));
|
|
1157
|
-
}),
|
|
1160
|
+
}), ke(e, ae);
|
|
1158
1161
|
}
|
|
1159
|
-
function ht(e, t, n,
|
|
1162
|
+
function ht(e, t, n, a) {
|
|
1160
1163
|
if (!s.editable || !s.schemaPlan.mediaBlock) return null;
|
|
1161
1164
|
const l = [
|
|
1162
1165
|
{
|
|
1163
1166
|
type: "mediaBlock",
|
|
1164
1167
|
attrs: {
|
|
1165
|
-
id:
|
|
1168
|
+
id: kt(),
|
|
1166
1169
|
nodeVersion: 0,
|
|
1167
1170
|
assetId: e.id || null,
|
|
1171
|
+
sourceType: e.sourceType || null,
|
|
1168
1172
|
src: e.url,
|
|
1169
1173
|
kind: e.kind,
|
|
1170
1174
|
name: t,
|
|
@@ -1174,33 +1178,33 @@ const bn = {
|
|
|
1174
1178
|
},
|
|
1175
1179
|
{ type: "paragraph" }
|
|
1176
1180
|
];
|
|
1177
|
-
return
|
|
1181
|
+
return Ie(l, n, a);
|
|
1178
1182
|
}
|
|
1179
1183
|
function bt(e, t, n) {
|
|
1180
|
-
var
|
|
1181
|
-
return ((
|
|
1184
|
+
var a;
|
|
1185
|
+
return ((a = De([{ file: e, kind: t }], n)) == null ? void 0 : a[0]) || null;
|
|
1182
1186
|
}
|
|
1183
1187
|
function De(e, t) {
|
|
1184
1188
|
if (!s.editable || !s.schemaPlan.mediaBlock || !i.value || !e.length)
|
|
1185
1189
|
return null;
|
|
1186
|
-
const n = new Set(
|
|
1190
|
+
const n = new Set(y.keys());
|
|
1187
1191
|
i.value.state.doc.descendants((f) => {
|
|
1188
1192
|
f.attrs.id && n.add(String(f.attrs.id));
|
|
1189
1193
|
});
|
|
1190
|
-
const
|
|
1194
|
+
const a = [], l = [];
|
|
1191
1195
|
try {
|
|
1192
|
-
for (const { file: f, kind:
|
|
1193
|
-
const
|
|
1194
|
-
n.add(
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1196
|
+
for (const { file: f, kind: k } of e) {
|
|
1197
|
+
const m = ke(n, ae);
|
|
1198
|
+
n.add(m);
|
|
1199
|
+
const b = URL.createObjectURL(f);
|
|
1200
|
+
y.set(m, b), a.push(m), l.push({
|
|
1197
1201
|
type: "mediaBlock",
|
|
1198
1202
|
attrs: {
|
|
1199
|
-
id:
|
|
1203
|
+
id: m,
|
|
1200
1204
|
nodeVersion: 0,
|
|
1201
1205
|
assetId: null,
|
|
1202
|
-
src:
|
|
1203
|
-
kind:
|
|
1206
|
+
src: b,
|
|
1207
|
+
kind: k,
|
|
1204
1208
|
name: f.name,
|
|
1205
1209
|
poster: null,
|
|
1206
1210
|
status: "uploading",
|
|
@@ -1208,54 +1212,54 @@ const bn = {
|
|
|
1208
1212
|
}
|
|
1209
1213
|
});
|
|
1210
1214
|
}
|
|
1211
|
-
if (l.push({ type: "paragraph" }), t.insert(l)) return
|
|
1215
|
+
if (l.push({ type: "paragraph" }), t.insert(l)) return a;
|
|
1212
1216
|
} catch {
|
|
1213
1217
|
}
|
|
1214
|
-
return
|
|
1218
|
+
return a.forEach(G), null;
|
|
1215
1219
|
}
|
|
1216
1220
|
function ue(e) {
|
|
1217
1221
|
const t = i.value;
|
|
1218
1222
|
if (!t || t.isDestroyed) return null;
|
|
1219
1223
|
let n = null;
|
|
1220
|
-
return t.state.doc.descendants((
|
|
1221
|
-
|
|
1222
|
-
kind:
|
|
1223
|
-
status:
|
|
1224
|
-
nodeVersion:
|
|
1224
|
+
return t.state.doc.descendants((a) => {
|
|
1225
|
+
a.type.name === "mediaBlock" && a.attrs.id === e && Number.isSafeInteger(a.attrs.nodeVersion) && a.attrs.nodeVersion >= 0 && (n = {
|
|
1226
|
+
kind: a.attrs.kind,
|
|
1227
|
+
status: a.attrs.status,
|
|
1228
|
+
nodeVersion: a.attrs.nodeVersion
|
|
1225
1229
|
});
|
|
1226
1230
|
}), n;
|
|
1227
1231
|
}
|
|
1228
|
-
function fe(e, t, n,
|
|
1232
|
+
function fe(e, t, n, a) {
|
|
1229
1233
|
const l = i.value;
|
|
1230
1234
|
if (!l || l.isDestroyed || !Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER)
|
|
1231
1235
|
return !1;
|
|
1232
1236
|
let f = null;
|
|
1233
|
-
if (l.state.doc.descendants((
|
|
1234
|
-
|
|
1237
|
+
if (l.state.doc.descendants((m, b) => {
|
|
1238
|
+
m.type.name === "mediaBlock" && m.attrs.id === e && (f = b);
|
|
1235
1239
|
}), f === null) return !1;
|
|
1236
|
-
const
|
|
1237
|
-
return !
|
|
1240
|
+
const k = l.state.doc.nodeAt(f);
|
|
1241
|
+
return !k || k.attrs.nodeVersion !== t || k.attrs.status !== n ? !1 : (l.view.dispatch(
|
|
1238
1242
|
l.state.tr.setNodeMarkup(f, void 0, {
|
|
1239
|
-
...
|
|
1240
|
-
...
|
|
1243
|
+
...k.attrs,
|
|
1244
|
+
...a,
|
|
1241
1245
|
nodeVersion: t + 1
|
|
1242
1246
|
}).setMeta("addToHistory", !1)
|
|
1243
1247
|
), !0);
|
|
1244
1248
|
}
|
|
1245
1249
|
function vt(e, t) {
|
|
1246
|
-
var
|
|
1250
|
+
var k, m, b, A;
|
|
1247
1251
|
const n = i.value;
|
|
1248
1252
|
if (!s.editable || !n || n.isDestroyed) return !1;
|
|
1249
|
-
let
|
|
1253
|
+
let a = null, l = 0;
|
|
1250
1254
|
if (n.state.doc.descendants((C, E) => {
|
|
1251
|
-
C.type.name === "mediaBlock" && C.attrs.id === e.nodeId && (
|
|
1252
|
-
}), l !== 1 ||
|
|
1253
|
-
const f = n.state.doc.nodeAt(
|
|
1254
|
-
if (!f || f.attrs.kind !== t || f.attrs.status !== "uploading" || f.attrs.nodeVersion !== e.expectedNodeVersion || e.node.type !== "mediaBlock" || ((
|
|
1255
|
+
C.type.name === "mediaBlock" && C.attrs.id === e.nodeId && (a = E, l++);
|
|
1256
|
+
}), l !== 1 || a === null) return !1;
|
|
1257
|
+
const f = n.state.doc.nodeAt(a);
|
|
1258
|
+
if (!f || f.attrs.kind !== t || f.attrs.status !== "uploading" || f.attrs.nodeVersion !== e.expectedNodeVersion || e.node.type !== "mediaBlock" || ((k = e.node.attrs) == null ? void 0 : k.id) !== e.nodeId || ((m = e.node.attrs) == null ? void 0 : m.kind) !== t || ((b = e.node.attrs) == null ? void 0 : b.nodeVersion) !== e.expectedNodeVersion + 1)
|
|
1255
1259
|
return !1;
|
|
1256
1260
|
try {
|
|
1257
1261
|
n.view.dispatch(
|
|
1258
|
-
n.state.tr.setNodeMarkup(
|
|
1262
|
+
n.state.tr.setNodeMarkup(a, void 0, e.node.attrs).setMeta("addToHistory", !1)
|
|
1259
1263
|
);
|
|
1260
1264
|
} catch {
|
|
1261
1265
|
return !1;
|
|
@@ -1263,37 +1267,37 @@ const bn = {
|
|
|
1263
1267
|
return ((A = ue(e.nodeId)) == null ? void 0 : A.status) !== "ready" ? !1 : (G(e.nodeId), !0);
|
|
1264
1268
|
}
|
|
1265
1269
|
function Re(e, t) {
|
|
1266
|
-
var f,
|
|
1270
|
+
var f, k;
|
|
1267
1271
|
const n = i.value;
|
|
1268
1272
|
if (!s.editable || !n || n.isDestroyed || !e.length)
|
|
1269
1273
|
return null;
|
|
1270
|
-
const
|
|
1271
|
-
for (const
|
|
1272
|
-
if (
|
|
1273
|
-
|
|
1274
|
-
let
|
|
1275
|
-
if (n.state.doc.descendants((E,
|
|
1276
|
-
Q(E.type.name) && E.attrs.id ===
|
|
1277
|
-
}), A !== 1 ||
|
|
1278
|
-
const C = n.state.doc.nodeAt(
|
|
1279
|
-
if (!C ||
|
|
1274
|
+
const a = /* @__PURE__ */ new Set(), l = [];
|
|
1275
|
+
for (const m of e) {
|
|
1276
|
+
if (a.has(m.nodeId)) return null;
|
|
1277
|
+
a.add(m.nodeId);
|
|
1278
|
+
let b = null, A = 0;
|
|
1279
|
+
if (n.state.doc.descendants((E, x) => {
|
|
1280
|
+
Q(E.type.name) && E.attrs.id === m.nodeId && (b = x, A++);
|
|
1281
|
+
}), A !== 1 || b === null) return null;
|
|
1282
|
+
const C = n.state.doc.nodeAt(b);
|
|
1283
|
+
if (!C || qe(C.type.name, C.attrs) !== t || C.attrs.nodeVersion !== m.expectedNodeVersion || C.type.name === "originalReply" && tn(C.toJSON()) || m.kind === "updateNode" && (C.type.name === "mediaBlock" || m.node.type !== C.type.name || ((f = m.node.attrs) == null ? void 0 : f.id) !== m.nodeId || ((k = m.node.attrs) == null ? void 0 : k.nodeVersion) !== m.expectedNodeVersion + 1 || qe(m.node.type, m.node.attrs) !== t))
|
|
1280
1284
|
return null;
|
|
1281
|
-
l.push({ plan:
|
|
1285
|
+
l.push({ plan: m, position: b, size: C.nodeSize });
|
|
1282
1286
|
}
|
|
1283
1287
|
try {
|
|
1284
|
-
let
|
|
1285
|
-
for (const { plan:
|
|
1286
|
-
(E,
|
|
1288
|
+
let m = n.state.tr;
|
|
1289
|
+
for (const { plan: b, position: A, size: C } of l.sort(
|
|
1290
|
+
(E, x) => x.position - E.position
|
|
1287
1291
|
))
|
|
1288
|
-
|
|
1292
|
+
b.kind === "removeNode" ? m = m.delete(A, A + C) : m = m.replaceWith(
|
|
1289
1293
|
A,
|
|
1290
1294
|
A + C,
|
|
1291
|
-
n.schema.nodeFromJSON(
|
|
1295
|
+
n.schema.nodeFromJSON(b.node)
|
|
1292
1296
|
);
|
|
1293
|
-
return
|
|
1294
|
-
|
|
1295
|
-
e.filter((
|
|
1296
|
-
), { transaction:
|
|
1297
|
+
return m.doc.check(), m.setMeta(
|
|
1298
|
+
U,
|
|
1299
|
+
e.filter((b) => b.kind === "updateNode").map((b) => b.nodeId)
|
|
1300
|
+
), { transaction: m, requestedIds: a };
|
|
1297
1301
|
} catch {
|
|
1298
1302
|
return null;
|
|
1299
1303
|
}
|
|
@@ -1303,33 +1307,33 @@ const bn = {
|
|
|
1303
1307
|
return ((n = Re(e, t)) == null ? void 0 : n.transaction.doc.toJSON()) || null;
|
|
1304
1308
|
}
|
|
1305
1309
|
function Be(e, t) {
|
|
1306
|
-
const n = Re(e, t),
|
|
1307
|
-
if (!n || !
|
|
1310
|
+
const n = Re(e, t), a = i.value;
|
|
1311
|
+
if (!n || !a || a.isDestroyed) return !1;
|
|
1308
1312
|
const { transaction: l, requestedIds: f } = n;
|
|
1309
1313
|
try {
|
|
1310
|
-
|
|
1314
|
+
a.view.dispatch(l);
|
|
1311
1315
|
} catch {
|
|
1312
1316
|
return !1;
|
|
1313
1317
|
}
|
|
1314
|
-
const
|
|
1315
|
-
return
|
|
1316
|
-
Q(
|
|
1318
|
+
const k = /* @__PURE__ */ new Map();
|
|
1319
|
+
return a.state.doc.descendants((m) => {
|
|
1320
|
+
Q(m.type.name) && f.has(m.attrs.id) && k.set(m.attrs.id, m.attrs.nodeVersion);
|
|
1317
1321
|
}), e.every(
|
|
1318
|
-
(
|
|
1322
|
+
(m) => m.kind === "removeNode" ? !k.has(m.nodeId) : k.get(m.nodeId) === m.expectedNodeVersion + 1
|
|
1319
1323
|
);
|
|
1320
1324
|
}
|
|
1321
|
-
function
|
|
1325
|
+
function Tt(e, t) {
|
|
1322
1326
|
return Be([e], t);
|
|
1323
1327
|
}
|
|
1324
|
-
function
|
|
1328
|
+
function St(e, t, n) {
|
|
1325
1329
|
return fe(e, n, "uploading", {
|
|
1326
1330
|
status: "error",
|
|
1327
1331
|
error: t
|
|
1328
1332
|
});
|
|
1329
1333
|
}
|
|
1330
1334
|
function Ct(e, t, n) {
|
|
1331
|
-
const
|
|
1332
|
-
if ((
|
|
1335
|
+
const a = ue(e);
|
|
1336
|
+
if ((a == null ? void 0 : a.kind) !== n.kind || !Z(n.url)) return !1;
|
|
1333
1337
|
const l = fe(e, t, "uploading", {
|
|
1334
1338
|
status: "ready",
|
|
1335
1339
|
src: n.url,
|
|
@@ -1346,13 +1350,13 @@ const bn = {
|
|
|
1346
1350
|
});
|
|
1347
1351
|
}
|
|
1348
1352
|
function Et(e, t, n) {
|
|
1349
|
-
const
|
|
1350
|
-
if (!
|
|
1353
|
+
const a = i.value;
|
|
1354
|
+
if (!a || a.isDestroyed || !Number.isFinite(n))
|
|
1351
1355
|
return !1;
|
|
1352
1356
|
let l = !1;
|
|
1353
|
-
return
|
|
1357
|
+
return a.state.doc.descendants((f) => {
|
|
1354
1358
|
f.type.name === "mediaBlock" && f.attrs.id === e && f.attrs.status === "uploading" && f.attrs.nodeVersion === t && (l = !0);
|
|
1355
|
-
}), l ? (
|
|
1359
|
+
}), l ? (a.view.dom.dispatchEvent(
|
|
1356
1360
|
new CustomEvent("fkp-media-progress", {
|
|
1357
1361
|
detail: { id: e, percent: Math.round(Math.max(0, Math.min(100, n))) }
|
|
1358
1362
|
})
|
|
@@ -1361,7 +1365,7 @@ const bn = {
|
|
|
1361
1365
|
function Nt(e) {
|
|
1362
1366
|
var n;
|
|
1363
1367
|
const t = (n = e.detail) == null ? void 0 : n.id;
|
|
1364
|
-
typeof t == "string" &&
|
|
1368
|
+
typeof t == "string" && g("retry-media", t);
|
|
1365
1369
|
}
|
|
1366
1370
|
function Oe() {
|
|
1367
1371
|
const e = i.value;
|
|
@@ -1369,25 +1373,25 @@ const bn = {
|
|
|
1369
1373
|
const { selection: t } = e.state;
|
|
1370
1374
|
let n;
|
|
1371
1375
|
if (t instanceof $ && t.empty) {
|
|
1372
|
-
const { $from:
|
|
1373
|
-
if (
|
|
1376
|
+
const { $from: a } = t, l = a.start();
|
|
1377
|
+
if (a.parent.forEach((f, k) => {
|
|
1374
1378
|
if (f.type.name !== "businessToken" || !f.attrs.id) return;
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1379
|
+
const m = t.from - (l + k + f.nodeSize);
|
|
1380
|
+
m >= 0 && m <= 1 && (n = {
|
|
1377
1381
|
id: String(f.attrs.id),
|
|
1378
1382
|
kind: "inlineAfter",
|
|
1379
|
-
offset:
|
|
1383
|
+
offset: m
|
|
1380
1384
|
});
|
|
1381
|
-
}), !n &&
|
|
1382
|
-
const f =
|
|
1383
|
-
for (let
|
|
1384
|
-
const A =
|
|
1385
|
+
}), !n && a.depth >= 1 && a.parent.isTextblock && a.parentOffset <= 1) {
|
|
1386
|
+
const f = a.depth - 1, k = a.index(f), m = a.node(f);
|
|
1387
|
+
for (let b = k - 1; b >= 0; b--) {
|
|
1388
|
+
const A = m.child(b);
|
|
1385
1389
|
if (A.type.name === "mediaBlock" && A.attrs.id) {
|
|
1386
1390
|
n = {
|
|
1387
1391
|
id: String(A.attrs.id),
|
|
1388
1392
|
kind: "blockAfter",
|
|
1389
|
-
offset:
|
|
1390
|
-
siblingOffset:
|
|
1393
|
+
offset: a.parentOffset,
|
|
1394
|
+
siblingOffset: k - b
|
|
1391
1395
|
};
|
|
1392
1396
|
break;
|
|
1393
1397
|
}
|
|
@@ -1404,39 +1408,39 @@ const bn = {
|
|
|
1404
1408
|
}
|
|
1405
1409
|
function Pe(e, t) {
|
|
1406
1410
|
const n = e.state.doc.content.size;
|
|
1407
|
-
let
|
|
1411
|
+
let a;
|
|
1408
1412
|
const { nodeCaret: l } = t;
|
|
1409
|
-
l && t.from === t.to && e.state.doc.descendants((
|
|
1410
|
-
if (
|
|
1413
|
+
l && t.from === t.to && e.state.doc.descendants((b, A) => {
|
|
1414
|
+
if (b.attrs.id !== l.id) return;
|
|
1411
1415
|
if (l.kind === "inlineAfter") {
|
|
1412
|
-
if (
|
|
1416
|
+
if (b.type.name !== "businessToken") return;
|
|
1413
1417
|
const R = e.state.doc.resolve(A).end();
|
|
1414
|
-
|
|
1415
|
-
A +
|
|
1418
|
+
a = Math.min(
|
|
1419
|
+
A + b.nodeSize + l.offset,
|
|
1416
1420
|
R
|
|
1417
1421
|
);
|
|
1418
1422
|
return;
|
|
1419
1423
|
}
|
|
1420
|
-
if (
|
|
1421
|
-
const C = e.state.doc.resolve(A), { parent: E } = C,
|
|
1424
|
+
if (b.type.name !== "mediaBlock") return;
|
|
1425
|
+
const C = e.state.doc.resolve(A), { parent: E } = C, x = C.index(), J = x + l.siblingOffset, V = E.maybeChild(J);
|
|
1422
1426
|
if (V != null && V.isTextblock && Array.from(
|
|
1423
1427
|
{ length: l.siblingOffset - 1 },
|
|
1424
|
-
(R, j) => E.child(
|
|
1428
|
+
(R, j) => E.child(x + j + 1)
|
|
1425
1429
|
).every((R) => R.isTextblock && R.content.size === 0)) {
|
|
1426
1430
|
let R = A;
|
|
1427
|
-
for (let j =
|
|
1431
|
+
for (let j = x; j < J; j++)
|
|
1428
1432
|
R += E.child(j).nodeSize;
|
|
1429
|
-
|
|
1433
|
+
a = Math.min(
|
|
1430
1434
|
R + 1 + l.offset,
|
|
1431
1435
|
R + V.nodeSize - 1
|
|
1432
1436
|
);
|
|
1433
1437
|
}
|
|
1434
1438
|
});
|
|
1435
1439
|
const f = {
|
|
1436
|
-
from:
|
|
1437
|
-
to:
|
|
1438
|
-
},
|
|
1439
|
-
t.focused && (!
|
|
1440
|
+
from: a ?? Math.min(t.from, n),
|
|
1441
|
+
to: a ?? Math.min(t.to, n)
|
|
1442
|
+
}, k = document.activeElement;
|
|
1443
|
+
t.focused && (!k || k === document.body || k === e.view.dom || !k.isConnected) ? e.chain().setTextSelection(f).focus().run() : e.commands.setTextSelection(f);
|
|
1440
1444
|
}
|
|
1441
1445
|
async function ze() {
|
|
1442
1446
|
if (!(ie || !te)) {
|
|
@@ -1463,7 +1467,7 @@ const bn = {
|
|
|
1463
1467
|
function Ve(e) {
|
|
1464
1468
|
const t = e.clipboardData, n = i.value;
|
|
1465
1469
|
if (!s.editable || !n || !t) return null;
|
|
1466
|
-
const
|
|
1470
|
+
const a = () => t.files.length ? Ye(n, n.state.selection.to) : null, l = t.getData("text/html"), { slice: f, handled: k } = kn(
|
|
1467
1471
|
l,
|
|
1468
1472
|
n.state.schema,
|
|
1469
1473
|
s.pasteCapabilities || [],
|
|
@@ -1473,12 +1477,12 @@ const bn = {
|
|
|
1473
1477
|
if (f)
|
|
1474
1478
|
return n.view.dispatch(
|
|
1475
1479
|
n.state.tr.replaceSelection(f).setMeta("uiEvent", "paste")
|
|
1476
|
-
),
|
|
1477
|
-
if (
|
|
1478
|
-
const
|
|
1479
|
-
return
|
|
1480
|
+
), a();
|
|
1481
|
+
if (k) return null;
|
|
1482
|
+
const m = t.getData("text/plain");
|
|
1483
|
+
return m && n.view.pasteText(m, new Event("paste")), m ? a() : null;
|
|
1480
1484
|
}
|
|
1481
|
-
function
|
|
1485
|
+
function xt(e) {
|
|
1482
1486
|
const t = i.value;
|
|
1483
1487
|
!t || !e.clipboardData || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || pn(
|
|
1484
1488
|
e.clipboardData,
|
|
@@ -1487,7 +1491,7 @@ const bn = {
|
|
|
1487
1491
|
s.documentAdapter.clipboard
|
|
1488
1492
|
) && (e.preventDefault(), e.stopPropagation());
|
|
1489
1493
|
}
|
|
1490
|
-
function
|
|
1494
|
+
function It(e) {
|
|
1491
1495
|
var t;
|
|
1492
1496
|
e.defaultPrevented || (t = e.clipboardData) != null && t.files.length || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || (e.preventDefault(), e.stopPropagation(), Ve(e));
|
|
1493
1497
|
}
|
|
@@ -1508,16 +1512,16 @@ const bn = {
|
|
|
1508
1512
|
insertText: gt,
|
|
1509
1513
|
insertOriginal: ft,
|
|
1510
1514
|
insertSeparator: pt,
|
|
1511
|
-
insertBatch:
|
|
1512
|
-
restoreDoc:
|
|
1515
|
+
insertBatch: Ie,
|
|
1516
|
+
restoreDoc: yt,
|
|
1513
1517
|
insertMedia: ht,
|
|
1514
1518
|
insertPendingMedia: bt,
|
|
1515
1519
|
insertPendingMediaBatch: De,
|
|
1516
1520
|
applyNodeUpdate: vt,
|
|
1517
|
-
applyPluginNodeOperation:
|
|
1521
|
+
applyPluginNodeOperation: Tt,
|
|
1518
1522
|
applyPluginNodeOperations: Be,
|
|
1519
1523
|
previewPluginNodeOperations: At,
|
|
1520
|
-
failMedia:
|
|
1524
|
+
failMedia: St,
|
|
1521
1525
|
completeMedia: Ct,
|
|
1522
1526
|
retryMedia: Mt,
|
|
1523
1527
|
getMediaState: ue,
|
|
@@ -1525,7 +1529,7 @@ const bn = {
|
|
|
1525
1529
|
captureSelection: Oe,
|
|
1526
1530
|
restoreSelection: wt,
|
|
1527
1531
|
captureMediaTarget: () => i.value ? hn(i.value) : null,
|
|
1528
|
-
whenReady: () =>
|
|
1532
|
+
whenReady: () => T,
|
|
1529
1533
|
captureEndTarget: () => {
|
|
1530
1534
|
var n;
|
|
1531
1535
|
const e = i.value;
|
|
@@ -1534,8 +1538,8 @@ const bn = {
|
|
|
1534
1538
|
return (n = t.lastChild) != null && n.isTextblock ? Xe(e, t.content.size - 1) : Ye(e, t.content.size);
|
|
1535
1539
|
},
|
|
1536
1540
|
captureMediaTargetAt: (e, t) => {
|
|
1537
|
-
const n = i.value,
|
|
1538
|
-
return ee(),
|
|
1541
|
+
const n = i.value, a = n ? Ee({ clientX: e, clientY: t }) : null;
|
|
1542
|
+
return ee(), I.value = null, n && a !== null ? Xe(n, a) : null;
|
|
1539
1543
|
},
|
|
1540
1544
|
focus: () => {
|
|
1541
1545
|
var e;
|
|
@@ -1545,10 +1549,10 @@ const bn = {
|
|
|
1545
1549
|
var e;
|
|
1546
1550
|
return (e = i.value) == null ? void 0 : e.getJSON();
|
|
1547
1551
|
}
|
|
1548
|
-
}), (e, t) => v.value ? (L(),
|
|
1552
|
+
}), (e, t) => v.value ? (L(), q("div", bn, "媒体编辑器加载失败,请刷新页面重试")) : (L(), q("div", {
|
|
1549
1553
|
key: 1,
|
|
1550
1554
|
ref_key: "areaRoot",
|
|
1551
|
-
ref:
|
|
1555
|
+
ref: p,
|
|
1552
1556
|
class: "fkp-knowledge-area",
|
|
1553
1557
|
onFkpMediaRetry: Nt,
|
|
1554
1558
|
onClick: ot,
|
|
@@ -1559,14 +1563,14 @@ const bn = {
|
|
|
1559
1563
|
rt(n), O(n);
|
|
1560
1564
|
}),
|
|
1561
1565
|
onFocusin: w,
|
|
1562
|
-
onFocusout:
|
|
1566
|
+
onFocusout: _,
|
|
1563
1567
|
onDragstartCapture: st,
|
|
1564
1568
|
onDragoverCapture: it,
|
|
1565
1569
|
onDragleaveCapture: ct,
|
|
1566
1570
|
onDropCapture: lt,
|
|
1567
1571
|
onDragendCapture: dt,
|
|
1568
|
-
onCopyCapture:
|
|
1569
|
-
onPasteCapture:
|
|
1572
|
+
onCopyCapture: xt,
|
|
1573
|
+
onPasteCapture: It,
|
|
1570
1574
|
onScrollCapture: tt
|
|
1571
1575
|
}, [
|
|
1572
1576
|
Fe(W(zt), {
|
|
@@ -1593,16 +1597,16 @@ const bn = {
|
|
|
1593
1597
|
D("div", {
|
|
1594
1598
|
class: "fkp-order-remark-detail",
|
|
1595
1599
|
onMouseenter: F,
|
|
1596
|
-
onMouseleave:
|
|
1600
|
+
onMouseleave: _
|
|
1597
1601
|
}, [
|
|
1598
1602
|
D("div", vn, [
|
|
1599
1603
|
t[2] || (t[2] = D("strong", null, "订单备注", -1)),
|
|
1600
|
-
u.value.contentMode === "smart" ? (L(),
|
|
1604
|
+
u.value.contentMode === "smart" ? (L(), q("span", An, "智能提取")) : re("", !0)
|
|
1601
1605
|
]),
|
|
1602
|
-
D("div",
|
|
1603
|
-
D("div",
|
|
1606
|
+
D("div", Tn, He(u.value.content), 1),
|
|
1607
|
+
D("div", Sn, [
|
|
1604
1608
|
t[3] || (t[3] = D("span", null, "备注插旗", -1)),
|
|
1605
|
-
u.value.flag === "none" ? (L(),
|
|
1609
|
+
u.value.flag === "none" ? (L(), q("span", Cn, "不标记")) : (L(), q("span", {
|
|
1606
1610
|
key: 1,
|
|
1607
1611
|
class: "fkp-order-remark-detail-flag",
|
|
1608
1612
|
role: "img",
|
|
@@ -1626,17 +1630,17 @@ const bn = {
|
|
|
1626
1630
|
]),
|
|
1627
1631
|
_: 1
|
|
1628
1632
|
})) : re("", !0),
|
|
1629
|
-
|
|
1633
|
+
I.value ? (L(), q("div", {
|
|
1630
1634
|
key: 1,
|
|
1631
1635
|
class: "fkp-media-drop-line",
|
|
1632
1636
|
style: me({
|
|
1633
|
-
top: `${
|
|
1634
|
-
left: `${
|
|
1635
|
-
width: `${
|
|
1637
|
+
top: `${I.value.top}px`,
|
|
1638
|
+
left: `${I.value.left}px`,
|
|
1639
|
+
width: `${I.value.width}px`
|
|
1636
1640
|
}),
|
|
1637
1641
|
"aria-hidden": "true"
|
|
1638
1642
|
}, null, 4)) : re("", !0),
|
|
1639
|
-
e.referencePlaceholder &&
|
|
1643
|
+
e.referencePlaceholder && h.value ? (L(), q("div", Nn, [
|
|
1640
1644
|
t[6] || (t[6] = D("span", { class: "fkp-reference-bracket" }, "<", -1)),
|
|
1641
1645
|
Fe(W($t), {
|
|
1642
1646
|
color: "arcoblue",
|