@work-zhanguo/light-file-preview 0.0.4 → 0.0.6
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 +14 -2
- package/dist/{DocxRenderer-B8Ed3qFw.js → DocxRenderer-D0ngcG2T.js} +2 -2
- package/dist/{PdfRenderer-CYtwJLrP.js → PdfRenderer-SICIjXYT.js} +2 -2
- package/dist/{SheetRenderer-C9AKQiKN.js → SheetRenderer-D4Y1dYZX.js} +2 -2
- package/dist/{TextRenderer-W4uPsa5O.js → TextRenderer-KUhpnf63.js} +14 -14
- package/dist/{UnsupportedRenderer-BpyBTIIE.js → UnsupportedRenderer-Y2AgN0-l.js} +1 -1
- package/dist/{docx-preview-B2OPGnfm.js → docx-preview-D_8kC8vU.js} +666 -652
- package/dist/{index-BlBE9ZR-.js → index-DZOrV9D_.js} +86 -85
- package/dist/light-file-preview.js +1 -1
- package/dist/light-file-preview.umd.cjs +29 -29
- package/dist/{marked.esm-toXckLRC.js → marked.esm-CRmQbSOC.js} +15 -15
- package/dist/{pdf-B2JYpzlX.js → pdf-CV932zwQ.js} +1863 -1849
- package/dist/{purify.es-D5dazAgD.js → purify.es-CCmmh-Lt.js} +10 -10
- package/dist/standalone/light-file-preview.iife.js +68 -68
- package/dist/standalone/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/{text-CcxmtFce.js → text-Bqxn_tMI.js} +5 -5
- package/dist/vue2/{DocxRenderer-IkLQeCjg.js → DocxRenderer-D-MItvaP.js} +3 -3
- package/dist/vue2/{PdfRenderer-DmgMRpqS.js → PdfRenderer-rw-3PY9w.js} +3 -3
- package/dist/vue2/{SheetRenderer-CuAyFgj9.js → SheetRenderer-BxfF54Q3.js} +3 -3
- package/dist/vue2/{TextRenderer-Bxqs7APd.js → TextRenderer-DOzgi4YR.js} +14 -14
- package/dist/vue2/{UnsupportedRenderer-Cs2uPl_6.js → UnsupportedRenderer-VozD1bVb.js} +1 -1
- package/dist/vue2/{docx-preview-B2OPGnfm.js → docx-preview-D_8kC8vU.js} +666 -652
- package/dist/vue2/light-file-preview-vue2.js +1 -1
- package/dist/vue2/light-file-preview-vue2.umd.cjs +76 -76
- package/dist/vue2/{marked.esm-toXckLRC.js → marked.esm-CRmQbSOC.js} +15 -15
- package/dist/vue2/{pdf-B2JYpzlX.js → pdf-CV932zwQ.js} +1863 -1849
- package/dist/vue2/{purify.es-D5dazAgD.js → purify.es-CCmmh-Lt.js} +10 -10
- package/dist/vue2/{text-CcxmtFce.js → text-Bqxn_tMI.js} +5 -5
- package/dist/vue2/{vue2-CzAkhodr.js → vue2-rrMAk2-n.js} +119 -118
- package/dist/vue2/{xlsx-CZNBZqms.js → xlsx-j9Zzywas.js} +82 -82
- package/dist/{xlsx-CZNBZqms.js → xlsx-j9Zzywas.js} +82 -82
- package/package.json +4 -2
- package/style.css +1 -0
- package/vue2.js +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as B, g as $, o as E, a as F, b as e, c as t, F as f, h as v, e as w, t as r, f as b, r as k, n as L } from "./vue2-
|
|
2
|
-
import { r as M } from "./text-
|
|
1
|
+
import { d as B, g as $, o as E, a as F, b as e, c as t, F as f, h as v, e as w, t as r, f as b, r as k, n as L } from "./vue2-rrMAk2-n.js";
|
|
2
|
+
import { r as M } from "./text-Bqxn_tMI.js";
|
|
3
3
|
const N = { class: "lfp-document lfp-sheet" }, V = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "lfp-sheet__tabs"
|
|
@@ -22,7 +22,7 @@ const N = { class: "lfp-document lfp-sheet" }, V = {
|
|
|
22
22
|
async function g() {
|
|
23
23
|
m("loading", !0);
|
|
24
24
|
try {
|
|
25
|
-
const l = await M(i.source, y.signal), h = await import("./xlsx-
|
|
25
|
+
const l = await M(i.source, y.signal), h = await import("./xlsx-j9Zzywas.js"), o = h.read(l, { type: "array" });
|
|
26
26
|
c.value = o.SheetNames.map((a) => {
|
|
27
27
|
const n = h.utils.sheet_to_json(o.Sheets[a], {
|
|
28
28
|
header: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as g, g as f, o as h, a as k, b as n, c as a, t as p, e as B, f as w, r as
|
|
2
|
-
import { a as M } from "./text-
|
|
1
|
+
import { d as g, g as f, o as h, a as k, b as n, c as a, t as p, e as B, f as w, r as c } from "./vue2-rrMAk2-n.js";
|
|
2
|
+
import { a as M } from "./text-Bqxn_tMI.js";
|
|
3
3
|
const C = { class: "lfp-document" }, T = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "lfp-hint"
|
|
@@ -15,21 +15,21 @@ const C = { class: "lfp-document" }, T = {
|
|
|
15
15
|
maxBytes: {}
|
|
16
16
|
},
|
|
17
17
|
emits: ["loading", "error"],
|
|
18
|
-
setup(
|
|
19
|
-
const e =
|
|
18
|
+
setup(i, { emit: v }) {
|
|
19
|
+
const e = i, s = v, t = c(""), u = c(!1), d = new AbortController(), r = c(""), m = f(() => e.extension === "md"), y = f(() => e.extension === "json");
|
|
20
20
|
async function x() {
|
|
21
21
|
s("loading", !0);
|
|
22
22
|
try {
|
|
23
|
-
t.value = await M(e.source, e.encoding, e.maxBytes,
|
|
23
|
+
t.value = await M(e.source, e.encoding, e.maxBytes, d.signal);
|
|
24
24
|
const o = typeof e.source == "string" ? t.value.length : e.source.size;
|
|
25
|
-
if (
|
|
25
|
+
if (u.value = o > e.maxBytes, y.value)
|
|
26
26
|
try {
|
|
27
27
|
t.value = JSON.stringify(JSON.parse(t.value), null, 2);
|
|
28
|
-
} catch {
|
|
28
|
+
} catch (l) {
|
|
29
29
|
}
|
|
30
|
-
if (
|
|
31
|
-
const [{ marked:
|
|
32
|
-
r.value = _.sanitize(
|
|
30
|
+
if (m.value) {
|
|
31
|
+
const [{ marked: l }, { default: _ }] = await Promise.all([import("./marked.esm-CRmQbSOC.js"), import("./purify.es-CCmmh-Lt.js")]);
|
|
32
|
+
r.value = _.sanitize(l.parse(t.value));
|
|
33
33
|
} else
|
|
34
34
|
r.value = "";
|
|
35
35
|
} catch (o) {
|
|
@@ -41,10 +41,10 @@ const C = { class: "lfp-document" }, T = {
|
|
|
41
41
|
return h(() => {
|
|
42
42
|
x();
|
|
43
43
|
}), k(() => {
|
|
44
|
-
|
|
45
|
-
}), (o,
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
d.abort();
|
|
45
|
+
}), (o, l) => (n(), a("div", C, [
|
|
46
|
+
u.value ? (n(), a("p", T, "文件较大,当前仅展示前 " + p(Math.round(i.maxBytes / 1024)) + " KB 内容。", 1)) : B("", !0),
|
|
47
|
+
m.value ? (n(), a("article", {
|
|
48
48
|
key: 1,
|
|
49
49
|
class: "lfp-markdown",
|
|
50
50
|
innerHTML: r.value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as n, b as l, c as o, f as t, t as s, u as i, i as r } from "./vue2-
|
|
1
|
+
import { d as n, b as l, c as o, f as t, t as s, u as i, i as r } from "./vue2-rrMAk2-n.js";
|
|
2
2
|
const d = { class: "lfp-empty" }, p = { class: "lfp-hint" }, c = /* @__PURE__ */ n({
|
|
3
3
|
__name: "UnsupportedRenderer",
|
|
4
4
|
props: {
|