@freecallai/pro 0.0.14 → 0.0.15
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-D-SOdFra.js → FkpRichText.vue_vue_type_script_setup_true_lang-DaSKjAe7.js} +246 -244
- package/dist/{KnowledgeArea-ClZoLiaZ.js → KnowledgeArea-BV2T5ecq.js} +1 -1
- package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-QJZNyAnH.js} +221 -223
- package/dist/{ToolForm-BK9epxdr.js → ToolForm-CJRw9QhZ.js} +1 -1
- package/dist/agent-prompt-editor/index.js +198 -179
- package/dist/agent-prompt-editor/legacy-converter/index.js +188 -162
- package/dist/{choice-UgePgrSl.js → choice-BZa68Gpl.js} +1 -1
- package/dist/{guard-DPwe4mCm.js → guard-CZOoBb3d.js} +271 -213
- package/dist/index-9-vUHS0W.js +15 -0
- package/dist/index-B4oT1Q9u.js +5 -0
- package/dist/index-BHgHsPrz.js +5 -0
- package/dist/index-Bd2S6qOP.js +19 -0
- package/dist/{index-CaA13lC9.js → index-BdSClCaD.js} +1 -1
- package/dist/{index-BIi3k45j.js → index-BwkcWrL6.js} +1 -1
- package/dist/{index-ChuzFuNm.js → index-Cn_sllKh.js} +1 -1
- package/dist/{index-DiLMgNEe.js → index-DvDbrMvv.js} +1 -1
- package/dist/{index-DfKH-RZq.js → index-OMoExOaa.js} +2 -2
- package/dist/{index-RHu4JIw7.js → index-WExTogRL.js} +1 -1
- package/dist/{index-v1UD08i6.js → index-w2M63UAJ.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CVF1zEsG.js → inline-BJJy0svW.js} +1 -1
- package/dist/{knowledge-DWM6tWnP.js → knowledge-B3aTxExW.js} +1 -1
- package/dist/media-extensions-CpwsEWCD.js +338 -0
- package/dist/{media-migration-BctCLEuT.js → media-migration-3-xnOp0T.js} +1 -1
- package/dist/{media-policy-B1UuSN2e.js → media-policy-BqquGDH1.js} +36 -36
- package/dist/{media-upload-DtH-oCtw.js → media-upload-AunEWyNv.js} +1 -1
- package/dist/{model-VLLhEQfn.js → model-aED-32GY.js} +10 -6
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +905 -842
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/model.d.ts +1 -1
- package/dist/types/rich-text/config/descriptor.d.ts +2 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +1 -0
- package/dist/types/rich-text/plugins/noFollow/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/noFollow/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/noFollow/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/token-catalog.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/index-BMHUPL5x.js +0 -5
- package/dist/index-DJLfgC4v.js +0 -5
- package/dist/media-extensions-YYbGuUQa.js +0 -341
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Ot, shallowRef as Pt, watch as ie, onBeforeUnmount as ve, ref as re, nextTick as He, onMounted as zt, openBlock as G, createElementBlock as W, createVNode as Ke, unref as le, createBlock as Lt, withCtx as
|
|
1
|
+
import { defineComponent as Ot, shallowRef as Pt, watch as ie, onBeforeUnmount as ve, ref as re, nextTick as He, onMounted as zt, openBlock as G, createElementBlock as W, createVNode as Ke, unref as le, createBlock as Lt, withCtx as Ae, createElementVNode as K, normalizeStyle as Te, createCommentVNode as fe, toDisplayString as Ue, createTextVNode as $t } from "vue";
|
|
2
2
|
import { EditorContent as qt, Editor as Ft } from "@tiptap/vue-3";
|
|
3
3
|
import { Popover as Ht, Tag as Kt } from "@freecallai/ui";
|
|
4
4
|
import { PluginKey as Qe, Plugin as Ce, TextSelection as j, NodeSelection as Ut, Selection as _t } from "@tiptap/pm/state";
|
|
@@ -6,14 +6,14 @@ import Jt from "@tiptap/starter-kit";
|
|
|
6
6
|
import Yt from "@tiptap/extension-placeholder";
|
|
7
7
|
import { Extension as Ze, Node as Ee } from "@tiptap/core";
|
|
8
8
|
import { Decoration as pe, DecorationSet as et } from "@tiptap/pm/view";
|
|
9
|
-
import { g as de, d as ce, t as Q,
|
|
9
|
+
import { g as de, d as ce, t as Q, r as Me, u as Xt, c as Gt, v as tt, b as nt, i as ue, w as me, C as jt, x as Wt, y as Qt, z as Zt, A as _e, B as en } from "./guard-CZOoBb3d.js";
|
|
10
10
|
import { DOMSerializer as rt, DOMParser as tn } from "@tiptap/pm/model";
|
|
11
11
|
import { c as ge } from "./media-id-b2dgniSy.js";
|
|
12
12
|
import { icons as nn } from "@freecallai/icons";
|
|
13
|
-
import { a as rn, c as Je } from "./media-policy-
|
|
13
|
+
import { a as rn, c as Je } from "./media-policy-BqquGDH1.js";
|
|
14
14
|
function an(r) {
|
|
15
|
-
const o = new Qe("fkpTagValidity"),
|
|
16
|
-
let a,
|
|
15
|
+
const o = new Qe("fkpTagValidity"), l = /* @__PURE__ */ new Map();
|
|
16
|
+
let a, c = 0, f = 0, y = !1, i = !1, A, T = /* @__PURE__ */ new Set();
|
|
17
17
|
function p(D = ((F) => (F = r.editor()) == null ? void 0 : F.state.doc)()) {
|
|
18
18
|
const C = [];
|
|
19
19
|
return D == null || D.descendants((w, P) => {
|
|
@@ -54,7 +54,7 @@ function an(r) {
|
|
|
54
54
|
props: {
|
|
55
55
|
decorations(D) {
|
|
56
56
|
const F = p(D.doc).flatMap((C) => {
|
|
57
|
-
const w =
|
|
57
|
+
const w = l.get(C.fingerprint);
|
|
58
58
|
return (w == null ? void 0 : w.status) !== "invalid" ? [] : [
|
|
59
59
|
pe.node(C.pos, C.pos + C.size, {
|
|
60
60
|
class: "fkp-tag-validity-invalid",
|
|
@@ -72,30 +72,30 @@ function an(r) {
|
|
|
72
72
|
});
|
|
73
73
|
function m() {
|
|
74
74
|
y || i || (y = !0, queueMicrotask(() => {
|
|
75
|
-
y = !1, i ||
|
|
75
|
+
y = !1, i || S(!1);
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
78
|
-
async function
|
|
78
|
+
async function S(D) {
|
|
79
79
|
var H;
|
|
80
80
|
const F = r.port(), C = p(), w = new Set(C.map((x) => x.fingerprint));
|
|
81
|
-
for (const x of
|
|
81
|
+
for (const x of l.keys()) w.has(x) || l.delete(x);
|
|
82
82
|
if (!F)
|
|
83
|
-
return a == null || a.abort(),
|
|
84
|
-
const P = D ? C : C.filter((x) => !
|
|
83
|
+
return a == null || a.abort(), c++, A = void 0, T.clear(), l.clear(), k(), { status: "unavailable", items: [] };
|
|
84
|
+
const P = D ? C : C.filter((x) => !l.has(x.fingerprint));
|
|
85
85
|
if (!P.length && D)
|
|
86
|
-
return a == null || a.abort(),
|
|
86
|
+
return a == null || a.abort(), c++, A = void 0, T.clear(), { status: "complete", items: [] };
|
|
87
87
|
if (!P.length)
|
|
88
|
-
return
|
|
88
|
+
return A || {
|
|
89
89
|
status: "complete",
|
|
90
90
|
items: C.flatMap((x) => {
|
|
91
|
-
const V =
|
|
91
|
+
const V = l.get(x.fingerprint);
|
|
92
92
|
return V ? [{ ...x.input, ...V }] : [];
|
|
93
93
|
})
|
|
94
94
|
};
|
|
95
|
-
if (!D &&
|
|
96
|
-
return
|
|
97
|
-
a == null || a.abort(), a = new AbortController(),
|
|
98
|
-
const { signal: R } = a, $ = ++
|
|
95
|
+
if (!D && A && P.every((x) => T.has(x.fingerprint)))
|
|
96
|
+
return A;
|
|
97
|
+
a == null || a.abort(), a = new AbortController(), T = new Set(P.map((x) => x.fingerprint));
|
|
98
|
+
const { signal: R } = a, $ = ++c, N = r.editorKey(), q = JSON.parse(
|
|
99
99
|
JSON.stringify(
|
|
100
100
|
P.map((x, V) => ({
|
|
101
101
|
...x.input,
|
|
@@ -109,7 +109,7 @@ function an(r) {
|
|
|
109
109
|
{ tags: q },
|
|
110
110
|
{ editorKey: N, requestId: `${N}:${++f}`, signal: R }
|
|
111
111
|
);
|
|
112
|
-
if (i || R.aborted || $ !==
|
|
112
|
+
if (i || R.aborted || $ !== c || N !== r.editorKey())
|
|
113
113
|
return { status: "cancelled", items: [] };
|
|
114
114
|
const Y = V != null && V.ok && Array.isArray((x = V.data) == null ? void 0 : x.items) ? V.data.items : null, se = new Set(q.map((I) => I.requestItemId));
|
|
115
115
|
if (!Y || Y.length !== se.size || new Set(Y.map((I) => I == null ? void 0 : I.requestItemId)).size !== se.size || Y.some(
|
|
@@ -128,7 +128,7 @@ function an(r) {
|
|
|
128
128
|
);
|
|
129
129
|
return P.forEach((I, J) => {
|
|
130
130
|
const te = ee.get(q[J].requestItemId);
|
|
131
|
-
te.status === "unknown" &&
|
|
131
|
+
te.status === "unknown" && l.has(I.fingerprint) || l.set(I.fingerprint, te);
|
|
132
132
|
}), k(), {
|
|
133
133
|
status: "complete",
|
|
134
134
|
items: P.map((I, J) => ({
|
|
@@ -137,35 +137,35 @@ function an(r) {
|
|
|
137
137
|
}))
|
|
138
138
|
};
|
|
139
139
|
} catch (V) {
|
|
140
|
-
return R.aborted || $ !==
|
|
140
|
+
return R.aborted || $ !== c || i ? { status: "cancelled", items: [] } : {
|
|
141
141
|
status: "error",
|
|
142
142
|
items: [],
|
|
143
143
|
message: V instanceof Error ? V.message : "标签状态查询失败"
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
})();
|
|
147
|
-
|
|
147
|
+
A = z;
|
|
148
148
|
const _ = await z;
|
|
149
|
-
return _.status === "error" && ((H = r.onError) == null || H.call(r, _.message || "标签状态查询失败")),
|
|
149
|
+
return _.status === "error" && ((H = r.onError) == null || H.call(r, _.message || "标签状态查询失败")), A === z && (A = void 0, T.clear()), _;
|
|
150
150
|
}
|
|
151
151
|
function O() {
|
|
152
|
-
a == null || a.abort(),
|
|
152
|
+
a == null || a.abort(), c++, A = void 0, T.clear(), l.clear(), k(), m();
|
|
153
153
|
}
|
|
154
154
|
return {
|
|
155
155
|
extension: v,
|
|
156
156
|
schedule: m,
|
|
157
|
-
refresh: () =>
|
|
157
|
+
refresh: () => S(!0),
|
|
158
158
|
reset: O,
|
|
159
159
|
dispose() {
|
|
160
|
-
i = !0, a == null || a.abort(),
|
|
160
|
+
i = !0, a == null || a.abort(), c++, l.clear();
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
function ae(r, o) {
|
|
165
|
-
const
|
|
166
|
-
`http://www.w3.org/2000/svg ${
|
|
167
|
-
|
|
168
|
-
...
|
|
165
|
+
const l = (c) => [
|
|
166
|
+
`http://www.w3.org/2000/svg ${c.tag}`,
|
|
167
|
+
c.attrs,
|
|
168
|
+
...c.children.map(l)
|
|
169
169
|
], a = nn[r];
|
|
170
170
|
return [
|
|
171
171
|
"http://www.w3.org/2000/svg svg",
|
|
@@ -175,33 +175,33 @@ function ae(r, o) {
|
|
|
175
175
|
"aria-hidden": "true",
|
|
176
176
|
focusable: "false"
|
|
177
177
|
},
|
|
178
|
-
...a.children.map(
|
|
178
|
+
...a.children.map(l)
|
|
179
179
|
];
|
|
180
180
|
}
|
|
181
181
|
function sn(r) {
|
|
182
182
|
var y;
|
|
183
|
-
const o = (y = de(r.kind)) == null ? void 0 : y.present(r),
|
|
183
|
+
const o = (y = de(r.kind)) == null ? void 0 : y.present(r), l = String(r.kind || ""), a = (o == null ? void 0 : o.label) || String(r.label || r.key || ""), c = (i) => [
|
|
184
184
|
"span",
|
|
185
185
|
{ class: i },
|
|
186
186
|
a
|
|
187
187
|
];
|
|
188
188
|
let f = [a];
|
|
189
189
|
return (o == null ? void 0 : o.layout) === "choice" && (f = [
|
|
190
|
-
ae(o.icon, `fkp-choice-token-icon fkp-${
|
|
191
|
-
|
|
190
|
+
ae(o.icon, `fkp-choice-token-icon fkp-${l}-token-icon`),
|
|
191
|
+
c(`fkp-choice-token-label fkp-${l}-token-label`),
|
|
192
192
|
ae(
|
|
193
193
|
"arrow-down",
|
|
194
|
-
`fkp-choice-token-arrow fkp-${
|
|
194
|
+
`fkp-choice-token-arrow fkp-${l}-token-arrow`
|
|
195
195
|
)
|
|
196
196
|
]), (o == null ? void 0 : o.layout) === "inline" && (f = [
|
|
197
197
|
ae(o.icon, "fkp-inline-token-icon"),
|
|
198
|
-
|
|
198
|
+
c("fkp-inline-token-label")
|
|
199
199
|
]), (o == null ? void 0 : o.layout) === "tool" && (f = [
|
|
200
200
|
ae(o.icon, "fkp-tool-token-icon"),
|
|
201
|
-
|
|
201
|
+
c("fkp-tool-token-label")
|
|
202
202
|
]), (o == null ? void 0 : o.layout) === "toolNote" && (f = [
|
|
203
203
|
ae(o.icon, "fkp-tool-note-icon"),
|
|
204
|
-
|
|
204
|
+
c("fkp-tool-note-label"),
|
|
205
205
|
...o.summary ? [
|
|
206
206
|
[
|
|
207
207
|
"span",
|
|
@@ -224,7 +224,7 @@ function sn(r) {
|
|
|
224
224
|
"data-token": r.token,
|
|
225
225
|
...r.params ? { "data-fkp-params": JSON.stringify(r.params) } : {},
|
|
226
226
|
...o ? { "data-label": r.label, "aria-label": o.ariaLabel } : {},
|
|
227
|
-
class: `fk-token fk-token--${
|
|
227
|
+
class: `fk-token fk-token--${l} fkp-knowledge-tag fkp-knowledge-tag--${l}${(o == null ? void 0 : o.layout) === "choice" ? " fkp-choice-token" : ""}${o != null && o.className ? ` ${o.className}` : ""}`,
|
|
228
228
|
contenteditable: "false"
|
|
229
229
|
},
|
|
230
230
|
...f
|
|
@@ -239,17 +239,17 @@ const on = Ze.create({
|
|
|
239
239
|
addProseMirrorPlugins() {
|
|
240
240
|
return [
|
|
241
241
|
new Ce({
|
|
242
|
-
appendTransaction(r, o,
|
|
242
|
+
appendTransaction(r, o, l) {
|
|
243
243
|
if (!r.some((p) => p.docChanged))
|
|
244
244
|
return null;
|
|
245
|
-
const a = /* @__PURE__ */ new Map(),
|
|
245
|
+
const a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
246
246
|
o.doc.descendants((p, k) => {
|
|
247
247
|
if (!ce(p.type.name) || !p.attrs.id) return;
|
|
248
|
-
|
|
248
|
+
c.set(String(p.attrs.id), p);
|
|
249
249
|
let v = k;
|
|
250
|
-
for (const
|
|
251
|
-
v =
|
|
252
|
-
const m =
|
|
250
|
+
for (const S of r)
|
|
251
|
+
v = S.mapping.mapResult(v, 1).pos;
|
|
252
|
+
const m = l.doc.nodeAt(v);
|
|
253
253
|
(m == null ? void 0 : m.type.name) === p.type.name && m.attrs.id === p.attrs.id && a.set(String(p.attrs.id), v);
|
|
254
254
|
});
|
|
255
255
|
const f = /* @__PURE__ */ new Set();
|
|
@@ -260,23 +260,23 @@ const on = Ze.create({
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
const y = /* @__PURE__ */ new Set();
|
|
263
|
-
|
|
263
|
+
l.doc.descendants((p) => {
|
|
264
264
|
ce(p.type.name) && p.attrs.id && y.add(String(p.attrs.id));
|
|
265
265
|
});
|
|
266
|
-
const i = /* @__PURE__ */ new Set(), { tr:
|
|
266
|
+
const i = /* @__PURE__ */ new Set(), { tr: A } = l, T = r.some(
|
|
267
267
|
(p) => p.getMeta("uiEvent") === "drop"
|
|
268
268
|
);
|
|
269
|
-
return
|
|
269
|
+
return l.doc.descendants((p, k) => {
|
|
270
270
|
var O;
|
|
271
271
|
if (!ce(p.type.name)) return;
|
|
272
272
|
let v = String(p.attrs.id || "");
|
|
273
273
|
const m = a.get(v);
|
|
274
|
-
!!v && !i.has(v) && (m === k ||
|
|
274
|
+
!!v && !i.has(v) && (m === k || T && m === void 0 && ((O = c.get(v)) == null ? void 0 : O.eq(p)) || m === void 0 && f.has(v)) || (v = Me(y, ge), A.setNodeMarkup(k, void 0, {
|
|
275
275
|
...p.attrs,
|
|
276
276
|
id: v,
|
|
277
277
|
nodeVersion: 0
|
|
278
278
|
}), y.add(v)), i.add(v);
|
|
279
|
-
}),
|
|
279
|
+
}), A.docChanged ? A.setMeta("addToHistory", !1) : null;
|
|
280
280
|
}
|
|
281
281
|
})
|
|
282
282
|
];
|
|
@@ -327,37 +327,37 @@ const on = Ze.create({
|
|
|
327
327
|
);
|
|
328
328
|
function Xe(r) {
|
|
329
329
|
const o = [];
|
|
330
|
-
r.forEach((a,
|
|
331
|
-
o.push({ node: a, position:
|
|
330
|
+
r.forEach((a, c) => {
|
|
331
|
+
o.push({ node: a, position: c });
|
|
332
332
|
});
|
|
333
|
-
const
|
|
334
|
-
return o.forEach(({ node: a },
|
|
333
|
+
const l = /* @__PURE__ */ new Set();
|
|
334
|
+
return o.forEach(({ node: a }, c) => {
|
|
335
335
|
var f;
|
|
336
336
|
if (!(a.type.name !== "originalReply" || a.childCount !== 1 || ((f = a.firstChild) == null ? void 0 : f.type.name) !== "paragraph"))
|
|
337
|
-
for (const y of [o[
|
|
338
|
-
(y == null ? void 0 : y.node.type.name) === "paragraph" &&
|
|
337
|
+
for (const y of [o[c - 1], o[c + 1]])
|
|
338
|
+
(y == null ? void 0 : y.node.type.name) === "paragraph" && l.add(y.position);
|
|
339
339
|
}), et.create(r, [
|
|
340
340
|
...o.filter(({ node: a }) => a.type.name === "originalReply").map(
|
|
341
341
|
({ position: a }) => pe.widget(
|
|
342
342
|
a + 1,
|
|
343
343
|
() => {
|
|
344
|
-
const
|
|
345
|
-
return
|
|
344
|
+
const c = document.createElement("span");
|
|
345
|
+
return c.className = "fkp-original-reply-label", c.setAttribute("aria-hidden", "true"), c.append(
|
|
346
346
|
rt.renderSpec(document, ae("quote", "")).dom
|
|
347
|
-
),
|
|
347
|
+
), c;
|
|
348
348
|
},
|
|
349
349
|
{ side: -1, ignoreSelection: !0 }
|
|
350
350
|
)
|
|
351
351
|
),
|
|
352
|
-
...[...
|
|
353
|
-
const
|
|
352
|
+
...[...l].flatMap((a) => {
|
|
353
|
+
const c = r.nodeAt(a), f = pe.node(
|
|
354
354
|
a,
|
|
355
|
-
a +
|
|
355
|
+
a + c.nodeSize,
|
|
356
356
|
{
|
|
357
|
-
class:
|
|
357
|
+
class: c.content.size ? "fk-inline-reply-neighbor" : "fk-inline-reply-neighbor fk-inline-reply-neighbor--empty"
|
|
358
358
|
}
|
|
359
359
|
);
|
|
360
|
-
return
|
|
360
|
+
return c.content.size ? [f] : [
|
|
361
361
|
f,
|
|
362
362
|
pe.widget(
|
|
363
363
|
a + 1,
|
|
@@ -375,42 +375,42 @@ function Ge(r) {
|
|
|
375
375
|
var o;
|
|
376
376
|
return r.type.name === "originalReply" && r.childCount === 1 && ((o = r.firstChild) == null ? void 0 : o.type.name) === "paragraph" && r.firstChild.content.size === 0;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function Se(r, o) {
|
|
379
379
|
var k;
|
|
380
|
-
const { state:
|
|
381
|
-
if (!r.editable || r.composing || !a || !(
|
|
380
|
+
const { state: l } = r, { empty: a, $from: c } = l.selection;
|
|
381
|
+
if (!r.editable || r.composing || !a || !(l.selection instanceof j) || c.parent.type.name !== "paragraph")
|
|
382
382
|
return !1;
|
|
383
383
|
const f = (v, m) => {
|
|
384
|
-
const
|
|
385
|
-
return
|
|
384
|
+
const S = l.tr.delete(v, v + m.nodeSize);
|
|
385
|
+
return S.setSelection(
|
|
386
386
|
j.near(
|
|
387
|
-
|
|
387
|
+
S.doc.resolve(Math.min(v, S.doc.content.size)),
|
|
388
388
|
o ? -1 : 1
|
|
389
389
|
)
|
|
390
|
-
), r.dispatch(
|
|
391
|
-
}, y =
|
|
392
|
-
if (y < 1 ||
|
|
393
|
-
if (
|
|
390
|
+
), r.dispatch(S.scrollIntoView()), !0;
|
|
391
|
+
}, y = c.depth - 1;
|
|
392
|
+
if (y < 1 || c.node(y).type.name !== "originalReply") {
|
|
393
|
+
if (c.parentOffset !== (o ? 0 : c.parent.content.size))
|
|
394
394
|
return !1;
|
|
395
|
-
const v = o ?
|
|
396
|
-
if ((
|
|
397
|
-
const O = o ? v -
|
|
398
|
-
return Ge(
|
|
399
|
-
|
|
395
|
+
const v = o ? c.before() : c.after(), m = l.doc.resolve(v), S = o ? m.nodeBefore : m.nodeAfter;
|
|
396
|
+
if ((S == null ? void 0 : S.type.name) !== "originalReply") return !1;
|
|
397
|
+
const O = o ? v - S.nodeSize : v;
|
|
398
|
+
return Ge(S) ? f(O, S) : (r.dispatch(
|
|
399
|
+
l.tr.setSelection(Ut.create(l.doc, O)).scrollIntoView()
|
|
400
400
|
), !0);
|
|
401
401
|
}
|
|
402
|
-
const i =
|
|
403
|
-
if (Ge(i)) return f(
|
|
404
|
-
if (
|
|
402
|
+
const i = c.node(y);
|
|
403
|
+
if (Ge(i)) return f(c.before(y), i);
|
|
404
|
+
if (c.parent.childCount !== 1 || !((k = c.parent.firstChild) != null && k.isText) || c.parentOffset !== (o ? c.parent.content.size : 0))
|
|
405
405
|
return !1;
|
|
406
|
-
const
|
|
406
|
+
const A = c.parent.textContent;
|
|
407
407
|
if ((typeof Intl.Segmenter == "function" ? [
|
|
408
408
|
...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
|
|
409
|
-
|
|
409
|
+
A
|
|
410
410
|
)
|
|
411
|
-
] : Array.from(
|
|
412
|
-
const p =
|
|
413
|
-
return p.setSelection(j.create(p.doc,
|
|
411
|
+
] : Array.from(A)).length !== 1) return !1;
|
|
412
|
+
const p = l.tr.delete(c.start(), c.end());
|
|
413
|
+
return p.setSelection(j.create(p.doc, c.start())), r.dispatch(p.scrollIntoView()), !0;
|
|
414
414
|
}
|
|
415
415
|
const cn = Ee.create({
|
|
416
416
|
name: "originalReply",
|
|
@@ -437,37 +437,37 @@ const cn = Ee.create({
|
|
|
437
437
|
},
|
|
438
438
|
addKeyboardShortcuts() {
|
|
439
439
|
const r = (o) => {
|
|
440
|
-
const { state:
|
|
441
|
-
if (!this.editor.isEditable || a.composing || !
|
|
440
|
+
const { state: l, view: a } = this.editor, { empty: c, $from: f } = l.selection, { paragraph: y } = l.schema.nodes;
|
|
441
|
+
if (!this.editor.isEditable || a.composing || !c || !(l.selection instanceof j) || f.parent.type !== y || f.parentOffset !== (o === 1 ? f.parent.content.size : 0))
|
|
442
442
|
return !1;
|
|
443
|
-
const { tr: i } =
|
|
444
|
-
if (
|
|
445
|
-
const
|
|
446
|
-
if (f.pos !==
|
|
447
|
-
const p = o === 1 ? f.after(
|
|
443
|
+
const { tr: i } = l, A = f.depth - 1;
|
|
444
|
+
if (A > 0 && f.node(A).type === this.type) {
|
|
445
|
+
const T = o === 1 ? f.end(A) - 1 : f.start(A) + 1;
|
|
446
|
+
if (f.pos !== T) return !1;
|
|
447
|
+
const p = o === 1 ? f.after(A) : f.before(A), k = l.doc.resolve(p), v = o === 1 ? k.nodeAfter : k.nodeBefore;
|
|
448
448
|
let m;
|
|
449
449
|
if ((v == null ? void 0 : v.type) === y)
|
|
450
450
|
m = o === 1 ? p + 1 : p - 1;
|
|
451
451
|
else {
|
|
452
|
-
const
|
|
453
|
-
if (!k.parent.canReplaceWith(
|
|
452
|
+
const S = k.index();
|
|
453
|
+
if (!k.parent.canReplaceWith(S, S, y))
|
|
454
454
|
return !1;
|
|
455
455
|
i.insert(p, y.create()), m = p + 1;
|
|
456
456
|
}
|
|
457
457
|
i.setSelection(j.create(i.doc, m));
|
|
458
458
|
} else {
|
|
459
|
-
const
|
|
459
|
+
const T = o === 1 ? f.after() : f.before(), p = l.doc.resolve(T), k = o === 1 ? p.nodeAfter : p.nodeBefore;
|
|
460
460
|
if ((k == null ? void 0 : k.type) !== this.type) return !1;
|
|
461
461
|
const v = o === 1 ? k.firstChild : k.lastChild;
|
|
462
462
|
if ((v == null ? void 0 : v.type) !== y) return !1;
|
|
463
|
-
const m = o === 1 ?
|
|
463
|
+
const m = o === 1 ? T + 2 : T - 2;
|
|
464
464
|
i.setSelection(j.create(i.doc, m));
|
|
465
465
|
}
|
|
466
466
|
return a.dispatch(i.scrollIntoView()), !0;
|
|
467
467
|
};
|
|
468
468
|
return {
|
|
469
|
-
Backspace: () =>
|
|
470
|
-
Delete: () =>
|
|
469
|
+
Backspace: () => Se(this.editor.view, !0),
|
|
470
|
+
Delete: () => Se(this.editor.view, !1),
|
|
471
471
|
ArrowLeft: () => r(-1),
|
|
472
472
|
ArrowRight: () => r(1)
|
|
473
473
|
};
|
|
@@ -484,20 +484,20 @@ const cn = Ee.create({
|
|
|
484
484
|
handleDOMEvents: {
|
|
485
485
|
beforeinput: (r, o) => {
|
|
486
486
|
if (!o.cancelable || o.isComposing) return !1;
|
|
487
|
-
const
|
|
488
|
-
return !
|
|
487
|
+
const l = o.inputType === "deleteContentBackward";
|
|
488
|
+
return !l && o.inputType !== "deleteContentForward" || !Se(r, l) ? !1 : (o.preventDefault(), !0);
|
|
489
489
|
},
|
|
490
490
|
mousedown: (r, o) => {
|
|
491
491
|
var f;
|
|
492
492
|
if (!r.editable || r.composing || o.button !== 0 || o.shiftKey || o.ctrlKey || o.metaKey || o.altKey || o.detail > 1 || !(o.target instanceof Element))
|
|
493
493
|
return !1;
|
|
494
|
-
const
|
|
495
|
-
if (!
|
|
494
|
+
const l = o.target.closest("p");
|
|
495
|
+
if (!l || !r.dom.contains(l) || !((f = l.parentElement) != null && f.matches(
|
|
496
496
|
"section[data-original-reply]"
|
|
497
497
|
)))
|
|
498
498
|
return !1;
|
|
499
|
-
const a = r.posAtDOM(
|
|
500
|
-
return
|
|
499
|
+
const a = r.posAtDOM(l, 0), c = r.state.doc.resolve(a);
|
|
500
|
+
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(
|
|
501
501
|
r.state.tr.setSelection(
|
|
502
502
|
j.create(r.state.doc, a)
|
|
503
503
|
)
|
|
@@ -559,11 +559,11 @@ const cn = Ee.create({
|
|
|
559
559
|
"OL",
|
|
560
560
|
"LI"
|
|
561
561
|
]);
|
|
562
|
-
function gn(r, o,
|
|
562
|
+
function gn(r, o, l, a) {
|
|
563
563
|
if (!o.content.size) return !1;
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
rt.fromSchema(
|
|
564
|
+
const c = document.createElement("div");
|
|
565
|
+
c.appendChild(
|
|
566
|
+
rt.fromSchema(l).serializeFragment(o.content)
|
|
567
567
|
);
|
|
568
568
|
const f = o.content.textBetween(
|
|
569
569
|
0,
|
|
@@ -571,54 +571,54 @@ function gn(r, o, c, a) {
|
|
|
571
571
|
`
|
|
572
572
|
`,
|
|
573
573
|
(y) => {
|
|
574
|
-
var
|
|
574
|
+
var A;
|
|
575
575
|
if (y.type.name === "mediaBlock")
|
|
576
|
-
return
|
|
576
|
+
return `[${y.attrs.kind === "video" ? "视频" : "图片"}:${y.attrs.name || ""}]`;
|
|
577
577
|
if (y.type.name === "businessToken")
|
|
578
578
|
return at(y.attrs);
|
|
579
|
-
const i = (
|
|
579
|
+
const i = (A = a == null ? void 0 : a.serializeNode) == null ? void 0 : A.call(a, y);
|
|
580
580
|
return i !== void 0 ? i : y.type.name === "messageSeparator" ? "{分隔符}" : "";
|
|
581
581
|
}
|
|
582
582
|
);
|
|
583
583
|
try {
|
|
584
|
-
return r.setData("text/plain", f), r.setData("text/html",
|
|
584
|
+
return r.setData("text/plain", f), r.setData("text/html", c.innerHTML), !0;
|
|
585
585
|
} catch {
|
|
586
586
|
return !1;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
function yn(r, o,
|
|
589
|
+
function yn(r, o, l, a) {
|
|
590
590
|
var v;
|
|
591
|
-
const
|
|
592
|
-
if (!Xt(
|
|
591
|
+
const c = r.getAttribute("data-kind"), f = r.getAttribute("data-key"), y = r.getAttribute("data-label"), i = r.getAttribute("data-token");
|
|
592
|
+
if (!Xt(c) || !f || !y || a != null && a.allowBusinessToken && !a.allowBusinessToken(c, f) || l && ((v = de(c)) == null ? void 0 : v.allowInOriginalReply) === !1 || !o.has(`${c}:knowledgeInline`))
|
|
593
593
|
return null;
|
|
594
|
-
const
|
|
595
|
-
let
|
|
596
|
-
if (
|
|
597
|
-
if (
|
|
594
|
+
const A = r.getAttribute("data-fkp-params");
|
|
595
|
+
let T = null;
|
|
596
|
+
if (A != null) {
|
|
597
|
+
if (A.length > 8192) return null;
|
|
598
598
|
try {
|
|
599
|
-
const m = JSON.parse(
|
|
599
|
+
const m = JSON.parse(A);
|
|
600
600
|
if (!m || typeof m != "object" || Array.isArray(m))
|
|
601
601
|
return null;
|
|
602
|
-
|
|
602
|
+
T = m;
|
|
603
603
|
} catch {
|
|
604
604
|
return null;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
if (
|
|
607
|
+
if (c === "tool" && (!T || f === "small_payment" && !Gt(T.amount) || f === "order_note" && !tt(T)) || nt({
|
|
608
608
|
type: "doc",
|
|
609
609
|
content: [
|
|
610
|
-
{ type: "paragraph", content: [{ type: "businessToken", attrs: { kind:
|
|
610
|
+
{ type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: f, label: y, token: i, params: T } }] }
|
|
611
611
|
]
|
|
612
612
|
}))
|
|
613
613
|
return null;
|
|
614
614
|
const k = document.createElement("span");
|
|
615
|
-
return k.setAttribute("data-business-token", ""), k.setAttribute("data-fkp-node", "business-token"), k.setAttribute("data-kind",
|
|
615
|
+
return k.setAttribute("data-business-token", ""), k.setAttribute("data-fkp-node", "business-token"), k.setAttribute("data-kind", c), k.setAttribute("data-key", f), k.setAttribute("data-label", y), i && k.setAttribute("data-token", i), T && k.setAttribute("data-fkp-params", JSON.stringify(T)), k.textContent = r.textContent, k;
|
|
616
616
|
}
|
|
617
|
-
function kn(r, o,
|
|
618
|
-
var
|
|
617
|
+
function kn(r, o, l) {
|
|
618
|
+
var T, p;
|
|
619
619
|
const a = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video");
|
|
620
620
|
if (!a) return !1;
|
|
621
|
-
const
|
|
621
|
+
const c = a.tagName === "VIDEO" ? "video" : "image", f = a.getAttribute("src") || (c === "video" ? (T = a.querySelector("source[src]")) == null ? void 0 : T.getAttribute("src") : null);
|
|
622
622
|
let y = "";
|
|
623
623
|
if (ue(f))
|
|
624
624
|
try {
|
|
@@ -635,76 +635,74 @@ function kn(r, o, c) {
|
|
|
635
635
|
y
|
|
636
636
|
].filter((k) => !!(k != null && k.trim())).map((k) => k.trim().toLowerCase());
|
|
637
637
|
if (!i.length) return !1;
|
|
638
|
-
const
|
|
638
|
+
const A = o.findIndex(
|
|
639
639
|
(k, v) => {
|
|
640
640
|
var m;
|
|
641
|
-
return !
|
|
641
|
+
return !l.has(v) && ((m = rn(k)) == null ? void 0 : m.kind) === c && i.includes(k.name.toLowerCase());
|
|
642
642
|
}
|
|
643
643
|
);
|
|
644
|
-
return
|
|
644
|
+
return A < 0 ? !1 : (l.add(A), !0);
|
|
645
645
|
}
|
|
646
646
|
function hn(r, o) {
|
|
647
|
-
var m,
|
|
648
|
-
const
|
|
649
|
-
if (r.getAttribute("data-fkp-node") === "media-block" && r.hasAttribute("status") && r.getAttribute("status") !== "ready" ||
|
|
647
|
+
var m, S;
|
|
648
|
+
const l = r.tagName === "IMG" || r.tagName === "VIDEO" ? r : r.querySelector("img,video") || (r.getAttribute("data-source-type") === "qianniuVideo" ? r.querySelector("a[href]") : null), a = r.getAttribute("data-kind") || ((l == null ? void 0 : l.tagName) === "VIDEO" ? "video" : "image"), c = (l == null ? void 0 : l.getAttribute("src")) || (l == null ? void 0 : l.getAttribute("href")) || ((l == null ? void 0 : l.tagName) === "VIDEO" ? (m = l.querySelector("source[src]")) == null ? void 0 : m.getAttribute("src") : null), f = l == null ? void 0 : l.getAttribute("poster");
|
|
649
|
+
if (r.getAttribute("data-fkp-node") === "media-block" && r.hasAttribute("status") && r.getAttribute("status") !== "ready" || l && (a === "image" && l.tagName !== "IMG" || a === "video" && l.tagName !== "VIDEO" && !(r.getAttribute("data-source-type") === "qianniuVideo" && l.tagName === "A")) || !["image", "video"].includes(a) || !o.has(`${a}:knowledgeBlock`) || !ue(c) || f && !ue(f))
|
|
650
650
|
return null;
|
|
651
|
-
const y = r.getAttribute("data-name") || ((
|
|
651
|
+
const y = r.getAttribute("data-name") || ((S = r.querySelector("figcaption")) == null ? void 0 : S.textContent) || (l == null ? void 0 : l.getAttribute("alt")) || "", i = r.getAttribute("data-asset-id") || (l == null ? void 0 : l.getAttribute("data-video-id")) || (r.getAttribute("data-source-type") === "qianniuVideo" ? l == null ? void 0 : l.getAttribute("id") : null), A = r.getAttribute("data-source-type"), T = {
|
|
652
652
|
id: ge(),
|
|
653
653
|
kind: a,
|
|
654
|
-
src:
|
|
654
|
+
src: c,
|
|
655
655
|
name: y,
|
|
656
656
|
status: "ready",
|
|
657
657
|
...f ? { poster: f } : {},
|
|
658
658
|
...i ? { assetId: i } : {},
|
|
659
|
-
...
|
|
659
|
+
...A ? { sourceType: A } : {}
|
|
660
660
|
};
|
|
661
661
|
if (nt({
|
|
662
662
|
type: "doc",
|
|
663
|
-
content: [{ type: "mediaBlock", attrs:
|
|
663
|
+
content: [{ type: "mediaBlock", attrs: T }]
|
|
664
664
|
}))
|
|
665
665
|
return null;
|
|
666
666
|
const p = document.createElement("figure");
|
|
667
|
-
p.setAttribute("data-media-block", ""), p.setAttribute("data-fkp-node", "media-block"), p.setAttribute("data-id",
|
|
668
|
-
const k = document.createElement(
|
|
669
|
-
|
|
670
|
-
);
|
|
671
|
-
k.setAttribute(S.sourceType === "qianniuVideo" ? "href" : "src", l), S.sourceType === "qianniuVideo" && (k.textContent = l), f && k.setAttribute("poster", f), p.appendChild(k);
|
|
667
|
+
p.setAttribute("data-media-block", ""), p.setAttribute("data-fkp-node", "media-block"), p.setAttribute("data-id", T.id), p.setAttribute("data-kind", a), i && p.setAttribute("data-asset-id", i), T.sourceType && p.setAttribute("data-source-type", T.sourceType);
|
|
668
|
+
const k = document.createElement(a === "video" ? "video" : "img");
|
|
669
|
+
k.setAttribute("src", c), T.sourceType === "qianniuVideo" && i && k.setAttribute("id", i), T.sourceType === "qianniuVideo" && i && k.setAttribute("data-video-id", i), f && k.setAttribute("poster", f), p.appendChild(k);
|
|
672
670
|
const v = document.createElement("figcaption");
|
|
673
671
|
return v.textContent = y, p.appendChild(v), p;
|
|
674
672
|
}
|
|
675
|
-
function bn(r, o,
|
|
673
|
+
function bn(r, o, l, a = [], c) {
|
|
676
674
|
var v;
|
|
677
675
|
if (!r || r.length > un)
|
|
678
676
|
return { slice: null, handled: !1 };
|
|
679
677
|
const f = new Set(
|
|
680
|
-
|
|
678
|
+
l.map((m) => `${m.id}:${m.slot}`)
|
|
681
679
|
), y = new DOMParser().parseFromString(
|
|
682
680
|
r.replace(
|
|
683
681
|
/<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
|
|
684
682
|
"<video$1></video>"
|
|
685
683
|
),
|
|
686
684
|
"text/html"
|
|
687
|
-
), i = document.createElement("div"),
|
|
688
|
-
let
|
|
689
|
-
const k = (m,
|
|
685
|
+
), i = document.createElement("div"), A = /* @__PURE__ */ new Set();
|
|
686
|
+
let T = 0, p = !1;
|
|
687
|
+
const k = (m, S = !1) => {
|
|
690
688
|
var F;
|
|
691
|
-
if (++
|
|
689
|
+
if (++T > fn)
|
|
692
690
|
throw new Error("Clipboard HTML is too large");
|
|
693
691
|
if (m.nodeType === Node.TEXT_NODE)
|
|
694
692
|
return document.createTextNode(m.textContent || "");
|
|
695
693
|
if (!(m instanceof Element) || pn.has(m.tagName))
|
|
696
694
|
return null;
|
|
697
|
-
const O = (F =
|
|
695
|
+
const O = (F = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : F.call(c, m);
|
|
698
696
|
if (O !== void 0)
|
|
699
697
|
return O || (p = !0), O;
|
|
700
698
|
if (m.hasAttribute("data-agent-size-chart"))
|
|
701
699
|
return p = !0, null;
|
|
702
700
|
if (m.getAttribute("data-fkp-node") === "business-token") {
|
|
703
|
-
const C = yn(m, f,
|
|
701
|
+
const C = yn(m, f, S, c);
|
|
704
702
|
return C || (p = !0), C;
|
|
705
703
|
}
|
|
706
704
|
if (m.getAttribute("data-fkp-node") === "media-block" || m.tagName === "IMG" || m.tagName === "VIDEO" || m.tagName === "FIGURE" && m.querySelector("img,video")) {
|
|
707
|
-
if (kn(m, a,
|
|
705
|
+
if (kn(m, a, A))
|
|
708
706
|
return p = !0, null;
|
|
709
707
|
const C = hn(m, f);
|
|
710
708
|
return C || (p = !0), C;
|
|
@@ -728,13 +726,13 @@ function bn(r, o, c, a = [], l) {
|
|
|
728
726
|
return p = !0, null;
|
|
729
727
|
const D = mn.has(m.tagName) ? document.createElement(m.tagName.toLowerCase()) : m.tagName === "BR" ? document.createElement("br") : document.createDocumentFragment();
|
|
730
728
|
return m.childNodes.forEach((C) => {
|
|
731
|
-
const w = k(C,
|
|
729
|
+
const w = k(C, S);
|
|
732
730
|
w && D.appendChild(w);
|
|
733
731
|
}), D;
|
|
734
732
|
};
|
|
735
733
|
try {
|
|
736
|
-
if (y.body.childNodes.forEach((
|
|
737
|
-
const O = k(
|
|
734
|
+
if (y.body.childNodes.forEach((S) => {
|
|
735
|
+
const O = k(S);
|
|
738
736
|
O && i.appendChild(O);
|
|
739
737
|
}), !((v = i.textContent) != null && v.trim()) && !i.querySelector(
|
|
740
738
|
"figure, [data-message-separator], [data-original-reply]"
|
|
@@ -754,19 +752,19 @@ function vn(r) {
|
|
|
754
752
|
function je(r, o) {
|
|
755
753
|
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
756
754
|
return null;
|
|
757
|
-
let
|
|
755
|
+
let l = o, a = !0, c = !0;
|
|
758
756
|
const f = ({ transaction: y }) => {
|
|
759
|
-
const i = y.mapping.mapResult(
|
|
760
|
-
i.deletedAcross && (
|
|
757
|
+
const i = y.mapping.mapResult(l, 1);
|
|
758
|
+
i.deletedAcross && (c = !1), l = i.pos;
|
|
761
759
|
};
|
|
762
760
|
return r.on("transaction", f), {
|
|
763
761
|
status() {
|
|
764
|
-
return !a || r.isDestroyed ? "disposed" :
|
|
762
|
+
return !a || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
765
763
|
},
|
|
766
764
|
insert(y) {
|
|
767
|
-
if (!a || !
|
|
765
|
+
if (!a || !c || r.isDestroyed) return !1;
|
|
768
766
|
try {
|
|
769
|
-
return r.chain().setMeta(Q, me(y)).insertContentAt(
|
|
767
|
+
return r.chain().setMeta(Q, me(y)).insertContentAt(l, y).run();
|
|
770
768
|
} catch {
|
|
771
769
|
return !1;
|
|
772
770
|
}
|
|
@@ -780,33 +778,33 @@ function We(r, o) {
|
|
|
780
778
|
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
781
779
|
return null;
|
|
782
780
|
try {
|
|
783
|
-
const
|
|
781
|
+
const l = _t.near(
|
|
784
782
|
r.state.doc.resolve(o)
|
|
785
783
|
).getBookmark();
|
|
786
|
-
return st(r,
|
|
784
|
+
return st(r, l);
|
|
787
785
|
} catch {
|
|
788
786
|
return null;
|
|
789
787
|
}
|
|
790
788
|
}
|
|
791
789
|
function st(r, o) {
|
|
792
|
-
let
|
|
793
|
-
const
|
|
794
|
-
const p =
|
|
795
|
-
!f && (p.deletedAcross || k.deletedAcross) && (
|
|
790
|
+
let l = o, a = !0, c = !0, f = !1, { from: y, to: i } = o.resolve(r.state.doc);
|
|
791
|
+
const A = ({ transaction: T }) => {
|
|
792
|
+
const p = T.mapping.mapResult(y, 1), k = T.mapping.mapResult(i, -1);
|
|
793
|
+
!f && (p.deletedAcross || k.deletedAcross) && (c = !1), y = p.pos, i = k.pos, l = l.map(T.mapping);
|
|
796
794
|
};
|
|
797
|
-
return r.on("transaction",
|
|
795
|
+
return r.on("transaction", A), {
|
|
798
796
|
status() {
|
|
799
|
-
return !a || r.isDestroyed ? "disposed" :
|
|
797
|
+
return !a || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
800
798
|
},
|
|
801
|
-
insert(
|
|
802
|
-
if (!a || !
|
|
799
|
+
insert(T) {
|
|
800
|
+
if (!a || !c || r.isDestroyed) return !1;
|
|
803
801
|
try {
|
|
804
|
-
const p =
|
|
802
|
+
const p = l.resolve(r.state.doc);
|
|
805
803
|
f = !0;
|
|
806
804
|
try {
|
|
807
|
-
return r.chain().setMeta(Q, me(
|
|
805
|
+
return r.chain().setMeta(Q, me(T)).insertContentAt(
|
|
808
806
|
{ from: p.from, to: p.to },
|
|
809
|
-
|
|
807
|
+
T
|
|
810
808
|
).run();
|
|
811
809
|
} finally {
|
|
812
810
|
f = !1;
|
|
@@ -816,15 +814,15 @@ function st(r, o) {
|
|
|
816
814
|
}
|
|
817
815
|
},
|
|
818
816
|
dispose() {
|
|
819
|
-
a && (a = !1, r.off("transaction",
|
|
817
|
+
a && (a = !1, r.off("transaction", A));
|
|
820
818
|
}
|
|
821
819
|
};
|
|
822
820
|
}
|
|
823
|
-
const
|
|
821
|
+
const An = {
|
|
824
822
|
key: 0,
|
|
825
823
|
class: "fkp-knowledge-area",
|
|
826
824
|
role: "alert"
|
|
827
|
-
},
|
|
825
|
+
}, Tn = { class: "fkp-order-remark-detail-title" }, Sn = {
|
|
828
826
|
key: 0,
|
|
829
827
|
class: "fkp-order-remark-extract"
|
|
830
828
|
}, Mn = { class: "fkp-order-remark-detail-content" }, Cn = { class: "fkp-order-remark-detail-row" }, En = { key: 0 }, wn = ["aria-label"], In = { class: "fkp-order-remark-detail-row" }, Nn = {
|
|
@@ -846,10 +844,10 @@ const Tn = {
|
|
|
846
844
|
documentAdapter: {}
|
|
847
845
|
},
|
|
848
846
|
emits: ["update:modelValue", "retry-media", "load-error", "tag-validity-error", "edit-tool", "choice-menu", "leave-choice"],
|
|
849
|
-
setup(r, { expose: o, emit:
|
|
847
|
+
setup(r, { expose: o, emit: l }) {
|
|
850
848
|
const a = r;
|
|
851
|
-
let
|
|
852
|
-
const f =
|
|
849
|
+
let c = !1;
|
|
850
|
+
const f = l, y = /* @__PURE__ */ new Map(), i = Pt(), A = an({
|
|
853
851
|
editor: () => i.value,
|
|
854
852
|
port: () => a.tagValidityPort,
|
|
855
853
|
editorKey: () => a.tagValidityKey || "",
|
|
@@ -861,20 +859,20 @@ const Tn = {
|
|
|
861
859
|
});
|
|
862
860
|
ie(
|
|
863
861
|
() => [a.tagValidityPort, a.tagValidityKey],
|
|
864
|
-
() =>
|
|
865
|
-
), ve(() =>
|
|
866
|
-
let
|
|
862
|
+
() => A.reset()
|
|
863
|
+
), ve(() => A.dispose());
|
|
864
|
+
let T = () => {
|
|
867
865
|
};
|
|
868
866
|
const p = new Promise((e) => {
|
|
869
|
-
|
|
870
|
-
}), k = re(), v = re(!0), m = re(!1),
|
|
867
|
+
T = e;
|
|
868
|
+
}), k = re(), v = re(!0), m = re(!1), S = re(null), O = re({});
|
|
871
869
|
let D = null;
|
|
872
870
|
function F() {
|
|
873
871
|
D && clearTimeout(D), D = null;
|
|
874
872
|
}
|
|
875
873
|
function C() {
|
|
876
874
|
F(), D = setTimeout(() => {
|
|
877
|
-
|
|
875
|
+
S.value = null;
|
|
878
876
|
}, 150);
|
|
879
877
|
}
|
|
880
878
|
function w(e) {
|
|
@@ -886,7 +884,7 @@ const Tn = {
|
|
|
886
884
|
n != null && n.dataset.nodeId && (F(), i.value.state.doc.descendants((s) => {
|
|
887
885
|
if (s.type.name !== "businessToken" || s.attrs.id !== n.dataset.nodeId)
|
|
888
886
|
return !0;
|
|
889
|
-
|
|
887
|
+
S.value = tt(s.attrs.params) ? s.attrs.params : null;
|
|
890
888
|
const d = n.getBoundingClientRect();
|
|
891
889
|
return O.value = {
|
|
892
890
|
left: `${d.left}px`,
|
|
@@ -941,7 +939,7 @@ const Tn = {
|
|
|
941
939
|
h !== e.scrollTop && (e.scrollTop = h, z = requestAnimationFrame(Y));
|
|
942
940
|
}
|
|
943
941
|
function se() {
|
|
944
|
-
|
|
942
|
+
S.value = null, q ? V() : N.value = null;
|
|
945
943
|
}
|
|
946
944
|
let Z = null, ee = !1;
|
|
947
945
|
const I = `[data-business-token]:is(${jt.map(
|
|
@@ -984,7 +982,7 @@ const Tn = {
|
|
|
984
982
|
const s = t.closest(
|
|
985
983
|
'[data-business-token][data-kind="tool"]'
|
|
986
984
|
);
|
|
987
|
-
s && (
|
|
985
|
+
s && (S.value = null);
|
|
988
986
|
const d = s == null ? void 0 : s.dataset.nodeId;
|
|
989
987
|
d && i.value.state.doc.descendants((u) => {
|
|
990
988
|
if (u.type.name !== "businessToken" || u.attrs.id !== d)
|
|
@@ -1162,7 +1160,7 @@ const Tn = {
|
|
|
1162
1160
|
placeholder: () => a.referencePlaceholder ? "" : a.placeholder || a.documentAdapter.placeholder
|
|
1163
1161
|
}),
|
|
1164
1162
|
on,
|
|
1165
|
-
|
|
1163
|
+
A.extension,
|
|
1166
1164
|
...a.schemaPlan.businessToken ? [ln] : [],
|
|
1167
1165
|
...a.schemaPlan.originalReply ? [cn] : [],
|
|
1168
1166
|
...a.schemaPlan.separator ? [dn] : [],
|
|
@@ -1180,19 +1178,19 @@ const Tn = {
|
|
|
1180
1178
|
onUpdate: ({ editor: t }) => {
|
|
1181
1179
|
v.value = t.isEmpty;
|
|
1182
1180
|
const n = t.getJSON();
|
|
1183
|
-
|
|
1181
|
+
A.schedule(), ye(n), c || f("update:modelValue", n);
|
|
1184
1182
|
}
|
|
1185
|
-
}), v.value = i.value.isEmpty,
|
|
1183
|
+
}), v.value = i.value.isEmpty, A.schedule(), T(!0), Ie(), qe();
|
|
1186
1184
|
}
|
|
1187
1185
|
zt(() => {
|
|
1188
1186
|
if (document.addEventListener("keydown", x), document.addEventListener("dragend", H), document.addEventListener("drop", H), !a.schemaPlan.mediaBlock) {
|
|
1189
1187
|
Ve([]);
|
|
1190
1188
|
return;
|
|
1191
1189
|
}
|
|
1192
|
-
import("./media-extensions-
|
|
1190
|
+
import("./media-extensions-CpwsEWCD.js").then(({ MediaBlock: e }) => {
|
|
1193
1191
|
R || Ve([e.configure({ sceneStyle: !0 })]);
|
|
1194
1192
|
}).catch(() => {
|
|
1195
|
-
R || (m.value = !0,
|
|
1193
|
+
R || (m.value = !0, T(!1), f("load-error", "媒体编辑器加载失败,请刷新页面重试"));
|
|
1196
1194
|
});
|
|
1197
1195
|
}), ie(
|
|
1198
1196
|
() => a.editable,
|
|
@@ -1205,13 +1203,13 @@ const Tn = {
|
|
|
1205
1203
|
(e) => {
|
|
1206
1204
|
if (i.value && Je(e) !== Je(i.value.getJSON())) {
|
|
1207
1205
|
const t = Le();
|
|
1208
|
-
i.value.chain().setMeta(Q, me(e)).setContent(e, { emitUpdate: !1 }).run(), v.value = i.value.isEmpty, ye(e),
|
|
1206
|
+
i.value.chain().setMeta(Q, me(e)).setContent(e, { emitUpdate: !1 }).run(), v.value = i.value.isEmpty, ye(e), A.schedule(), q && V(), t && $e(i.value, t);
|
|
1209
1207
|
}
|
|
1210
1208
|
},
|
|
1211
1209
|
{ deep: !0 }
|
|
1212
1210
|
), ve(() => {
|
|
1213
1211
|
var e;
|
|
1214
|
-
R = !0,
|
|
1212
|
+
R = !0, T(!1), document.removeEventListener("keydown", x), document.removeEventListener("dragend", H), document.removeEventListener("drop", H), H();
|
|
1215
1213
|
for (const t of y.keys()) J(t);
|
|
1216
1214
|
(e = i.value) == null || e.destroy();
|
|
1217
1215
|
});
|
|
@@ -1300,38 +1298,38 @@ const Tn = {
|
|
|
1300
1298
|
}
|
|
1301
1299
|
function Be(e, t, n) {
|
|
1302
1300
|
if (!a.editable || !i.value || !e.length) return null;
|
|
1303
|
-
|
|
1301
|
+
c = !0;
|
|
1304
1302
|
try {
|
|
1305
1303
|
const s = t.insert(e);
|
|
1306
1304
|
return s && e.some((d) => d.type === "originalReply") && Re(), s && n && i.value.commands.focus(), s ? i.value.getJSON() : null;
|
|
1307
1305
|
} finally {
|
|
1308
|
-
|
|
1306
|
+
c = !1;
|
|
1309
1307
|
}
|
|
1310
1308
|
}
|
|
1311
1309
|
function vt(e) {
|
|
1312
1310
|
if (!(!i.value || i.value.isDestroyed)) {
|
|
1313
|
-
|
|
1311
|
+
c = !0;
|
|
1314
1312
|
try {
|
|
1315
1313
|
i.value.chain().setMeta("addToHistory", !1).setMeta(Q, me(e)).setContent(e, { emitUpdate: !1 }).run(), v.value = i.value.isEmpty, ye(e);
|
|
1316
1314
|
} finally {
|
|
1317
|
-
|
|
1315
|
+
c = !1;
|
|
1318
1316
|
}
|
|
1319
1317
|
}
|
|
1320
1318
|
}
|
|
1321
|
-
function
|
|
1319
|
+
function At() {
|
|
1322
1320
|
var t;
|
|
1323
1321
|
const e = new Set(y.keys());
|
|
1324
1322
|
return (t = i.value) == null || t.state.doc.descendants((n) => {
|
|
1325
1323
|
n.attrs.id && e.add(String(n.attrs.id));
|
|
1326
1324
|
}), Me(e, ge);
|
|
1327
1325
|
}
|
|
1328
|
-
function
|
|
1326
|
+
function Tt(e, t, n, s) {
|
|
1329
1327
|
if (!a.editable || !a.schemaPlan.mediaBlock) return null;
|
|
1330
1328
|
const d = [
|
|
1331
1329
|
{
|
|
1332
1330
|
type: "mediaBlock",
|
|
1333
1331
|
attrs: {
|
|
1334
|
-
id:
|
|
1332
|
+
id: At(),
|
|
1335
1333
|
nodeVersion: 0,
|
|
1336
1334
|
assetId: e.id || null,
|
|
1337
1335
|
sourceType: e.sourceType || null,
|
|
@@ -1346,7 +1344,7 @@ const Tn = {
|
|
|
1346
1344
|
];
|
|
1347
1345
|
return Be(d, n, s);
|
|
1348
1346
|
}
|
|
1349
|
-
function
|
|
1347
|
+
function St(e, t, n) {
|
|
1350
1348
|
var s;
|
|
1351
1349
|
return ((s = Oe([{ file: e, kind: t }], n)) == null ? void 0 : s[0]) || null;
|
|
1352
1350
|
}
|
|
@@ -1662,7 +1660,7 @@ const Tn = {
|
|
|
1662
1660
|
e.defaultPrevented || (t = e.clipboardData) != null && t.files.length || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || (e.preventDefault(), e.stopPropagation(), Fe(e));
|
|
1663
1661
|
}
|
|
1664
1662
|
return o({
|
|
1665
|
-
validateTagValidity: async () => await p ?
|
|
1663
|
+
validateTagValidity: async () => await p ? A.refresh() : { status: "unavailable", items: [] },
|
|
1666
1664
|
pasteClipboardContent: Fe,
|
|
1667
1665
|
isSelectionInsideOriginalReply: () => {
|
|
1668
1666
|
const e = i.value;
|
|
@@ -1681,8 +1679,8 @@ const Tn = {
|
|
|
1681
1679
|
insertSeparator: kt,
|
|
1682
1680
|
insertBatch: Be,
|
|
1683
1681
|
restoreDoc: vt,
|
|
1684
|
-
insertMedia:
|
|
1685
|
-
insertPendingMedia:
|
|
1682
|
+
insertMedia: Tt,
|
|
1683
|
+
insertPendingMedia: St,
|
|
1686
1684
|
insertPendingMediaBatch: Oe,
|
|
1687
1685
|
applyNodeUpdate: Mt,
|
|
1688
1686
|
applyPluginNodeOperation: Et,
|
|
@@ -1716,7 +1714,7 @@ const Tn = {
|
|
|
1716
1714
|
var e;
|
|
1717
1715
|
return (e = i.value) == null ? void 0 : e.getJSON();
|
|
1718
1716
|
}
|
|
1719
|
-
}), (e, t) => m.value ? (G(), W("div",
|
|
1717
|
+
}), (e, t) => m.value ? (G(), W("div", An, "媒体编辑器加载失败,请刷新页面重试")) : (G(), W("div", {
|
|
1720
1718
|
key: 1,
|
|
1721
1719
|
ref_key: "areaRoot",
|
|
1722
1720
|
ref: k,
|
|
@@ -1744,7 +1742,7 @@ const Tn = {
|
|
|
1744
1742
|
class: "fkp-knowledge-editor",
|
|
1745
1743
|
editor: i.value
|
|
1746
1744
|
}, null, 8, ["editor"]),
|
|
1747
|
-
|
|
1745
|
+
S.value ? (G(), Lt(le(Ht), {
|
|
1748
1746
|
key: 0,
|
|
1749
1747
|
"popup-visible": !0,
|
|
1750
1748
|
trigger: [],
|
|
@@ -1760,39 +1758,39 @@ const Tn = {
|
|
|
1760
1758
|
overflowY: "auto"
|
|
1761
1759
|
}
|
|
1762
1760
|
}, {
|
|
1763
|
-
content:
|
|
1761
|
+
content: Ae(() => [
|
|
1764
1762
|
K("div", {
|
|
1765
1763
|
class: "fkp-order-remark-detail",
|
|
1766
1764
|
onMouseenter: F,
|
|
1767
1765
|
onMouseleave: C
|
|
1768
1766
|
}, [
|
|
1769
|
-
K("div",
|
|
1767
|
+
K("div", Tn, [
|
|
1770
1768
|
t[2] || (t[2] = K("strong", null, "订单备注", -1)),
|
|
1771
|
-
|
|
1769
|
+
S.value.contentMode === "smart" ? (G(), W("span", Sn, "智能提取")) : fe("", !0)
|
|
1772
1770
|
]),
|
|
1773
|
-
K("div", Mn, Ue(
|
|
1771
|
+
K("div", Mn, Ue(S.value.content), 1),
|
|
1774
1772
|
K("div", Cn, [
|
|
1775
1773
|
t[3] || (t[3] = K("span", null, "备注插旗", -1)),
|
|
1776
|
-
|
|
1774
|
+
S.value.flag === "none" ? (G(), W("span", En, "不标记")) : (G(), W("span", {
|
|
1777
1775
|
key: 1,
|
|
1778
1776
|
class: "fkp-order-remark-detail-flag",
|
|
1779
1777
|
role: "img",
|
|
1780
|
-
"aria-label": le(Qt)[
|
|
1781
|
-
style:
|
|
1782
|
-
backgroundColor: le(Wt)[
|
|
1778
|
+
"aria-label": le(Qt)[S.value.flag],
|
|
1779
|
+
style: Te({
|
|
1780
|
+
backgroundColor: le(Wt)[S.value.flag]
|
|
1783
1781
|
})
|
|
1784
1782
|
}, null, 12, wn))
|
|
1785
1783
|
]),
|
|
1786
1784
|
K("div", In, [
|
|
1787
1785
|
t[4] || (t[4] = K("span", null, "备注位置", -1)),
|
|
1788
|
-
K("span", null, Ue(
|
|
1786
|
+
K("span", null, Ue(S.value.position === "first" ? "最前" : "最后"), 1)
|
|
1789
1787
|
])
|
|
1790
1788
|
], 32)
|
|
1791
1789
|
]),
|
|
1792
|
-
default:
|
|
1790
|
+
default: Ae(() => [
|
|
1793
1791
|
K("span", {
|
|
1794
1792
|
class: "fkp-order-remark-anchor",
|
|
1795
|
-
style:
|
|
1793
|
+
style: Te(O.value)
|
|
1796
1794
|
}, null, 4)
|
|
1797
1795
|
]),
|
|
1798
1796
|
_: 1
|
|
@@ -1800,7 +1798,7 @@ const Tn = {
|
|
|
1800
1798
|
N.value ? (G(), W("div", {
|
|
1801
1799
|
key: 1,
|
|
1802
1800
|
class: "fkp-media-drop-line",
|
|
1803
|
-
style:
|
|
1801
|
+
style: Te({
|
|
1804
1802
|
top: `${N.value.top}px`,
|
|
1805
1803
|
left: `${N.value.left}px`,
|
|
1806
1804
|
width: `${N.value.width}px`
|
|
@@ -1814,7 +1812,7 @@ const Tn = {
|
|
|
1814
1812
|
size: "small",
|
|
1815
1813
|
bordered: ""
|
|
1816
1814
|
}, {
|
|
1817
|
-
default:
|
|
1815
|
+
default: Ae(() => t[5] || (t[5] = [
|
|
1818
1816
|
$t("参考话术")
|
|
1819
1817
|
])),
|
|
1820
1818
|
_: 1
|