@freecallai/pro 0.0.11 → 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-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js} +1811 -1781
- package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-ClZoLiaZ.js} +1 -1
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js +1830 -0
- package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-BK9epxdr.js} +1 -1
- package/dist/agent-prompt-editor/index.js +575 -549
- package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
- package/dist/{choice-BqjECVyx.js → choice-UgePgrSl.js} +1 -1
- package/dist/{guard-BmLOamCj.js → guard-DPwe4mCm.js} +200 -185
- package/dist/{index-gS1h8iW8.js → index-BIi3k45j.js} +1 -1
- package/dist/index-BMHUPL5x.js +5 -0
- package/dist/{index-B1rTu0jX.js → index-CaA13lC9.js} +1 -1
- package/dist/{index-6VSUucFX.js → index-ChuzFuNm.js} +1 -1
- package/dist/index-DJLfgC4v.js +5 -0
- package/dist/{index-0BXLYaKG.js → index-DfKH-RZq.js} +2 -2
- package/dist/{index-CN2knQcE.js → index-DiLMgNEe.js} +1 -1
- package/dist/{index-BDinNJn_.js → index-RHu4JIw7.js} +1 -1
- package/dist/{index-CCwmXuSJ.js → index-v1UD08i6.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CRGzAti7.js → inline-CVF1zEsG.js} +1 -1
- package/dist/{knowledge-DNDouB-s.js → knowledge-DWM6tWnP.js} +1 -1
- package/dist/media-extensions-YYbGuUQa.js +341 -0
- package/dist/{media-migration-D1KoHKoP.js → media-migration-BctCLEuT.js} +1 -1
- package/dist/media-policy-B1UuSN2e.js +215 -0
- package/dist/{media-upload-C5N6YWHu.js → media-upload-DtH-oCtw.js} +1 -1
- package/dist/{model-BVh9EZ9G.js → model-VLLhEQfn.js} +1 -1
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +357 -355
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +37 -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 +20 -2
- package/dist/types/rich-text/index.d.ts +1 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +2 -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 +7 -2
- package/dist/types/rich-text/runtime/document-adapter.d.ts +3 -0
- package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
- 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 +10 -0
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +23 -14
- 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 +5 -4
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js +0 -1659
- package/dist/index-CAczgwau.js +0 -5
- package/dist/index-faGbB8v6.js +0 -5
- package/dist/media-extensions-wlcCEdtg.js +0 -324
- package/dist/media-policy-D3-Qglzz.js +0 -158
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as n, p as l, b as d } from "./FkpRichText.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { l as n, p as l, b as d } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js";
|
|
2
2
|
const c = {
|
|
3
3
|
id: "reasoningTemplate",
|
|
4
4
|
slot: "sceneAction",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as a } from "./operations-D8pn-_iW.js";
|
|
2
|
-
import { m as i } from "./inline-
|
|
3
|
-
import { p as d } from "./guard-
|
|
2
|
+
import { m as i } from "./inline-CVF1zEsG.js";
|
|
3
|
+
import { p as d } from "./guard-DPwe4mCm.js";
|
|
4
4
|
const l = {
|
|
5
5
|
validateInsert(n, e) {
|
|
6
6
|
const { option: t } = n;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as t } from "./FkpRichText.vue_vue_type_script_setup_true_lang-
|
|
2
|
-
import { r as g } from "./FkpRichText.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as t } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js";
|
|
2
|
+
import { r as g } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js";
|
|
3
3
|
import { _ as i } from "./FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang--MPtqZY_.js";
|
|
4
4
|
import { a as h } from "./types-PvYB5e85.js";
|
|
5
|
-
import { s as u, e as w } from "./guard-
|
|
5
|
+
import { s as u, e as w } from "./guard-DPwe4mCm.js";
|
|
6
6
|
import { F as a } from "./index-CCATu_gD.js";
|
|
7
7
|
import { _ as v, a as y, b as E, c as M } from "./index-CCATu_gD.js";
|
|
8
8
|
import { N as s } from "./index-CbmRr3rH.js";
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { Node as $, mergeAttributes as B } from "@tiptap/core";
|
|
2
|
+
import { nodeViewProps as I, NodeViewWrapper as D, VueNodeViewRenderer as L } from "@tiptap/vue-3";
|
|
3
|
+
import { defineComponent as F, ref as C, watch as N, onMounted as H, onBeforeUnmount as P, openBlock as s, createBlock as p, unref as i, normalizeClass as M, withCtx as m, createElementVNode as z, createElementBlock as l, createVNode as v, createTextVNode as c, createCommentVNode as n, withModifiers as q, toDisplayString as b, Fragment as U } from "vue";
|
|
4
|
+
import { Button as y, ImagePreview as h, Modal as O } from "@freecallai/ui";
|
|
5
|
+
import { closeHistory as R } from "@tiptap/pm/history";
|
|
6
|
+
import g from "@freecallai/icons";
|
|
7
|
+
import { IconDragDotVertical as W } from "@freecallai/ui/es/icon/index.js";
|
|
8
|
+
const j = { class: "fk-media-surface" }, G = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "fk-media-failed"
|
|
11
|
+
}, J = ["href"], K = ["draggable", "src", "alt"], Q = ["draggable", "src", "poster", "controls"], X = {
|
|
12
|
+
key: 5,
|
|
13
|
+
class: "fk-media-actions"
|
|
14
|
+
}, Y = {
|
|
15
|
+
key: 0,
|
|
16
|
+
"data-drag-handle": "",
|
|
17
|
+
class: "fk-media-handle",
|
|
18
|
+
title: "拖动调整位置"
|
|
19
|
+
}, Z = {
|
|
20
|
+
key: 6,
|
|
21
|
+
class: "fk-upload-state"
|
|
22
|
+
}, x = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "fk-media-caption"
|
|
25
|
+
}, _ = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "fk-error"
|
|
28
|
+
}, ee = ["src"], te = /* @__PURE__ */ F({
|
|
29
|
+
__name: "MediaView",
|
|
30
|
+
props: I,
|
|
31
|
+
setup(a) {
|
|
32
|
+
const r = a, o = r.extension.options.sceneStyle === !0, d = C(!1), u = C(!1), V = C(null), k = C(r.editor.isEditable);
|
|
33
|
+
function E(e) {
|
|
34
|
+
const { detail: t } = e;
|
|
35
|
+
(t == null ? void 0 : t.id) === r.node.attrs.id && r.node.attrs.status === "uploading" && typeof t.percent == "number" && Number.isFinite(t.percent) && (V.value = t.percent);
|
|
36
|
+
}
|
|
37
|
+
const w = () => {
|
|
38
|
+
k.value = r.editor.isEditable;
|
|
39
|
+
};
|
|
40
|
+
r.editor.on("update", w), r.editor.on("transaction", w);
|
|
41
|
+
function T() {
|
|
42
|
+
r.editor.isEditable && (r.editor.view.dispatch(R(r.editor.state.tr)), r.deleteNode());
|
|
43
|
+
}
|
|
44
|
+
function A() {
|
|
45
|
+
r.editor.view.dom.dispatchEvent(
|
|
46
|
+
new CustomEvent("fkp-media-retry", {
|
|
47
|
+
bubbles: !0,
|
|
48
|
+
detail: { id: r.node.attrs.id }
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function S() {
|
|
53
|
+
!o || r.node.attrs.sourceType === "qianniuVideo" || u.value || !["image", "video"].includes(r.node.attrs.kind) || r.node.attrs.status !== "ready" || (d.value = !0);
|
|
54
|
+
}
|
|
55
|
+
return N(
|
|
56
|
+
() => r.node.attrs.src,
|
|
57
|
+
() => {
|
|
58
|
+
u.value = !1;
|
|
59
|
+
}
|
|
60
|
+
), N(
|
|
61
|
+
() => r.node.attrs.status,
|
|
62
|
+
(e) => {
|
|
63
|
+
e !== "uploading" && (V.value = null);
|
|
64
|
+
}
|
|
65
|
+
), H(() => {
|
|
66
|
+
r.editor.view.dom.addEventListener("fkp-media-progress", E);
|
|
67
|
+
}), P(() => {
|
|
68
|
+
r.editor.view.dom.removeEventListener("fkp-media-progress", E), r.editor.off("update", w), r.editor.off("transaction", w);
|
|
69
|
+
}), (e, t) => (s(), p(i(D), {
|
|
70
|
+
class: M(["fk-media", {
|
|
71
|
+
"is-selected": e.selected,
|
|
72
|
+
"is-scene-media": o,
|
|
73
|
+
"is-video": e.node.attrs.kind === "video",
|
|
74
|
+
"is-qianniu-video": e.node.attrs.sourceType === "qianniuVideo",
|
|
75
|
+
"is-error": e.node.attrs.status === "error"
|
|
76
|
+
}]),
|
|
77
|
+
"data-media-id": e.node.attrs.id,
|
|
78
|
+
"data-drag-handle": o && k.value ? "" : void 0,
|
|
79
|
+
contenteditable: "false",
|
|
80
|
+
onClick: S
|
|
81
|
+
}, {
|
|
82
|
+
default: m(() => [
|
|
83
|
+
z("div", j, [
|
|
84
|
+
u.value ? (s(), l("div", G, [
|
|
85
|
+
v(i(g), {
|
|
86
|
+
name: "fail",
|
|
87
|
+
size: 24
|
|
88
|
+
}),
|
|
89
|
+
t[8] || (t[8] = c("媒体无法加载"))
|
|
90
|
+
])) : n("", !0),
|
|
91
|
+
e.node.attrs.sourceType === "qianniuVideo" ? (s(), l("a", {
|
|
92
|
+
key: 1,
|
|
93
|
+
class: "fk-qianniu-video-link",
|
|
94
|
+
href: e.node.attrs.src,
|
|
95
|
+
target: "_blank",
|
|
96
|
+
rel: "noopener noreferrer",
|
|
97
|
+
onClick: t[0] || (t[0] = q(() => {
|
|
98
|
+
}, ["stop"]))
|
|
99
|
+
}, b(e.node.attrs.src), 9, J)) : e.node.attrs.kind === "image" ? (s(), l("img", {
|
|
100
|
+
key: 2,
|
|
101
|
+
draggable: o ? !1 : void 0,
|
|
102
|
+
src: e.node.attrs.src,
|
|
103
|
+
alt: e.node.attrs.name,
|
|
104
|
+
onError: t[1] || (t[1] = (f) => u.value = !0),
|
|
105
|
+
onDblclick: t[2] || (t[2] = (f) => d.value = !0)
|
|
106
|
+
}, null, 40, K)) : (s(), l("video", {
|
|
107
|
+
key: 3,
|
|
108
|
+
draggable: o ? !1 : void 0,
|
|
109
|
+
src: e.node.attrs.src,
|
|
110
|
+
poster: e.node.attrs.poster || void 0,
|
|
111
|
+
controls: !o,
|
|
112
|
+
muted: o,
|
|
113
|
+
playsinline: "",
|
|
114
|
+
preload: "metadata",
|
|
115
|
+
onError: t[3] || (t[3] = (f) => u.value = !0)
|
|
116
|
+
}, null, 40, Q)),
|
|
117
|
+
o && !u.value && e.node.attrs.sourceType !== "qianniuVideo" && e.node.attrs.status === "ready" && ["image", "video"].includes(e.node.attrs.kind) ? (s(), p(i(y), {
|
|
118
|
+
key: 4,
|
|
119
|
+
class: M(["fk-media-play", { "is-image-preview": e.node.attrs.kind === "image" }]),
|
|
120
|
+
type: "text",
|
|
121
|
+
"aria-label": e.node.attrs.kind === "image" ? "查看大图" : "播放视频",
|
|
122
|
+
style: { "pointer-events": "none" },
|
|
123
|
+
onClick: t[4] || (t[4] = (f) => d.value = !0)
|
|
124
|
+
}, {
|
|
125
|
+
default: m(() => [
|
|
126
|
+
v(i(g), {
|
|
127
|
+
name: "visible",
|
|
128
|
+
size: 14
|
|
129
|
+
}),
|
|
130
|
+
c(b(e.node.attrs.kind === "image" ? "点击查看大图" : "点击播放视频"), 1)
|
|
131
|
+
]),
|
|
132
|
+
_: 1
|
|
133
|
+
}, 8, ["class", "aria-label"])) : n("", !0),
|
|
134
|
+
o ? n("", !0) : (s(), l("div", X, [
|
|
135
|
+
k.value ? (s(), l("span", Y, [
|
|
136
|
+
v(i(W), { size: 15 })
|
|
137
|
+
])) : n("", !0),
|
|
138
|
+
e.node.attrs.sourceType !== "qianniuVideo" ? (s(), p(i(y), {
|
|
139
|
+
key: 1,
|
|
140
|
+
type: "text",
|
|
141
|
+
size: "mini",
|
|
142
|
+
title: "预览媒体",
|
|
143
|
+
"aria-label": "预览媒体",
|
|
144
|
+
onClick: t[5] || (t[5] = (f) => d.value = !0)
|
|
145
|
+
}, {
|
|
146
|
+
default: m(() => [
|
|
147
|
+
v(i(g), {
|
|
148
|
+
name: "open",
|
|
149
|
+
size: 15
|
|
150
|
+
})
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
})) : n("", !0),
|
|
154
|
+
k.value && e.node.attrs.status === "error" ? (s(), p(i(y), {
|
|
155
|
+
key: 2,
|
|
156
|
+
type: "text",
|
|
157
|
+
size: "mini",
|
|
158
|
+
title: "重试上传",
|
|
159
|
+
"aria-label": "重试上传",
|
|
160
|
+
onClick: A
|
|
161
|
+
}, {
|
|
162
|
+
default: m(() => t[9] || (t[9] = [
|
|
163
|
+
c("重试")
|
|
164
|
+
])),
|
|
165
|
+
_: 1
|
|
166
|
+
})) : n("", !0),
|
|
167
|
+
k.value ? (s(), p(i(y), {
|
|
168
|
+
key: 3,
|
|
169
|
+
type: "text",
|
|
170
|
+
size: "mini",
|
|
171
|
+
title: "删除媒体",
|
|
172
|
+
"aria-label": "删除媒体",
|
|
173
|
+
onClick: T
|
|
174
|
+
}, {
|
|
175
|
+
default: m(() => [
|
|
176
|
+
v(i(g), {
|
|
177
|
+
name: "rte-del",
|
|
178
|
+
size: 15
|
|
179
|
+
})
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
})) : n("", !0)
|
|
183
|
+
])),
|
|
184
|
+
e.node.attrs.status === "uploading" ? (s(), l("div", Z, [
|
|
185
|
+
v(i(g), {
|
|
186
|
+
name: "sync",
|
|
187
|
+
size: 17,
|
|
188
|
+
class: "fk-spin"
|
|
189
|
+
}),
|
|
190
|
+
c("正在上传" + b(V.value === null ? "…" : ` ${V.value}%`), 1),
|
|
191
|
+
o && k.value ? (s(), p(i(y), {
|
|
192
|
+
key: 0,
|
|
193
|
+
class: "fk-media-status-action",
|
|
194
|
+
type: "text",
|
|
195
|
+
size: "mini",
|
|
196
|
+
"aria-label": "取消上传",
|
|
197
|
+
onClick: q(T, ["stop"])
|
|
198
|
+
}, {
|
|
199
|
+
default: m(() => t[10] || (t[10] = [
|
|
200
|
+
c("取消上传")
|
|
201
|
+
])),
|
|
202
|
+
_: 1
|
|
203
|
+
})) : n("", !0)
|
|
204
|
+
])) : n("", !0)
|
|
205
|
+
]),
|
|
206
|
+
e.node.attrs.sourceType !== "qianniuVideo" ? (s(), l("div", x, [
|
|
207
|
+
e.node.attrs.kind === "video" ? (s(), p(i(g), {
|
|
208
|
+
key: 0,
|
|
209
|
+
name: "video2",
|
|
210
|
+
size: 12
|
|
211
|
+
})) : n("", !0),
|
|
212
|
+
z("span", null, b(e.node.attrs.name), 1),
|
|
213
|
+
e.node.attrs.status === "error" ? (s(), l("span", _, b(e.node.attrs.error), 1)) : n("", !0),
|
|
214
|
+
o && k.value && e.node.attrs.status === "error" ? (s(), l(U, { key: 2 }, [
|
|
215
|
+
v(i(y), {
|
|
216
|
+
class: "fk-media-status-action",
|
|
217
|
+
type: "text",
|
|
218
|
+
size: "mini",
|
|
219
|
+
"aria-label": "重试上传",
|
|
220
|
+
onClick: q(A, ["stop"])
|
|
221
|
+
}, {
|
|
222
|
+
default: m(() => t[11] || (t[11] = [
|
|
223
|
+
c("重试")
|
|
224
|
+
])),
|
|
225
|
+
_: 1
|
|
226
|
+
}),
|
|
227
|
+
v(i(y), {
|
|
228
|
+
class: "fk-media-status-action",
|
|
229
|
+
type: "text",
|
|
230
|
+
size: "mini",
|
|
231
|
+
"aria-label": "移除失败媒体",
|
|
232
|
+
onClick: q(T, ["stop"])
|
|
233
|
+
}, {
|
|
234
|
+
default: m(() => t[12] || (t[12] = [
|
|
235
|
+
c("移除")
|
|
236
|
+
])),
|
|
237
|
+
_: 1
|
|
238
|
+
})
|
|
239
|
+
], 64)) : n("", !0)
|
|
240
|
+
])) : n("", !0),
|
|
241
|
+
e.node.attrs.kind === "image" ? (s(), p(i(h), {
|
|
242
|
+
key: 1,
|
|
243
|
+
visible: d.value,
|
|
244
|
+
"onUpdate:visible": t[6] || (t[6] = (f) => d.value = f),
|
|
245
|
+
src: e.node.attrs.src,
|
|
246
|
+
"mask-closable": !0
|
|
247
|
+
}, null, 8, ["visible", "src"])) : (s(), p(i(O), {
|
|
248
|
+
key: 2,
|
|
249
|
+
visible: d.value,
|
|
250
|
+
"onUpdate:visible": t[7] || (t[7] = (f) => d.value = f),
|
|
251
|
+
title: e.node.attrs.name,
|
|
252
|
+
footer: !1,
|
|
253
|
+
width: "min(960px, 90vw)",
|
|
254
|
+
"unmount-on-close": ""
|
|
255
|
+
}, {
|
|
256
|
+
default: m(() => [
|
|
257
|
+
z("video", {
|
|
258
|
+
class: "fk-video-preview",
|
|
259
|
+
src: e.node.attrs.src,
|
|
260
|
+
controls: "",
|
|
261
|
+
autoplay: ""
|
|
262
|
+
}, null, 8, ee)
|
|
263
|
+
]),
|
|
264
|
+
_: 1
|
|
265
|
+
}, 8, ["visible", "title"]))
|
|
266
|
+
]),
|
|
267
|
+
_: 1
|
|
268
|
+
}, 8, ["class", "data-media-id", "data-drag-handle"]));
|
|
269
|
+
}
|
|
270
|
+
}), le = $.create({
|
|
271
|
+
name: "mediaBlock",
|
|
272
|
+
group: "block",
|
|
273
|
+
atom: !0,
|
|
274
|
+
draggable: !0,
|
|
275
|
+
selectable: !0,
|
|
276
|
+
addOptions() {
|
|
277
|
+
return { sceneStyle: !1 };
|
|
278
|
+
},
|
|
279
|
+
addAttributes() {
|
|
280
|
+
return {
|
|
281
|
+
id: { default: "" },
|
|
282
|
+
nodeVersion: { default: 0 },
|
|
283
|
+
assetId: { default: null },
|
|
284
|
+
sourceType: { default: null },
|
|
285
|
+
src: { default: "" },
|
|
286
|
+
kind: { default: "image" },
|
|
287
|
+
name: { default: "" },
|
|
288
|
+
poster: { default: null },
|
|
289
|
+
status: { default: "ready" },
|
|
290
|
+
error: { default: "" }
|
|
291
|
+
};
|
|
292
|
+
},
|
|
293
|
+
parseHTML() {
|
|
294
|
+
return [
|
|
295
|
+
{
|
|
296
|
+
tag: "figure[data-media-block]",
|
|
297
|
+
getAttrs: (a) => {
|
|
298
|
+
var r, o, d, u;
|
|
299
|
+
return {
|
|
300
|
+
id: a.getAttribute("data-id"),
|
|
301
|
+
kind: a.getAttribute("data-kind"),
|
|
302
|
+
src: ((r = a.querySelector("img,video")) == null ? void 0 : r.getAttribute("src")) || (a.getAttribute("data-source-type") === "qianniuVideo" ? (o = a.querySelector("a[href]")) == null ? void 0 : o.getAttribute("href") : null),
|
|
303
|
+
name: (d = a.querySelector("figcaption")) == null ? void 0 : d.textContent,
|
|
304
|
+
assetId: a.getAttribute("data-asset-id"),
|
|
305
|
+
sourceType: a.getAttribute("data-source-type"),
|
|
306
|
+
poster: (u = a.querySelector("video")) == null ? void 0 : u.getAttribute("poster"),
|
|
307
|
+
status: "ready"
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
},
|
|
313
|
+
renderHTML({ node: a, HTMLAttributes: r }) {
|
|
314
|
+
return [
|
|
315
|
+
"figure",
|
|
316
|
+
B(r, {
|
|
317
|
+
"data-media-block": "",
|
|
318
|
+
"data-fkp-node": "media-block",
|
|
319
|
+
"data-id": a.attrs.id,
|
|
320
|
+
"data-kind": a.attrs.kind,
|
|
321
|
+
"data-asset-id": a.attrs.assetId,
|
|
322
|
+
"data-source-type": a.attrs.sourceType,
|
|
323
|
+
"data-name": a.attrs.name
|
|
324
|
+
}),
|
|
325
|
+
a.attrs.sourceType === "qianniuVideo" ? ["a", { href: a.attrs.src }, a.attrs.src] : a.attrs.kind === "video" ? [
|
|
326
|
+
"video",
|
|
327
|
+
{ src: a.attrs.src, controls: "", poster: a.attrs.poster }
|
|
328
|
+
] : ["img", { src: a.attrs.src, alt: a.attrs.name }],
|
|
329
|
+
["figcaption", {}, a.attrs.name]
|
|
330
|
+
];
|
|
331
|
+
},
|
|
332
|
+
renderText({ node: a }) {
|
|
333
|
+
return a.attrs.sourceType === "qianniuVideo" ? a.attrs.src : `[${a.attrs.kind === "video" ? "视频" : "图片"}:${a.attrs.name}]`;
|
|
334
|
+
},
|
|
335
|
+
addNodeView() {
|
|
336
|
+
return L(te);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
export {
|
|
340
|
+
le as MediaBlock
|
|
341
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { defineComponent as O, ref as v, watch as B, nextTick as N, openBlock as s, createElementBlock as $, Fragment as q, createBlock as k, unref as u, withKeys as c, withModifiers as p, normalizeStyle as H, withCtx as f, renderList as T, createTextVNode as y, toDisplayString as b, createCommentVNode as K, createElementVNode as m, createVNode as M } from "vue";
|
|
2
|
+
import { Menu as U, MenuItem as F, Modal as D, Input as I, Alert as L, Message as j } from "@freecallai/ui";
|
|
3
|
+
import { i as h, o as J } from "./guard-DPwe4mCm.js";
|
|
4
|
+
function R(a, l) {
|
|
5
|
+
const o = a == null ? void 0 : a[l];
|
|
6
|
+
return o === void 0 ? ["local"] : Array.isArray(o) ? [
|
|
7
|
+
...new Set(
|
|
8
|
+
o.filter(
|
|
9
|
+
(n) => n === "local" || n === "online" || l === "video" && n === "qianniu"
|
|
10
|
+
)
|
|
11
|
+
)
|
|
12
|
+
] : [];
|
|
13
|
+
}
|
|
14
|
+
function z(a) {
|
|
15
|
+
const l = (o) => Array.isArray(o) ? `[${o.map((n) => l(n)).join(",")}]` : o && typeof o == "object" ? `{${Object.keys(o).filter((n) => o[n] !== void 0).sort().map(
|
|
16
|
+
(n) => `${JSON.stringify(n)}:${l(
|
|
17
|
+
o[n]
|
|
18
|
+
)}`
|
|
19
|
+
).join(",")}}` : JSON.stringify(o) ?? "null";
|
|
20
|
+
return l(a);
|
|
21
|
+
}
|
|
22
|
+
function Z(a) {
|
|
23
|
+
return z(a);
|
|
24
|
+
}
|
|
25
|
+
const P = ["for"], Q = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "fkp-media-url-error",
|
|
28
|
+
role: "alert"
|
|
29
|
+
}, X = { class: "fkp-qianniu-video-form" }, x = /* @__PURE__ */ O({
|
|
30
|
+
__name: "MediaSourceControls",
|
|
31
|
+
props: {
|
|
32
|
+
menuKind: {},
|
|
33
|
+
dialogKind: {},
|
|
34
|
+
qianniuDialog: { type: Boolean },
|
|
35
|
+
menuStyle: {},
|
|
36
|
+
sources: {}
|
|
37
|
+
},
|
|
38
|
+
emits: ["choose", "submit", "submit-qianniu", "close"],
|
|
39
|
+
setup(a, { emit: l }) {
|
|
40
|
+
const o = a, n = l, r = v(""), g = v(""), d = v(""), w = v();
|
|
41
|
+
B(
|
|
42
|
+
() => o.dialogKind,
|
|
43
|
+
(i) => {
|
|
44
|
+
r.value = "", g.value = "", d.value = "", i && N(() => {
|
|
45
|
+
var e;
|
|
46
|
+
return (e = w.value) == null ? void 0 : e.focus();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
function S() {
|
|
51
|
+
const i = r.value.trim();
|
|
52
|
+
return h(i) ? (d.value = "", n("submit", i), !0) : (d.value = "请输入有效的 http(s) 媒体链接", !1);
|
|
53
|
+
}
|
|
54
|
+
function C() {
|
|
55
|
+
const i = g.value.trim(), e = r.value.trim();
|
|
56
|
+
return !i || !e ? (j.error(
|
|
57
|
+
!i && !e ? "请填写视频ID与链接" : i ? "请填写视频链接" : "请填写视频ID"
|
|
58
|
+
), !1) : J(e) ? (n("submit-qianniu", { id: i, url: e }), !0) : (j.error("不支持此链接格式,请前往千牛素材中心复制"), !1);
|
|
59
|
+
}
|
|
60
|
+
function E() {
|
|
61
|
+
var i;
|
|
62
|
+
(i = w.value) == null || i.focus();
|
|
63
|
+
}
|
|
64
|
+
return (i, e) => (s(), $(q, null, [
|
|
65
|
+
i.menuKind ? (s(), k(u(U), {
|
|
66
|
+
key: 0,
|
|
67
|
+
class: "fkp-media-source-menu",
|
|
68
|
+
style: H(i.menuStyle),
|
|
69
|
+
role: "menu",
|
|
70
|
+
"aria-label": `选择${i.menuKind === "image" ? "图片" : "视频"}来源`,
|
|
71
|
+
onKeydown: e[1] || (e[1] = c(p((t) => n("close"), ["stop"]), ["esc"]))
|
|
72
|
+
}, {
|
|
73
|
+
default: f(() => [
|
|
74
|
+
(s(!0), $(q, null, T(i.sources, (t) => (s(), k(u(F), {
|
|
75
|
+
key: t,
|
|
76
|
+
role: "menuitem",
|
|
77
|
+
tabindex: "0",
|
|
78
|
+
onMousedown: e[0] || (e[0] = p(() => {
|
|
79
|
+
}, ["prevent"])),
|
|
80
|
+
onClick: (V) => n("choose", t),
|
|
81
|
+
onKeydown: [
|
|
82
|
+
c(p((V) => n("choose", t), ["prevent"]), ["enter"]),
|
|
83
|
+
c(p((V) => n("choose", t), ["prevent"]), ["space"])
|
|
84
|
+
]
|
|
85
|
+
}, {
|
|
86
|
+
default: f(() => [
|
|
87
|
+
y(b(t === "qianniu" ? "千牛" : t === "online" ? "在线" : "本地") + b(i.menuKind === "image" ? "图片" : "视频"), 1)
|
|
88
|
+
]),
|
|
89
|
+
_: 2
|
|
90
|
+
}, 1032, ["onClick", "onKeydown"]))), 128))
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
}, 8, ["style", "aria-label"])) : K("", !0),
|
|
94
|
+
i.dialogKind && !i.qianniuDialog ? (s(), k(u(D), {
|
|
95
|
+
key: 1,
|
|
96
|
+
visible: !0,
|
|
97
|
+
title: `添加在线${i.dialogKind === "image" ? "图片" : "视频"}`,
|
|
98
|
+
width: 420,
|
|
99
|
+
"render-to-body": !1,
|
|
100
|
+
"on-before-ok": S,
|
|
101
|
+
"ok-text": "添加",
|
|
102
|
+
role: "dialog",
|
|
103
|
+
"aria-modal": "true",
|
|
104
|
+
"aria-label": `添加在线${i.dialogKind === "image" ? "图片" : "视频"}`,
|
|
105
|
+
onOpen: E,
|
|
106
|
+
onCancel: e[4] || (e[4] = (t) => n("close"))
|
|
107
|
+
}, {
|
|
108
|
+
default: f(() => [
|
|
109
|
+
m("label", {
|
|
110
|
+
class: "fkp-media-url-label",
|
|
111
|
+
for: `fkp-media-url-${i.dialogKind}`
|
|
112
|
+
}, b(i.dialogKind === "image" ? "图片" : "视频") + "链接", 9, P),
|
|
113
|
+
M(u(I), {
|
|
114
|
+
ref_key: "input",
|
|
115
|
+
ref: w,
|
|
116
|
+
modelValue: r.value,
|
|
117
|
+
"onUpdate:modelValue": e[2] || (e[2] = (t) => r.value = t),
|
|
118
|
+
error: !!d.value,
|
|
119
|
+
"input-attrs": { id: `fkp-media-url-${i.dialogKind}`, type: "url" },
|
|
120
|
+
placeholder: "https://example.com/media",
|
|
121
|
+
onInput: e[3] || (e[3] = (t) => d.value = ""),
|
|
122
|
+
onKeydown: c(p(S, ["prevent"]), ["enter"])
|
|
123
|
+
}, null, 8, ["modelValue", "error", "input-attrs", "onKeydown"]),
|
|
124
|
+
d.value ? (s(), $("p", Q, b(d.value), 1)) : K("", !0)
|
|
125
|
+
]),
|
|
126
|
+
_: 1
|
|
127
|
+
}, 8, ["title", "aria-label"])) : K("", !0),
|
|
128
|
+
i.dialogKind === "video" && i.qianniuDialog ? (s(), k(u(D), {
|
|
129
|
+
key: 2,
|
|
130
|
+
visible: !0,
|
|
131
|
+
title: "添加视频",
|
|
132
|
+
width: 600,
|
|
133
|
+
"render-to-body": !1,
|
|
134
|
+
"on-before-ok": C,
|
|
135
|
+
"ok-text": "添加",
|
|
136
|
+
role: "dialog",
|
|
137
|
+
"aria-modal": "true",
|
|
138
|
+
"aria-label": "添加视频",
|
|
139
|
+
onCancel: e[7] || (e[7] = (t) => n("close"))
|
|
140
|
+
}, {
|
|
141
|
+
default: f(() => [
|
|
142
|
+
m("div", X, [
|
|
143
|
+
M(u(L), {
|
|
144
|
+
type: "info",
|
|
145
|
+
"show-icon": !0
|
|
146
|
+
}, {
|
|
147
|
+
default: f(() => e[8] || (e[8] = [
|
|
148
|
+
y("请前往千牛平台「素材中心-我的图片/视频」复制视频ID与链接")
|
|
149
|
+
])),
|
|
150
|
+
_: 1
|
|
151
|
+
}),
|
|
152
|
+
e[9] || (e[9] = m("label", { for: "fkp-qianniu-video-id" }, [
|
|
153
|
+
m("span", { "aria-hidden": "true" }, "*"),
|
|
154
|
+
y(" 视频ID")
|
|
155
|
+
], -1)),
|
|
156
|
+
M(u(I), {
|
|
157
|
+
id: "fkp-qianniu-video-id",
|
|
158
|
+
modelValue: g.value,
|
|
159
|
+
"onUpdate:modelValue": e[5] || (e[5] = (t) => g.value = t),
|
|
160
|
+
placeholder: "请输入视频id"
|
|
161
|
+
}, null, 8, ["modelValue"]),
|
|
162
|
+
e[10] || (e[10] = m("label", { for: "fkp-qianniu-video-url" }, [
|
|
163
|
+
m("span", { "aria-hidden": "true" }, "*"),
|
|
164
|
+
y(" 视频链接")
|
|
165
|
+
], -1)),
|
|
166
|
+
M(u(I), {
|
|
167
|
+
id: "fkp-qianniu-video-url",
|
|
168
|
+
modelValue: r.value,
|
|
169
|
+
"onUpdate:modelValue": e[6] || (e[6] = (t) => r.value = t),
|
|
170
|
+
placeholder: "请输入视频链接"
|
|
171
|
+
}, null, 8, ["modelValue"])
|
|
172
|
+
])
|
|
173
|
+
]),
|
|
174
|
+
_: 1
|
|
175
|
+
})) : K("", !0)
|
|
176
|
+
], 64));
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
function _() {
|
|
180
|
+
const a = v(null);
|
|
181
|
+
function l(n) {
|
|
182
|
+
a.value = n;
|
|
183
|
+
}
|
|
184
|
+
function o(n, r) {
|
|
185
|
+
(n === "image" || n === "video") && !r && (a.value = null);
|
|
186
|
+
}
|
|
187
|
+
return { suppressedMediaHint: a, suppressMediaHint: l, resumeMediaHintOnHover: o };
|
|
188
|
+
}
|
|
189
|
+
const ee = 10, ne = {
|
|
190
|
+
image: 5 * 1024 * 1024,
|
|
191
|
+
video: 100 * 1024 * 1024
|
|
192
|
+
}, ie = {
|
|
193
|
+
image: ["image/png", "image/jpeg"],
|
|
194
|
+
video: ["video/mp4"]
|
|
195
|
+
}, A = {
|
|
196
|
+
png: { kind: "image", mime: "image/png" },
|
|
197
|
+
jpg: { kind: "image", mime: "image/jpeg" },
|
|
198
|
+
jpeg: { kind: "image", mime: "image/jpeg" },
|
|
199
|
+
mp4: { kind: "video", mime: "video/mp4" }
|
|
200
|
+
};
|
|
201
|
+
function oe(a) {
|
|
202
|
+
const l = a.name.lastIndexOf("."), o = l < 0 ? "" : a.name.slice(l + 1).toLowerCase(), n = Object.prototype.hasOwnProperty.call(A, o) ? A[o] : void 0;
|
|
203
|
+
return !n || a.type && a.type.toLowerCase() !== n.mime ? null : n;
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
ee as M,
|
|
207
|
+
x as _,
|
|
208
|
+
oe as a,
|
|
209
|
+
ne as b,
|
|
210
|
+
z as c,
|
|
211
|
+
Z as d,
|
|
212
|
+
ie as e,
|
|
213
|
+
R as m,
|
|
214
|
+
_ as u
|
|
215
|
+
};
|