@eternalheart/vue-file-preview 1.6.4 → 1.6.5
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/lib/chunks/{index-BjLnlWld.mjs → index-5bftazEI.mjs} +44 -45
- package/lib/chunks/{index-BW6Z1etg.mjs → index-BFZyrk0b.mjs} +20 -20
- package/lib/chunks/index-Bjh8pgvO.mjs +105 -0
- package/lib/chunks/index-Bso3kiuo.mjs +48 -0
- package/lib/chunks/{index-RshnMles.mjs → index-BujnNIdi.mjs} +213 -207
- package/lib/chunks/index-C4x3R4P6.mjs +320 -0
- package/lib/chunks/{index-CAM2s3GD.mjs → index-CDdmBvY6.mjs} +19 -19
- package/lib/chunks/{index-BkpKhifq.mjs → index-CH0gyinl.mjs} +15 -15
- package/lib/chunks/{index-Ccdi178q.mjs → index-COciDyvJ.mjs} +77 -77
- package/lib/chunks/{index-Df8-y_Ok.mjs → index-CVQmCNmf.mjs} +18 -18
- package/lib/chunks/{index-Dl0SQhkc.mjs → index-CaChuF62.mjs} +25 -25
- package/lib/chunks/{index-ntrMGZWG.mjs → index-CmUWVGTa.mjs} +15 -15
- package/lib/chunks/{index-Ck-FSxNL.mjs → index-DA_KAGO4.mjs} +21 -21
- package/lib/chunks/{index-C9ju7INJ.mjs → index-DLHCSwf3.mjs} +26 -26
- package/lib/chunks/{index-CbEYsjU9.mjs → index-DR87l2gD.mjs} +50 -50
- package/lib/chunks/{index-CyXt4Rjo.mjs → index-DezBKYfu.mjs} +1 -1
- package/lib/chunks/index-DjgGNQ_1.mjs +49 -0
- package/lib/chunks/{index-CNVufPKA.mjs → index-Do_q3F1Q.mjs} +1 -1
- package/lib/chunks/{index-DnmsSoFY.mjs → index-Dq541Zfu.mjs} +1 -1
- package/lib/chunks/{index-CeCl4UNc.mjs → index-DwHqKJVc.mjs} +3746 -1100
- package/lib/chunks/{index-Cyps3Pjb.mjs → index-e0CU-cuJ.mjs} +131 -129
- package/lib/chunks/{index-DHAH_W8y.mjs → index-yvSDwlVY.mjs} +26 -26
- package/lib/chunks/{useShikiHighlight-D2eoQi-e.mjs → useShikiHighlight-CMxdbY5k.mjs} +5 -5
- package/lib/index.cjs +78 -48
- package/lib/index.css +1 -1
- package/lib/index.mjs +7 -7
- package/lib/renderers/Doc/index.vue.d.ts +9 -0
- package/lib/renderers/Ppt/index.vue.d.ts +9 -0
- package/lib/renderers/lazy.d.ts +2 -0
- package/package.json +2 -2
- package/lib/chunks/index-Bts2l6ss.mjs +0 -300
- package/lib/chunks/index-DXECkJ55.mjs +0 -106
package/README.md
CHANGED
|
@@ -264,9 +264,9 @@ Differences from `FilePreviewModal`:
|
|
|
264
264
|
|
|
265
265
|
### Documents
|
|
266
266
|
- **PDF**: Pagination, zoom
|
|
267
|
-
- **Word**: DOCX
|
|
268
|
-
- **Excel**: XLSX
|
|
269
|
-
- **PowerPoint**: PPTX
|
|
267
|
+
- **Word**: DOCX and legacy DOC (97–2003) support
|
|
268
|
+
- **Excel**: XLSX and legacy XLS (97–2003) support
|
|
269
|
+
- **PowerPoint**: PPTX and legacy PPT (97–2003) slide preview
|
|
270
270
|
|
|
271
271
|
### Fonts
|
|
272
272
|
- **Formats**: TTF, OTF, WOFF, WOFF2
|
package/README.zh-CN.md
CHANGED
|
@@ -264,9 +264,9 @@ const files = [
|
|
|
264
264
|
|
|
265
265
|
### 文档
|
|
266
266
|
- **PDF**: 分页浏览、缩放
|
|
267
|
-
- **Word**: DOCX
|
|
268
|
-
- **Excel**: XLSX
|
|
269
|
-
- **PowerPoint**: PPTX
|
|
267
|
+
- **Word**: DOCX 与旧版 DOC(97–2003)支持
|
|
268
|
+
- **Excel**: XLSX 与旧版 XLS(97–2003)支持
|
|
269
|
+
- **PowerPoint**: PPTX 与旧版 PPT(97–2003)幻灯片预览
|
|
270
270
|
|
|
271
271
|
### 字体
|
|
272
272
|
- **格式**: TTF, OTF, WOFF, WOFF2
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { defineComponent as E, ref as p, onMounted as D, watch as M, onBeforeUnmount as z, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as B, unref as _, createCommentVNode as w, createBlock as S, normalizeStyle as
|
|
2
|
-
import
|
|
3
|
-
import { S as
|
|
4
|
-
import { u as
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as E, ref as p, onMounted as D, watch as M, onBeforeUnmount as z, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as B, unref as _, createCommentVNode as w, createBlock as S, normalizeStyle as C } from "vue";
|
|
2
|
+
import W from "exceljs";
|
|
3
|
+
import { S as H } from "./index-CyBXARuf.mjs";
|
|
4
|
+
import { u as R, b as G, C as L, s as F, y as N, g as O } from "./index-DwHqKJVc.mjs";
|
|
5
|
+
import { _ as V } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
6
|
+
const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, j = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
9
|
-
},
|
|
9
|
+
}, q = { class: "vfp-text-center" }, A = { class: "vfp-text-xs md:vfp-text-sm vfp-text-fg-secondary vfp-font-medium" }, X = /* @__PURE__ */ E({
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
12
12
|
url: {}
|
|
13
13
|
},
|
|
14
14
|
setup(y, { expose: k }) {
|
|
15
|
-
const
|
|
16
|
-
let
|
|
15
|
+
const g = y, { t: i } = R(), T = G(), o = p(!0), l = p(null), r = p(null);
|
|
16
|
+
let a = null, f = null, n = null, u = { width: 0, height: 0 };
|
|
17
17
|
const d = () => {
|
|
18
18
|
if (!r.value) return { width: 800, height: 600 };
|
|
19
|
-
const e = r.value.clientWidth, t = r.value.clientHeight,
|
|
20
|
-
return { width:
|
|
21
|
-
},
|
|
22
|
-
if (!r.value || !
|
|
19
|
+
const e = r.value.clientWidth, t = r.value.clientHeight, s = e > 100 ? e : 800, c = t > 100 ? t : 600;
|
|
20
|
+
return { width: s, height: c };
|
|
21
|
+
}, x = () => {
|
|
22
|
+
if (!r.value || !a) return;
|
|
23
23
|
r.value.innerHTML = "";
|
|
24
|
-
const { width: e, height: t } = d(),
|
|
25
|
-
new
|
|
24
|
+
const { width: e, height: t } = d(), s = e < 640;
|
|
25
|
+
new H(r.value, {
|
|
26
26
|
mode: "read",
|
|
27
27
|
showToolbar: !1,
|
|
28
28
|
showContextmenu: !1,
|
|
@@ -33,72 +33,71 @@ const I = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
|
|
|
33
33
|
},
|
|
34
34
|
col: {
|
|
35
35
|
len: 26,
|
|
36
|
-
width:
|
|
37
|
-
indexWidth:
|
|
38
|
-
minWidth:
|
|
36
|
+
width: s ? 80 : 100,
|
|
37
|
+
indexWidth: s ? 40 : 60,
|
|
38
|
+
minWidth: s ? 40 : 60
|
|
39
39
|
},
|
|
40
40
|
view: {
|
|
41
41
|
height: () => t,
|
|
42
42
|
width: () => e
|
|
43
43
|
}
|
|
44
|
-
}).loadData(
|
|
45
|
-
},
|
|
44
|
+
}).loadData(a);
|
|
45
|
+
}, b = async () => {
|
|
46
46
|
if (r.value) {
|
|
47
|
-
|
|
47
|
+
o.value = !0, l.value = null;
|
|
48
48
|
try {
|
|
49
|
-
const e = await T.value(
|
|
49
|
+
const e = await T.value(g.url, {
|
|
50
50
|
mode: "cors",
|
|
51
51
|
credentials: "omit",
|
|
52
52
|
redirect: "follow"
|
|
53
53
|
});
|
|
54
54
|
if (!e.ok)
|
|
55
|
-
throw e.status === 404 ? new Error(
|
|
55
|
+
throw e.status === 404 ? new Error(i.value("xlsx.not_found")) : e.status === 403 ? new Error("无权限访问此文件") : new Error(`文件加载失败 (${e.status})`);
|
|
56
56
|
const t = await e.arrayBuffer();
|
|
57
57
|
if (t.byteLength === 0)
|
|
58
58
|
throw new Error("文件为空");
|
|
59
|
-
|
|
60
|
-
await o.xlsx.load(t), n = L(o), b(), s.value = !1;
|
|
59
|
+
a = L(t) ? F(N(t)) : O(await new W.Workbook().xlsx.load(t)), x(), o.value = !1;
|
|
61
60
|
} catch (e) {
|
|
62
61
|
console.error("Excel 解析错误:", e);
|
|
63
|
-
let t =
|
|
64
|
-
e instanceof Error && (t = e.message), l.value = t,
|
|
62
|
+
let t = i.value("xlsx.parse_failed");
|
|
63
|
+
e instanceof Error && (t = e.message), l.value = t, o.value = !1;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
};
|
|
68
67
|
return D(() => {
|
|
69
68
|
if (!r.value) return;
|
|
70
69
|
let e = !0;
|
|
71
|
-
|
|
70
|
+
f = new ResizeObserver(() => {
|
|
72
71
|
if (e) {
|
|
73
|
-
e = !1,
|
|
72
|
+
e = !1, u = d();
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
76
|
-
const t = d(),
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const t = d(), s = Math.abs(u.width - t.width), c = Math.abs(u.height - t.height);
|
|
76
|
+
s < 10 && c < 10 || (u = t, n !== null && clearTimeout(n), n = window.setTimeout(() => {
|
|
77
|
+
a && x();
|
|
79
78
|
}, 500));
|
|
80
|
-
}),
|
|
81
|
-
requestAnimationFrame(() =>
|
|
79
|
+
}), f.observe(r.value), setTimeout(() => {
|
|
80
|
+
requestAnimationFrame(() => b());
|
|
82
81
|
}, 100);
|
|
83
82
|
}), M(
|
|
84
|
-
() =>
|
|
83
|
+
() => g.url,
|
|
85
84
|
(e) => {
|
|
86
|
-
e &&
|
|
85
|
+
e && b();
|
|
87
86
|
}
|
|
88
87
|
), z(() => {
|
|
89
|
-
|
|
88
|
+
f && f.disconnect(), n !== null && clearTimeout(n), a = null, r.value && (r.value.innerHTML = "");
|
|
90
89
|
}), k({
|
|
91
90
|
getToolbarGroups: () => []
|
|
92
|
-
}), (e, t) => (v(), h("div",
|
|
93
|
-
|
|
94
|
-
m("div",
|
|
91
|
+
}), (e, t) => (v(), h("div", $, [
|
|
92
|
+
o.value ? (v(), h("div", j, [
|
|
93
|
+
m("div", q, [
|
|
95
94
|
t[0] || (t[0] = m("div", { class: "vfp-w-10 vfp-h-10 md:vfp-w-12 md:vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)),
|
|
96
|
-
m("p",
|
|
95
|
+
m("p", A, B(_(i)("xlsx.loading")), 1)
|
|
97
96
|
])
|
|
98
97
|
])) : w("", !0),
|
|
99
|
-
l.value && !
|
|
98
|
+
l.value && !o.value ? (v(), S(V, {
|
|
100
99
|
key: 1,
|
|
101
|
-
message: _(
|
|
100
|
+
message: _(i)("xlsx.load_failed"),
|
|
102
101
|
detail: l.value,
|
|
103
102
|
class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
|
|
104
103
|
}, null, 8, ["message", "detail"])) : w("", !0),
|
|
@@ -107,11 +106,11 @@ const I = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
|
|
|
107
106
|
ref_key: "containerRef",
|
|
108
107
|
ref: r,
|
|
109
108
|
class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
|
|
110
|
-
style:
|
|
109
|
+
style: C({ opacity: o.value ? 0 : 1 })
|
|
111
110
|
}, null, 4))
|
|
112
111
|
]));
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
114
|
export {
|
|
116
|
-
|
|
115
|
+
X as default
|
|
117
116
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as V,
|
|
1
|
+
import { defineComponent as $, ref as y, watch as G, computed as h, openBlock as a, createElementBlock as r, createElementVNode as e, createBlock as S, unref as u, normalizeClass as x, Fragment as g, renderList as k, toDisplayString as o, createCommentVNode as T } from "vue";
|
|
2
|
+
import { u as V, b as j, M as z, $ as d, e as A, _ as D } from "./index-DwHqKJVc.mjs";
|
|
3
3
|
import { _ as I } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
|
-
const
|
|
4
|
+
const O = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-bg-[#0f0f12]"
|
|
7
|
-
},
|
|
7
|
+
}, R = { class: "content-scroll" }, X = { class: "timeline" }, Y = { class: "cues" }, q = { class: "cue-meta" }, H = { class: "cue-time" }, J = { class: "cue-time" }, K = { class: "cue-id" }, P = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "cue-style"
|
|
10
10
|
}, Q = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "cue-words"
|
|
13
|
-
}, U = ["title"], W = { class: "cue-word-time" }, Z = { class: "cue-word-text" }, ee = { class: "status-pill" }, se = /* @__PURE__ */
|
|
13
|
+
}, U = ["title"], W = { class: "cue-word-time" }, Z = { class: "cue-word-text" }, ee = { class: "status-pill" }, se = /* @__PURE__ */ $({
|
|
14
14
|
__name: "index",
|
|
15
15
|
props: {
|
|
16
16
|
url: {},
|
|
17
17
|
fileName: {}
|
|
18
18
|
},
|
|
19
19
|
setup(B, { expose: C }) {
|
|
20
|
-
const
|
|
20
|
+
const p = B, { t: c } = V(), F = j(), v = y(""), f = y(!0), i = y(null), N = {
|
|
21
21
|
srt: "srt",
|
|
22
22
|
vtt: "vtt",
|
|
23
23
|
lrc: "lrc",
|
|
@@ -26,15 +26,15 @@ const R = {
|
|
|
26
26
|
ssa: "ssa",
|
|
27
27
|
ttml: "ttml",
|
|
28
28
|
dfxp: "ttml"
|
|
29
|
-
},
|
|
29
|
+
}, E = (t) => {
|
|
30
30
|
var l;
|
|
31
31
|
const s = ((l = t.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
32
|
-
return
|
|
32
|
+
return N[s];
|
|
33
33
|
};
|
|
34
|
-
G(() =>
|
|
34
|
+
G(() => p.url, async () => {
|
|
35
35
|
f.value = !0, i.value = null;
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
v.value = await A(p.url, { fetcher: F.value });
|
|
38
38
|
} catch (t) {
|
|
39
39
|
console.error(t), i.value = c.value("subtitle.load_failed");
|
|
40
40
|
} finally {
|
|
@@ -42,9 +42,9 @@ const R = {
|
|
|
42
42
|
}
|
|
43
43
|
}, { immediate: !0 });
|
|
44
44
|
const n = h(() => {
|
|
45
|
-
if (!
|
|
45
|
+
if (!v.value) return null;
|
|
46
46
|
try {
|
|
47
|
-
return z(
|
|
47
|
+
return z(v.value, E(p.fileName));
|
|
48
48
|
} catch (t) {
|
|
49
49
|
return console.error(t), null;
|
|
50
50
|
}
|
|
@@ -54,10 +54,10 @@ const R = {
|
|
|
54
54
|
}), b = h(() => {
|
|
55
55
|
var t;
|
|
56
56
|
return ((t = n.value) == null ? void 0 : t.metadata) ?? {};
|
|
57
|
-
}),
|
|
57
|
+
}), L = (t) => d(t).slice(3, 8);
|
|
58
58
|
return C({
|
|
59
59
|
getToolbarGroups: () => []
|
|
60
|
-
}), (t, s) => f.value ? (a(), r("div",
|
|
60
|
+
}), (t, s) => f.value ? (a(), r("div", O, [...s[0] || (s[0] = [
|
|
61
61
|
e("div", { class: "vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)
|
|
62
62
|
])])) : i.value || !n.value ? (a(), S(I, {
|
|
63
63
|
key: 1,
|
|
@@ -67,10 +67,10 @@ const R = {
|
|
|
67
67
|
key: 2,
|
|
68
68
|
class: x(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]", m.value ? "flavor-lyric" : "flavor-subtitle"])
|
|
69
69
|
}, [
|
|
70
|
-
e("div",
|
|
71
|
-
e("div",
|
|
70
|
+
e("div", R, [
|
|
71
|
+
e("div", X, [
|
|
72
72
|
s[3] || (s[3] = e("div", { class: "timeline-line" }, null, -1)),
|
|
73
|
-
e("ol",
|
|
73
|
+
e("ol", Y, [
|
|
74
74
|
(a(!0), r(g, null, k(n.value.cues, (l, w) => (a(), r("li", {
|
|
75
75
|
key: "cue-" + w,
|
|
76
76
|
class: "cue-row"
|
|
@@ -84,12 +84,12 @@ const R = {
|
|
|
84
84
|
l.style ? (a(), r("span", P, o(l.style), 1)) : T("", !0)
|
|
85
85
|
]),
|
|
86
86
|
l.words && l.words.length > 0 ? (a(), r("div", Q, [
|
|
87
|
-
(a(!0), r(g, null, k(l.words, (_,
|
|
88
|
-
key: "w-" +
|
|
87
|
+
(a(!0), r(g, null, k(l.words, (_, M) => (a(), r("span", {
|
|
88
|
+
key: "w-" + M,
|
|
89
89
|
class: "cue-word",
|
|
90
90
|
title: u(d)(_.start)
|
|
91
91
|
}, [
|
|
92
|
-
e("span", W, o(
|
|
92
|
+
e("span", W, o(L(_.start)), 1),
|
|
93
93
|
e("span", Z, o(_.text), 1)
|
|
94
94
|
], 8, U))), 128))
|
|
95
95
|
])) : (a(), r("p", {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineComponent as L, ref as a, watch as _, nextTick as M, computed as y, openBlock as s, createElementBlock as c, createElementVNode as f, createBlock as $, normalizeStyle as p, Fragment as N, renderList as j } from "vue";
|
|
2
|
+
import I from "mammoth";
|
|
3
|
+
import { u as F, b as X, X as C, j as R, B as q } from "./index-DwHqKJVc.mjs";
|
|
4
|
+
import { _ as z } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
5
|
+
const O = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
|
|
8
|
+
}, U = {
|
|
9
|
+
key: 2,
|
|
10
|
+
class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
11
|
+
style: { background: "rgba(0, 0, 0, 0.15)" }
|
|
12
|
+
}, V = ["innerHTML"], W = ["innerHTML"], b = 1123, w = 60, T = 50, Y = 24, te = /* @__PURE__ */ L({
|
|
13
|
+
__name: "index",
|
|
14
|
+
props: {
|
|
15
|
+
url: {}
|
|
16
|
+
},
|
|
17
|
+
setup(k, { expose: E }) {
|
|
18
|
+
const G = b - w * 2, m = k, { t: H } = F(), A = X(), r = a(""), v = a(!0), u = a(null), l = a([]), d = a({}), h = a(null), P = async () => {
|
|
19
|
+
v.value = !0, u.value = null, r.value = "", l.value = [], d.value = {};
|
|
20
|
+
try {
|
|
21
|
+
const e = await A.value(m.url);
|
|
22
|
+
if (!e.ok) throw new Error("文件加载失败");
|
|
23
|
+
const n = await e.arrayBuffer(), [t, o] = await Promise.all([
|
|
24
|
+
I.convertToHtml({ arrayBuffer: n }, { styleMap: R }),
|
|
25
|
+
q(n).catch(() => ({}))
|
|
26
|
+
]);
|
|
27
|
+
d.value = o, r.value = t.value;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.error("Docx 解析错误:", e), u.value = H.value("docx.parse_failed");
|
|
30
|
+
} finally {
|
|
31
|
+
v.value = !1;
|
|
32
|
+
}
|
|
33
|
+
}, B = () => {
|
|
34
|
+
const e = h.value;
|
|
35
|
+
if (!e || !r.value) return;
|
|
36
|
+
const n = Array.from(e.children);
|
|
37
|
+
if (n.length === 0) {
|
|
38
|
+
l.value = [r.value];
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const t = [[]];
|
|
42
|
+
let o = 0;
|
|
43
|
+
for (const i of n) {
|
|
44
|
+
const g = i.offsetHeight;
|
|
45
|
+
o > 0 && o + g > G && (t.push([]), o = 0), t[t.length - 1].push(i.outerHTML), o += g;
|
|
46
|
+
}
|
|
47
|
+
t.length === 0 && t.push([]), l.value = t.map((i) => i.join(""));
|
|
48
|
+
};
|
|
49
|
+
_(() => m.url, (e) => {
|
|
50
|
+
e && P();
|
|
51
|
+
}, { immediate: !0 }), _(r, async () => {
|
|
52
|
+
r.value && (await M(), requestAnimationFrame(() => B()));
|
|
53
|
+
});
|
|
54
|
+
const x = y(() => C(d.value)), S = y(() => ({
|
|
55
|
+
...x.value,
|
|
56
|
+
position: "absolute",
|
|
57
|
+
visibility: "hidden",
|
|
58
|
+
width: `${794 - T * 2}px`,
|
|
59
|
+
pointerEvents: "none"
|
|
60
|
+
})), D = {
|
|
61
|
+
width: "100%",
|
|
62
|
+
maxWidth: "794px",
|
|
63
|
+
minHeight: `${b}px`,
|
|
64
|
+
background: "white",
|
|
65
|
+
boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)",
|
|
66
|
+
flexShrink: 0,
|
|
67
|
+
padding: `${w}px ${T}px`
|
|
68
|
+
};
|
|
69
|
+
return E({
|
|
70
|
+
getToolbarGroups: () => []
|
|
71
|
+
}), (e, n) => v.value ? (s(), c("div", O, [...n[0] || (n[0] = [
|
|
72
|
+
f("div", { class: "vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)
|
|
73
|
+
])])) : u.value ? (s(), $(z, {
|
|
74
|
+
key: 1,
|
|
75
|
+
message: u.value
|
|
76
|
+
}, null, 8, ["message"])) : (s(), c("div", U, [
|
|
77
|
+
f("div", {
|
|
78
|
+
ref_key: "measureRef",
|
|
79
|
+
ref: h,
|
|
80
|
+
style: p(S.value),
|
|
81
|
+
innerHTML: r.value
|
|
82
|
+
}, null, 12, V),
|
|
83
|
+
f("div", {
|
|
84
|
+
class: "vfp-flex vfp-flex-col vfp-items-center",
|
|
85
|
+
style: p({ gap: `${Y}px` })
|
|
86
|
+
}, [
|
|
87
|
+
(s(!0), c(N, null, j(l.value.length > 0 ? l.value : [""], (t, o) => (s(), c("div", {
|
|
88
|
+
key: o,
|
|
89
|
+
style: p({
|
|
90
|
+
...D,
|
|
91
|
+
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 20px rgba(0, 0, 0, 0.10)"
|
|
92
|
+
})
|
|
93
|
+
}, [
|
|
94
|
+
f("div", {
|
|
95
|
+
style: p(x.value),
|
|
96
|
+
innerHTML: t
|
|
97
|
+
}, null, 12, W)
|
|
98
|
+
], 4))), 128))
|
|
99
|
+
], 4)
|
|
100
|
+
]));
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export {
|
|
104
|
+
te as default
|
|
105
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineComponent as m, ref as a, watch as _, openBlock as s, createElementBlock as f, createElementVNode as p, createBlock as h } from "vue";
|
|
2
|
+
import { u as w, b as y, S as g } from "./index-DwHqKJVc.mjs";
|
|
3
|
+
import { _ as b } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
|
+
const k = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
|
|
7
|
+
}, x = {
|
|
8
|
+
key: 2,
|
|
9
|
+
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
10
|
+
}, T = ["innerHTML"], L = /* @__PURE__ */ m({
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
url: {}
|
|
14
|
+
},
|
|
15
|
+
setup(u, { expose: v }) {
|
|
16
|
+
const n = u, { t: c } = w(), i = y(), t = a(""), o = a(!0), r = a(null), d = async () => {
|
|
17
|
+
o.value = !0, r.value = null, t.value = "";
|
|
18
|
+
try {
|
|
19
|
+
const e = await i.value(n.url);
|
|
20
|
+
if (!e.ok) throw new Error("load failed");
|
|
21
|
+
const l = await e.arrayBuffer();
|
|
22
|
+
t.value = await g(l);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error("Ppt 解析错误:", e), r.value = c.value("ppt.parse_failed");
|
|
25
|
+
} finally {
|
|
26
|
+
o.value = !1;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return _(() => n.url, (e) => {
|
|
30
|
+
e && d();
|
|
31
|
+
}, { immediate: !0 }), v({
|
|
32
|
+
getToolbarGroups: () => []
|
|
33
|
+
}), (e, l) => o.value ? (s(), f("div", k, [...l[0] || (l[0] = [
|
|
34
|
+
p("div", { class: "vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)
|
|
35
|
+
])])) : r.value ? (s(), h(b, {
|
|
36
|
+
key: 1,
|
|
37
|
+
message: r.value
|
|
38
|
+
}, null, 8, ["message"])) : (s(), f("div", x, [
|
|
39
|
+
p("div", {
|
|
40
|
+
class: "vfp-legacy-ppt-wrap",
|
|
41
|
+
innerHTML: t.value
|
|
42
|
+
}, null, 8, T)
|
|
43
|
+
]));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
L as default
|
|
48
|
+
};
|