@freecallai/pro 0.0.12 → 0.0.13
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 +23 -2
- package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js → FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js} +1364 -1349
- package/dist/{KnowledgeArea-FGgCcubh.js → KnowledgeArea-ClZoLiaZ.js} +1 -1
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js +1830 -0
- package/dist/{ToolForm-CHmdyhjh.js → ToolForm-BK9epxdr.js} +1 -1
- package/dist/agent-prompt-editor/index.js +510 -495
- package/dist/agent-prompt-editor/legacy-converter/index.js +2 -2
- package/dist/{choice-CUCsR2dN.js → choice-UgePgrSl.js} +1 -1
- package/dist/{guard-DgExtfXo.js → guard-DPwe4mCm.js} +1 -0
- package/dist/{index-DqJvaPTD.js → index-BIi3k45j.js} +1 -1
- package/dist/index-BMHUPL5x.js +5 -0
- package/dist/{index-pdr6mUf0.js → index-CaA13lC9.js} +1 -1
- package/dist/{index-C54ce9Tn.js → index-ChuzFuNm.js} +1 -1
- package/dist/index-DJLfgC4v.js +5 -0
- package/dist/{index-dnsGFj0F.js → index-DfKH-RZq.js} +2 -2
- package/dist/{index-DaGfiqBX.js → index-DiLMgNEe.js} +1 -1
- package/dist/{index-BwZXmefJ.js → index-RHu4JIw7.js} +1 -1
- package/dist/{index-DIMONp3g.js → index-v1UD08i6.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-BpwAryXp.js → inline-CVF1zEsG.js} +1 -1
- package/dist/{knowledge-DIzYk2iM.js → knowledge-DWM6tWnP.js} +1 -1
- package/dist/{media-migration-Bnfn27i9.js → media-migration-BctCLEuT.js} +1 -1
- package/dist/{media-policy-tG5OHWSj.js → media-policy-B1UuSN2e.js} +1 -1
- package/dist/{media-upload-_xeZtn3i.js → media-upload-DtH-oCtw.js} +1 -1
- package/dist/{model-DlAjlPai.js → model-VLLhEQfn.js} +1 -1
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +33 -2
- package/dist/types/agent-prompt-editor/index.d.ts +1 -0
- package/dist/types/agent-prompt-editor/types.d.ts +4 -0
- package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
- package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
- package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
- package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +18 -2
- package/dist/types/rich-text/index.d.ts +1 -0
- package/dist/types/rich-text/plugins/attribute/token.d.ts +1 -0
- package/dist/types/rich-text/plugins/tableKnowledge/token.d.ts +1 -0
- package/dist/types/rich-text/plugins/ticket/token.d.ts +2 -1
- package/dist/types/rich-text/plugins/token-catalog.d.ts +4 -1
- package/dist/types/rich-text/plugins/token-definition.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +5 -0
- package/dist/types/rich-text/runtime/document-adapter.d.ts +3 -0
- package/dist/types/rich-text/runtime/tag-validity.d.ts +46 -0
- package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +2 -2
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +9 -0
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +4 -4
- package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
- package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
- package/package.json +3 -2
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js +0 -1663
- package/dist/index-CMl5mgFR.js +0 -5
- package/dist/index-Cs38tTe4.js +0 -5
|
@@ -1,1663 +0,0 @@
|
|
|
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
|
-
import { EditorContent as zt, Editor as Vt } from "@tiptap/vue-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 qt } from "@tiptap/pm/state";
|
|
5
|
-
import Ut from "@tiptap/starter-kit";
|
|
6
|
-
import _t from "@tiptap/extension-placeholder";
|
|
7
|
-
import { Extension as Kt, Node as he } from "@tiptap/core";
|
|
8
|
-
import { DOMSerializer as je, DOMParser as Jt } from "@tiptap/pm/model";
|
|
9
|
-
import { DecorationSet as Yt, Decoration as ge } from "@tiptap/pm/view";
|
|
10
|
-
import { c as ae } from "./media-id-b2dgniSy.js";
|
|
11
|
-
import { icons as Xt } from "@freecallai/icons";
|
|
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
|
-
const d = (c) => [
|
|
16
|
-
`http://www.w3.org/2000/svg ${c.tag}`,
|
|
17
|
-
c.attrs,
|
|
18
|
-
...c.children.map(d)
|
|
19
|
-
], s = Xt[r];
|
|
20
|
-
return [
|
|
21
|
-
"http://www.w3.org/2000/svg svg",
|
|
22
|
-
{
|
|
23
|
-
...s.attrs,
|
|
24
|
-
class: `fkp-icon ${o}`,
|
|
25
|
-
"aria-hidden": "true",
|
|
26
|
-
focusable: "false"
|
|
27
|
-
},
|
|
28
|
-
...s.children.map(d)
|
|
29
|
-
];
|
|
30
|
-
}
|
|
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
|
-
"span",
|
|
35
|
-
{ class: i },
|
|
36
|
-
s
|
|
37
|
-
];
|
|
38
|
-
let g = [s];
|
|
39
|
-
return (o == null ? void 0 : o.layout) === "choice" && (g = [
|
|
40
|
-
X(o.icon, `fkp-choice-token-icon fkp-${d}-token-icon`),
|
|
41
|
-
c(`fkp-choice-token-label fkp-${d}-token-label`),
|
|
42
|
-
X(
|
|
43
|
-
"arrow-down",
|
|
44
|
-
`fkp-choice-token-arrow fkp-${d}-token-arrow`
|
|
45
|
-
)
|
|
46
|
-
]), (o == null ? void 0 : o.layout) === "inline" && (g = [
|
|
47
|
-
X(o.icon, "fkp-inline-token-icon"),
|
|
48
|
-
c("fkp-inline-token-label")
|
|
49
|
-
]), (o == null ? void 0 : o.layout) === "tool" && (g = [
|
|
50
|
-
X(o.icon, "fkp-tool-token-icon"),
|
|
51
|
-
c("fkp-tool-token-label")
|
|
52
|
-
]), (o == null ? void 0 : o.layout) === "toolNote" && (g = [
|
|
53
|
-
X(o.icon, "fkp-tool-note-icon"),
|
|
54
|
-
c("fkp-tool-note-label"),
|
|
55
|
-
...o.summary ? [
|
|
56
|
-
[
|
|
57
|
-
"span",
|
|
58
|
-
{ class: "fkp-tool-note-divider", "aria-hidden": "true" }
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
"span",
|
|
62
|
-
{ class: "fkp-tool-note-summary" },
|
|
63
|
-
o.summary
|
|
64
|
-
]
|
|
65
|
-
] : []
|
|
66
|
-
]), [
|
|
67
|
-
"span",
|
|
68
|
-
{
|
|
69
|
-
"data-business-token": "",
|
|
70
|
-
"data-fkp-node": "business-token",
|
|
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
|
-
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
|
-
contenteditable: "false"
|
|
79
|
-
},
|
|
80
|
-
...g
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
function Ze(r) {
|
|
84
|
-
var o;
|
|
85
|
-
return ((o = be(r.kind)) == null ? void 0 : o.serialize(r)) || String(r.label || r.key || "");
|
|
86
|
-
}
|
|
87
|
-
const an = Kt.create({
|
|
88
|
-
name: "uniqueExtensionNodeIds",
|
|
89
|
-
addProseMirrorPlugins() {
|
|
90
|
-
return [
|
|
91
|
-
new Ge({
|
|
92
|
-
appendTransaction(r, o, d) {
|
|
93
|
-
if (!r.some((p) => p.docChanged))
|
|
94
|
-
return null;
|
|
95
|
-
const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
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
|
-
v = M.mapping.mapResult(v, 1).pos;
|
|
102
|
-
const u = d.doc.nodeAt(v);
|
|
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
|
-
});
|
|
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
|
-
});
|
|
111
|
-
}
|
|
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
|
-
});
|
|
116
|
-
const i = /* @__PURE__ */ new Set(), { tr: S } = d, T = r.some(
|
|
117
|
-
(p) => p.getMeta("uiEvent") === "drop"
|
|
118
|
-
);
|
|
119
|
-
return d.doc.descendants((p, h) => {
|
|
120
|
-
var N;
|
|
121
|
-
if (!Q(p.type.name)) return;
|
|
122
|
-
let v = String(p.attrs.id || "");
|
|
123
|
-
const u = s.get(v);
|
|
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
|
-
id: v,
|
|
127
|
-
nodeVersion: 0
|
|
128
|
-
}), y.add(v)), i.add(v);
|
|
129
|
-
}), S.docChanged ? S.setMeta("addToHistory", !1) : null;
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
}), on = he.create({
|
|
135
|
-
name: "businessToken",
|
|
136
|
-
group: "inline",
|
|
137
|
-
inline: !0,
|
|
138
|
-
atom: !0,
|
|
139
|
-
selectable: !0,
|
|
140
|
-
addAttributes() {
|
|
141
|
-
return {
|
|
142
|
-
id: { default: "" },
|
|
143
|
-
nodeVersion: { default: 0 },
|
|
144
|
-
kind: { default: "variable" },
|
|
145
|
-
key: { default: "" },
|
|
146
|
-
label: { default: "" },
|
|
147
|
-
token: { default: null },
|
|
148
|
-
params: { default: null }
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
parseHTML() {
|
|
152
|
-
return [
|
|
153
|
-
{
|
|
154
|
-
tag: "span[data-business-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
|
-
params: (() => {
|
|
161
|
-
const o = r.getAttribute("data-fkp-params");
|
|
162
|
-
if (!o || o.length > 8192) return null;
|
|
163
|
-
try {
|
|
164
|
-
return JSON.parse(o);
|
|
165
|
-
} catch {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
})()
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
];
|
|
172
|
-
},
|
|
173
|
-
renderHTML: ({ node: r }) => rn(r.attrs),
|
|
174
|
-
renderText: ({ node: r }) => Ze(r.attrs)
|
|
175
|
-
}), _e = new Ft(
|
|
176
|
-
"inlineReplyNeighbors"
|
|
177
|
-
);
|
|
178
|
-
function Ke(r) {
|
|
179
|
-
const o = [];
|
|
180
|
-
r.forEach((s, c) => {
|
|
181
|
-
o.push({ node: s, position: c });
|
|
182
|
-
});
|
|
183
|
-
const d = /* @__PURE__ */ new Set();
|
|
184
|
-
return o.forEach(({ node: s }, c) => {
|
|
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
|
-
...o.filter(({ node: s }) => s.type.name === "originalReply").map(
|
|
191
|
-
({ position: s }) => ge.widget(
|
|
192
|
-
s + 1,
|
|
193
|
-
() => {
|
|
194
|
-
const c = document.createElement("span");
|
|
195
|
-
return c.className = "fkp-original-reply-label", c.setAttribute("aria-hidden", "true"), c.append(
|
|
196
|
-
je.renderSpec(document, X("quote", "")).dom
|
|
197
|
-
), c;
|
|
198
|
-
},
|
|
199
|
-
{ side: -1, ignoreSelection: !0 }
|
|
200
|
-
)
|
|
201
|
-
),
|
|
202
|
-
...[...d].flatMap((s) => {
|
|
203
|
-
const c = r.nodeAt(s), g = ge.node(
|
|
204
|
-
s,
|
|
205
|
-
s + c.nodeSize,
|
|
206
|
-
{
|
|
207
|
-
class: c.content.size ? "fk-inline-reply-neighbor" : "fk-inline-reply-neighbor fk-inline-reply-neighbor--empty"
|
|
208
|
-
}
|
|
209
|
-
);
|
|
210
|
-
return c.content.size ? [g] : [
|
|
211
|
-
g,
|
|
212
|
-
ge.widget(
|
|
213
|
-
s + 1,
|
|
214
|
-
() => {
|
|
215
|
-
const y = document.createElement("span");
|
|
216
|
-
return y.className = "fkp-reply-caret-anchor", y.setAttribute("aria-hidden", "true"), y.textContent = "", y;
|
|
217
|
-
},
|
|
218
|
-
{ side: -1, ignoreSelection: !0 }
|
|
219
|
-
)
|
|
220
|
-
];
|
|
221
|
-
})
|
|
222
|
-
]);
|
|
223
|
-
}
|
|
224
|
-
function Je(r) {
|
|
225
|
-
var o;
|
|
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
|
-
}
|
|
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
|
-
return !1;
|
|
233
|
-
const g = (v, u) => {
|
|
234
|
-
const M = d.tr.delete(v, v + u.nodeSize);
|
|
235
|
-
return M.setSelection(
|
|
236
|
-
$.near(
|
|
237
|
-
M.doc.resolve(Math.min(v, M.doc.content.size)),
|
|
238
|
-
o ? -1 : 1
|
|
239
|
-
)
|
|
240
|
-
), r.dispatch(M.scrollIntoView()), !0;
|
|
241
|
-
}, y = c.depth - 1;
|
|
242
|
-
if (y < 1 || c.node(y).type.name !== "originalReply") {
|
|
243
|
-
if (c.parentOffset !== (o ? 0 : c.parent.content.size))
|
|
244
|
-
return !1;
|
|
245
|
-
const v = o ? c.before() : c.after(), u = d.doc.resolve(v), M = o ? u.nodeBefore : u.nodeAfter;
|
|
246
|
-
if ((M == null ? void 0 : M.type.name) !== "originalReply") return !1;
|
|
247
|
-
const N = o ? v - M.nodeSize : v;
|
|
248
|
-
return Je(M) ? g(N, M) : (r.dispatch(
|
|
249
|
-
d.tr.setSelection(Ht.create(d.doc, N)).scrollIntoView()
|
|
250
|
-
), !0);
|
|
251
|
-
}
|
|
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
|
-
return !1;
|
|
256
|
-
const S = c.parent.textContent;
|
|
257
|
-
if ((typeof Intl.Segmenter == "function" ? [
|
|
258
|
-
...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
|
|
259
|
-
S
|
|
260
|
-
)
|
|
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
|
-
}
|
|
265
|
-
const sn = he.create({
|
|
266
|
-
name: "originalReply",
|
|
267
|
-
group: "block",
|
|
268
|
-
content: "(paragraph | mediaBlock | messageSeparator)+",
|
|
269
|
-
defining: !0,
|
|
270
|
-
isolating: !0,
|
|
271
|
-
addAttributes() {
|
|
272
|
-
return { id: { default: "" }, nodeVersion: { default: 0 } };
|
|
273
|
-
},
|
|
274
|
-
parseHTML() {
|
|
275
|
-
return [{ tag: "section[data-original-reply]" }];
|
|
276
|
-
},
|
|
277
|
-
renderHTML() {
|
|
278
|
-
return [
|
|
279
|
-
"section",
|
|
280
|
-
{
|
|
281
|
-
"data-original-reply": "",
|
|
282
|
-
"data-fkp-node": "original-reply",
|
|
283
|
-
class: "fk-original-reply"
|
|
284
|
-
},
|
|
285
|
-
0
|
|
286
|
-
];
|
|
287
|
-
},
|
|
288
|
-
addKeyboardShortcuts() {
|
|
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
|
-
return !1;
|
|
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
|
-
let u;
|
|
299
|
-
if ((v == null ? void 0 : v.type) === y)
|
|
300
|
-
u = o === 1 ? p + 1 : p - 1;
|
|
301
|
-
else {
|
|
302
|
-
const M = h.index();
|
|
303
|
-
if (!h.parent.canReplaceWith(M, M, y))
|
|
304
|
-
return !1;
|
|
305
|
-
i.insert(p, y.create()), u = p + 1;
|
|
306
|
-
}
|
|
307
|
-
i.setSelection($.create(i.doc, u));
|
|
308
|
-
} else {
|
|
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
|
-
i.setSelection($.create(i.doc, u));
|
|
315
|
-
}
|
|
316
|
-
return s.dispatch(i.scrollIntoView()), !0;
|
|
317
|
-
};
|
|
318
|
-
return {
|
|
319
|
-
Backspace: () => ye(this.editor.view, !0),
|
|
320
|
-
Delete: () => ye(this.editor.view, !1),
|
|
321
|
-
ArrowLeft: () => r(-1),
|
|
322
|
-
ArrowRight: () => r(1)
|
|
323
|
-
};
|
|
324
|
-
},
|
|
325
|
-
addProseMirrorPlugins() {
|
|
326
|
-
return [
|
|
327
|
-
new Ge({
|
|
328
|
-
key: _e,
|
|
329
|
-
state: {
|
|
330
|
-
init: (r, o) => Ke(o.doc),
|
|
331
|
-
apply: (r, o) => r.docChanged ? Ke(r.doc) : o
|
|
332
|
-
},
|
|
333
|
-
props: {
|
|
334
|
-
handleDOMEvents: {
|
|
335
|
-
beforeinput: (r, o) => {
|
|
336
|
-
if (!o.cancelable || o.isComposing) return !1;
|
|
337
|
-
const d = o.inputType === "deleteContentBackward";
|
|
338
|
-
return !d && o.inputType !== "deleteContentForward" || !ye(r, d) ? !1 : (o.preventDefault(), !0);
|
|
339
|
-
},
|
|
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
|
-
return !1;
|
|
344
|
-
const d = o.target.closest("p");
|
|
345
|
-
if (!d || !r.dom.contains(d) || !((g = d.parentElement) != null && g.matches(
|
|
346
|
-
"section[data-original-reply]"
|
|
347
|
-
)))
|
|
348
|
-
return !1;
|
|
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
|
-
)
|
|
354
|
-
), r.focus(), !0);
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
decorations(r) {
|
|
358
|
-
return _e.getState(r);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
})
|
|
362
|
-
];
|
|
363
|
-
}
|
|
364
|
-
}), ln = he.create({
|
|
365
|
-
name: "messageSeparator",
|
|
366
|
-
group: "block",
|
|
367
|
-
atom: !0,
|
|
368
|
-
selectable: !0,
|
|
369
|
-
addAttributes() {
|
|
370
|
-
return { id: { default: "" }, nodeVersion: { default: 0 } };
|
|
371
|
-
},
|
|
372
|
-
parseHTML() {
|
|
373
|
-
return [{ tag: "div[data-message-separator]" }];
|
|
374
|
-
},
|
|
375
|
-
renderHTML() {
|
|
376
|
-
return [
|
|
377
|
-
"div",
|
|
378
|
-
{
|
|
379
|
-
"data-message-separator": "",
|
|
380
|
-
"data-fkp-node": "message-separator",
|
|
381
|
-
class: "fk-message-separator"
|
|
382
|
-
},
|
|
383
|
-
[
|
|
384
|
-
"span",
|
|
385
|
-
{
|
|
386
|
-
class: "fk-separator-tag fkp-knowledge-tag fkp-knowledge-tag--primary"
|
|
387
|
-
},
|
|
388
|
-
"分隔符"
|
|
389
|
-
]
|
|
390
|
-
];
|
|
391
|
-
},
|
|
392
|
-
renderText() {
|
|
393
|
-
return `
|
|
394
|
-
{分隔符}
|
|
395
|
-
`;
|
|
396
|
-
}
|
|
397
|
-
}), cn = 1024 * 1024, dn = 1e4, un = /* @__PURE__ */ new Set([
|
|
398
|
-
"SCRIPT",
|
|
399
|
-
"STYLE",
|
|
400
|
-
"SVG",
|
|
401
|
-
"IFRAME",
|
|
402
|
-
"OBJECT",
|
|
403
|
-
"TEMPLATE"
|
|
404
|
-
]), fn = /* @__PURE__ */ new Set([
|
|
405
|
-
"P",
|
|
406
|
-
"DIV",
|
|
407
|
-
"BLOCKQUOTE",
|
|
408
|
-
"UL",
|
|
409
|
-
"OL",
|
|
410
|
-
"LI"
|
|
411
|
-
]);
|
|
412
|
-
function pn(r, o, d, s) {
|
|
413
|
-
if (!o.content.size) return !1;
|
|
414
|
-
const c = document.createElement("div");
|
|
415
|
-
c.appendChild(
|
|
416
|
-
je.fromSchema(d).serializeFragment(o.content)
|
|
417
|
-
);
|
|
418
|
-
const g = o.content.textBetween(
|
|
419
|
-
0,
|
|
420
|
-
o.content.size,
|
|
421
|
-
`
|
|
422
|
-
`,
|
|
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
|
-
}
|
|
432
|
-
);
|
|
433
|
-
try {
|
|
434
|
-
return r.setData("text/plain", g), r.setData("text/html", c.innerHTML), !0;
|
|
435
|
-
} catch {
|
|
436
|
-
return !1;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
function mn(r, o, d, s) {
|
|
440
|
-
var v;
|
|
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
|
-
return null;
|
|
444
|
-
const S = r.getAttribute("data-fkp-params");
|
|
445
|
-
let T = null;
|
|
446
|
-
if (S != null) {
|
|
447
|
-
if (S.length > 8192) return null;
|
|
448
|
-
try {
|
|
449
|
-
const u = JSON.parse(S);
|
|
450
|
-
if (!u || typeof u != "object" || Array.isArray(u))
|
|
451
|
-
return null;
|
|
452
|
-
T = u;
|
|
453
|
-
} catch {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if (c === "tool" && (!T || g === "small_payment" && !jt(T.amount) || g === "order_note" && !We(T)) || Qe({
|
|
458
|
-
type: "doc",
|
|
459
|
-
content: [
|
|
460
|
-
{ type: "paragraph", content: [{ type: "businessToken", attrs: { kind: c, key: g, label: y, token: i, params: T } }] }
|
|
461
|
-
]
|
|
462
|
-
}))
|
|
463
|
-
return null;
|
|
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
|
-
}
|
|
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
|
-
if (!s) return !1;
|
|
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
|
-
try {
|
|
475
|
-
y = decodeURIComponent(
|
|
476
|
-
new URL(g).pathname.split("/").pop() || ""
|
|
477
|
-
);
|
|
478
|
-
} catch {
|
|
479
|
-
y = "";
|
|
480
|
-
}
|
|
481
|
-
const i = [
|
|
482
|
-
r.getAttribute("data-name"),
|
|
483
|
-
(p = r.querySelector("figcaption")) == null ? void 0 : p.textContent,
|
|
484
|
-
s.getAttribute("alt"),
|
|
485
|
-
y
|
|
486
|
-
].filter((h) => !!(h != null && h.trim())).map((h) => h.trim().toLowerCase());
|
|
487
|
-
if (!i.length) return !1;
|
|
488
|
-
const S = o.findIndex(
|
|
489
|
-
(h, v) => {
|
|
490
|
-
var u;
|
|
491
|
-
return !d.has(v) && ((u = nn(h)) == null ? void 0 : u.kind) === c && i.includes(h.name.toLowerCase());
|
|
492
|
-
}
|
|
493
|
-
);
|
|
494
|
-
return S < 0 ? !1 : (d.add(S), !0);
|
|
495
|
-
}
|
|
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
|
-
return null;
|
|
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
|
-
id: ae(),
|
|
503
|
-
kind: s,
|
|
504
|
-
src: c,
|
|
505
|
-
name: y,
|
|
506
|
-
status: "ready",
|
|
507
|
-
...g ? { poster: g } : {},
|
|
508
|
-
...i ? { assetId: i } : {},
|
|
509
|
-
...S ? { sourceType: S } : {}
|
|
510
|
-
};
|
|
511
|
-
if (Qe({
|
|
512
|
-
type: "doc",
|
|
513
|
-
content: [{ type: "mediaBlock", attrs: T }]
|
|
514
|
-
}))
|
|
515
|
-
return null;
|
|
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;
|
|
524
|
-
}
|
|
525
|
-
function kn(r, o, d, s = [], c) {
|
|
526
|
-
var v;
|
|
527
|
-
if (!r || r.length > cn)
|
|
528
|
-
return { slice: null, handled: !1 };
|
|
529
|
-
const g = new Set(
|
|
530
|
-
d.map((u) => `${u.id}:${u.slot}`)
|
|
531
|
-
), y = new DOMParser().parseFromString(
|
|
532
|
-
r.replace(
|
|
533
|
-
/<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
|
|
534
|
-
"<video$1></video>"
|
|
535
|
-
),
|
|
536
|
-
"text/html"
|
|
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)
|
|
542
|
-
throw new Error("Clipboard HTML is too large");
|
|
543
|
-
if (u.nodeType === Node.TEXT_NODE)
|
|
544
|
-
return document.createTextNode(u.textContent || "");
|
|
545
|
-
if (!(u instanceof Element) || un.has(u.tagName))
|
|
546
|
-
return null;
|
|
547
|
-
const N = (_ = c == null ? void 0 : c.sanitizeInlineNode) == null ? void 0 : _.call(c, u);
|
|
548
|
-
if (N !== void 0)
|
|
549
|
-
return N || (p = !0), N;
|
|
550
|
-
if (u.hasAttribute("data-agent-size-chart"))
|
|
551
|
-
return p = !0, null;
|
|
552
|
-
if (u.getAttribute("data-fkp-node") === "business-token") {
|
|
553
|
-
const w = mn(u, g, M, c);
|
|
554
|
-
return w || (p = !0), w;
|
|
555
|
-
}
|
|
556
|
-
if (u.getAttribute("data-fkp-node") === "media-block" || u.tagName === "IMG" || u.tagName === "VIDEO" || u.tagName === "FIGURE" && u.querySelector("img,video")) {
|
|
557
|
-
if (gn(u, s, S))
|
|
558
|
-
return p = !0, null;
|
|
559
|
-
const w = yn(u, g);
|
|
560
|
-
return w || (p = !0), w;
|
|
561
|
-
}
|
|
562
|
-
if (u.getAttribute("data-fkp-node") === "message-separator") {
|
|
563
|
-
if (!g.has("separator:knowledgeInline"))
|
|
564
|
-
return p = !0, null;
|
|
565
|
-
const w = document.createElement("div");
|
|
566
|
-
return w.setAttribute("data-message-separator", ""), w;
|
|
567
|
-
}
|
|
568
|
-
if (u.getAttribute("data-fkp-node") === "original-reply") {
|
|
569
|
-
const w = g.has("originalReply:knowledgeBlock");
|
|
570
|
-
w || (p = !0);
|
|
571
|
-
const O = w ? document.createElement("section") : document.createDocumentFragment();
|
|
572
|
-
return O instanceof HTMLElement && O.setAttribute("data-original-reply", ""), u.childNodes.forEach((K) => {
|
|
573
|
-
const B = h(K, w);
|
|
574
|
-
B && O.appendChild(B);
|
|
575
|
-
}), O;
|
|
576
|
-
}
|
|
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")
|
|
578
|
-
return p = !0, null;
|
|
579
|
-
const F = fn.has(u.tagName) ? document.createElement(u.tagName.toLowerCase()) : u.tagName === "BR" ? document.createElement("br") : document.createDocumentFragment();
|
|
580
|
-
return u.childNodes.forEach((w) => {
|
|
581
|
-
const O = h(w, M);
|
|
582
|
-
O && F.appendChild(O);
|
|
583
|
-
}), F;
|
|
584
|
-
};
|
|
585
|
-
try {
|
|
586
|
-
if (y.body.childNodes.forEach((M) => {
|
|
587
|
-
const N = h(M);
|
|
588
|
-
N && i.appendChild(N);
|
|
589
|
-
}), !((v = i.textContent) != null && v.trim()) && !i.querySelector(
|
|
590
|
-
"figure, [data-message-separator], [data-original-reply]"
|
|
591
|
-
))
|
|
592
|
-
return { slice: null, handled: p };
|
|
593
|
-
const u = Jt.fromSchema(o).parseSlice(i, {
|
|
594
|
-
preserveWhitespace: !0
|
|
595
|
-
});
|
|
596
|
-
return u.content.size ? { slice: u, handled: !0 } : { slice: null, handled: p };
|
|
597
|
-
} catch {
|
|
598
|
-
return { slice: null, handled: !1 };
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
function hn(r) {
|
|
602
|
-
return et(r, r.state.selection.getBookmark());
|
|
603
|
-
}
|
|
604
|
-
function Ye(r, o) {
|
|
605
|
-
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
606
|
-
return null;
|
|
607
|
-
let d = o, s = !0, c = !0;
|
|
608
|
-
const g = ({ transaction: y }) => {
|
|
609
|
-
const i = y.mapping.mapResult(d, 1);
|
|
610
|
-
i.deletedAcross && (c = !1), d = i.pos;
|
|
611
|
-
};
|
|
612
|
-
return r.on("transaction", g), {
|
|
613
|
-
status() {
|
|
614
|
-
return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
615
|
-
},
|
|
616
|
-
insert(y) {
|
|
617
|
-
if (!s || !c || r.isDestroyed) return !1;
|
|
618
|
-
try {
|
|
619
|
-
return r.chain().setMeta(U, oe(y)).insertContentAt(d, y).run();
|
|
620
|
-
} catch {
|
|
621
|
-
return !1;
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
dispose() {
|
|
625
|
-
s && (s = !1, r.off("transaction", g));
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
function Xe(r, o) {
|
|
630
|
-
if (r.isDestroyed || !Number.isInteger(o) || o < 0 || o > r.state.doc.content.size)
|
|
631
|
-
return null;
|
|
632
|
-
try {
|
|
633
|
-
const d = qt.near(
|
|
634
|
-
r.state.doc.resolve(o)
|
|
635
|
-
).getBookmark();
|
|
636
|
-
return et(r, d);
|
|
637
|
-
} catch {
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
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);
|
|
646
|
-
};
|
|
647
|
-
return r.on("transaction", S), {
|
|
648
|
-
status() {
|
|
649
|
-
return !s || r.isDestroyed ? "disposed" : c ? "ready" : "lost";
|
|
650
|
-
},
|
|
651
|
-
insert(T) {
|
|
652
|
-
if (!s || !c || r.isDestroyed) return !1;
|
|
653
|
-
try {
|
|
654
|
-
const p = d.resolve(r.state.doc);
|
|
655
|
-
g = !0;
|
|
656
|
-
try {
|
|
657
|
-
return r.chain().setMeta(U, oe(T)).insertContentAt(
|
|
658
|
-
{ from: p.from, to: p.to },
|
|
659
|
-
T
|
|
660
|
-
).run();
|
|
661
|
-
} finally {
|
|
662
|
-
g = !1;
|
|
663
|
-
}
|
|
664
|
-
} catch {
|
|
665
|
-
return !1;
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
dispose() {
|
|
669
|
-
s && (s = !1, r.off("transaction", S));
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
const bn = {
|
|
674
|
-
key: 0,
|
|
675
|
-
class: "fkp-knowledge-area",
|
|
676
|
-
role: "alert"
|
|
677
|
-
}, vn = { class: "fkp-order-remark-detail-title" }, An = {
|
|
678
|
-
key: 0,
|
|
679
|
-
class: "fkp-order-remark-extract"
|
|
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 = {
|
|
681
|
-
key: 2,
|
|
682
|
-
class: "fkp-reference-placeholder",
|
|
683
|
-
"aria-hidden": "true"
|
|
684
|
-
}, Hn = /* @__PURE__ */ Dt({
|
|
685
|
-
__name: "KnowledgeArea",
|
|
686
|
-
props: {
|
|
687
|
-
modelValue: {},
|
|
688
|
-
editable: { type: Boolean },
|
|
689
|
-
placeholder: {},
|
|
690
|
-
referencePlaceholder: { type: Boolean },
|
|
691
|
-
schemaPlan: {},
|
|
692
|
-
pasteCapabilities: {},
|
|
693
|
-
activeChoiceId: {},
|
|
694
|
-
documentAdapter: {}
|
|
695
|
-
},
|
|
696
|
-
emits: ["update:modelValue", "retry-media", "load-error", "edit-tool", "choice-menu", "leave-choice"],
|
|
697
|
-
setup(r, { expose: o, emit: d }) {
|
|
698
|
-
const s = r;
|
|
699
|
-
let c = !1;
|
|
700
|
-
const g = d, y = /* @__PURE__ */ new Map(), i = Rt();
|
|
701
|
-
let S = () => {
|
|
702
|
-
};
|
|
703
|
-
const T = new Promise((e) => {
|
|
704
|
-
S = e;
|
|
705
|
-
}), p = Y(), h = Y(!0), v = Y(!1), u = Y(null), M = Y({});
|
|
706
|
-
let N = null;
|
|
707
|
-
function F() {
|
|
708
|
-
N && clearTimeout(N), N = null;
|
|
709
|
-
}
|
|
710
|
-
function _() {
|
|
711
|
-
F(), N = setTimeout(() => {
|
|
712
|
-
u.value = null;
|
|
713
|
-
}, 150);
|
|
714
|
-
}
|
|
715
|
-
function w(e) {
|
|
716
|
-
const { target: t } = e;
|
|
717
|
-
if (!(t instanceof Element) || !i.value) return;
|
|
718
|
-
const n = t.closest(
|
|
719
|
-
'[data-business-token][data-key="order_note"]'
|
|
720
|
-
);
|
|
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)
|
|
723
|
-
return !0;
|
|
724
|
-
u.value = We(a.attrs.params) ? a.attrs.params : null;
|
|
725
|
-
const l = n.getBoundingClientRect();
|
|
726
|
-
return M.value = {
|
|
727
|
-
left: `${l.left}px`,
|
|
728
|
-
top: `${l.top}px`,
|
|
729
|
-
width: `${l.width}px`,
|
|
730
|
-
height: `${l.height}px`
|
|
731
|
-
}, !1;
|
|
732
|
-
}));
|
|
733
|
-
}
|
|
734
|
-
function O(e) {
|
|
735
|
-
const { target: t } = e;
|
|
736
|
-
if (!(t instanceof Element)) return;
|
|
737
|
-
const n = t.closest('[data-business-token][data-key="order_note"]');
|
|
738
|
-
n && (!(e.relatedTarget instanceof Node) || !n.contains(e.relatedTarget)) && _();
|
|
739
|
-
}
|
|
740
|
-
Le(F);
|
|
741
|
-
let K = !1, B = null;
|
|
742
|
-
const I = Y(null);
|
|
743
|
-
let P = null, H = null;
|
|
744
|
-
function ee() {
|
|
745
|
-
P = null, H !== null && cancelAnimationFrame(H), H = null;
|
|
746
|
-
}
|
|
747
|
-
function z() {
|
|
748
|
-
ee(), B = null, I.value = null;
|
|
749
|
-
}
|
|
750
|
-
function ve(e) {
|
|
751
|
-
e.key === "Escape" && z();
|
|
752
|
-
}
|
|
753
|
-
function se() {
|
|
754
|
-
if (!P) return;
|
|
755
|
-
const e = Ee({
|
|
756
|
-
clientX: P.x,
|
|
757
|
-
clientY: P.y
|
|
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);
|
|
760
|
-
}
|
|
761
|
-
ne(
|
|
762
|
-
() => s.editable,
|
|
763
|
-
(e) => {
|
|
764
|
-
e || z();
|
|
765
|
-
}
|
|
766
|
-
);
|
|
767
|
-
function Ae() {
|
|
768
|
-
H = null;
|
|
769
|
-
const e = p.value, t = P;
|
|
770
|
-
if (!e || !t || !s.editable) return;
|
|
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;
|
|
774
|
-
if (!l || f <= 0) return;
|
|
775
|
-
const k = Math.max(0, Math.min(f, e.scrollTop + l));
|
|
776
|
-
k !== e.scrollTop && (e.scrollTop = k, H = requestAnimationFrame(Ae));
|
|
777
|
-
}
|
|
778
|
-
function tt() {
|
|
779
|
-
u.value = null, P ? se() : I.value = null;
|
|
780
|
-
}
|
|
781
|
-
let te = null, ie = !1;
|
|
782
|
-
const Te = `[data-business-token]:is(${Wt.map(
|
|
783
|
-
(e) => `[data-kind="${e}"]`
|
|
784
|
-
).join(", ")})`;
|
|
785
|
-
function G(e) {
|
|
786
|
-
const t = y.get(e);
|
|
787
|
-
t && (URL.revokeObjectURL(t), y.delete(e));
|
|
788
|
-
}
|
|
789
|
-
function le(e) {
|
|
790
|
-
return !s.editable || !(e.target instanceof Element) ? null : e.target.closest(Te);
|
|
791
|
-
}
|
|
792
|
-
function nt(e) {
|
|
793
|
-
const t = le(e);
|
|
794
|
-
!t || e.relatedTarget instanceof Node && t.contains(e.relatedTarget) || Se(t);
|
|
795
|
-
}
|
|
796
|
-
function rt(e) {
|
|
797
|
-
const t = le(e);
|
|
798
|
-
t && (!(e.relatedTarget instanceof Node) || !t.contains(e.relatedTarget)) && g("leave-choice");
|
|
799
|
-
}
|
|
800
|
-
function Se(e) {
|
|
801
|
-
const { nodeId: t } = e.dataset;
|
|
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", {
|
|
803
|
-
nodeId: t,
|
|
804
|
-
nodeVersion: Number(n.attrs.nodeVersion) || 0,
|
|
805
|
-
key: String(n.attrs.key),
|
|
806
|
-
kind: n.attrs.kind,
|
|
807
|
-
anchor: e
|
|
808
|
-
}), !1));
|
|
809
|
-
}
|
|
810
|
-
function at(e) {
|
|
811
|
-
if (!s.editable || !i.value) return;
|
|
812
|
-
const { target: t } = e;
|
|
813
|
-
if (!(t instanceof Element)) return;
|
|
814
|
-
const n = le(e);
|
|
815
|
-
if (n) {
|
|
816
|
-
Se(n);
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
const a = t.closest(
|
|
820
|
-
'[data-business-token][data-kind="tool"]'
|
|
821
|
-
);
|
|
822
|
-
a && (u.value = null);
|
|
823
|
-
const l = a == null ? void 0 : a.dataset.nodeId;
|
|
824
|
-
l && i.value.state.doc.descendants((f) => {
|
|
825
|
-
if (f.type.name !== "businessToken" || f.attrs.id !== l)
|
|
826
|
-
return !0;
|
|
827
|
-
const { params: k } = f.attrs;
|
|
828
|
-
return g("edit-tool", {
|
|
829
|
-
nodeId: l,
|
|
830
|
-
nodeVersion: Number(f.attrs.nodeVersion) || 0,
|
|
831
|
-
key: String(f.attrs.key),
|
|
832
|
-
label: String(f.attrs.label || f.attrs.key),
|
|
833
|
-
params: k && typeof k == "object" && !Array.isArray(k) ? k : null
|
|
834
|
-
}), !1;
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
function ot(e) {
|
|
838
|
-
if (!s.editable || !i.value) return;
|
|
839
|
-
const { target: t } = e;
|
|
840
|
-
if (t === p.value || t === i.value.view.dom.parentElement) {
|
|
841
|
-
i.value.commands.focus("end");
|
|
842
|
-
return;
|
|
843
|
-
}
|
|
844
|
-
at(e);
|
|
845
|
-
}
|
|
846
|
-
function Ce() {
|
|
847
|
-
var e;
|
|
848
|
-
(e = p.value) == null || e.querySelectorAll(Te).forEach(
|
|
849
|
-
(t) => t.classList.toggle(
|
|
850
|
-
"is-menu-open",
|
|
851
|
-
!!s.activeChoiceId && t.dataset.nodeId === s.activeChoiceId
|
|
852
|
-
)
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
ne(
|
|
856
|
-
[() => s.activeChoiceId, () => s.modelValue],
|
|
857
|
-
() => void $e(Ce)
|
|
858
|
-
);
|
|
859
|
-
function st(e) {
|
|
860
|
-
var n;
|
|
861
|
-
const t = e.target instanceof Element ? e.target.closest(".fk-media[data-drag-handle]") : null;
|
|
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());
|
|
863
|
-
}
|
|
864
|
-
function Me(e, t) {
|
|
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();
|
|
870
|
-
return {
|
|
871
|
-
top: (f ? A.bottom : A.top) - C.top + a.scrollTop,
|
|
872
|
-
left: a.scrollLeft,
|
|
873
|
-
width: a.clientWidth || C.right - C.left,
|
|
874
|
-
pos: e,
|
|
875
|
-
kind: t
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
function Ee(e) {
|
|
879
|
-
const t = i.value;
|
|
880
|
-
if (!t) return null;
|
|
881
|
-
const { view: n } = t, a = n.posAtCoords({ left: e.clientX, top: e.clientY });
|
|
882
|
-
if (!a) {
|
|
883
|
-
const C = n.dom.children;
|
|
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;
|
|
888
|
-
}
|
|
889
|
-
if (E === C.length) return n.state.doc.content.size;
|
|
890
|
-
const J = n.state.doc.resolve(n.posAtDOM(C[E], 0));
|
|
891
|
-
return J.depth ? J.before(1) : J.pos;
|
|
892
|
-
}
|
|
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;
|
|
900
|
-
}
|
|
901
|
-
function Ne(e, t) {
|
|
902
|
-
const n = i.value;
|
|
903
|
-
if (!n) return null;
|
|
904
|
-
const a = /* @__PURE__ */ new Map();
|
|
905
|
-
n.state.doc.descendants((A, C) => {
|
|
906
|
-
A.type.name === "mediaBlock" && typeof A.attrs.id == "string" && a.set(A.attrs.id, { pos: C, size: A.nodeSize });
|
|
907
|
-
});
|
|
908
|
-
const l = a.get(t);
|
|
909
|
-
if (!l) return null;
|
|
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);
|
|
917
|
-
} else {
|
|
918
|
-
const A = n.view.posAtCoords({
|
|
919
|
-
left: e.clientX,
|
|
920
|
-
top: e.clientY
|
|
921
|
-
});
|
|
922
|
-
if (!A) return null;
|
|
923
|
-
const C = [0];
|
|
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
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
|
-
return b === l.pos || b === l.pos + l.size ? null : { source: l, insertion: b };
|
|
931
|
-
}
|
|
932
|
-
function it(e) {
|
|
933
|
-
var t;
|
|
934
|
-
if (s.editable) {
|
|
935
|
-
if (B) {
|
|
936
|
-
e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "move");
|
|
937
|
-
const n = Ne(e, B);
|
|
938
|
-
I.value = n ? Me(n.insertion, "media") : null;
|
|
939
|
-
return;
|
|
940
|
-
}
|
|
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)));
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
function lt(e) {
|
|
945
|
-
var m;
|
|
946
|
-
ee();
|
|
947
|
-
const t = B;
|
|
948
|
-
if (!t) {
|
|
949
|
-
(m = e.dataTransfer) != null && m.files.length || (I.value = null);
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
B = null, I.value = null, e.preventDefault(), e.stopPropagation();
|
|
953
|
-
const n = i.value;
|
|
954
|
-
if (!s.editable || !n || n.isDestroyed) return;
|
|
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"))
|
|
959
|
-
try {
|
|
960
|
-
const b = n.state.tr.delete(
|
|
961
|
-
l.pos,
|
|
962
|
-
l.pos + l.size
|
|
963
|
-
);
|
|
964
|
-
b.insert(b.mapping.map(f), k), b.setMeta("uiEvent", "drop"), b.setMeta(U, [t]), n.view.dispatch(b);
|
|
965
|
-
} catch {
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
function ct(e) {
|
|
969
|
-
const t = p.value;
|
|
970
|
-
if (!t || !I.value || e.relatedTarget instanceof Node && t.contains(e.relatedTarget))
|
|
971
|
-
return;
|
|
972
|
-
const n = t.getBoundingClientRect();
|
|
973
|
-
e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom || (ee(), I.value = null);
|
|
974
|
-
}
|
|
975
|
-
function dt() {
|
|
976
|
-
z();
|
|
977
|
-
}
|
|
978
|
-
function ce(e) {
|
|
979
|
-
const t = /* @__PURE__ */ new Set(), n = (a) => {
|
|
980
|
-
var l, f;
|
|
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);
|
|
982
|
-
};
|
|
983
|
-
n(e);
|
|
984
|
-
for (const a of y.keys()) t.has(a) || G(a);
|
|
985
|
-
}
|
|
986
|
-
function we(e) {
|
|
987
|
-
i.value = new Vt({
|
|
988
|
-
content: s.modelValue,
|
|
989
|
-
editable: s.editable,
|
|
990
|
-
extensions: [
|
|
991
|
-
Ut.configure({
|
|
992
|
-
heading: !1,
|
|
993
|
-
dropcursor: { color: "#4884e4", width: 2 },
|
|
994
|
-
link: { openOnClick: !1, isAllowedUri: (t) => Z(t) }
|
|
995
|
-
}),
|
|
996
|
-
_t.configure({
|
|
997
|
-
placeholder: () => s.referencePlaceholder ? "" : s.placeholder || s.documentAdapter.placeholder
|
|
998
|
-
}),
|
|
999
|
-
an,
|
|
1000
|
-
...s.schemaPlan.businessToken ? [on] : [],
|
|
1001
|
-
...s.schemaPlan.originalReply ? [sn] : [],
|
|
1002
|
-
...s.schemaPlan.separator ? [ln] : [],
|
|
1003
|
-
...s.documentAdapter.extensions || [],
|
|
1004
|
-
...e
|
|
1005
|
-
],
|
|
1006
|
-
editorProps: {
|
|
1007
|
-
attributes: {
|
|
1008
|
-
class: "fkp-knowledge-document",
|
|
1009
|
-
role: "textbox",
|
|
1010
|
-
"aria-label": s.documentAdapter.ariaLabel,
|
|
1011
|
-
"aria-multiline": "true"
|
|
1012
|
-
}
|
|
1013
|
-
},
|
|
1014
|
-
onUpdate: ({ editor: t }) => {
|
|
1015
|
-
h.value = t.isEmpty;
|
|
1016
|
-
const n = t.getJSON();
|
|
1017
|
-
ce(n), c || g("update:modelValue", n);
|
|
1018
|
-
}
|
|
1019
|
-
}), h.value = i.value.isEmpty, S(!0), Ce(), ze();
|
|
1020
|
-
}
|
|
1021
|
-
Bt(() => {
|
|
1022
|
-
if (document.addEventListener("keydown", ve), document.addEventListener("dragend", z), document.addEventListener("drop", z), !s.schemaPlan.mediaBlock) {
|
|
1023
|
-
we([]);
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
import("./media-extensions-YYbGuUQa.js").then(({ MediaBlock: e }) => {
|
|
1027
|
-
K || we([e.configure({ sceneStyle: !0 })]);
|
|
1028
|
-
}).catch(() => {
|
|
1029
|
-
K || (v.value = !0, S(!1), g("load-error", "媒体编辑器加载失败,请刷新页面重试"));
|
|
1030
|
-
});
|
|
1031
|
-
}), ne(
|
|
1032
|
-
() => s.editable,
|
|
1033
|
-
(e) => {
|
|
1034
|
-
var t;
|
|
1035
|
-
return (t = i.value) == null ? void 0 : t.setEditable(e);
|
|
1036
|
-
}
|
|
1037
|
-
), ne(
|
|
1038
|
-
() => s.modelValue,
|
|
1039
|
-
(e) => {
|
|
1040
|
-
if (i.value && Ue(e) !== Ue(i.value.getJSON())) {
|
|
1041
|
-
const t = Oe();
|
|
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);
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
{ deep: !0 }
|
|
1046
|
-
), Le(() => {
|
|
1047
|
-
var e;
|
|
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);
|
|
1050
|
-
(e = i.value) == null || e.destroy();
|
|
1051
|
-
});
|
|
1052
|
-
function de(e, t, n, a, l) {
|
|
1053
|
-
var f;
|
|
1054
|
-
return !s.editable || !s.schemaPlan.businessToken ? !1 : !!((f = i.value) != null && f.chain().focus().insertContent([
|
|
1055
|
-
{ type: "businessToken", attrs: { kind: e, key: t, label: n, token: a, params: l } },
|
|
1056
|
-
{ type: "text", text: " " }
|
|
1057
|
-
]).run());
|
|
1058
|
-
}
|
|
1059
|
-
function ut(e, t, n, a) {
|
|
1060
|
-
const l = i.value;
|
|
1061
|
-
if (!s.editable || !s.schemaPlan.businessToken || !l)
|
|
1062
|
-
return !1;
|
|
1063
|
-
const f = [];
|
|
1064
|
-
if (l.state.doc.descendants((b, A) => {
|
|
1065
|
-
b.type.name === "businessToken" && b.attrs.kind === e && b.attrs.key === t && f.push(A);
|
|
1066
|
-
}), f.length > 1) return !1;
|
|
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
|
|
1074
|
-
})
|
|
1075
|
-
), !0) : !1;
|
|
1076
|
-
}
|
|
1077
|
-
function ft() {
|
|
1078
|
-
if (!s.editable || !s.schemaPlan.originalReply) return !1;
|
|
1079
|
-
const e = i.value;
|
|
1080
|
-
if (!e) return !1;
|
|
1081
|
-
e.commands.focus();
|
|
1082
|
-
const { from: t, to: n } = e.state.selection, a = e.commands.insertContentAt(
|
|
1083
|
-
{ from: t, to: n },
|
|
1084
|
-
{ type: "originalReply", content: [{ type: "paragraph" }] }
|
|
1085
|
-
);
|
|
1086
|
-
return a && xe(), a;
|
|
1087
|
-
}
|
|
1088
|
-
function pt() {
|
|
1089
|
-
return de("separator", "separator", "分隔符", "{分隔符}");
|
|
1090
|
-
}
|
|
1091
|
-
function mt(e, t) {
|
|
1092
|
-
var a;
|
|
1093
|
-
const n = i.value;
|
|
1094
|
-
return !s.editable || !n || !((a = s.documentAdapter.extensions) != null && a.some(
|
|
1095
|
-
(l) => l.name === e
|
|
1096
|
-
)) ? !1 : n.chain().focus().insertContent([
|
|
1097
|
-
{ type: e, attrs: t },
|
|
1098
|
-
{ type: "text", text: " " }
|
|
1099
|
-
]).run() || !1;
|
|
1100
|
-
}
|
|
1101
|
-
function gt(e, t = "lastCaret", n = !1) {
|
|
1102
|
-
var l;
|
|
1103
|
-
const a = i.value;
|
|
1104
|
-
if (!s.editable || !a || !e) return !1;
|
|
1105
|
-
if (t === "end") {
|
|
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) => ({
|
|
1107
|
-
type: "paragraph",
|
|
1108
|
-
...b ? { content: [{ type: "text", text: b }] } : {}
|
|
1109
|
-
}));
|
|
1110
|
-
if (!a.commands.insertContentAt(
|
|
1111
|
-
f ? { from: 0, to: a.state.doc.content.size } : k,
|
|
1112
|
-
m
|
|
1113
|
-
))
|
|
1114
|
-
return !1;
|
|
1115
|
-
if (n) {
|
|
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)
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
return a.commands.focus(), !0;
|
|
1123
|
-
}
|
|
1124
|
-
return a.chain().focus().insertContent(e).run();
|
|
1125
|
-
}
|
|
1126
|
-
function xe() {
|
|
1127
|
-
const e = i.value;
|
|
1128
|
-
if (!e) return;
|
|
1129
|
-
const t = e.state.selection.from;
|
|
1130
|
-
let n = null;
|
|
1131
|
-
e.state.doc.descendants((a, l) => {
|
|
1132
|
-
a.type.name === "originalReply" && l < t && (n = l);
|
|
1133
|
-
}), n !== null && e.commands.setTextSelection(n + 2);
|
|
1134
|
-
}
|
|
1135
|
-
function Ie(e, t, n) {
|
|
1136
|
-
if (!s.editable || !i.value || !e.length) return null;
|
|
1137
|
-
c = !0;
|
|
1138
|
-
try {
|
|
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;
|
|
1141
|
-
} finally {
|
|
1142
|
-
c = !1;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
function yt(e) {
|
|
1146
|
-
if (!(!i.value || i.value.isDestroyed)) {
|
|
1147
|
-
c = !0;
|
|
1148
|
-
try {
|
|
1149
|
-
i.value.chain().setMeta("addToHistory", !1).setMeta(U, oe(e)).setContent(e, { emitUpdate: !1 }).run(), h.value = i.value.isEmpty, ce(e);
|
|
1150
|
-
} finally {
|
|
1151
|
-
c = !1;
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
function kt() {
|
|
1156
|
-
var t;
|
|
1157
|
-
const e = new Set(y.keys());
|
|
1158
|
-
return (t = i.value) == null || t.state.doc.descendants((n) => {
|
|
1159
|
-
n.attrs.id && e.add(String(n.attrs.id));
|
|
1160
|
-
}), ke(e, ae);
|
|
1161
|
-
}
|
|
1162
|
-
function ht(e, t, n, a) {
|
|
1163
|
-
if (!s.editable || !s.schemaPlan.mediaBlock) return null;
|
|
1164
|
-
const l = [
|
|
1165
|
-
{
|
|
1166
|
-
type: "mediaBlock",
|
|
1167
|
-
attrs: {
|
|
1168
|
-
id: kt(),
|
|
1169
|
-
nodeVersion: 0,
|
|
1170
|
-
assetId: e.id || null,
|
|
1171
|
-
sourceType: e.sourceType || null,
|
|
1172
|
-
src: e.url,
|
|
1173
|
-
kind: e.kind,
|
|
1174
|
-
name: t,
|
|
1175
|
-
poster: e.posterUrl || null,
|
|
1176
|
-
status: "ready"
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
{ type: "paragraph" }
|
|
1180
|
-
];
|
|
1181
|
-
return Ie(l, n, a);
|
|
1182
|
-
}
|
|
1183
|
-
function bt(e, t, n) {
|
|
1184
|
-
var a;
|
|
1185
|
-
return ((a = De([{ file: e, kind: t }], n)) == null ? void 0 : a[0]) || null;
|
|
1186
|
-
}
|
|
1187
|
-
function De(e, t) {
|
|
1188
|
-
if (!s.editable || !s.schemaPlan.mediaBlock || !i.value || !e.length)
|
|
1189
|
-
return null;
|
|
1190
|
-
const n = new Set(y.keys());
|
|
1191
|
-
i.value.state.doc.descendants((f) => {
|
|
1192
|
-
f.attrs.id && n.add(String(f.attrs.id));
|
|
1193
|
-
});
|
|
1194
|
-
const a = [], l = [];
|
|
1195
|
-
try {
|
|
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({
|
|
1201
|
-
type: "mediaBlock",
|
|
1202
|
-
attrs: {
|
|
1203
|
-
id: m,
|
|
1204
|
-
nodeVersion: 0,
|
|
1205
|
-
assetId: null,
|
|
1206
|
-
src: b,
|
|
1207
|
-
kind: k,
|
|
1208
|
-
name: f.name,
|
|
1209
|
-
poster: null,
|
|
1210
|
-
status: "uploading",
|
|
1211
|
-
error: ""
|
|
1212
|
-
}
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1215
|
-
if (l.push({ type: "paragraph" }), t.insert(l)) return a;
|
|
1216
|
-
} catch {
|
|
1217
|
-
}
|
|
1218
|
-
return a.forEach(G), null;
|
|
1219
|
-
}
|
|
1220
|
-
function ue(e) {
|
|
1221
|
-
const t = i.value;
|
|
1222
|
-
if (!t || t.isDestroyed) return null;
|
|
1223
|
-
let n = null;
|
|
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
|
|
1229
|
-
});
|
|
1230
|
-
}), n;
|
|
1231
|
-
}
|
|
1232
|
-
function fe(e, t, n, a) {
|
|
1233
|
-
const l = i.value;
|
|
1234
|
-
if (!l || l.isDestroyed || !Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER)
|
|
1235
|
-
return !1;
|
|
1236
|
-
let f = null;
|
|
1237
|
-
if (l.state.doc.descendants((m, b) => {
|
|
1238
|
-
m.type.name === "mediaBlock" && m.attrs.id === e && (f = b);
|
|
1239
|
-
}), f === null) return !1;
|
|
1240
|
-
const k = l.state.doc.nodeAt(f);
|
|
1241
|
-
return !k || k.attrs.nodeVersion !== t || k.attrs.status !== n ? !1 : (l.view.dispatch(
|
|
1242
|
-
l.state.tr.setNodeMarkup(f, void 0, {
|
|
1243
|
-
...k.attrs,
|
|
1244
|
-
...a,
|
|
1245
|
-
nodeVersion: t + 1
|
|
1246
|
-
}).setMeta("addToHistory", !1)
|
|
1247
|
-
), !0);
|
|
1248
|
-
}
|
|
1249
|
-
function vt(e, t) {
|
|
1250
|
-
var k, m, b, A;
|
|
1251
|
-
const n = i.value;
|
|
1252
|
-
if (!s.editable || !n || n.isDestroyed) return !1;
|
|
1253
|
-
let a = null, l = 0;
|
|
1254
|
-
if (n.state.doc.descendants((C, E) => {
|
|
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)
|
|
1259
|
-
return !1;
|
|
1260
|
-
try {
|
|
1261
|
-
n.view.dispatch(
|
|
1262
|
-
n.state.tr.setNodeMarkup(a, void 0, e.node.attrs).setMeta("addToHistory", !1)
|
|
1263
|
-
);
|
|
1264
|
-
} catch {
|
|
1265
|
-
return !1;
|
|
1266
|
-
}
|
|
1267
|
-
return ((A = ue(e.nodeId)) == null ? void 0 : A.status) !== "ready" ? !1 : (G(e.nodeId), !0);
|
|
1268
|
-
}
|
|
1269
|
-
function Re(e, t) {
|
|
1270
|
-
var f, k;
|
|
1271
|
-
const n = i.value;
|
|
1272
|
-
if (!s.editable || !n || n.isDestroyed || !e.length)
|
|
1273
|
-
return null;
|
|
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))
|
|
1284
|
-
return null;
|
|
1285
|
-
l.push({ plan: m, position: b, size: C.nodeSize });
|
|
1286
|
-
}
|
|
1287
|
-
try {
|
|
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
|
|
1291
|
-
))
|
|
1292
|
-
b.kind === "removeNode" ? m = m.delete(A, A + C) : m = m.replaceWith(
|
|
1293
|
-
A,
|
|
1294
|
-
A + C,
|
|
1295
|
-
n.schema.nodeFromJSON(b.node)
|
|
1296
|
-
);
|
|
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 };
|
|
1301
|
-
} catch {
|
|
1302
|
-
return null;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
function At(e, t) {
|
|
1306
|
-
var n;
|
|
1307
|
-
return ((n = Re(e, t)) == null ? void 0 : n.transaction.doc.toJSON()) || null;
|
|
1308
|
-
}
|
|
1309
|
-
function Be(e, t) {
|
|
1310
|
-
const n = Re(e, t), a = i.value;
|
|
1311
|
-
if (!n || !a || a.isDestroyed) return !1;
|
|
1312
|
-
const { transaction: l, requestedIds: f } = n;
|
|
1313
|
-
try {
|
|
1314
|
-
a.view.dispatch(l);
|
|
1315
|
-
} catch {
|
|
1316
|
-
return !1;
|
|
1317
|
-
}
|
|
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);
|
|
1321
|
-
}), e.every(
|
|
1322
|
-
(m) => m.kind === "removeNode" ? !k.has(m.nodeId) : k.get(m.nodeId) === m.expectedNodeVersion + 1
|
|
1323
|
-
);
|
|
1324
|
-
}
|
|
1325
|
-
function Tt(e, t) {
|
|
1326
|
-
return Be([e], t);
|
|
1327
|
-
}
|
|
1328
|
-
function St(e, t, n) {
|
|
1329
|
-
return fe(e, n, "uploading", {
|
|
1330
|
-
status: "error",
|
|
1331
|
-
error: t
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
function Ct(e, t, n) {
|
|
1335
|
-
const a = ue(e);
|
|
1336
|
-
if ((a == null ? void 0 : a.kind) !== n.kind || !Z(n.url)) return !1;
|
|
1337
|
-
const l = fe(e, t, "uploading", {
|
|
1338
|
-
status: "ready",
|
|
1339
|
-
src: n.url,
|
|
1340
|
-
assetId: n.id || null,
|
|
1341
|
-
poster: n.posterUrl || null,
|
|
1342
|
-
error: ""
|
|
1343
|
-
});
|
|
1344
|
-
return l && G(e), l;
|
|
1345
|
-
}
|
|
1346
|
-
function Mt(e, t) {
|
|
1347
|
-
return fe(e, t, "error", {
|
|
1348
|
-
status: "uploading",
|
|
1349
|
-
error: ""
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
function Et(e, t, n) {
|
|
1353
|
-
const a = i.value;
|
|
1354
|
-
if (!a || a.isDestroyed || !Number.isFinite(n))
|
|
1355
|
-
return !1;
|
|
1356
|
-
let l = !1;
|
|
1357
|
-
return a.state.doc.descendants((f) => {
|
|
1358
|
-
f.type.name === "mediaBlock" && f.attrs.id === e && f.attrs.status === "uploading" && f.attrs.nodeVersion === t && (l = !0);
|
|
1359
|
-
}), l ? (a.view.dom.dispatchEvent(
|
|
1360
|
-
new CustomEvent("fkp-media-progress", {
|
|
1361
|
-
detail: { id: e, percent: Math.round(Math.max(0, Math.min(100, n))) }
|
|
1362
|
-
})
|
|
1363
|
-
), !0) : !1;
|
|
1364
|
-
}
|
|
1365
|
-
function Nt(e) {
|
|
1366
|
-
var n;
|
|
1367
|
-
const t = (n = e.detail) == null ? void 0 : n.id;
|
|
1368
|
-
typeof t == "string" && g("retry-media", t);
|
|
1369
|
-
}
|
|
1370
|
-
function Oe() {
|
|
1371
|
-
const e = i.value;
|
|
1372
|
-
if (!e || e.isDestroyed) return null;
|
|
1373
|
-
const { selection: t } = e.state;
|
|
1374
|
-
let n;
|
|
1375
|
-
if (t instanceof $ && t.empty) {
|
|
1376
|
-
const { $from: a } = t, l = a.start();
|
|
1377
|
-
if (a.parent.forEach((f, k) => {
|
|
1378
|
-
if (f.type.name !== "businessToken" || !f.attrs.id) return;
|
|
1379
|
-
const m = t.from - (l + k + f.nodeSize);
|
|
1380
|
-
m >= 0 && m <= 1 && (n = {
|
|
1381
|
-
id: String(f.attrs.id),
|
|
1382
|
-
kind: "inlineAfter",
|
|
1383
|
-
offset: m
|
|
1384
|
-
});
|
|
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);
|
|
1389
|
-
if (A.type.name === "mediaBlock" && A.attrs.id) {
|
|
1390
|
-
n = {
|
|
1391
|
-
id: String(A.attrs.id),
|
|
1392
|
-
kind: "blockAfter",
|
|
1393
|
-
offset: a.parentOffset,
|
|
1394
|
-
siblingOffset: k - b
|
|
1395
|
-
};
|
|
1396
|
-
break;
|
|
1397
|
-
}
|
|
1398
|
-
if (!A.isTextblock || A.content.size > 0) break;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
return {
|
|
1403
|
-
from: t.from,
|
|
1404
|
-
to: t.to,
|
|
1405
|
-
focused: e.isFocused,
|
|
1406
|
-
...n ? { nodeCaret: n } : {}
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
function Pe(e, t) {
|
|
1410
|
-
const n = e.state.doc.content.size;
|
|
1411
|
-
let a;
|
|
1412
|
-
const { nodeCaret: l } = t;
|
|
1413
|
-
l && t.from === t.to && e.state.doc.descendants((b, A) => {
|
|
1414
|
-
if (b.attrs.id !== l.id) return;
|
|
1415
|
-
if (l.kind === "inlineAfter") {
|
|
1416
|
-
if (b.type.name !== "businessToken") return;
|
|
1417
|
-
const R = e.state.doc.resolve(A).end();
|
|
1418
|
-
a = Math.min(
|
|
1419
|
-
A + b.nodeSize + l.offset,
|
|
1420
|
-
R
|
|
1421
|
-
);
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
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);
|
|
1426
|
-
if (V != null && V.isTextblock && Array.from(
|
|
1427
|
-
{ length: l.siblingOffset - 1 },
|
|
1428
|
-
(R, j) => E.child(x + j + 1)
|
|
1429
|
-
).every((R) => R.isTextblock && R.content.size === 0)) {
|
|
1430
|
-
let R = A;
|
|
1431
|
-
for (let j = x; j < J; j++)
|
|
1432
|
-
R += E.child(j).nodeSize;
|
|
1433
|
-
a = Math.min(
|
|
1434
|
-
R + 1 + l.offset,
|
|
1435
|
-
R + V.nodeSize - 1
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
});
|
|
1439
|
-
const f = {
|
|
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);
|
|
1444
|
-
}
|
|
1445
|
-
async function ze() {
|
|
1446
|
-
if (!(ie || !te)) {
|
|
1447
|
-
ie = !0;
|
|
1448
|
-
try {
|
|
1449
|
-
for (let e = 0; e < 5 && !K; e++) {
|
|
1450
|
-
await $e();
|
|
1451
|
-
const t = i.value;
|
|
1452
|
-
if (!t || t.isDestroyed || !t.view.dom.isConnected)
|
|
1453
|
-
continue;
|
|
1454
|
-
const n = te;
|
|
1455
|
-
if (te = null, !n) return;
|
|
1456
|
-
Pe(t, n);
|
|
1457
|
-
return;
|
|
1458
|
-
}
|
|
1459
|
-
} finally {
|
|
1460
|
-
ie = !1;
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
function wt(e) {
|
|
1465
|
-
e && (te = e, ze());
|
|
1466
|
-
}
|
|
1467
|
-
function Ve(e) {
|
|
1468
|
-
const t = e.clipboardData, n = i.value;
|
|
1469
|
-
if (!s.editable || !n || !t) return null;
|
|
1470
|
-
const a = () => t.files.length ? Ye(n, n.state.selection.to) : null, l = t.getData("text/html"), { slice: f, handled: k } = kn(
|
|
1471
|
-
l,
|
|
1472
|
-
n.state.schema,
|
|
1473
|
-
s.pasteCapabilities || [],
|
|
1474
|
-
Array.from(t.files),
|
|
1475
|
-
s.documentAdapter.clipboard
|
|
1476
|
-
);
|
|
1477
|
-
if (f)
|
|
1478
|
-
return n.view.dispatch(
|
|
1479
|
-
n.state.tr.replaceSelection(f).setMeta("uiEvent", "paste")
|
|
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;
|
|
1484
|
-
}
|
|
1485
|
-
function xt(e) {
|
|
1486
|
-
const t = i.value;
|
|
1487
|
-
!t || !e.clipboardData || !(e.target instanceof Element) || !e.target.closest(".fkp-knowledge-document") || pn(
|
|
1488
|
-
e.clipboardData,
|
|
1489
|
-
t.state.selection.content(),
|
|
1490
|
-
t.state.schema,
|
|
1491
|
-
s.documentAdapter.clipboard
|
|
1492
|
-
) && (e.preventDefault(), e.stopPropagation());
|
|
1493
|
-
}
|
|
1494
|
-
function It(e) {
|
|
1495
|
-
var t;
|
|
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));
|
|
1497
|
-
}
|
|
1498
|
-
return o({
|
|
1499
|
-
pasteClipboardContent: Ve,
|
|
1500
|
-
isSelectionInsideOriginalReply: () => {
|
|
1501
|
-
const e = i.value;
|
|
1502
|
-
if (!e) return !1;
|
|
1503
|
-
const { selection: t } = e.state;
|
|
1504
|
-
for (let { depth: n } = t.$from; n > 0; n--)
|
|
1505
|
-
if (t.$from.node(n).type.name === "originalReply")
|
|
1506
|
-
return !0;
|
|
1507
|
-
return !1;
|
|
1508
|
-
},
|
|
1509
|
-
insertToken: de,
|
|
1510
|
-
upsertToken: ut,
|
|
1511
|
-
insertInlineNode: mt,
|
|
1512
|
-
insertText: gt,
|
|
1513
|
-
insertOriginal: ft,
|
|
1514
|
-
insertSeparator: pt,
|
|
1515
|
-
insertBatch: Ie,
|
|
1516
|
-
restoreDoc: yt,
|
|
1517
|
-
insertMedia: ht,
|
|
1518
|
-
insertPendingMedia: bt,
|
|
1519
|
-
insertPendingMediaBatch: De,
|
|
1520
|
-
applyNodeUpdate: vt,
|
|
1521
|
-
applyPluginNodeOperation: Tt,
|
|
1522
|
-
applyPluginNodeOperations: Be,
|
|
1523
|
-
previewPluginNodeOperations: At,
|
|
1524
|
-
failMedia: St,
|
|
1525
|
-
completeMedia: Ct,
|
|
1526
|
-
retryMedia: Mt,
|
|
1527
|
-
getMediaState: ue,
|
|
1528
|
-
reportMediaProgress: Et,
|
|
1529
|
-
captureSelection: Oe,
|
|
1530
|
-
restoreSelection: wt,
|
|
1531
|
-
captureMediaTarget: () => i.value ? hn(i.value) : null,
|
|
1532
|
-
whenReady: () => T,
|
|
1533
|
-
captureEndTarget: () => {
|
|
1534
|
-
var n;
|
|
1535
|
-
const e = i.value;
|
|
1536
|
-
if (!e) return null;
|
|
1537
|
-
const { doc: t } = e.state;
|
|
1538
|
-
return (n = t.lastChild) != null && n.isTextblock ? Xe(e, t.content.size - 1) : Ye(e, t.content.size);
|
|
1539
|
-
},
|
|
1540
|
-
captureMediaTargetAt: (e, t) => {
|
|
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;
|
|
1543
|
-
},
|
|
1544
|
-
focus: () => {
|
|
1545
|
-
var e;
|
|
1546
|
-
return (e = i.value) == null ? void 0 : e.commands.focus();
|
|
1547
|
-
},
|
|
1548
|
-
getJSON: () => {
|
|
1549
|
-
var e;
|
|
1550
|
-
return (e = i.value) == null ? void 0 : e.getJSON();
|
|
1551
|
-
}
|
|
1552
|
-
}), (e, t) => v.value ? (L(), q("div", bn, "媒体编辑器加载失败,请刷新页面重试")) : (L(), q("div", {
|
|
1553
|
-
key: 1,
|
|
1554
|
-
ref_key: "areaRoot",
|
|
1555
|
-
ref: p,
|
|
1556
|
-
class: "fkp-knowledge-area",
|
|
1557
|
-
onFkpMediaRetry: Nt,
|
|
1558
|
-
onClick: ot,
|
|
1559
|
-
onMouseover: t[0] || (t[0] = (n) => {
|
|
1560
|
-
nt(n), w(n);
|
|
1561
|
-
}),
|
|
1562
|
-
onMouseout: t[1] || (t[1] = (n) => {
|
|
1563
|
-
rt(n), O(n);
|
|
1564
|
-
}),
|
|
1565
|
-
onFocusin: w,
|
|
1566
|
-
onFocusout: _,
|
|
1567
|
-
onDragstartCapture: st,
|
|
1568
|
-
onDragoverCapture: it,
|
|
1569
|
-
onDragleaveCapture: ct,
|
|
1570
|
-
onDropCapture: lt,
|
|
1571
|
-
onDragendCapture: dt,
|
|
1572
|
-
onCopyCapture: xt,
|
|
1573
|
-
onPasteCapture: It,
|
|
1574
|
-
onScrollCapture: tt
|
|
1575
|
-
}, [
|
|
1576
|
-
Fe(W(zt), {
|
|
1577
|
-
class: "fkp-knowledge-editor",
|
|
1578
|
-
editor: i.value
|
|
1579
|
-
}, null, 8, ["editor"]),
|
|
1580
|
-
u.value ? (L(), Ot(W(Lt), {
|
|
1581
|
-
key: 0,
|
|
1582
|
-
"popup-visible": !0,
|
|
1583
|
-
trigger: [],
|
|
1584
|
-
position: "tl",
|
|
1585
|
-
"content-class": "fkp-order-remark-popover",
|
|
1586
|
-
"content-style": {
|
|
1587
|
-
width: "326px",
|
|
1588
|
-
maxWidth: "calc(100vw - 32px)",
|
|
1589
|
-
padding: "16px",
|
|
1590
|
-
border: "none",
|
|
1591
|
-
boxSizing: "border-box",
|
|
1592
|
-
maxHeight: "420px",
|
|
1593
|
-
overflowY: "auto"
|
|
1594
|
-
}
|
|
1595
|
-
}, {
|
|
1596
|
-
content: pe(() => [
|
|
1597
|
-
D("div", {
|
|
1598
|
-
class: "fkp-order-remark-detail",
|
|
1599
|
-
onMouseenter: F,
|
|
1600
|
-
onMouseleave: _
|
|
1601
|
-
}, [
|
|
1602
|
-
D("div", vn, [
|
|
1603
|
-
t[2] || (t[2] = D("strong", null, "订单备注", -1)),
|
|
1604
|
-
u.value.contentMode === "smart" ? (L(), q("span", An, "智能提取")) : re("", !0)
|
|
1605
|
-
]),
|
|
1606
|
-
D("div", Tn, He(u.value.content), 1),
|
|
1607
|
-
D("div", Sn, [
|
|
1608
|
-
t[3] || (t[3] = D("span", null, "备注插旗", -1)),
|
|
1609
|
-
u.value.flag === "none" ? (L(), q("span", Cn, "不标记")) : (L(), q("span", {
|
|
1610
|
-
key: 1,
|
|
1611
|
-
class: "fkp-order-remark-detail-flag",
|
|
1612
|
-
role: "img",
|
|
1613
|
-
"aria-label": W(Zt)[u.value.flag],
|
|
1614
|
-
style: me({
|
|
1615
|
-
backgroundColor: W(Qt)[u.value.flag]
|
|
1616
|
-
})
|
|
1617
|
-
}, null, 12, Mn))
|
|
1618
|
-
]),
|
|
1619
|
-
D("div", En, [
|
|
1620
|
-
t[4] || (t[4] = D("span", null, "备注位置", -1)),
|
|
1621
|
-
D("span", null, He(u.value.position === "first" ? "最前" : "最后"), 1)
|
|
1622
|
-
])
|
|
1623
|
-
], 32)
|
|
1624
|
-
]),
|
|
1625
|
-
default: pe(() => [
|
|
1626
|
-
D("span", {
|
|
1627
|
-
class: "fkp-order-remark-anchor",
|
|
1628
|
-
style: me(M.value)
|
|
1629
|
-
}, null, 4)
|
|
1630
|
-
]),
|
|
1631
|
-
_: 1
|
|
1632
|
-
})) : re("", !0),
|
|
1633
|
-
I.value ? (L(), q("div", {
|
|
1634
|
-
key: 1,
|
|
1635
|
-
class: "fkp-media-drop-line",
|
|
1636
|
-
style: me({
|
|
1637
|
-
top: `${I.value.top}px`,
|
|
1638
|
-
left: `${I.value.left}px`,
|
|
1639
|
-
width: `${I.value.width}px`
|
|
1640
|
-
}),
|
|
1641
|
-
"aria-hidden": "true"
|
|
1642
|
-
}, null, 4)) : re("", !0),
|
|
1643
|
-
e.referencePlaceholder && h.value ? (L(), q("div", Nn, [
|
|
1644
|
-
t[6] || (t[6] = D("span", { class: "fkp-reference-bracket" }, "<", -1)),
|
|
1645
|
-
Fe(W($t), {
|
|
1646
|
-
color: "arcoblue",
|
|
1647
|
-
size: "small",
|
|
1648
|
-
bordered: ""
|
|
1649
|
-
}, {
|
|
1650
|
-
default: pe(() => t[5] || (t[5] = [
|
|
1651
|
-
Pt("参考话术")
|
|
1652
|
-
])),
|
|
1653
|
-
_: 1
|
|
1654
|
-
}),
|
|
1655
|
-
t[7] || (t[7] = D("span", null, "请填写参考话术", -1)),
|
|
1656
|
-
t[8] || (t[8] = D("span", { class: "fkp-reference-bracket" }, ">", -1))
|
|
1657
|
-
])) : re("", !0)
|
|
1658
|
-
], 544));
|
|
1659
|
-
}
|
|
1660
|
-
});
|
|
1661
|
-
export {
|
|
1662
|
-
Hn as _
|
|
1663
|
-
};
|