@infinilabs/doc-detail 0.0.14 → 0.0.15
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/dist/doc-detail.cjs +3 -3
- package/dist/doc-detail.js +36 -25
- package/package.json +1 -1
- package/src/components/DocDetail/components/Preview/components/Docx/index.tsx +4 -0
- package/src/components/DocDetail/components/Preview/components/Pptx/index.tsx +19 -5
- package/src/components/DocDetail/index.tsx +2 -1
package/dist/doc-detail.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }:root{--color-primary: #1677ff;--color-border: #d9d9d9;--color-primary-bg: #e6f4ff;--color-text-secondary: rgba(0,0,0,.65);--color-bg-layout: #f5f5f5}.dark{--color-primary: #1668dc;--color-border: #424242;--color-primary-bg: #15325b;--color-text-secondary: rgba(255,255,255,.65);--color-bg-layout: #000000}.float-left{float:left}.my-2{margin-top:.5rem;margin-bottom:.5rem}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.children\\:size-4>*{width:1rem;height:1rem}.size-3{width:.75rem;height:.75rem}.size-6{width:1.5rem;height:1.5rem}.size-full\\!{width:100%!important;height:100%!important}.children\\:h-unset\\!>*{height:unset!important}.children\\:w-full\\!>*{width:100%!important}.h-full{height:100%}.w-1\\/2{width:50%}.w-24{width:6rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.rotate-90{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:90deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-scale-y-100{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\\.5{gap:.125rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-row-2{row-gap:.5rem}.overflow-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }:root{--color-primary: #1677ff;--color-border: #d9d9d9;--color-primary-bg: #e6f4ff;--color-text-secondary: rgba(0,0,0,.65);--color-bg-layout: #f5f5f5}.dark{--color-primary: #1668dc;--color-border: #424242;--color-primary-bg: #15325b;--color-text-secondary: rgba(255,255,255,.65);--color-bg-layout: #000000}.float-left{float:left}.my-2{margin-top:.5rem;margin-bottom:.5rem}.ml-2{margin-left:.5rem}.mr-3{margin-right:.75rem}.children\\:size-4>*{width:1rem;height:1rem}.size-3{width:.75rem;height:.75rem}.size-6{width:1.5rem;height:1.5rem}.size-full\\!{width:100%!important;height:100%!important}.children\\:h-unset\\!>*{height:unset!important}.children\\:w-full\\!>*{width:100%!important}.h-full{height:100%}.w-1\\/2{width:50%}.w-24{width:6rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.rotate-90{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:90deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-scale-y-100{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\\.5{gap:.125rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-row-2{row-gap:.5rem}.\\[\\&_\\.pptx-preview-wrapper\\]\\:overflow-hidden .pptx-preview-wrapper,.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}.border{border-width:1px}.border-border{border-color:var(--color-border)}.rounded-lg{border-radius:.5rem}.border-solid{border-style:solid}.bg-black\\/3{background-color:#00000008}.bg-transparent{background-color:transparent}.dark .dark\\:bg-white\\/4{background-color:#ffffff0a}.\\[\\&\\>\\.docx\\]\\:p-0\\!>.docx{padding:0!important}.p-4{padding:1rem}.p-4\\!{padding:1rem!important}.text-3{font-size:.75rem}.text-3\\.5{font-size:.875rem}.text-4\\.5\\/6{font-size:1.125rem;line-height:1.5rem}.text-primary,.hover\\:text-primary:hover{color:var(--color-primary)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@media (max-width: 639.9px){.\\<sm\\:w-full{width:100%}}@keyframes x-markdown-fade-in{0%{opacity:0}to{opacity:1}}.x-markdown{--text-color: inherit;--font-size: inherit;--margin-block: 0 0 1em 0;--td-th-padding: .85em 1em;--pre-th-td-padding: 2px 0;--border-font-weight: 600;--padding-ul-ol: 0 0 0 1em;--margin-ul-ol: 0 0 1em 1.8em;--margin-li: .25em 0;--margin-pre: 1em 0;--padding-code-inline: .2em .4em;--margin-code-inline: 0 .2em;--code-inline-text: .85em;--small-border-radius: 2px;--image-margin: .5em 0;--hr-margin: 1.5em 0;--table-margin: 1em 0;font-size:var(--font-size);line-height:1.5714285714285714;width:100%;color:var(--text-color)}.x-markdown p,.x-markdown div,.x-markdown span,.x-markdown li{word-break:break-word;overflow-wrap:break-word}.x-markdown pre,.x-markdown code{word-break:break-word;overflow-wrap:break-word;white-space:pre-wrap}.x-markdown th,.x-markdown td{padding:var(--td-th-padding)}.x-markdown th{font-weight:var(--border-font-weight)}.x-markdown pre table{box-shadow:none}.x-markdown pre td,.x-markdown pre th{padding:var(--pre-th-td-padding);border:none;text-align:left}.x-markdown p{margin:var(--margin-block)}.x-markdown p:first-child{margin-top:0}.x-markdown p:last-child{margin-bottom:0}.x-markdown ul,.x-markdown ol{margin:var(--margin-ul-ol);padding:var(--padding-ul-ol)}.x-markdown ul:first-child,.x-markdown ol:first-child{margin-top:0}.x-markdown ul:last-child,.x-markdown ol:last-child{margin-bottom:0}.x-markdown ol>li{list-style:decimal}.x-markdown ul>li{list-style:disc}.x-markdown li{margin:var(--margin-li)}.x-markdown li:first-child{margin-top:0}.x-markdown li:last-child{margin-bottom:0}.x-markdown pre{margin:var(--margin-pre);overflow-x:auto}.x-markdown pre:first-child{margin-top:0}.x-markdown pre:last-child{margin-bottom:0}.x-markdown code{padding:var(--padding-code-inline);margin:var(--margin-code-inline);font-size:var(--code-inline-text);border-radius:var(--small-border-radius)}.x-markdown pre code{padding:0;margin:0;font-size:inherit;border-radius:0;line-height:2}.x-markdown img{max-width:100%;height:auto;margin:var(--image-margin)}.x-markdown hr{margin:var(--hr-margin)}.x-markdown table:not(pre){margin:var(--table-margin);border-collapse:collapse;display:block;width:max-content;max-width:100%;overflow:auto}.x-markdown table:not(pre):first-child{margin-top:0}.x-markdown table:not(pre):last-child{margin-bottom:0}.x-markdown .inline-katex .katex-display{display:inline-block;margin:0;text-align:initial;vertical-align:middle}.x-markdown .inline-katex .katex-display>.katex{display:inline-block;text-align:initial;white-space:normal}.x-markdown .inline-katex .katex-display>.katex>.katex-html{display:inline-block;position:static}.x-markdown .inline-katex .katex-display>.katex>.katex-html>.tag{position:static}")),document.head.appendChild(r)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
2
|
var zme = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
@@ -110368,14 +110368,16 @@ async function b7t(t, e, r, n) {
|
|
|
110368
110368
|
const E7t = (t) => {
|
|
110369
110369
|
const { url: e, requestHeaders: r } = t, n = ba(null), a = async () => {
|
|
110370
110370
|
if (!n.current) return;
|
|
110371
|
-
const
|
|
110371
|
+
const i = await fetch(e, {
|
|
110372
110372
|
headers: r
|
|
110373
|
-
})
|
|
110374
|
-
|
|
110373
|
+
});
|
|
110374
|
+
if (!i.ok) return;
|
|
110375
|
+
const s = await i.arrayBuffer();
|
|
110376
|
+
s.byteLength !== 0 && (n.current.innerHTML = "", b7t(s, n.current, void 0, {
|
|
110375
110377
|
inWrapper: !1,
|
|
110376
110378
|
ignoreWidth: !0,
|
|
110377
110379
|
ignoreHeight: !0
|
|
110378
|
-
});
|
|
110380
|
+
}));
|
|
110379
110381
|
};
|
|
110380
110382
|
return Sn(() => {
|
|
110381
110383
|
a();
|
|
@@ -160630,17 +160632,26 @@ function Mir(t, e) {
|
|
|
160630
160632
|
const Pir = (t) => {
|
|
160631
160633
|
const { url: e, requestHeaders: r } = t, n = ba(null), a = async () => {
|
|
160632
160634
|
if (!n.current) return;
|
|
160633
|
-
|
|
160634
|
-
|
|
160635
|
-
|
|
160636
|
-
|
|
160635
|
+
n.current.innerHTML = "";
|
|
160636
|
+
const i = n.current.clientWidth, s = Math.round(i * (9 / 16)), o = Mir(n.current, {
|
|
160637
|
+
width: i,
|
|
160638
|
+
height: s
|
|
160639
|
+
}), l = await fetch(e, {
|
|
160637
160640
|
headers: r
|
|
160638
|
-
})
|
|
160639
|
-
|
|
160641
|
+
});
|
|
160642
|
+
if (!l.ok) return;
|
|
160643
|
+
const u = await l.arrayBuffer();
|
|
160644
|
+
u.byteLength !== 0 && o.preview(u);
|
|
160640
160645
|
};
|
|
160641
160646
|
return Sn(() => {
|
|
160642
160647
|
a();
|
|
160643
|
-
}, [e]), /* @__PURE__ */ yr(
|
|
160648
|
+
}, [e]), /* @__PURE__ */ yr(
|
|
160649
|
+
"div",
|
|
160650
|
+
{
|
|
160651
|
+
ref: n,
|
|
160652
|
+
className: "w-full [&_.pptx-preview-wrapper]:overflow-hidden"
|
|
160653
|
+
}
|
|
160654
|
+
);
|
|
160644
160655
|
};
|
|
160645
160656
|
var zKe = function(t) {
|
|
160646
160657
|
return typeof t == "function";
|
|
@@ -163854,7 +163865,7 @@ const lsr = (t) => {
|
|
|
163854
163865
|
orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
|
|
163855
163866
|
};
|
|
163856
163867
|
}, Jsr = /* @__PURE__ */ Osr(Qsr), $Ie = (...t) => Jsr(za(t)), { Text: GIe } = zB, bBr = (t) => {
|
|
163857
|
-
const { data: e, i18n: r, actionButtons: n,
|
|
163868
|
+
const { data: e, i18n: r, actionButtons: n, requestHeaders: a, className: i, ...s } = t, [o, l] = Zo(!1), u = [
|
|
163858
163869
|
{
|
|
163859
163870
|
label: r?.labels?.type ?? "Type",
|
|
163860
163871
|
value: e?.type
|
|
@@ -163879,8 +163890,8 @@ const lsr = (t) => {
|
|
|
163879
163890
|
return /* @__PURE__ */ Wf(
|
|
163880
163891
|
"div",
|
|
163881
163892
|
{
|
|
163882
|
-
className: $Ie("flex flex-col h-full overflow-hidden",
|
|
163883
|
-
...
|
|
163893
|
+
className: $Ie("flex flex-col h-full overflow-hidden", i),
|
|
163894
|
+
...s,
|
|
163884
163895
|
children: [
|
|
163885
163896
|
/* @__PURE__ */ Wf("div", { children: [
|
|
163886
163897
|
/* @__PURE__ */ yr("img", { src: e?.icon, className: "size-6 mr-3 float-left" }),
|
|
@@ -163906,11 +163917,11 @@ const lsr = (t) => {
|
|
|
163906
163917
|
className: $Ie(
|
|
163907
163918
|
"ml-2 size-3 hover:text-primary transition cursor-pointer",
|
|
163908
163919
|
{
|
|
163909
|
-
"-scale-y-100":
|
|
163920
|
+
"-scale-y-100": o
|
|
163910
163921
|
}
|
|
163911
163922
|
),
|
|
163912
163923
|
onClick: () => {
|
|
163913
|
-
|
|
163924
|
+
l((d) => !d);
|
|
163914
163925
|
}
|
|
163915
163926
|
}
|
|
163916
163927
|
)
|
|
@@ -163925,22 +163936,22 @@ const lsr = (t) => {
|
|
|
163925
163936
|
className: "bg-black/3 dark:bg-white/4 rounded-lg overflow-hidden",
|
|
163926
163937
|
initial: !1,
|
|
163927
163938
|
animate: {
|
|
163928
|
-
height:
|
|
163929
|
-
opacity:
|
|
163930
|
-
marginBottom:
|
|
163939
|
+
height: o ? "auto" : 0,
|
|
163940
|
+
opacity: o ? 1 : 0,
|
|
163941
|
+
marginBottom: o ? "1rem" : 0
|
|
163931
163942
|
},
|
|
163932
|
-
children: /* @__PURE__ */ yr("div", { className: "flex flex-wrap gap-row-2 p-4", children:
|
|
163933
|
-
const { label:
|
|
163943
|
+
children: /* @__PURE__ */ yr("div", { className: "flex flex-wrap gap-row-2 p-4", children: u.map((d) => {
|
|
163944
|
+
const { label: h, value: f } = d;
|
|
163934
163945
|
return /* @__PURE__ */ Wf(
|
|
163935
163946
|
"div",
|
|
163936
163947
|
{
|
|
163937
163948
|
className: "w-1/2 inline-flex items-center <sm:w-full",
|
|
163938
163949
|
children: [
|
|
163939
|
-
/* @__PURE__ */ yr(GIe, { type: "secondary", className: "w-24", children:
|
|
163940
|
-
/* @__PURE__ */ yr("span", { className: "text-3.5", children:
|
|
163950
|
+
/* @__PURE__ */ yr(GIe, { type: "secondary", className: "w-24", children: h }),
|
|
163951
|
+
/* @__PURE__ */ yr("span", { className: "text-3.5", children: f ?? "-" })
|
|
163941
163952
|
]
|
|
163942
163953
|
},
|
|
163943
|
-
|
|
163954
|
+
h
|
|
163944
163955
|
);
|
|
163945
163956
|
}) })
|
|
163946
163957
|
}
|
package/package.json
CHANGED
|
@@ -18,8 +18,12 @@ const Docx: FC<DocxProps> = (props) => {
|
|
|
18
18
|
headers: requestHeaders,
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
if (!response.ok) return;
|
|
22
|
+
|
|
21
23
|
const arrayBuffer = await response.arrayBuffer();
|
|
22
24
|
|
|
25
|
+
if (arrayBuffer.byteLength === 0) return;
|
|
26
|
+
|
|
23
27
|
containerRef.current.innerHTML = "";
|
|
24
28
|
|
|
25
29
|
renderAsync(arrayBuffer, containerRef.current!, void 0, {
|
|
@@ -12,28 +12,42 @@ const Pptx: FC<PptxProps> = (props) => {
|
|
|
12
12
|
|
|
13
13
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const renderPptx = async () => {
|
|
16
16
|
if (!containerRef.current) return;
|
|
17
17
|
|
|
18
|
+
containerRef.current.innerHTML = "";
|
|
19
|
+
|
|
20
|
+
const width = containerRef.current.clientWidth;
|
|
21
|
+
const height = Math.round(width * (9 / 16));
|
|
22
|
+
|
|
18
23
|
const pptx = init(containerRef.current, {
|
|
19
|
-
width
|
|
20
|
-
height
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
21
26
|
});
|
|
22
27
|
|
|
23
28
|
const response = await fetch(url, {
|
|
24
29
|
headers: requestHeaders,
|
|
25
30
|
});
|
|
26
31
|
|
|
32
|
+
if (!response.ok) return;
|
|
33
|
+
|
|
27
34
|
const arrayBuffer = await response.arrayBuffer();
|
|
28
35
|
|
|
36
|
+
if (arrayBuffer.byteLength === 0) return;
|
|
37
|
+
|
|
29
38
|
pptx.preview(arrayBuffer);
|
|
30
39
|
};
|
|
31
40
|
|
|
32
41
|
useEffect(() => {
|
|
33
|
-
|
|
42
|
+
renderPptx();
|
|
34
43
|
}, [url]);
|
|
35
44
|
|
|
36
|
-
return
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
ref={containerRef}
|
|
48
|
+
className="w-full [&_.pptx-preview-wrapper]:(overflow-hidden)"
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
37
51
|
};
|
|
38
52
|
|
|
39
53
|
export default Pptx;
|
|
@@ -79,7 +79,8 @@ export interface DocDetailProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
const DocDetail: FC<DocDetailProps> = (props) => {
|
|
82
|
-
const { data, i18n, actionButtons, className, ...rest } =
|
|
82
|
+
const { data, i18n, actionButtons, requestHeaders, className, ...rest } =
|
|
83
|
+
props;
|
|
83
84
|
|
|
84
85
|
const [expandMore, setExpandMore] = useState(false);
|
|
85
86
|
|