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