@mxmweb/fviewer 1.5.4 → 1.5.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 +155 -506
- package/core/Fviewer.d.ts +1 -0
- package/core/PdfRender/index.d.ts +1 -0
- package/index.js +1020 -844
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/stats.html +1 -1
- package/examples/CoreReader/index.d.ts +0 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import n, { useRef as
|
|
2
|
-
import
|
|
1
|
+
import n, { useRef as O, useState as z, useCallback as $, useEffect as te, forwardRef as ve, createElement as Ee } from "react";
|
|
2
|
+
import J from "styled-components";
|
|
3
3
|
import { Markdownit as we, DataType as ye } from "@mxmweb/rtext";
|
|
4
4
|
import * as re from "pdfjs-dist";
|
|
5
5
|
const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, ke = ({
|
|
@@ -8,62 +8,62 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
8
8
|
isAnnotating: o,
|
|
9
9
|
annotations: u = [],
|
|
10
10
|
onAnnotationAdd: r,
|
|
11
|
-
onAnnotationDelete:
|
|
12
|
-
readOnly:
|
|
11
|
+
onAnnotationDelete: i,
|
|
12
|
+
readOnly: v = !1
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
(
|
|
16
|
-
if (!o || !
|
|
17
|
-
const
|
|
18
|
-
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX:
|
|
14
|
+
const f = O(null), [s, h] = z(!1), [p, B] = z({ x: 0, y: 0 }), [w, x] = z(null), [C, l] = z(null), F = $(
|
|
15
|
+
(d) => {
|
|
16
|
+
if (!o || !f.current) return;
|
|
17
|
+
const y = f.current.getBoundingClientRect(), g = (d.clientX - y.left) / y.width, I = (d.clientY - y.top) / y.height;
|
|
18
|
+
console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:", { clientX: d.clientX, clientY: d.clientY, rect: y, x: g, y: I, scale: t }), h(!0), B({ x: g, y: I });
|
|
19
19
|
},
|
|
20
20
|
[o, t]
|
|
21
|
-
),
|
|
22
|
-
(
|
|
23
|
-
if (!
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
x: Math.min(
|
|
27
|
-
y: Math.min(
|
|
28
|
-
width: Math.abs(
|
|
29
|
-
height: Math.abs(
|
|
21
|
+
), b = $(
|
|
22
|
+
(d) => {
|
|
23
|
+
if (!s || !f.current) return;
|
|
24
|
+
const y = f.current.getBoundingClientRect(), g = (d.clientX - y.left) / y.width, I = (d.clientY - y.top) / y.height;
|
|
25
|
+
x({
|
|
26
|
+
x: Math.min(p.x, g),
|
|
27
|
+
y: Math.min(p.y, I),
|
|
28
|
+
width: Math.abs(g - p.x),
|
|
29
|
+
height: Math.abs(I - p.y)
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
|
-
[
|
|
33
|
-
),
|
|
34
|
-
if (!
|
|
35
|
-
if (
|
|
36
|
-
|
|
32
|
+
[s, p, t]
|
|
33
|
+
), S = $(() => {
|
|
34
|
+
if (!s || !w) return;
|
|
35
|
+
if (h(!1), w.width < 5 || w.height < 5) {
|
|
36
|
+
x(null);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const d = {
|
|
40
40
|
id: Be(),
|
|
41
41
|
pageNumber: e,
|
|
42
|
-
...
|
|
42
|
+
...w,
|
|
43
43
|
content: "",
|
|
44
44
|
color: De
|
|
45
45
|
};
|
|
46
|
-
r == null || r(
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
return
|
|
51
|
-
const
|
|
52
|
-
...
|
|
53
|
-
content:
|
|
46
|
+
r == null || r(d), x(null);
|
|
47
|
+
}, [s, w, e, r]), M = $((d) => {
|
|
48
|
+
l(C === d ? null : d);
|
|
49
|
+
}, [C]);
|
|
50
|
+
return $((d, y) => {
|
|
51
|
+
const g = {
|
|
52
|
+
...d,
|
|
53
|
+
content: y
|
|
54
54
|
};
|
|
55
|
-
r == null || r(
|
|
56
|
-
}, [r]),
|
|
57
|
-
|
|
58
|
-
}, [
|
|
55
|
+
r == null || r(g);
|
|
56
|
+
}, [r]), $((d) => {
|
|
57
|
+
i == null || i(d), l(null);
|
|
58
|
+
}, [i]), console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:", {
|
|
59
59
|
pageNumber: e,
|
|
60
60
|
annotations: u.length,
|
|
61
|
-
currentPageAnnotationsCount: u.filter((
|
|
62
|
-
currentPageAnnotations: u.filter((
|
|
61
|
+
currentPageAnnotationsCount: u.filter((d) => d.pageNumber === e).length,
|
|
62
|
+
currentPageAnnotations: u.filter((d) => d.pageNumber === e)
|
|
63
63
|
}), /* @__PURE__ */ n.createElement(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
|
-
ref:
|
|
66
|
+
ref: f,
|
|
67
67
|
style: {
|
|
68
68
|
position: "absolute",
|
|
69
69
|
top: 0,
|
|
@@ -74,24 +74,24 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
74
74
|
pointerEvents: "auto"
|
|
75
75
|
// 确保可以接收鼠标事件
|
|
76
76
|
},
|
|
77
|
-
onMouseDown:
|
|
78
|
-
onMouseMove:
|
|
79
|
-
onMouseUp:
|
|
80
|
-
onMouseLeave:
|
|
77
|
+
onMouseDown: F,
|
|
78
|
+
onMouseMove: b,
|
|
79
|
+
onMouseUp: S,
|
|
80
|
+
onMouseLeave: S
|
|
81
81
|
},
|
|
82
|
-
|
|
82
|
+
w && /* @__PURE__ */ n.createElement(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: "absolute border-2 border-yellow-400 bg-yellow-100/30",
|
|
86
86
|
style: {
|
|
87
|
-
left: `${
|
|
88
|
-
top: `${
|
|
89
|
-
width: `${
|
|
90
|
-
height: `${
|
|
87
|
+
left: `${w.x * 100}%`,
|
|
88
|
+
top: `${w.y * 100}%`,
|
|
89
|
+
width: `${w.width * 100}%`,
|
|
90
|
+
height: `${w.height * 100}%`
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
u.filter((
|
|
94
|
+
u.filter((d) => d.pageNumber === e).map((d) => (console.log("\u6E32\u67D3\u6807\u6CE8:", d.id, `\u4F4D\u7F6E: ${d.x * 100}%, ${d.y * 100}%`), /* @__PURE__ */ n.createElement("div", { key: d.id, style: {
|
|
95
95
|
width: "100%",
|
|
96
96
|
height: "100%",
|
|
97
97
|
position: "absolute",
|
|
@@ -103,17 +103,17 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
103
103
|
className: "border border-solid",
|
|
104
104
|
style: {
|
|
105
105
|
position: "absolute",
|
|
106
|
-
left: `${
|
|
107
|
-
top: `${
|
|
108
|
-
width: `${
|
|
109
|
-
height: `${
|
|
106
|
+
left: `${d.x * 100}%`,
|
|
107
|
+
top: `${d.y * 100}%`,
|
|
108
|
+
width: `${d.width * 100}%`,
|
|
109
|
+
height: `${d.height * 100}%`,
|
|
110
110
|
borderWidth: "2px",
|
|
111
|
-
borderColor: `${
|
|
112
|
-
backgroundColor: `${
|
|
111
|
+
borderColor: `${d.color}`,
|
|
112
|
+
backgroundColor: `${d.color}4D`,
|
|
113
113
|
// 30%透明度 (4D = 77/255 ≈ 0.3)
|
|
114
114
|
zIndex: 1e3
|
|
115
115
|
},
|
|
116
|
-
onClick: () =>
|
|
116
|
+
onClick: () => M(d.id)
|
|
117
117
|
}
|
|
118
118
|
))))
|
|
119
119
|
);
|
|
@@ -141,14 +141,14 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
141
141
|
shadow: "md",
|
|
142
142
|
lineHeight: "md"
|
|
143
143
|
}
|
|
144
|
-
}, $e =
|
|
144
|
+
}, $e = J.div`
|
|
145
145
|
display: flex;
|
|
146
146
|
align-items: center;
|
|
147
147
|
justify-content: center;
|
|
148
148
|
height: 200px;
|
|
149
149
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
150
150
|
font-size: 14px;
|
|
151
|
-
`, Pe =
|
|
151
|
+
`, Pe = J.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
align-items: center;
|
|
154
154
|
justify-content: center;
|
|
@@ -163,68 +163,104 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
163
163
|
// 默认从第1页开始
|
|
164
164
|
scale: u,
|
|
165
165
|
annotations: r,
|
|
166
|
-
isAnnotating:
|
|
167
|
-
isSlidesMode:
|
|
168
|
-
|
|
169
|
-
onScaleChange:
|
|
170
|
-
onAnnotationChange:
|
|
171
|
-
onAnnotationDelete:
|
|
172
|
-
styles:
|
|
166
|
+
isAnnotating: i,
|
|
167
|
+
isSlidesMode: v = !1,
|
|
168
|
+
setScale: f,
|
|
169
|
+
onScaleChange: s,
|
|
170
|
+
onAnnotationChange: h,
|
|
171
|
+
onAnnotationDelete: p,
|
|
172
|
+
styles: B
|
|
173
173
|
}) => {
|
|
174
|
-
const [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
174
|
+
const [w, x] = z(!1), [C, l] = z(null), [F, b] = z(null), [S, M] = z(!0), d = (B == null ? void 0 : B.theme) || Ae, y = O(null), g = O(null), I = O(!1), U = O(null), Q = $(
|
|
175
|
+
(A) => {
|
|
176
|
+
if (!g.current || !S || !s) return null;
|
|
177
|
+
const X = g.current, P = X.offsetWidth - 40, c = X.offsetHeight - 40, a = P / A.width, m = c / A.height, D = Math.min(a, m, 1), R = Math.max(0.3, Math.min(1, D));
|
|
178
|
+
return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
|
|
179
|
+
containerWidth: P,
|
|
180
|
+
containerHeight: c,
|
|
181
|
+
viewportWidth: A.width,
|
|
182
|
+
viewportHeight: A.height,
|
|
183
|
+
scaleX: a,
|
|
184
|
+
scaleY: m,
|
|
185
|
+
autoScale: D,
|
|
186
|
+
finalScale: R
|
|
187
|
+
}), R;
|
|
188
|
+
},
|
|
189
|
+
[S, s]
|
|
190
|
+
), k = $(async () => {
|
|
191
|
+
if (!(!e || !y.current)) {
|
|
192
|
+
if (I.current || U.current === t) {
|
|
190
193
|
console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");
|
|
191
194
|
return;
|
|
192
195
|
}
|
|
193
196
|
try {
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
if (console.log(
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
U.current = t, I.current = !0;
|
|
198
|
+
const A = t - o + 1;
|
|
199
|
+
if (console.log(
|
|
200
|
+
`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${A}`
|
|
201
|
+
), A < 1 || A > e.numPages)
|
|
202
|
+
throw console.error(
|
|
203
|
+
`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${A}, PDF\u603B\u9875\u6570=${e.numPages}`
|
|
204
|
+
), new Error(
|
|
205
|
+
`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${t}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${e.numPages}\u9875`
|
|
206
|
+
);
|
|
207
|
+
const X = await e.getPage(A), P = y.current, c = P.getContext("2d");
|
|
199
208
|
console.log("\u5F53\u524Dscale\u503C:", u);
|
|
200
|
-
const
|
|
201
|
-
if (console.log("viewport\u5C3A\u5BF8:",
|
|
202
|
-
canvasContext:
|
|
203
|
-
viewport:
|
|
204
|
-
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",
|
|
205
|
-
const
|
|
206
|
-
console.log("\u5BB9\u5668\u5C3A\u5BF8:",
|
|
209
|
+
const a = X.getViewport({ scale: 1 });
|
|
210
|
+
if (console.log("viewport\u5C3A\u5BF8:", a.width, "x", a.height), S && M(!1), P.width = a.width, P.height = a.height, P.width && P.height && b({ width: P.width, height: P.height }), await X.render({
|
|
211
|
+
canvasContext: c,
|
|
212
|
+
viewport: a
|
|
213
|
+
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", P.width, "x", P.height), g.current) {
|
|
214
|
+
const m = g.current;
|
|
215
|
+
console.log("\u5BB9\u5668\u5C3A\u5BF8:", m.offsetWidth, "x", m.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", P.offsetWidth, "x", P.offsetHeight);
|
|
207
216
|
}
|
|
208
|
-
} catch (
|
|
209
|
-
console.error("PDF\u6E32\u67D3\u5931\u8D25:",
|
|
217
|
+
} catch (A) {
|
|
218
|
+
console.error("PDF\u6E32\u67D3\u5931\u8D25:", A);
|
|
210
219
|
} finally {
|
|
211
|
-
|
|
220
|
+
I.current = !1;
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
|
-
}, [e, u, o, Q,
|
|
215
|
-
|
|
216
|
-
e && t && o && (console.log(
|
|
223
|
+
}, [e, u, o, Q, s, t]);
|
|
224
|
+
if (te(() => {
|
|
225
|
+
e && t && o && (console.log(
|
|
226
|
+
"\u8BA1\u7B97\u4E0B\uFF0CrenderPage:",
|
|
227
|
+
"pdfStartPage:" + o,
|
|
228
|
+
"currentPage:" + t,
|
|
229
|
+
"pdfDocument:",
|
|
230
|
+
e
|
|
231
|
+
), k());
|
|
217
232
|
}, [t, e, o]), te(() => {
|
|
218
|
-
e && t &&
|
|
219
|
-
}, [u, e, t]),
|
|
233
|
+
e && t && k();
|
|
234
|
+
}, [u, e, t]), w)
|
|
235
|
+
return /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement($e, { $theme: d }, "\u52A0\u8F7D\u4E2D..."));
|
|
236
|
+
if (C)
|
|
237
|
+
return /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-center min-h-full" }, /* @__PURE__ */ n.createElement(Pe, { $theme: d }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, C))));
|
|
238
|
+
const _ = O(null), Y = () => {
|
|
239
|
+
const A = g.current ? g.current.offsetWidth - 40 : null;
|
|
240
|
+
if (!A || !(F != null && F.width)) return;
|
|
241
|
+
const X = F.width, c = +(A / X).toFixed(2);
|
|
242
|
+
typeof c == "number" ? f && f(c) : (clearInterval(_.current), _.current = null);
|
|
243
|
+
};
|
|
244
|
+
return te(() => {
|
|
245
|
+
if (!g.current || !(F != null && F.width) || !(F != null && F.height)) {
|
|
246
|
+
clearInterval(_.current), _.current = null, _.current = setInterval(() => {
|
|
247
|
+
Y();
|
|
248
|
+
}, 34);
|
|
249
|
+
return;
|
|
250
|
+
} else
|
|
251
|
+
Y();
|
|
252
|
+
return () => {
|
|
253
|
+
clearInterval(_.current), _.current = null;
|
|
254
|
+
};
|
|
255
|
+
}, [F]), /* @__PURE__ */ n.createElement(
|
|
220
256
|
"div",
|
|
221
257
|
{
|
|
222
|
-
ref:
|
|
258
|
+
ref: g,
|
|
223
259
|
className: "bg-gray-100",
|
|
224
260
|
style: {
|
|
225
|
-
display:
|
|
226
|
-
justifyContent:
|
|
227
|
-
alignItems:
|
|
261
|
+
display: v ? "block" : "flex",
|
|
262
|
+
justifyContent: v ? "initial" : "center",
|
|
263
|
+
alignItems: v ? "initial" : "flex-start",
|
|
228
264
|
padding: "20px",
|
|
229
265
|
minHeight: "100%",
|
|
230
266
|
width: "100%",
|
|
@@ -232,7 +268,7 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
232
268
|
overflow: "visible"
|
|
233
269
|
}
|
|
234
270
|
},
|
|
235
|
-
|
|
271
|
+
w ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20" }, /* @__PURE__ */ n.createElement("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900" }), /* @__PURE__ */ n.createElement("div", { className: "text-xs text-gray-600" }, "PDF\u52A0\u8F7D\u4E2D...")) : C ? /* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center gap-2 mt-20 text-red-500" }, /* @__PURE__ */ n.createElement("div", null, "\u6E32\u67D3\u9519\u8BEF"), /* @__PURE__ */ n.createElement("div", { className: "text-xs" }, C)) : /* @__PURE__ */ n.createElement("div", { className: "flex justify-center items-start" }, /* @__PURE__ */ n.createElement(
|
|
236
272
|
"div",
|
|
237
273
|
{
|
|
238
274
|
className: "relative",
|
|
@@ -246,7 +282,7 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
246
282
|
/* @__PURE__ */ n.createElement(
|
|
247
283
|
"canvas",
|
|
248
284
|
{
|
|
249
|
-
ref:
|
|
285
|
+
ref: y,
|
|
250
286
|
className: "shadow-lg bg-white border border-gray-300",
|
|
251
287
|
style: {
|
|
252
288
|
display: "block"
|
|
@@ -257,17 +293,17 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
257
293
|
ke,
|
|
258
294
|
{
|
|
259
295
|
pageNumber: t,
|
|
260
|
-
scale: u,
|
|
261
|
-
isAnnotating:
|
|
296
|
+
scale: u || 1,
|
|
297
|
+
isAnnotating: i,
|
|
262
298
|
annotations: r,
|
|
263
|
-
onAnnotationAdd:
|
|
264
|
-
onAnnotationDelete:
|
|
265
|
-
readOnly: !
|
|
299
|
+
onAnnotationAdd: h,
|
|
300
|
+
onAnnotationDelete: p,
|
|
301
|
+
readOnly: !i
|
|
266
302
|
}
|
|
267
303
|
)
|
|
268
304
|
))
|
|
269
305
|
);
|
|
270
|
-
}, _e =
|
|
306
|
+
}, _e = J.div`
|
|
271
307
|
flex: 1;
|
|
272
308
|
background: ${(e) => e.$theme.colors.background};
|
|
273
309
|
position: relative;
|
|
@@ -280,13 +316,13 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
280
316
|
/* 支持大尺寸内容的滚动 */
|
|
281
317
|
overflow-x: auto;
|
|
282
318
|
overflow-y: auto; /* 改为auto,允许垂直滚动 */
|
|
283
|
-
`, Re =
|
|
319
|
+
`, Re = J.div`
|
|
284
320
|
display: flex;
|
|
285
321
|
align-items: center;
|
|
286
322
|
justify-content: center;
|
|
287
323
|
height: 100%;
|
|
288
324
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
289
|
-
`, Ne =
|
|
325
|
+
`, Ne = J.div`
|
|
290
326
|
display: flex;
|
|
291
327
|
flex-direction: column;
|
|
292
328
|
align-items: center;
|
|
@@ -404,467 +440,530 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
404
440
|
return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"), "unknown";
|
|
405
441
|
const t = e.fileName || "", o = e.fileType || "", u = e.content;
|
|
406
442
|
return console.log("\u68C0\u6D4B\u53C2\u6570:", { fileName: t, fileType: o, content: u }), o === "pdf" || o === "pdf_slides" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), o) : o === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : o === "markdown_table" ? (console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"), "markdown_table") : o === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : o === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : o === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : t.toLowerCase().endsWith(".pdf") || (u == null ? void 0 : u.type) === "pdf" ? (console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"), "pdf") : t.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/) || (u == null ? void 0 : u.type) === "image" ? (console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"), "image") : t.toLowerCase().endsWith(".md") || (u == null ? void 0 : u.type) === "markdown" ? (console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"), "markdown") : t.toLowerCase().match(/\.(html|htm)$/) || (u == null ? void 0 : u.type) === "html" ? (console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"), "html") : t.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/) || (u == null ? void 0 : u.type) === "text" ? (console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"), "text") : (console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"), "unknown");
|
|
407
|
-
}, Me = (e, t, o = !1) => {
|
|
408
|
-
var
|
|
409
|
-
console.log(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
443
|
+
}, Me = (e, t, o = !1, u = void 0) => {
|
|
444
|
+
var r, i, v, f, s, h, p;
|
|
445
|
+
console.log(
|
|
446
|
+
"\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:",
|
|
447
|
+
"pdfStartPage:" + e.pdfStartPage,
|
|
448
|
+
"currentPage:" + t.currentPage
|
|
449
|
+
), console.log("=== renderPdfContent \u5F00\u59CB ==="), console.log("PDF\u6570\u636E:", e), console.log("PDF\u6587\u6863:", (r = e.content) == null ? void 0 : r.document), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof ((i = e.content) == null ? void 0 : i.document)), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:", ((v = e.content) == null ? void 0 : v.document) === null), console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:", ((f = e.content) == null ? void 0 : f.document) === void 0), console.log(
|
|
450
|
+
"PDF\u6587\u6863\u65B9\u6CD5:",
|
|
451
|
+
(s = e.content) != null && s.document ? Object.getOwnPropertyNames(Object.getPrototypeOf(e.content.document)) : "\u65E0\u6587\u6863"
|
|
452
|
+
), console.log(
|
|
453
|
+
"PDF\u6587\u6863\u5C5E\u6027:",
|
|
454
|
+
(h = e.content) != null && h.document ? Object.keys(e.content.document) : "\u65E0\u6587\u6863"
|
|
455
|
+
);
|
|
456
|
+
const B = e.pdfStartPage || 1;
|
|
457
|
+
console.log("PDF\u8D77\u59CB\u9875:", B);
|
|
458
|
+
const w = (t.annotationData || []).filter(
|
|
459
|
+
(l) => "pageNumber" in l && "x" in l && "y" in l
|
|
414
460
|
);
|
|
415
|
-
console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",
|
|
416
|
-
const
|
|
461
|
+
console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="), console.log("\u539F\u59CBannotationData:", t.annotationData), console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:", w);
|
|
462
|
+
const x = o ? 0.82 : 1, C = t.initialZoom || t.scale || x;
|
|
417
463
|
return /* @__PURE__ */ n.createElement(
|
|
418
464
|
Te,
|
|
419
465
|
{
|
|
420
|
-
pdfDocument: ((
|
|
466
|
+
pdfDocument: ((p = e.content) == null ? void 0 : p.document) || null,
|
|
421
467
|
currentPage: t.currentPage || 1,
|
|
422
|
-
pdfStartPage:
|
|
423
|
-
scale:
|
|
424
|
-
|
|
468
|
+
pdfStartPage: B,
|
|
469
|
+
scale: C,
|
|
470
|
+
setScale: u,
|
|
471
|
+
annotations: w,
|
|
425
472
|
isAnnotating: !1,
|
|
426
473
|
isSlidesMode: o,
|
|
427
|
-
onPageChange: t.eventsEmit ? (
|
|
428
|
-
var
|
|
429
|
-
return (
|
|
474
|
+
onPageChange: t.eventsEmit ? (l) => {
|
|
475
|
+
var F;
|
|
476
|
+
return (F = t.eventsEmit) == null ? void 0 : F.call(t, "pageChange", { pageNumber: l });
|
|
430
477
|
} : void 0,
|
|
431
|
-
onScaleChange: t.eventsEmit ? (
|
|
432
|
-
var
|
|
433
|
-
return (
|
|
478
|
+
onScaleChange: t.eventsEmit ? (l) => {
|
|
479
|
+
var F;
|
|
480
|
+
return (F = t.eventsEmit) == null ? void 0 : F.call(t, "scaleChange", { scale: l });
|
|
434
481
|
} : void 0,
|
|
435
|
-
onAnnotationChange: t.eventsEmit ? (
|
|
436
|
-
var
|
|
437
|
-
return (
|
|
482
|
+
onAnnotationChange: t.eventsEmit ? (l) => {
|
|
483
|
+
var F;
|
|
484
|
+
return (F = t.eventsEmit) == null ? void 0 : F.call(t, "annotationChange", { annotation: l });
|
|
438
485
|
} : void 0,
|
|
439
|
-
onAnnotationDelete: t.eventsEmit ? (
|
|
440
|
-
var
|
|
441
|
-
return (
|
|
486
|
+
onAnnotationDelete: t.eventsEmit ? (l) => {
|
|
487
|
+
var F;
|
|
488
|
+
return (F = t.eventsEmit) == null ? void 0 : F.call(t, "annotationDelete", { annotationId: l });
|
|
442
489
|
} : void 0,
|
|
443
490
|
styles: t.styles
|
|
444
491
|
}
|
|
445
492
|
);
|
|
446
|
-
},
|
|
447
|
-
var o, u, r,
|
|
493
|
+
}, Ie = (e, t) => {
|
|
494
|
+
var o, u, r, i, v, f, s, h, p, B, w, x, C, l;
|
|
448
495
|
console.log("=== Fviewer renderImageContent ==="), console.log("data:", e), console.log("data.content:", e.content), console.log("data.content?.url:", (o = e.content) == null ? void 0 : o.url), console.log("rotation:", t.rotation);
|
|
449
|
-
const
|
|
450
|
-
console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",
|
|
451
|
-
},
|
|
452
|
-
console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",
|
|
496
|
+
const F = ((u = e.content) == null ? void 0 : u.url) || e.content, [b, S] = z(!0), [M, d] = z(!1), y = () => {
|
|
497
|
+
console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:", F), S(!1), d(!1);
|
|
498
|
+
}, g = () => {
|
|
499
|
+
console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:", F), S(!1), d(!0);
|
|
453
500
|
};
|
|
454
|
-
return /* @__PURE__ */ n.createElement(
|
|
455
|
-
|
|
456
|
-
justifyContent: "center",
|
|
457
|
-
alignItems: "center",
|
|
458
|
-
height: "100%",
|
|
459
|
-
padding: "20px",
|
|
460
|
-
overflow: "auto",
|
|
461
|
-
position: "relative",
|
|
462
|
-
backgroundColor: "#272727"
|
|
463
|
-
// 图片模式深色背景
|
|
464
|
-
} }, y && /* @__PURE__ */ n.createElement("div", { style: {
|
|
465
|
-
position: "absolute",
|
|
466
|
-
top: "50%",
|
|
467
|
-
left: "50%",
|
|
468
|
-
transform: "translate(-50%, -50%)",
|
|
469
|
-
display: "flex",
|
|
470
|
-
flexDirection: "column",
|
|
471
|
-
alignItems: "center",
|
|
472
|
-
gap: "12px",
|
|
473
|
-
zIndex: 1
|
|
474
|
-
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
475
|
-
width: "32px",
|
|
476
|
-
height: "32px",
|
|
477
|
-
border: `3px solid ${((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.border) || "#dee2e6"}`,
|
|
478
|
-
borderTop: `3px solid ${((f = (m = (g = t.styles) == null ? void 0 : g.theme) == null ? void 0 : m.colors) == null ? void 0 : f.primary) || "#007bff"}`,
|
|
479
|
-
borderRadius: "50%",
|
|
480
|
-
animation: "spin 1s linear infinite"
|
|
481
|
-
} }), /* @__PURE__ */ n.createElement("div", { style: {
|
|
482
|
-
fontSize: "12px",
|
|
483
|
-
color: ((v = (x = (C = t.styles) == null ? void 0 : C.theme) == null ? void 0 : x.colors) == null ? void 0 : v.text) || "#343a40"
|
|
484
|
-
} }, "\u56FE\u7247\u52A0\u8F7D\u4E2D...")), z && /* @__PURE__ */ n.createElement("div", { style: {
|
|
485
|
-
position: "absolute",
|
|
486
|
-
top: "50%",
|
|
487
|
-
left: "50%",
|
|
488
|
-
transform: "translate(-50%, -50%)",
|
|
489
|
-
display: "flex",
|
|
490
|
-
flexDirection: "column",
|
|
491
|
-
alignItems: "center",
|
|
492
|
-
gap: "8px",
|
|
493
|
-
zIndex: 1
|
|
494
|
-
} }, /* @__PURE__ */ n.createElement("div", { style: {
|
|
495
|
-
fontSize: "14px",
|
|
496
|
-
color: ((a = (s = (D = t.styles) == null ? void 0 : D.theme) == null ? void 0 : s.colors) == null ? void 0 : a.error) || "#dc3545"
|
|
497
|
-
} }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), /* @__PURE__ */ n.createElement(
|
|
498
|
-
"img",
|
|
501
|
+
return /* @__PURE__ */ n.createElement(
|
|
502
|
+
"div",
|
|
499
503
|
{
|
|
500
|
-
src: B,
|
|
501
|
-
alt: e.fileName || "\u56FE\u7247",
|
|
502
|
-
onLoad: b,
|
|
503
|
-
onError: h,
|
|
504
504
|
style: {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
505
|
+
display: "flex",
|
|
506
|
+
justifyContent: "center",
|
|
507
|
+
alignItems: "center",
|
|
508
|
+
height: "100%",
|
|
509
|
+
padding: "20px",
|
|
510
|
+
overflow: "auto",
|
|
511
|
+
position: "relative",
|
|
512
|
+
backgroundColor: "#272727"
|
|
513
|
+
// 图片模式深色背景
|
|
511
514
|
}
|
|
512
|
-
}
|
|
513
|
-
|
|
515
|
+
},
|
|
516
|
+
b && /* @__PURE__ */ n.createElement(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
style: {
|
|
520
|
+
position: "absolute",
|
|
521
|
+
top: "50%",
|
|
522
|
+
left: "50%",
|
|
523
|
+
transform: "translate(-50%, -50%)",
|
|
524
|
+
display: "flex",
|
|
525
|
+
flexDirection: "column",
|
|
526
|
+
alignItems: "center",
|
|
527
|
+
gap: "12px",
|
|
528
|
+
zIndex: 1
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
/* @__PURE__ */ n.createElement(
|
|
532
|
+
"div",
|
|
533
|
+
{
|
|
534
|
+
style: {
|
|
535
|
+
width: "32px",
|
|
536
|
+
height: "32px",
|
|
537
|
+
border: `3px solid ${((v = (i = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : i.colors) == null ? void 0 : v.border) || "#dee2e6"}`,
|
|
538
|
+
borderTop: `3px solid ${((h = (s = (f = t.styles) == null ? void 0 : f.theme) == null ? void 0 : s.colors) == null ? void 0 : h.primary) || "#007bff"}`,
|
|
539
|
+
borderRadius: "50%",
|
|
540
|
+
animation: "spin 1s linear infinite"
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
/* @__PURE__ */ n.createElement(
|
|
545
|
+
"div",
|
|
546
|
+
{
|
|
547
|
+
style: {
|
|
548
|
+
fontSize: "12px",
|
|
549
|
+
color: ((w = (B = (p = t.styles) == null ? void 0 : p.theme) == null ? void 0 : B.colors) == null ? void 0 : w.text) || "#343a40"
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
"\u56FE\u7247\u52A0\u8F7D\u4E2D..."
|
|
553
|
+
)
|
|
554
|
+
),
|
|
555
|
+
M && /* @__PURE__ */ n.createElement(
|
|
556
|
+
"div",
|
|
557
|
+
{
|
|
558
|
+
style: {
|
|
559
|
+
position: "absolute",
|
|
560
|
+
top: "50%",
|
|
561
|
+
left: "50%",
|
|
562
|
+
transform: "translate(-50%, -50%)",
|
|
563
|
+
display: "flex",
|
|
564
|
+
flexDirection: "column",
|
|
565
|
+
alignItems: "center",
|
|
566
|
+
gap: "8px",
|
|
567
|
+
zIndex: 1
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
/* @__PURE__ */ n.createElement(
|
|
571
|
+
"div",
|
|
572
|
+
{
|
|
573
|
+
style: {
|
|
574
|
+
fontSize: "14px",
|
|
575
|
+
color: ((l = (C = (x = t.styles) == null ? void 0 : x.theme) == null ? void 0 : C.colors) == null ? void 0 : l.error) || "#dc3545"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"
|
|
579
|
+
)
|
|
580
|
+
),
|
|
581
|
+
/* @__PURE__ */ n.createElement(
|
|
582
|
+
"img",
|
|
583
|
+
{
|
|
584
|
+
src: F,
|
|
585
|
+
alt: e.fileName || "\u56FE\u7247",
|
|
586
|
+
onLoad: y,
|
|
587
|
+
onError: g,
|
|
588
|
+
style: {
|
|
589
|
+
maxWidth: "100%",
|
|
590
|
+
maxHeight: "100%",
|
|
591
|
+
objectFit: "contain",
|
|
592
|
+
transform: `scale(${t.scale || 1}) rotate(${t.rotation || 0}deg)`,
|
|
593
|
+
opacity: b ? 0 : 1,
|
|
594
|
+
transition: "opacity 0.3s ease-in-out, transform 0.2s ease-in-out"
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ n.createElement("style", null, `
|
|
514
599
|
@keyframes spin {
|
|
515
600
|
0% { transform: rotate(0deg); }
|
|
516
601
|
100% { transform: rotate(360deg); }
|
|
517
602
|
}
|
|
518
|
-
`)
|
|
519
|
-
|
|
520
|
-
|
|
603
|
+
`)
|
|
604
|
+
);
|
|
605
|
+
}, We = (e, t) => {
|
|
606
|
+
var o, u, r, i, v;
|
|
521
607
|
console.log("=== Fviewer renderTextContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
522
|
-
let
|
|
523
|
-
typeof e.content == "string" ?
|
|
524
|
-
const
|
|
608
|
+
let f = "";
|
|
609
|
+
typeof e.content == "string" ? f = e.content : (o = e.content) != null && o.text ? f = e.content.text : (u = e.content) != null && u.content && (f = e.content.content), console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:", f);
|
|
610
|
+
const s = O(null), h = O(null);
|
|
525
611
|
return te(() => {
|
|
526
|
-
if (
|
|
527
|
-
const
|
|
528
|
-
var
|
|
529
|
-
const
|
|
530
|
-
|
|
612
|
+
if (s.current && h.current && f) {
|
|
613
|
+
const p = setTimeout(() => {
|
|
614
|
+
var B;
|
|
615
|
+
const w = ((B = s.current) == null ? void 0 : B.scrollHeight) || 0, x = Math.max(w + 80, 200);
|
|
616
|
+
h.current && (h.current.style.minHeight = `${x}px`, console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:", x));
|
|
531
617
|
}, 100);
|
|
532
|
-
return () => clearTimeout(
|
|
618
|
+
return () => clearTimeout(p);
|
|
533
619
|
}
|
|
534
|
-
}, [
|
|
535
|
-
height: "100%",
|
|
536
|
-
overflow: "auto",
|
|
537
|
-
backgroundColor: "#f5f5f5",
|
|
538
|
-
// 纸张背景色
|
|
539
|
-
padding: "20px",
|
|
540
|
-
display: "flex",
|
|
541
|
-
justifyContent: "center",
|
|
542
|
-
position: "relative"
|
|
543
|
-
} }, /* @__PURE__ */ n.createElement(
|
|
620
|
+
}, [f]), /* @__PURE__ */ n.createElement(
|
|
544
621
|
"div",
|
|
545
622
|
{
|
|
546
|
-
ref: f,
|
|
547
623
|
style: {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
backgroundColor: "
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
position: "relative"
|
|
556
|
-
transform: `scale(${t.scale || 1})`,
|
|
557
|
-
transition: "transform 0.2s ease-in-out",
|
|
558
|
-
transformOrigin: "top center"
|
|
624
|
+
height: "100%",
|
|
625
|
+
overflow: "auto",
|
|
626
|
+
backgroundColor: "#f5f5f5",
|
|
627
|
+
// 纸张背景色
|
|
628
|
+
padding: "20px",
|
|
629
|
+
display: "flex",
|
|
630
|
+
justifyContent: "center",
|
|
631
|
+
position: "relative"
|
|
559
632
|
}
|
|
560
633
|
},
|
|
561
634
|
/* @__PURE__ */ n.createElement(
|
|
562
635
|
"div",
|
|
563
636
|
{
|
|
564
|
-
ref:
|
|
637
|
+
ref: h,
|
|
565
638
|
style: {
|
|
566
639
|
width: "100%",
|
|
567
|
-
|
|
640
|
+
maxWidth: "800px",
|
|
641
|
+
backgroundColor: "white",
|
|
642
|
+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",
|
|
643
|
+
borderRadius: "8px",
|
|
644
|
+
padding: "40px",
|
|
645
|
+
margin: "20px 0",
|
|
646
|
+
position: "relative",
|
|
647
|
+
transform: `scale(${t.scale || 1})`,
|
|
648
|
+
transition: "transform 0.2s ease-in-out",
|
|
649
|
+
transformOrigin: "top center"
|
|
568
650
|
}
|
|
569
651
|
},
|
|
570
652
|
/* @__PURE__ */ n.createElement(
|
|
571
|
-
|
|
653
|
+
"div",
|
|
572
654
|
{
|
|
573
|
-
|
|
574
|
-
type: ye.TEXT,
|
|
575
|
-
content: g
|
|
576
|
-
},
|
|
577
|
-
size: "md",
|
|
578
|
-
theme: {
|
|
579
|
-
primaryColor: ((p = (c = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : c.colors) == null ? void 0 : p.primary) || "#007bff",
|
|
580
|
-
backgroundColor: "transparent",
|
|
581
|
-
textColor: "#333",
|
|
582
|
-
borderColor: "transparent",
|
|
583
|
-
borderRadius: "0",
|
|
584
|
-
padding: "0"
|
|
585
|
-
},
|
|
655
|
+
ref: s,
|
|
586
656
|
style: {
|
|
587
|
-
border: "none",
|
|
588
|
-
background: "transparent",
|
|
589
657
|
width: "100%",
|
|
590
|
-
height: "auto",
|
|
591
658
|
overflow: "visible"
|
|
592
659
|
}
|
|
660
|
+
},
|
|
661
|
+
/* @__PURE__ */ n.createElement(
|
|
662
|
+
we,
|
|
663
|
+
{
|
|
664
|
+
dataSource: {
|
|
665
|
+
type: ye.TEXT,
|
|
666
|
+
content: f
|
|
667
|
+
},
|
|
668
|
+
size: "md",
|
|
669
|
+
theme: {
|
|
670
|
+
primaryColor: ((v = (i = (r = t.styles) == null ? void 0 : r.theme) == null ? void 0 : i.colors) == null ? void 0 : v.primary) || "#007bff",
|
|
671
|
+
backgroundColor: "transparent",
|
|
672
|
+
textColor: "#333",
|
|
673
|
+
borderColor: "transparent",
|
|
674
|
+
borderRadius: "0",
|
|
675
|
+
padding: "0"
|
|
676
|
+
},
|
|
677
|
+
style: {
|
|
678
|
+
border: "none",
|
|
679
|
+
background: "transparent",
|
|
680
|
+
width: "100%",
|
|
681
|
+
height: "auto",
|
|
682
|
+
overflow: "visible",
|
|
683
|
+
whiteSpace: "pre-line"
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
)
|
|
687
|
+
),
|
|
688
|
+
/* @__PURE__ */ n.createElement(
|
|
689
|
+
"div",
|
|
690
|
+
{
|
|
691
|
+
style: {
|
|
692
|
+
position: "absolute",
|
|
693
|
+
top: "0",
|
|
694
|
+
left: "0",
|
|
695
|
+
right: "0",
|
|
696
|
+
height: "2px",
|
|
697
|
+
background: "linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",
|
|
698
|
+
borderTopLeftRadius: "8px",
|
|
699
|
+
borderTopRightRadius: "8px"
|
|
700
|
+
}
|
|
593
701
|
}
|
|
594
702
|
)
|
|
595
|
-
)
|
|
596
|
-
|
|
597
|
-
position: "absolute",
|
|
598
|
-
top: "0",
|
|
599
|
-
left: "0",
|
|
600
|
-
right: "0",
|
|
601
|
-
height: "2px",
|
|
602
|
-
background: "linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",
|
|
603
|
-
borderTopLeftRadius: "8px",
|
|
604
|
-
borderTopRightRadius: "8px"
|
|
605
|
-
} })
|
|
606
|
-
));
|
|
703
|
+
)
|
|
704
|
+
);
|
|
607
705
|
}, je = ({ data: e, parentProps: t, isTableMode: o = !1 }) => {
|
|
608
|
-
var u, r,
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const [
|
|
612
|
-
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop:
|
|
613
|
-
},
|
|
706
|
+
var u, r, i, v, f, s, h, p, B, w, x, C;
|
|
707
|
+
const l = O(null), F = O(null), b = O(null), S = O(!1);
|
|
708
|
+
O(0), O(null);
|
|
709
|
+
const [M] = z(!1), d = (c, a) => {
|
|
710
|
+
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: c, scrollHeight: a }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: c, scrollHeight: a });
|
|
711
|
+
}, y = () => {
|
|
614
712
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
|
|
615
|
-
},
|
|
713
|
+
}, g = () => {
|
|
616
714
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
|
|
617
|
-
},
|
|
618
|
-
|
|
619
|
-
var
|
|
715
|
+
}, I = O();
|
|
716
|
+
I.current = (c) => {
|
|
717
|
+
var a, m;
|
|
620
718
|
try {
|
|
621
719
|
if (!o) return;
|
|
622
|
-
const
|
|
623
|
-
if (!
|
|
624
|
-
const
|
|
625
|
-
if (((
|
|
720
|
+
const D = typeof e.content == "string" ? e.content : ((a = e.content) == null ? void 0 : a.content) || "";
|
|
721
|
+
if (!D || _.length === 0) return;
|
|
722
|
+
const R = JSON.stringify(_.map((G) => ({ o: G.offsets, c: G.color }))), H = `${D.length}:${D.substring(0, 64)}:${D.substring(D.length - 64)}|${R}`;
|
|
723
|
+
if (((m = c.dataset) == null ? void 0 : m.tableAnnoRuntimeSig) === H) return;
|
|
626
724
|
setTimeout(() => {
|
|
627
|
-
|
|
725
|
+
X(), c.dataset && (c.dataset.tableAnnoRuntimeSig = H);
|
|
628
726
|
}, 50);
|
|
629
|
-
} catch (
|
|
630
|
-
console.warn("[MarkdownRendered] apply failed",
|
|
727
|
+
} catch (D) {
|
|
728
|
+
console.warn("[MarkdownRendered] apply failed", D);
|
|
631
729
|
}
|
|
632
730
|
};
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
731
|
+
const U = n.useCallback(
|
|
732
|
+
(c) => {
|
|
733
|
+
var a;
|
|
734
|
+
return (a = I.current) == null ? void 0 : a.call(I, c);
|
|
735
|
+
},
|
|
736
|
+
[]
|
|
737
|
+
), Q = $(() => {
|
|
738
|
+
var c;
|
|
739
|
+
if (!M || !l.current) return;
|
|
740
|
+
const a = window.getSelection();
|
|
741
|
+
if (!a || a.isCollapsed) return;
|
|
742
|
+
const m = a.getRangeAt(0), D = m.toString().trim();
|
|
743
|
+
if (!D) return;
|
|
744
|
+
const R = l.current;
|
|
745
|
+
let H = 0, q = 0;
|
|
746
|
+
const G = document.createTreeWalker(R, NodeFilter.SHOW_TEXT, {
|
|
747
|
+
acceptNode: (j) => {
|
|
748
|
+
var V;
|
|
749
|
+
return (V = j.parentElement) != null && V.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
653
750
|
}
|
|
654
|
-
);
|
|
655
|
-
let ee =
|
|
751
|
+
});
|
|
752
|
+
let ee = G.nextNode();
|
|
656
753
|
for (; ee; ) {
|
|
657
|
-
if (ee ===
|
|
658
|
-
|
|
754
|
+
if (ee === m.startContainer) {
|
|
755
|
+
q = H + m.startOffset;
|
|
659
756
|
break;
|
|
660
757
|
}
|
|
661
|
-
|
|
758
|
+
H += ((c = ee.textContent) == null ? void 0 : c.length) || 0, ee = G.nextNode();
|
|
662
759
|
}
|
|
663
760
|
console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
|
|
664
|
-
text:
|
|
665
|
-
startOffset:
|
|
666
|
-
charCount:
|
|
667
|
-
container:
|
|
761
|
+
text: D,
|
|
762
|
+
startOffset: q,
|
|
763
|
+
charCount: H,
|
|
764
|
+
container: m.startContainer.textContent
|
|
668
765
|
});
|
|
669
766
|
const N = {
|
|
670
767
|
id: `md-anno-${Date.now()}`,
|
|
671
|
-
start:
|
|
672
|
-
end:
|
|
768
|
+
start: q,
|
|
769
|
+
end: q + D.length,
|
|
673
770
|
color: "#FFE599"
|
|
674
771
|
};
|
|
675
|
-
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N),
|
|
676
|
-
}, [
|
|
677
|
-
(
|
|
772
|
+
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", N), t.eventsEmit && t.eventsEmit("md_annotation_add", N), a.removeAllRanges();
|
|
773
|
+
}, [M, t.eventsEmit]), k = o ? [] : (t.annotationData || []).filter(
|
|
774
|
+
(c) => "start" in c && "end" in c && !("pageNumber" in c)
|
|
678
775
|
), _ = o ? (t.annotationData || []).filter(
|
|
679
|
-
(
|
|
680
|
-
) : [],
|
|
681
|
-
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !
|
|
776
|
+
(c) => "offsets" in c && Array.isArray(c.offsets)
|
|
777
|
+
) : [], Y = $(() => {
|
|
778
|
+
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
|
|
682
779
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
|
|
683
780
|
return;
|
|
684
781
|
}
|
|
685
|
-
const
|
|
686
|
-
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",
|
|
687
|
-
const
|
|
688
|
-
|
|
782
|
+
const c = l.current.querySelectorAll(".md-annotation");
|
|
783
|
+
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", c.length), c.length > 0 && c.forEach((a) => {
|
|
784
|
+
const m = a.parentNode;
|
|
785
|
+
m && m.replaceChild(document.createTextNode(a.textContent || ""), a);
|
|
689
786
|
}), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
|
|
690
|
-
}, []),
|
|
691
|
-
if (!
|
|
692
|
-
|
|
693
|
-
Array.from(
|
|
694
|
-
Array.from(
|
|
695
|
-
|
|
787
|
+
}, []), A = $(() => {
|
|
788
|
+
if (!l.current) return;
|
|
789
|
+
l.current.querySelectorAll("table").forEach((a) => {
|
|
790
|
+
Array.from(a.rows).forEach((D) => {
|
|
791
|
+
Array.from(D.cells).forEach((R) => {
|
|
792
|
+
R.getAttribute("data-table-annotated") === "1" && (R.style.removeProperty("background"), R.style.removeProperty("background-color"), R.removeAttribute("data-table-annotated"), R.removeAttribute("title"));
|
|
696
793
|
});
|
|
697
794
|
});
|
|
698
795
|
}), console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8");
|
|
699
|
-
}, []),
|
|
700
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !
|
|
796
|
+
}, []), X = $(() => {
|
|
797
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", _), !l.current) {
|
|
701
798
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");
|
|
702
799
|
return;
|
|
703
800
|
}
|
|
704
|
-
if (
|
|
801
|
+
if (A(), !_.length) {
|
|
705
802
|
console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");
|
|
706
803
|
return;
|
|
707
804
|
}
|
|
708
|
-
const
|
|
709
|
-
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",
|
|
805
|
+
const c = l.current.querySelectorAll("table");
|
|
806
|
+
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", c.length), c.length === 0) {
|
|
710
807
|
console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
|
|
711
808
|
return;
|
|
712
809
|
}
|
|
713
|
-
|
|
714
|
-
const
|
|
715
|
-
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",
|
|
716
|
-
console.warn("[TableAnnotation] annotation.offsets is not valid",
|
|
810
|
+
S.current = !0, _.forEach((a, m) => {
|
|
811
|
+
const D = a.offsets;
|
|
812
|
+
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", a), !Array.isArray(D) || !D.length || !Array.isArray(D[0]) || D[0].length !== 2) {
|
|
813
|
+
console.warn("[TableAnnotation] annotation.offsets is not valid", a);
|
|
717
814
|
return;
|
|
718
815
|
}
|
|
719
|
-
|
|
720
|
-
const [
|
|
721
|
-
if (typeof
|
|
722
|
-
console.warn("[TableAnnotation] offset is not [number, number]",
|
|
816
|
+
D.forEach((R, H) => {
|
|
817
|
+
const [q, G] = R;
|
|
818
|
+
if (typeof q != "number" || typeof G != "number") {
|
|
819
|
+
console.warn("[TableAnnotation] offset is not [number, number]", R);
|
|
723
820
|
return;
|
|
724
821
|
}
|
|
725
|
-
|
|
726
|
-
var
|
|
727
|
-
const
|
|
822
|
+
c.forEach((ee, N) => {
|
|
823
|
+
var j;
|
|
824
|
+
const V = Array.from(ee.rows), oe = V[q];
|
|
728
825
|
if (!oe) {
|
|
729
|
-
console.warn("[TableAnnotation] row out of range", {
|
|
826
|
+
console.warn("[TableAnnotation] row out of range", {
|
|
827
|
+
row: q,
|
|
828
|
+
tableIndex: N,
|
|
829
|
+
totalRows: V.length
|
|
830
|
+
});
|
|
730
831
|
return;
|
|
731
832
|
}
|
|
732
|
-
const
|
|
733
|
-
if (!
|
|
734
|
-
console.warn("[TableAnnotation] cell is undefined", { row:
|
|
833
|
+
const Z = (j = oe.cells) == null ? void 0 : j[G];
|
|
834
|
+
if (!Z) {
|
|
835
|
+
console.warn("[TableAnnotation] cell is undefined", { row: q, col: G, tableIndex: N });
|
|
735
836
|
return;
|
|
736
837
|
}
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
|
|
838
|
+
const T = a.color || "rgba(255, 229, 153, 0.5)", E = getComputedStyle(Z).backgroundColor;
|
|
839
|
+
Z.getAttribute("data-table-annotated") === "1" && (E === T || Z.style.backgroundColor === T) || (Z.style.setProperty("background", T, "important"), Z.style.setProperty("background-color", T, "important"), Z.setAttribute("data-table-annotated", "1")), a.content && (Z.title = a.content), H === 0 && m === 0 && setTimeout(() => {
|
|
840
|
+
Z.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
740
841
|
}, 300);
|
|
741
842
|
});
|
|
742
843
|
});
|
|
743
844
|
}), requestAnimationFrame(() => {
|
|
744
|
-
|
|
845
|
+
S.current = !1;
|
|
745
846
|
});
|
|
746
|
-
}, [_,
|
|
747
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !
|
|
847
|
+
}, [_, A]), P = $(() => {
|
|
848
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="), !l.current || !k.length) {
|
|
748
849
|
console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
749
850
|
return;
|
|
750
851
|
}
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
var
|
|
852
|
+
F.current && clearTimeout(F.current);
|
|
853
|
+
const c = () => {
|
|
854
|
+
var a;
|
|
754
855
|
console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
|
|
755
|
-
const
|
|
756
|
-
console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (
|
|
757
|
-
const
|
|
758
|
-
|
|
856
|
+
const m = (a = l.current) == null ? void 0 : a.querySelectorAll(".md-annotation");
|
|
857
|
+
console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (m == null ? void 0 : m.length) || 0), m == null || m.forEach((N) => {
|
|
858
|
+
const j = N.parentNode;
|
|
859
|
+
j && j.replaceChild(document.createTextNode(N.textContent || ""), N);
|
|
759
860
|
});
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
acceptNode: (N) => {
|
|
765
|
-
var I;
|
|
766
|
-
return (I = N.parentElement) != null && I.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
767
|
-
}
|
|
861
|
+
const D = document.createTreeWalker(l.current, NodeFilter.SHOW_TEXT, {
|
|
862
|
+
acceptNode: (N) => {
|
|
863
|
+
var j;
|
|
864
|
+
return (j = N.parentElement) != null && j.closest("pre") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
768
865
|
}
|
|
769
|
-
),
|
|
770
|
-
let
|
|
771
|
-
for (;
|
|
772
|
-
|
|
773
|
-
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",
|
|
774
|
-
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),
|
|
775
|
-
|
|
866
|
+
}), R = [];
|
|
867
|
+
let H;
|
|
868
|
+
for (; H = D.nextNode(); )
|
|
869
|
+
R.push(H);
|
|
870
|
+
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", R.length), R.length === 0) {
|
|
871
|
+
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), F.current = setTimeout(() => {
|
|
872
|
+
c();
|
|
776
873
|
}, 200);
|
|
777
874
|
return;
|
|
778
875
|
}
|
|
779
|
-
let
|
|
780
|
-
const
|
|
781
|
-
var
|
|
782
|
-
const
|
|
783
|
-
return
|
|
876
|
+
let q = 0;
|
|
877
|
+
const G = R.map((N) => {
|
|
878
|
+
var j;
|
|
879
|
+
const V = q;
|
|
880
|
+
return q += ((j = N.textContent) == null ? void 0 : j.length) || 0, {
|
|
784
881
|
node: N,
|
|
785
|
-
start:
|
|
786
|
-
end:
|
|
882
|
+
start: V,
|
|
883
|
+
end: q,
|
|
787
884
|
text: N.textContent
|
|
788
885
|
};
|
|
789
886
|
});
|
|
790
|
-
console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",
|
|
791
|
-
const ee = [...
|
|
887
|
+
console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:", G), console.log("\u603B\u6587\u672C\u957F\u5EA6:", q);
|
|
888
|
+
const ee = [...k].sort((N, j) => j.start - N.start);
|
|
792
889
|
console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:", ee), ee.forEach((N) => {
|
|
793
|
-
const { start:
|
|
794
|
-
console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions:
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
890
|
+
const { start: j, end: V, color: oe } = N;
|
|
891
|
+
console.log("\u5904\u7406\u6807\u6CE8:", { annotation: N, nodePositions: G });
|
|
892
|
+
const Z = G.filter((T) => j < T.end && V > T.start);
|
|
893
|
+
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Z.length), Z.forEach(({ node: T, start: E }) => {
|
|
894
|
+
var L, K, W, he, Fe, pe;
|
|
895
|
+
const le = Math.max(0, j - E), ae = Math.min(((L = T.textContent) == null ? void 0 : L.length) || 0, V - E);
|
|
896
|
+
if (console.log("\u672C\u5730\u4F4D\u7F6E:", {
|
|
897
|
+
localStart: le,
|
|
898
|
+
localEnd: ae,
|
|
899
|
+
nodeTextLength: (K = T.textContent) == null ? void 0 : K.length
|
|
900
|
+
}), le >= ae) {
|
|
802
901
|
console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
|
|
803
902
|
return;
|
|
804
903
|
}
|
|
805
|
-
const me = ((
|
|
904
|
+
const me = ((W = T.textContent) == null ? void 0 : W.slice(0, le)) || "", ge = ((he = T.textContent) == null ? void 0 : he.slice(le, ae)) || "", fe = ((Fe = T.textContent) == null ? void 0 : Fe.slice(ae)) || "";
|
|
806
905
|
console.log("\u5206\u5272\u6587\u672C:", { before: me, annotatedText: ge, after: fe });
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
me &&
|
|
906
|
+
const ie = document.createElement("span");
|
|
907
|
+
ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = ge;
|
|
908
|
+
const se = document.createDocumentFragment();
|
|
909
|
+
me && se.appendChild(document.createTextNode(me)), se.appendChild(ie), fe && se.appendChild(document.createTextNode(fe)), (pe = T.parentNode) == null || pe.replaceChild(se, T), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", ge);
|
|
811
910
|
});
|
|
812
911
|
});
|
|
813
912
|
};
|
|
814
|
-
|
|
815
|
-
|
|
913
|
+
F.current = setTimeout(() => {
|
|
914
|
+
c();
|
|
816
915
|
}, 100);
|
|
817
|
-
}, [
|
|
916
|
+
}, [k]);
|
|
818
917
|
return te(() => {
|
|
819
|
-
var
|
|
918
|
+
var c;
|
|
820
919
|
if (o) {
|
|
821
920
|
console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
|
|
822
921
|
return;
|
|
823
922
|
}
|
|
824
|
-
const
|
|
825
|
-
if (!
|
|
923
|
+
const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
|
|
924
|
+
if (!a || typeof a != "string") {
|
|
826
925
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
827
926
|
return;
|
|
828
927
|
}
|
|
829
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:",
|
|
928
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", k), console.log("tableAnnotations:", _), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", a), !l.current) {
|
|
830
929
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
|
|
831
930
|
return;
|
|
832
931
|
}
|
|
833
|
-
if (o ||
|
|
834
|
-
|
|
932
|
+
if (o || Y(), !o && k.length > 0) {
|
|
933
|
+
P();
|
|
835
934
|
return;
|
|
836
935
|
}
|
|
837
936
|
console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8");
|
|
838
|
-
}, [o, _,
|
|
937
|
+
}, [o, _, k]), te(() => {
|
|
839
938
|
if (!o)
|
|
840
|
-
return document.addEventListener("mouseup",
|
|
841
|
-
document.removeEventListener("mouseup",
|
|
939
|
+
return document.addEventListener("mouseup", Q), () => {
|
|
940
|
+
document.removeEventListener("mouseup", Q);
|
|
842
941
|
};
|
|
843
|
-
}, [
|
|
844
|
-
var
|
|
845
|
-
const
|
|
846
|
-
if (!
|
|
942
|
+
}, [Q, o]), te(() => {
|
|
943
|
+
var c;
|
|
944
|
+
const a = typeof e.content == "string" ? e.content : ((c = e.content) == null ? void 0 : c.content) || "";
|
|
945
|
+
if (!a || typeof a != "string") {
|
|
847
946
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
|
|
848
947
|
return;
|
|
849
948
|
}
|
|
850
|
-
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:",
|
|
851
|
-
}, [
|
|
852
|
-
if (o &&
|
|
853
|
-
const
|
|
854
|
-
var
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
if (
|
|
858
|
-
|
|
859
|
-
const
|
|
860
|
-
|
|
949
|
+
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", a.length || 0), typeof a == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", a.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", a.substring(a.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof a), console.log("\u5185\u5BB9\u503C:", a)), console.log("\u6807\u6CE8\u6570\u636E:", k), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", _);
|
|
950
|
+
}, [k, _, o]), te(() => {
|
|
951
|
+
if (o && l.current) {
|
|
952
|
+
const c = setTimeout(() => {
|
|
953
|
+
var a;
|
|
954
|
+
const m = (a = l.current) == null ? void 0 : a.querySelectorAll("table");
|
|
955
|
+
m && m.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", m.length), m.forEach((D, R) => {
|
|
956
|
+
if (D instanceof HTMLTableElement) {
|
|
957
|
+
D.style.width = "100%", D.style.minWidth = "100%", D.style.tableLayout = "auto";
|
|
958
|
+
const H = D.closest(".markdown-table-mode");
|
|
959
|
+
H && H instanceof HTMLElement && (H.style.width = "100%", H.style.overflowX = "auto"), console.log(`\u8868\u683C ${R + 1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`);
|
|
861
960
|
}
|
|
862
961
|
}));
|
|
863
962
|
}, 500);
|
|
864
|
-
return () => clearTimeout(
|
|
963
|
+
return () => clearTimeout(c);
|
|
865
964
|
}
|
|
866
965
|
}, [o, e.content]), te(() => () => {
|
|
867
|
-
|
|
966
|
+
F.current && clearTimeout(F.current), b.current && (b.current.disconnect(), b.current = null);
|
|
868
967
|
}, []), /* @__PURE__ */ n.createElement(
|
|
869
968
|
"div",
|
|
870
969
|
{
|
|
@@ -877,26 +976,26 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
877
976
|
className: `markdown-container markdown-scrollbar ${o ? "markdown-table-mode" : ""}`
|
|
878
977
|
},
|
|
879
978
|
/* @__PURE__ */ n.createElement("style", null, Le),
|
|
880
|
-
/* @__PURE__ */ n.createElement("div", { ref:
|
|
979
|
+
/* @__PURE__ */ n.createElement("div", { ref: l }, /* @__PURE__ */ n.createElement(
|
|
881
980
|
we,
|
|
882
981
|
{
|
|
883
982
|
dataSource: {
|
|
884
983
|
type: ye.MARKDOWN,
|
|
885
984
|
content: (() => {
|
|
886
|
-
var
|
|
887
|
-
return typeof e.content == "string" ? e.content : (
|
|
985
|
+
var c, a;
|
|
986
|
+
return typeof e.content == "string" ? e.content : (c = e.content) != null && c.text ? e.content.text : (a = e.content) != null && a.content ? e.content.content : "";
|
|
888
987
|
})()
|
|
889
988
|
},
|
|
890
989
|
size: "md",
|
|
891
|
-
onScroll: o ? void 0 :
|
|
892
|
-
onScrollToTop: o ? void 0 :
|
|
893
|
-
onScrollToBottom: o ? void 0 :
|
|
894
|
-
onRendered:
|
|
990
|
+
onScroll: o ? void 0 : d,
|
|
991
|
+
onScrollToTop: o ? void 0 : y,
|
|
992
|
+
onScrollToBottom: o ? void 0 : g,
|
|
993
|
+
onRendered: U,
|
|
895
994
|
theme: {
|
|
896
|
-
primaryColor: ((
|
|
897
|
-
backgroundColor: ((
|
|
898
|
-
textColor: ((
|
|
899
|
-
borderColor: ((
|
|
995
|
+
primaryColor: ((i = (r = (u = t.styles) == null ? void 0 : u.theme) == null ? void 0 : r.colors) == null ? void 0 : i.primary) || "#007bff",
|
|
996
|
+
backgroundColor: ((s = (f = (v = t.styles) == null ? void 0 : v.theme) == null ? void 0 : f.colors) == null ? void 0 : s.background) || "#f8f9fa",
|
|
997
|
+
textColor: ((B = (p = (h = t.styles) == null ? void 0 : h.theme) == null ? void 0 : p.colors) == null ? void 0 : B.text) || "#343a40",
|
|
998
|
+
borderColor: ((C = (x = (w = t.styles) == null ? void 0 : w.theme) == null ? void 0 : x.colors) == null ? void 0 : C.border) || "#dee2e6",
|
|
900
999
|
borderRadius: o ? "0px" : "8px",
|
|
901
1000
|
padding: o ? "0px" : "20px"
|
|
902
1001
|
},
|
|
@@ -910,60 +1009,62 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
910
1009
|
))
|
|
911
1010
|
);
|
|
912
1011
|
}, Oe = ({ markdown: e, onRendered: t, tableAnnotations: o = [] }) => {
|
|
913
|
-
const u =
|
|
914
|
-
const
|
|
915
|
-
let
|
|
916
|
-
for (let
|
|
917
|
-
const
|
|
918
|
-
if (
|
|
919
|
-
|
|
1012
|
+
const u = O(null), r = (f) => {
|
|
1013
|
+
const s = f.split(/\r?\n/).filter((C) => C.trim().length > 0);
|
|
1014
|
+
let h = -1;
|
|
1015
|
+
for (let C = 0; C < s.length - 1; C++) {
|
|
1016
|
+
const l = s[C].trim(), F = s[C + 1].trim();
|
|
1017
|
+
if (l.startsWith("|") && l.endsWith("|") && F.replace(/\s|:|\|/g, "").match(/^[-]+$/)) {
|
|
1018
|
+
h = C;
|
|
920
1019
|
break;
|
|
921
1020
|
}
|
|
922
1021
|
}
|
|
923
|
-
if (
|
|
924
|
-
const
|
|
925
|
-
for (let
|
|
926
|
-
const
|
|
927
|
-
if (!
|
|
928
|
-
|
|
1022
|
+
if (h === -1) return null;
|
|
1023
|
+
const B = s[h].split("|").slice(1, -1).map((C) => C.trim()), w = [];
|
|
1024
|
+
for (let C = h + 2; C < s.length; C++) {
|
|
1025
|
+
const l = s[C].trim();
|
|
1026
|
+
if (!l.startsWith("|") || !l.endsWith("|")) break;
|
|
1027
|
+
w.push(l);
|
|
929
1028
|
}
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
1029
|
+
const x = w.map(
|
|
1030
|
+
(C) => C.split("|").slice(1, -1).map((l) => l.trim())
|
|
1031
|
+
);
|
|
1032
|
+
return { headers: B, rows: x };
|
|
1033
|
+
}, i = n.useMemo(() => r(e), [e]);
|
|
933
1034
|
return te(() => {
|
|
934
|
-
const
|
|
1035
|
+
const f = () => {
|
|
935
1036
|
try {
|
|
936
1037
|
if (!u.current) return;
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
939
|
-
Array.from(
|
|
940
|
-
Array.from(
|
|
941
|
-
|
|
1038
|
+
const h = u.current.querySelectorAll("table");
|
|
1039
|
+
if (h.forEach((p) => {
|
|
1040
|
+
Array.from(p.rows).forEach((w) => {
|
|
1041
|
+
Array.from(w.cells).forEach((x) => {
|
|
1042
|
+
x.getAttribute("data-table-annotated") === "1" && (x.style.removeProperty("background"), x.style.removeProperty("background-color"), x.removeAttribute("data-table-annotated"), x.removeAttribute("title"));
|
|
942
1043
|
});
|
|
943
1044
|
});
|
|
944
|
-
}), !o.length || !
|
|
945
|
-
o.forEach((
|
|
946
|
-
(
|
|
947
|
-
const [
|
|
948
|
-
|
|
949
|
-
var
|
|
950
|
-
const
|
|
951
|
-
if (!
|
|
952
|
-
const
|
|
953
|
-
if (!
|
|
954
|
-
const
|
|
955
|
-
|
|
1045
|
+
}), !o.length || !h || h.length === 0) return;
|
|
1046
|
+
o.forEach((p, B) => {
|
|
1047
|
+
(p.offsets || []).forEach((x, C) => {
|
|
1048
|
+
const [l, F] = x;
|
|
1049
|
+
h.forEach((b) => {
|
|
1050
|
+
var S;
|
|
1051
|
+
const d = Array.from(b.rows)[l];
|
|
1052
|
+
if (!d) return;
|
|
1053
|
+
const y = (S = d.cells) == null ? void 0 : S[F];
|
|
1054
|
+
if (!y) return;
|
|
1055
|
+
const g = p.color || "rgba(255, 229, 153, 0.5)";
|
|
1056
|
+
y.getAttribute("data-table-annotated") === "1" || (y.style.setProperty("background", g, "important"), y.style.setProperty("background-color", g, "important"), y.setAttribute("data-table-annotated", "1"), p.content && (y.title = p.content)), B === 0 && C === 0 && setTimeout(() => y.scrollIntoView({ behavior: "smooth", block: "start" }), 50);
|
|
956
1057
|
});
|
|
957
1058
|
});
|
|
958
1059
|
});
|
|
959
|
-
} catch (
|
|
960
|
-
console.warn("[MinimalMarkdownTable] apply annotations failed",
|
|
1060
|
+
} catch (h) {
|
|
1061
|
+
console.warn("[MinimalMarkdownTable] apply annotations failed", h);
|
|
961
1062
|
}
|
|
962
|
-
},
|
|
963
|
-
|
|
1063
|
+
}, s = requestAnimationFrame(() => {
|
|
1064
|
+
f(), t && t();
|
|
964
1065
|
});
|
|
965
|
-
return () => cancelAnimationFrame(
|
|
966
|
-
}, [e, o, t]),
|
|
1066
|
+
return () => cancelAnimationFrame(s);
|
|
1067
|
+
}, [e, o, t]), i ? /* @__PURE__ */ n.createElement("div", { ref: u, className: "markdown-table-mode z-mdtbl-wrapper" }, /* @__PURE__ */ n.createElement("style", null, `
|
|
967
1068
|
.z-mdtbl-wrapper { overflow: auto; position: relative; }
|
|
968
1069
|
.z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
|
|
969
1070
|
.z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
|
|
@@ -975,93 +1076,139 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
975
1076
|
.z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
|
|
976
1077
|
.z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
|
|
977
1078
|
.z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
|
|
978
|
-
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null,
|
|
1079
|
+
`), /* @__PURE__ */ n.createElement("table", { className: "z-mdtbl" }, /* @__PURE__ */ n.createElement("thead", null, /* @__PURE__ */ n.createElement("tr", null, i.headers.map((f, s) => /* @__PURE__ */ n.createElement("th", { key: s }, f)))), /* @__PURE__ */ n.createElement("tbody", null, i.rows.map((f, s) => /* @__PURE__ */ n.createElement("tr", { key: s }, f.map((h, p) => /* @__PURE__ */ n.createElement("td", { key: p }, h))))))) : /* @__PURE__ */ n.createElement("div", { ref: u, style: { padding: "8px" } }, "\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C");
|
|
979
1080
|
}, He = (e, t) => {
|
|
980
1081
|
var o, u;
|
|
981
1082
|
console.log("=== Fviewer renderHtmlContent ==="), console.log("data:", e), console.log("data.content:", e.content);
|
|
982
1083
|
let r = "";
|
|
983
|
-
return typeof e.content == "string" ? r = e.content : (o = e.content) != null && o.text ? r = e.content.text : (u = e.content) != null && u.content && (r = e.content.content), console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:", r), /* @__PURE__ */ n.createElement(
|
|
984
|
-
|
|
985
|
-
overflow: "auto",
|
|
986
|
-
position: "relative"
|
|
987
|
-
} }, /* @__PURE__ */ n.createElement(
|
|
988
|
-
"iframe",
|
|
1084
|
+
return typeof e.content == "string" ? r = e.content : (o = e.content) != null && o.text ? r = e.content.text : (u = e.content) != null && u.content && (r = e.content.content), console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:", r), /* @__PURE__ */ n.createElement(
|
|
1085
|
+
"div",
|
|
989
1086
|
{
|
|
990
|
-
srcDoc: r,
|
|
991
1087
|
style: {
|
|
992
|
-
width: "100%",
|
|
993
1088
|
height: "100%",
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
|
|
1089
|
+
overflow: "auto",
|
|
1090
|
+
position: "relative"
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
/* @__PURE__ */ n.createElement(
|
|
1094
|
+
"iframe",
|
|
1095
|
+
{
|
|
1096
|
+
srcDoc: r,
|
|
1097
|
+
style: {
|
|
1098
|
+
width: "100%",
|
|
1099
|
+
height: "100%",
|
|
1100
|
+
border: "none",
|
|
1101
|
+
background: "white"
|
|
1102
|
+
},
|
|
1103
|
+
title: "HTML Preview",
|
|
1104
|
+
sandbox: "allow-same-origin allow-scripts"
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
);
|
|
1108
|
+
}, Ze = (e, t) => /* @__PURE__ */ n.createElement(
|
|
1109
|
+
"div",
|
|
1110
|
+
{
|
|
1111
|
+
style: {
|
|
1112
|
+
display: "flex",
|
|
1113
|
+
justifyContent: "center",
|
|
1114
|
+
alignItems: "center",
|
|
1115
|
+
height: "100%",
|
|
1116
|
+
color: "#666"
|
|
999
1117
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
justifyContent: "center",
|
|
1004
|
-
alignItems: "center",
|
|
1005
|
-
height: "100%",
|
|
1006
|
-
color: "#666"
|
|
1007
|
-
} }, /* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))), Xe = ({
|
|
1118
|
+
},
|
|
1119
|
+
/* @__PURE__ */ n.createElement("div", null, /* @__PURE__ */ n.createElement("div", null, "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, e.fileName || "\u672A\u77E5\u6587\u4EF6"))
|
|
1120
|
+
), Xe = ({
|
|
1008
1121
|
data: e,
|
|
1009
1122
|
annotationData: t = [],
|
|
1010
1123
|
totalPage: o = 0,
|
|
1011
1124
|
currentPage: u = 1,
|
|
1012
|
-
|
|
1125
|
+
setScale: r,
|
|
1126
|
+
scale: i,
|
|
1013
1127
|
// 重命名避免冲突
|
|
1014
|
-
rotation:
|
|
1128
|
+
rotation: v = 0,
|
|
1015
1129
|
// 添加rotation参数
|
|
1016
|
-
eventsEmit:
|
|
1017
|
-
styles:
|
|
1018
|
-
tools:
|
|
1130
|
+
eventsEmit: f,
|
|
1131
|
+
styles: s,
|
|
1132
|
+
tools: h = {
|
|
1019
1133
|
annotation: !0,
|
|
1020
1134
|
download: !0,
|
|
1021
1135
|
zoom: !0,
|
|
1022
1136
|
close: !0,
|
|
1023
1137
|
navigation: !0
|
|
1024
1138
|
},
|
|
1025
|
-
customComponents:
|
|
1026
|
-
className:
|
|
1027
|
-
contentClass:
|
|
1139
|
+
customComponents: p,
|
|
1140
|
+
className: B,
|
|
1141
|
+
contentClass: w
|
|
1028
1142
|
}) => {
|
|
1029
|
-
var
|
|
1030
|
-
const
|
|
1031
|
-
console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1143
|
+
var x, C, l, F;
|
|
1144
|
+
const b = (s == null ? void 0 : s.theme) || ze, [S, M] = z(!1), [d] = z("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."), [y, g] = z(null);
|
|
1145
|
+
console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="), console.log("Fviewer data:", e), console.log("Fviewer data.content:", e == null ? void 0 : e.content), console.log("Fviewer data.content.document:", (x = e == null ? void 0 : e.content) == null ? void 0 : x.document), console.log("Fviewer data.content.document\u7C7B\u578B:", typeof ((C = e == null ? void 0 : e.content) == null ? void 0 : C.document)), console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:", ((l = e == null ? void 0 : e.content) == null ? void 0 : l.document) === null), console.log(
|
|
1146
|
+
"Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",
|
|
1147
|
+
((F = e == null ? void 0 : e.content) == null ? void 0 : F.document) === void 0
|
|
1148
|
+
), console.log("Fviewer currentPage:", u), console.log("Fviewer scale:", i);
|
|
1149
|
+
const I = O(null), U = O(null), Q = O(0);
|
|
1150
|
+
Q.current += 1, console.log("[Fviewer] render count:", Q.current);
|
|
1151
|
+
const k = Se(e);
|
|
1152
|
+
console.log("=== Fviewer \u7EC4\u4EF6 ==="), console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:", k), console.log("\u5B8C\u6574\u6570\u636E:", e);
|
|
1153
|
+
const _ = () => {
|
|
1154
|
+
var Y;
|
|
1155
|
+
switch (console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:", k), k) {
|
|
1039
1156
|
case "pdf":
|
|
1040
1157
|
case "pdf_slides":
|
|
1041
|
-
return console.log(
|
|
1158
|
+
return console.log(
|
|
1159
|
+
"\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",
|
|
1160
|
+
k,
|
|
1161
|
+
"pdfStartPage:" + e.pdfStartPage,
|
|
1162
|
+
"currentPage:" + u
|
|
1163
|
+
), Me(
|
|
1164
|
+
e,
|
|
1165
|
+
{
|
|
1166
|
+
data: e,
|
|
1167
|
+
annotationData: t,
|
|
1168
|
+
totalPage: o,
|
|
1169
|
+
currentPage: u,
|
|
1170
|
+
scale: i,
|
|
1171
|
+
eventsEmit: f,
|
|
1172
|
+
styles: s,
|
|
1173
|
+
tools: h,
|
|
1174
|
+
className: B,
|
|
1175
|
+
contentClass: w
|
|
1176
|
+
},
|
|
1177
|
+
k === "pdf_slides",
|
|
1178
|
+
r
|
|
1179
|
+
);
|
|
1042
1180
|
case "image":
|
|
1043
|
-
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),
|
|
1181
|
+
return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"), Ie(e, {
|
|
1182
|
+
scale: i,
|
|
1183
|
+
rotation: v,
|
|
1184
|
+
styles: s
|
|
1185
|
+
});
|
|
1044
1186
|
case "text":
|
|
1045
|
-
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),
|
|
1187
|
+
return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"), We(e, {
|
|
1188
|
+
scale: i,
|
|
1189
|
+
styles: s
|
|
1190
|
+
});
|
|
1046
1191
|
case "markdown":
|
|
1047
1192
|
case "markdown_table":
|
|
1048
|
-
if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",
|
|
1049
|
-
const
|
|
1050
|
-
(
|
|
1051
|
-
);
|
|
1052
|
-
return /* @__PURE__ */ n.createElement(
|
|
1053
|
-
Oe,
|
|
1054
|
-
{
|
|
1055
|
-
markdown: V,
|
|
1056
|
-
tableAnnotations: Q
|
|
1057
|
-
}
|
|
1193
|
+
if (console.log("\u6E32\u67D3Markdown\u5185\u5BB9:", k), k === "markdown_table") {
|
|
1194
|
+
const A = typeof e.content == "string" ? e.content : ((Y = e.content) == null ? void 0 : Y.content) || "", X = (t || []).filter(
|
|
1195
|
+
(P) => "offsets" in P && Array.isArray(P.offsets)
|
|
1058
1196
|
);
|
|
1197
|
+
return /* @__PURE__ */ n.createElement(Oe, { markdown: A, tableAnnotations: X });
|
|
1059
1198
|
}
|
|
1060
1199
|
return /* @__PURE__ */ n.createElement(
|
|
1061
1200
|
je,
|
|
1062
1201
|
{
|
|
1063
1202
|
data: e,
|
|
1064
|
-
parentProps: {
|
|
1203
|
+
parentProps: {
|
|
1204
|
+
data: e,
|
|
1205
|
+
annotationData: t,
|
|
1206
|
+
eventsEmit: f,
|
|
1207
|
+
styles: s,
|
|
1208
|
+
tools: h,
|
|
1209
|
+
className: B,
|
|
1210
|
+
contentClass: w
|
|
1211
|
+
},
|
|
1065
1212
|
isTableMode: !1
|
|
1066
1213
|
}
|
|
1067
1214
|
);
|
|
@@ -1072,31 +1219,19 @@ const De = "#FFEB3B", Be = () => `annotation_${Date.now()}_${Math.random().toStr
|
|
|
1072
1219
|
}
|
|
1073
1220
|
};
|
|
1074
1221
|
return n.useEffect(() => {
|
|
1075
|
-
const
|
|
1222
|
+
const Y = I.current, A = U.current, X = Y !== e, P = A !== (e ? e.content : void 0);
|
|
1076
1223
|
console.log("[Fviewer useEffect:data] triggered", {
|
|
1077
|
-
dataChanged:
|
|
1078
|
-
contentChanged:
|
|
1224
|
+
dataChanged: X,
|
|
1225
|
+
contentChanged: P,
|
|
1079
1226
|
hasData: !!e,
|
|
1080
1227
|
hasContent: !!(e != null && e.content),
|
|
1081
|
-
isLoadingBefore:
|
|
1082
|
-
}),
|
|
1228
|
+
isLoadingBefore: S
|
|
1229
|
+
}), I.current = e, U.current = e ? e.content : void 0;
|
|
1083
1230
|
}, [e == null ? void 0 : e.content]), n.useEffect(() => {
|
|
1084
|
-
|
|
1085
|
-
}, [
|
|
1086
|
-
console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",
|
|
1087
|
-
}, [t,
|
|
1088
|
-
f.LoadingComponent,
|
|
1089
|
-
{
|
|
1090
|
-
status: z,
|
|
1091
|
-
theme: B
|
|
1092
|
-
}
|
|
1093
|
-
) : /* @__PURE__ */ n.createElement(Re, { $theme: B }, z) : i ? f != null && f.ErrorComponent ? /* @__PURE__ */ n.createElement(
|
|
1094
|
-
f.ErrorComponent,
|
|
1095
|
-
{
|
|
1096
|
-
error: i,
|
|
1097
|
-
theme: B
|
|
1098
|
-
}
|
|
1099
|
-
) : /* @__PURE__ */ n.createElement(Ne, { $theme: B }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, i)) : T());
|
|
1231
|
+
y && M(!1);
|
|
1232
|
+
}, [y]), n.useEffect(() => {
|
|
1233
|
+
console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="), console.log("annotationData:", t), console.log("annotationData \u957F\u5EA6:", (t == null ? void 0 : t.length) || 0), console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:", k);
|
|
1234
|
+
}, [t, k]), /* @__PURE__ */ n.createElement(_e, { $theme: b, className: w }, S ? p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: d, theme: b }) : /* @__PURE__ */ n.createElement(Re, { $theme: b }, d) : y ? p != null && p.ErrorComponent ? /* @__PURE__ */ n.createElement(p.ErrorComponent, { error: y, theme: b }) : /* @__PURE__ */ n.createElement(Ne, { $theme: b }, /* @__PURE__ */ n.createElement("div", null, "\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, y)) : _());
|
|
1100
1235
|
};
|
|
1101
1236
|
/**
|
|
1102
1237
|
* @license lucide-react v0.456.0 - ISC
|
|
@@ -1135,24 +1270,24 @@ const Ye = ve(
|
|
|
1135
1270
|
strokeWidth: o = 2,
|
|
1136
1271
|
absoluteStrokeWidth: u,
|
|
1137
1272
|
className: r = "",
|
|
1138
|
-
children:
|
|
1139
|
-
iconNode:
|
|
1140
|
-
...
|
|
1141
|
-
},
|
|
1273
|
+
children: i,
|
|
1274
|
+
iconNode: v,
|
|
1275
|
+
...f
|
|
1276
|
+
}, s) => Ee(
|
|
1142
1277
|
"svg",
|
|
1143
1278
|
{
|
|
1144
|
-
ref:
|
|
1279
|
+
ref: s,
|
|
1145
1280
|
...Ue,
|
|
1146
1281
|
width: t,
|
|
1147
1282
|
height: t,
|
|
1148
1283
|
stroke: e,
|
|
1149
1284
|
strokeWidth: u ? Number(o) * 24 / Number(t) : o,
|
|
1150
1285
|
className: be("lucide", r),
|
|
1151
|
-
...
|
|
1286
|
+
...f
|
|
1152
1287
|
},
|
|
1153
1288
|
[
|
|
1154
|
-
...
|
|
1155
|
-
...Array.isArray(
|
|
1289
|
+
...v.map(([h, p]) => Ee(h, p)),
|
|
1290
|
+
...Array.isArray(i) ? i : [i]
|
|
1156
1291
|
]
|
|
1157
1292
|
)
|
|
1158
1293
|
);
|
|
@@ -1164,8 +1299,8 @@ const Ye = ve(
|
|
|
1164
1299
|
*/
|
|
1165
1300
|
const ue = (e, t) => {
|
|
1166
1301
|
const o = ve(
|
|
1167
|
-
({ className: u, ...r },
|
|
1168
|
-
ref:
|
|
1302
|
+
({ className: u, ...r }, i) => Ee(Ye, {
|
|
1303
|
+
ref: i,
|
|
1169
1304
|
iconNode: t,
|
|
1170
1305
|
className: be(`lucide-${qe(e)}`, u),
|
|
1171
1306
|
...r
|
|
@@ -1270,7 +1405,7 @@ const nt = ue("ZoomOut", [
|
|
|
1270
1405
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
1271
1406
|
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
1272
1407
|
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
1273
|
-
]), ut =
|
|
1408
|
+
]), ut = J.div`
|
|
1274
1409
|
display: flex;
|
|
1275
1410
|
align-items: center;
|
|
1276
1411
|
padding: 0px 12px;
|
|
@@ -1279,28 +1414,28 @@ const nt = ue("ZoomOut", [
|
|
|
1279
1414
|
border-bottom: 1px solid ${(e) => e.$theme.colors.border};
|
|
1280
1415
|
background: ${(e) => e.$theme.colors.background};
|
|
1281
1416
|
min-height: 52px;
|
|
1282
|
-
`, rt =
|
|
1417
|
+
`, rt = J.div`
|
|
1283
1418
|
display: flex;
|
|
1284
1419
|
align-items: center;
|
|
1285
1420
|
gap: 8px;
|
|
1286
1421
|
flex: 1;
|
|
1287
1422
|
min-width: 0;
|
|
1288
|
-
`, lt =
|
|
1423
|
+
`, lt = J.div`
|
|
1289
1424
|
font-size: 14px;
|
|
1290
1425
|
font-weight: 500;
|
|
1291
1426
|
color: ${(e) => e.$theme.colors.text};
|
|
1292
1427
|
white-space: nowrap;
|
|
1293
1428
|
overflow: hidden;
|
|
1294
1429
|
text-overflow: ellipsis;
|
|
1295
|
-
`, at =
|
|
1430
|
+
`, at = J.div`
|
|
1296
1431
|
font-size: 12px;
|
|
1297
1432
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1298
1433
|
white-space: nowrap;
|
|
1299
|
-
`,
|
|
1434
|
+
`, it = J.div`
|
|
1300
1435
|
display: flex;
|
|
1301
1436
|
align-items: center;
|
|
1302
1437
|
gap: 4px;
|
|
1303
|
-
`, ne =
|
|
1438
|
+
`, ne = J.button`
|
|
1304
1439
|
display: flex;
|
|
1305
1440
|
align-items: center;
|
|
1306
1441
|
justify-content: center;
|
|
@@ -1328,7 +1463,7 @@ const nt = ue("ZoomOut", [
|
|
|
1328
1463
|
opacity: 0.5;
|
|
1329
1464
|
cursor: not-allowed;
|
|
1330
1465
|
}
|
|
1331
|
-
`,
|
|
1466
|
+
`, st = J.div`
|
|
1332
1467
|
font-size: 12px;
|
|
1333
1468
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1334
1469
|
min-width: 40px;
|
|
@@ -1370,34 +1505,34 @@ const nt = ue("ZoomOut", [
|
|
|
1370
1505
|
rotate: !0
|
|
1371
1506
|
},
|
|
1372
1507
|
styles: r,
|
|
1373
|
-
onPrevPage:
|
|
1374
|
-
onNextPage:
|
|
1375
|
-
onZoomIn:
|
|
1376
|
-
onZoomOut:
|
|
1377
|
-
onAnnotationToggle:
|
|
1378
|
-
onDownload:
|
|
1379
|
-
onRotateLeft:
|
|
1380
|
-
onRotateRight:
|
|
1381
|
-
onClose:
|
|
1382
|
-
scale:
|
|
1383
|
-
isAnnotating:
|
|
1384
|
-
className:
|
|
1508
|
+
onPrevPage: i,
|
|
1509
|
+
onNextPage: v,
|
|
1510
|
+
onZoomIn: f,
|
|
1511
|
+
onZoomOut: s,
|
|
1512
|
+
onAnnotationToggle: h,
|
|
1513
|
+
onDownload: p,
|
|
1514
|
+
onRotateLeft: B,
|
|
1515
|
+
onRotateRight: w,
|
|
1516
|
+
onClose: x,
|
|
1517
|
+
scale: C = 1,
|
|
1518
|
+
isAnnotating: l = !1,
|
|
1519
|
+
className: F
|
|
1385
1520
|
}) => {
|
|
1386
|
-
const
|
|
1387
|
-
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(ut, { $theme:
|
|
1521
|
+
const b = (r == null ? void 0 : r.theme) || ct;
|
|
1522
|
+
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(ut, { $theme: b, className: F }, /* @__PURE__ */ n.createElement(rt, { $theme: b }, /* @__PURE__ */ n.createElement(lt, { $theme: b }, e)), /* @__PURE__ */ n.createElement(it, { $theme: b }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1388
1523
|
ne,
|
|
1389
1524
|
{
|
|
1390
|
-
$theme:
|
|
1391
|
-
onClick:
|
|
1525
|
+
$theme: b,
|
|
1526
|
+
onClick: i,
|
|
1392
1527
|
disabled: t <= 1,
|
|
1393
1528
|
title: "\u4E0A\u4E00\u9875"
|
|
1394
1529
|
},
|
|
1395
1530
|
/* @__PURE__ */ n.createElement(Ge, { size: 16 })
|
|
1396
|
-
), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme:
|
|
1531
|
+
), o > 0 && /* @__PURE__ */ n.createElement(at, { $theme: b }, t, " / ", o), /* @__PURE__ */ n.createElement(
|
|
1397
1532
|
ne,
|
|
1398
1533
|
{
|
|
1399
|
-
$theme:
|
|
1400
|
-
onClick:
|
|
1534
|
+
$theme: b,
|
|
1535
|
+
onClick: v,
|
|
1401
1536
|
disabled: !o || t >= o,
|
|
1402
1537
|
title: "\u4E0B\u4E00\u9875"
|
|
1403
1538
|
},
|
|
@@ -1405,59 +1540,59 @@ const nt = ue("ZoomOut", [
|
|
|
1405
1540
|
)), u.zoom && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1406
1541
|
ne,
|
|
1407
1542
|
{
|
|
1408
|
-
$theme:
|
|
1409
|
-
onClick:
|
|
1410
|
-
disabled:
|
|
1543
|
+
$theme: b,
|
|
1544
|
+
onClick: s,
|
|
1545
|
+
disabled: C <= 0.3,
|
|
1411
1546
|
title: "\u7F29\u5C0F"
|
|
1412
1547
|
},
|
|
1413
1548
|
/* @__PURE__ */ n.createElement(nt, { size: 16 })
|
|
1414
|
-
), /* @__PURE__ */ n.createElement(
|
|
1549
|
+
), /* @__PURE__ */ n.createElement(st, { $theme: b }, Math.round(C * 100), "%"), /* @__PURE__ */ n.createElement(
|
|
1415
1550
|
ne,
|
|
1416
1551
|
{
|
|
1417
|
-
$theme:
|
|
1418
|
-
onClick:
|
|
1419
|
-
disabled:
|
|
1552
|
+
$theme: b,
|
|
1553
|
+
onClick: f,
|
|
1554
|
+
disabled: C >= 3,
|
|
1420
1555
|
title: "\u653E\u5927"
|
|
1421
1556
|
},
|
|
1422
1557
|
/* @__PURE__ */ n.createElement(ot, { size: 16 })
|
|
1423
1558
|
)), u.annotation && /* @__PURE__ */ n.createElement(
|
|
1424
1559
|
ne,
|
|
1425
1560
|
{
|
|
1426
|
-
$theme:
|
|
1427
|
-
$active:
|
|
1428
|
-
onClick:
|
|
1429
|
-
title:
|
|
1561
|
+
$theme: b,
|
|
1562
|
+
$active: l,
|
|
1563
|
+
onClick: h,
|
|
1564
|
+
title: l ? "\u9000\u51FA\u6807\u6CE8" : "\u5F00\u59CB\u6807\u6CE8"
|
|
1430
1565
|
},
|
|
1431
1566
|
/* @__PURE__ */ n.createElement(Ke, { size: 16 })
|
|
1432
1567
|
), u.download && /* @__PURE__ */ n.createElement(
|
|
1433
1568
|
ne,
|
|
1434
1569
|
{
|
|
1435
|
-
$theme:
|
|
1436
|
-
onClick:
|
|
1570
|
+
$theme: b,
|
|
1571
|
+
onClick: p,
|
|
1437
1572
|
title: "\u4E0B\u8F7D"
|
|
1438
1573
|
},
|
|
1439
1574
|
/* @__PURE__ */ n.createElement(Je, { size: 16 })
|
|
1440
1575
|
), u.rotate && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1441
1576
|
ne,
|
|
1442
1577
|
{
|
|
1443
|
-
$theme:
|
|
1444
|
-
onClick:
|
|
1578
|
+
$theme: b,
|
|
1579
|
+
onClick: B,
|
|
1445
1580
|
title: "\u5411\u5DE6\u65CB\u8F6C"
|
|
1446
1581
|
},
|
|
1447
1582
|
/* @__PURE__ */ n.createElement(Qe, { size: 16 })
|
|
1448
1583
|
), /* @__PURE__ */ n.createElement(
|
|
1449
1584
|
ne,
|
|
1450
1585
|
{
|
|
1451
|
-
$theme:
|
|
1452
|
-
onClick:
|
|
1586
|
+
$theme: b,
|
|
1587
|
+
onClick: w,
|
|
1453
1588
|
title: "\u5411\u53F3\u65CB\u8F6C"
|
|
1454
1589
|
},
|
|
1455
1590
|
/* @__PURE__ */ n.createElement(et, { size: 16 })
|
|
1456
1591
|
)), u.close && /* @__PURE__ */ n.createElement(
|
|
1457
1592
|
ne,
|
|
1458
1593
|
{
|
|
1459
|
-
$theme:
|
|
1460
|
-
onClick:
|
|
1594
|
+
$theme: b,
|
|
1595
|
+
onClick: x,
|
|
1461
1596
|
title: "\u5173\u95ED"
|
|
1462
1597
|
},
|
|
1463
1598
|
/* @__PURE__ */ n.createElement(tt, { size: 16 })
|
|
@@ -1483,17 +1618,17 @@ const nt = ue("ZoomOut", [
|
|
|
1483
1618
|
let o;
|
|
1484
1619
|
if (typeof e == "string") {
|
|
1485
1620
|
console.log("\u4ECEURL\u52A0\u8F7DPDF:", e);
|
|
1486
|
-
const
|
|
1621
|
+
const i = re.getDocument({
|
|
1487
1622
|
url: e,
|
|
1488
1623
|
httpHeaders: t.token ? { Authorization: t.token } : void 0
|
|
1489
1624
|
});
|
|
1490
|
-
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",
|
|
1625
|
+
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(i))), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:", Object.keys(i)), o = await i.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o), console.log("PDF\u6587\u6863\u65B9\u6CD5:", Object.getOwnPropertyNames(Object.getPrototypeOf(o))), console.log("PDF\u6587\u6863\u5C5E\u6027:", Object.keys(o));
|
|
1491
1626
|
} else {
|
|
1492
1627
|
console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");
|
|
1493
|
-
const
|
|
1628
|
+
const i = re.getDocument({
|
|
1494
1629
|
data: e
|
|
1495
1630
|
});
|
|
1496
|
-
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",
|
|
1631
|
+
console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="), console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:", i), console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:", typeof i), o = await i.promise, console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="), console.log("PDF\u6587\u6863\u5BF9\u8C61:", o), console.log("PDF\u6587\u6863\u7C7B\u578B:", typeof o);
|
|
1497
1632
|
}
|
|
1498
1633
|
const u = o.numPages;
|
|
1499
1634
|
console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:", u), console.log("PDF\u6307\u7EB9:", o.fingerprints), console.log("PDF\u4F20\u8F93\u5BF9\u8C61:", o._transport);
|
|
@@ -1537,21 +1672,21 @@ const nt = ue("ZoomOut", [
|
|
|
1537
1672
|
const r = new Blob([e]);
|
|
1538
1673
|
o = URL.createObjectURL(r);
|
|
1539
1674
|
}
|
|
1540
|
-
console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r,
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:",
|
|
1544
|
-
},
|
|
1545
|
-
console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o),
|
|
1675
|
+
console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:", o), await new Promise((r, i) => {
|
|
1676
|
+
const v = new Image();
|
|
1677
|
+
v.onload = () => {
|
|
1678
|
+
console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
|
|
1679
|
+
}, v.onerror = () => {
|
|
1680
|
+
console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
1546
1681
|
};
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1682
|
+
const f = setTimeout(() => {
|
|
1683
|
+
i(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"));
|
|
1549
1684
|
}, 1e4);
|
|
1550
|
-
|
|
1551
|
-
clearTimeout(
|
|
1552
|
-
},
|
|
1553
|
-
clearTimeout(
|
|
1554
|
-
},
|
|
1685
|
+
v.onload = () => {
|
|
1686
|
+
clearTimeout(f), console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:", o), console.log("\u56FE\u7247\u5C3A\u5BF8:", v.width, "x", v.height), r();
|
|
1687
|
+
}, v.onerror = () => {
|
|
1688
|
+
clearTimeout(f), console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:", o), i(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
1689
|
+
}, v.src = o;
|
|
1555
1690
|
});
|
|
1556
1691
|
const u = {
|
|
1557
1692
|
type: "image",
|
|
@@ -1687,7 +1822,7 @@ const nt = ue("ZoomOut", [
|
|
|
1687
1822
|
error: "\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"
|
|
1688
1823
|
};
|
|
1689
1824
|
}
|
|
1690
|
-
}, de =
|
|
1825
|
+
}, de = J.div`
|
|
1691
1826
|
display: flex;
|
|
1692
1827
|
flex-direction: column;
|
|
1693
1828
|
height: 100%;
|
|
@@ -1697,65 +1832,113 @@ const nt = ue("ZoomOut", [
|
|
|
1697
1832
|
border-radius: ${(e) => e.$theme.space.radius};
|
|
1698
1833
|
overflow: hidden;
|
|
1699
1834
|
min-height: 0; /* 确保flex子元素可以收缩 */
|
|
1700
|
-
`, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement(
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1835
|
+
`, pt = ({ status: e, theme: t }) => /* @__PURE__ */ n.createElement(
|
|
1836
|
+
"div",
|
|
1837
|
+
{
|
|
1838
|
+
style: {
|
|
1839
|
+
display: "flex",
|
|
1840
|
+
flexDirection: "column",
|
|
1841
|
+
alignItems: "center",
|
|
1842
|
+
justifyContent: "center",
|
|
1843
|
+
height: "100%",
|
|
1844
|
+
padding: "40px",
|
|
1845
|
+
background: t.colors.background
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
/* @__PURE__ */ n.createElement(
|
|
1849
|
+
"div",
|
|
1850
|
+
{
|
|
1851
|
+
style: {
|
|
1852
|
+
position: "relative",
|
|
1853
|
+
width: "80px",
|
|
1854
|
+
height: "80px",
|
|
1855
|
+
marginBottom: "24px"
|
|
1856
|
+
}
|
|
1857
|
+
},
|
|
1858
|
+
/* @__PURE__ */ n.createElement(
|
|
1859
|
+
"div",
|
|
1860
|
+
{
|
|
1861
|
+
style: {
|
|
1862
|
+
width: "60px",
|
|
1863
|
+
height: "80px",
|
|
1864
|
+
background: t.colors.primary,
|
|
1865
|
+
borderRadius: "8px 8px 0 0",
|
|
1866
|
+
position: "relative",
|
|
1867
|
+
margin: "0 auto"
|
|
1868
|
+
}
|
|
1869
|
+
},
|
|
1870
|
+
/* @__PURE__ */ n.createElement(
|
|
1871
|
+
"div",
|
|
1872
|
+
{
|
|
1873
|
+
style: {
|
|
1874
|
+
position: "absolute",
|
|
1875
|
+
top: "0",
|
|
1876
|
+
right: "0",
|
|
1877
|
+
width: "0",
|
|
1878
|
+
height: "0",
|
|
1879
|
+
borderStyle: "solid",
|
|
1880
|
+
borderWidth: "0 20px 20px 0",
|
|
1881
|
+
borderColor: `transparent ${t.colors.background} transparent transparent`
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
)
|
|
1885
|
+
),
|
|
1886
|
+
/* @__PURE__ */ n.createElement(
|
|
1887
|
+
"div",
|
|
1888
|
+
{
|
|
1889
|
+
style: {
|
|
1890
|
+
position: "absolute",
|
|
1891
|
+
top: "50%",
|
|
1892
|
+
left: "50%",
|
|
1893
|
+
transform: "translate(-50%, -50%)",
|
|
1894
|
+
width: "20px",
|
|
1895
|
+
height: "20px",
|
|
1896
|
+
borderRadius: "50%",
|
|
1897
|
+
background: t.colors.background,
|
|
1898
|
+
animation: "pulse 1.5s ease-in-out infinite"
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
)
|
|
1902
|
+
),
|
|
1903
|
+
/* @__PURE__ */ n.createElement(
|
|
1904
|
+
"div",
|
|
1905
|
+
{
|
|
1906
|
+
style: {
|
|
1907
|
+
fontSize: "16px",
|
|
1908
|
+
fontWeight: "500",
|
|
1909
|
+
color: t.colors.text,
|
|
1910
|
+
marginBottom: "8px",
|
|
1911
|
+
textAlign: "center"
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
e
|
|
1915
|
+
),
|
|
1916
|
+
/* @__PURE__ */ n.createElement(
|
|
1917
|
+
"div",
|
|
1918
|
+
{
|
|
1919
|
+
style: {
|
|
1920
|
+
width: "200px",
|
|
1921
|
+
height: "4px",
|
|
1922
|
+
background: t.colors.border,
|
|
1923
|
+
borderRadius: "2px",
|
|
1924
|
+
overflow: "hidden",
|
|
1925
|
+
position: "relative"
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
/* @__PURE__ */ n.createElement(
|
|
1929
|
+
"div",
|
|
1930
|
+
{
|
|
1931
|
+
style: {
|
|
1932
|
+
width: "30%",
|
|
1933
|
+
height: "100%",
|
|
1934
|
+
background: t.colors.primary,
|
|
1935
|
+
borderRadius: "2px",
|
|
1936
|
+
animation: "loading-progress 2s ease-in-out infinite"
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
),
|
|
1941
|
+
/* @__PURE__ */ n.createElement("style", null, `
|
|
1759
1942
|
@keyframes pulse {
|
|
1760
1943
|
0%, 100% {
|
|
1761
1944
|
opacity: 1;
|
|
@@ -1778,8 +1961,9 @@ const nt = ue("ZoomOut", [
|
|
|
1778
1961
|
transform: translateX(100%);
|
|
1779
1962
|
}
|
|
1780
1963
|
}
|
|
1781
|
-
`)
|
|
1782
|
-
|
|
1964
|
+
`)
|
|
1965
|
+
);
|
|
1966
|
+
J.div`
|
|
1783
1967
|
display: flex;
|
|
1784
1968
|
align-items: center;
|
|
1785
1969
|
justify-content: center;
|
|
@@ -1787,7 +1971,7 @@ G.div`
|
|
|
1787
1971
|
color: ${(e) => e.$theme.colors.disabledText};
|
|
1788
1972
|
font-size: 14px;
|
|
1789
1973
|
`;
|
|
1790
|
-
const Ce =
|
|
1974
|
+
const Ce = J.div`
|
|
1791
1975
|
display: flex;
|
|
1792
1976
|
flex-direction: column;
|
|
1793
1977
|
align-items: center;
|
|
@@ -1826,133 +2010,136 @@ const Ce = G.div`
|
|
|
1826
2010
|
annotations: o,
|
|
1827
2011
|
fileName: u,
|
|
1828
2012
|
token: r,
|
|
1829
|
-
initialPage:
|
|
1830
|
-
data:
|
|
1831
|
-
eventsEmit:
|
|
2013
|
+
initialPage: i = 1,
|
|
2014
|
+
data: v,
|
|
2015
|
+
eventsEmit: f = () => {
|
|
1832
2016
|
},
|
|
1833
|
-
styles:
|
|
1834
|
-
tools:
|
|
2017
|
+
styles: s,
|
|
2018
|
+
tools: h = {
|
|
1835
2019
|
annotation: !1,
|
|
1836
2020
|
download: !1,
|
|
1837
2021
|
zoom: !0,
|
|
1838
2022
|
close: !0,
|
|
1839
2023
|
navigation: !0
|
|
1840
2024
|
},
|
|
1841
|
-
customComponents:
|
|
1842
|
-
className:
|
|
1843
|
-
headerClass:
|
|
1844
|
-
contentClass:
|
|
2025
|
+
customComponents: p,
|
|
2026
|
+
className: B,
|
|
2027
|
+
headerClass: w,
|
|
2028
|
+
contentClass: x
|
|
1845
2029
|
}) => {
|
|
1846
|
-
var
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1849
|
-
}, [
|
|
1850
|
-
var
|
|
1851
|
-
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data:
|
|
1852
|
-
|
|
1853
|
-
type:
|
|
1854
|
-
content:
|
|
1855
|
-
fileName:
|
|
1856
|
-
fileType:
|
|
1857
|
-
totalPages:
|
|
2030
|
+
var C;
|
|
2031
|
+
const l = (s == null ? void 0 : s.theme) || Ct, [F, b] = z(!0), [S, M] = z("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [d, y] = z(null), [g, I] = z(null), [U, Q] = z(i), [k, _] = z(1), [Y, A] = z(0), [X, P] = z(!1), c = $(() => {
|
|
2032
|
+
b(!0), M("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), y(null), I(null), Q(i), A(0), P(!1);
|
|
2033
|
+
}, [i]), a = $(async () => {
|
|
2034
|
+
var E, L;
|
|
2035
|
+
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: v }), c(), v) {
|
|
2036
|
+
b(!1), y(null), I({
|
|
2037
|
+
type: v.fileType || t || "text",
|
|
2038
|
+
content: v.content,
|
|
2039
|
+
fileName: v.fileName || u,
|
|
2040
|
+
fileType: v.fileType || t,
|
|
2041
|
+
totalPages: v.totalPages || 1
|
|
1858
2042
|
});
|
|
1859
2043
|
return;
|
|
1860
2044
|
}
|
|
1861
2045
|
if (!e) {
|
|
1862
|
-
|
|
2046
|
+
y("\u6587\u4EF6URL\u4E0D\u80FD\u4E3A\u7A7A"), b(!1);
|
|
1863
2047
|
return;
|
|
1864
2048
|
}
|
|
1865
2049
|
try {
|
|
1866
|
-
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1869
|
-
const
|
|
2050
|
+
b(!0), y(null);
|
|
2051
|
+
const K = xe(u, t);
|
|
2052
|
+
M(K === "image" ? "\u56FE\u7247\u4E0B\u8F7D\u4E2D..." : K === "pdf" ? "PDF\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : K === "markdown" || K === "markdown_table" ? "Markdown\u6587\u4EF6\u4E0B\u8F7D\u4E2D..." : "\u6587\u4EF6\u4E0B\u8F7D\u4E2D...");
|
|
2053
|
+
const W = await Ft(e, {
|
|
1870
2054
|
fileName: u,
|
|
1871
2055
|
fileType: t,
|
|
1872
2056
|
token: r
|
|
1873
2057
|
});
|
|
1874
|
-
console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:",
|
|
1875
|
-
} catch (
|
|
1876
|
-
|
|
2058
|
+
console.log("=== StaticFileReader parseFile \u7ED3\u679C ==="), console.log("result:", W), console.log("result.type:", W.type), console.log("result.content:", W.content), console.log("result.content?.text:", (E = W.content) == null ? void 0 : E.text), console.log("result.fileName:", W.fileName), console.log("result.fileType:", W.fileType), W.error ? y(W.error) : (W.type === "image" ? M("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210") : W.type === "pdf" ? M("PDF\u52A0\u8F7D\u5B8C\u6210") : W.type === "markdown" || W.type === "markdown_table" ? M("Markdown\u52A0\u8F7D\u5B8C\u6210") : M("\u6587\u4EF6\u52A0\u8F7D\u5B8C\u6210"), console.log("=== parseResult \u8BBE\u7F6E ==="), console.log("parseResult:", W), console.log("parseResult.content:", W.content), console.log("parseResult.content.document:", (L = W.content) == null ? void 0 : L.document), I(W));
|
|
2059
|
+
} catch (K) {
|
|
2060
|
+
y(`\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25: ${K instanceof Error ? K.message : "\u672A\u77E5\u9519\u8BEF"}`);
|
|
1877
2061
|
} finally {
|
|
1878
|
-
|
|
2062
|
+
b(!1);
|
|
1879
2063
|
}
|
|
1880
|
-
}, [e, u, t, r,
|
|
2064
|
+
}, [e, u, t, r, v, c]);
|
|
1881
2065
|
te(() => {
|
|
1882
|
-
|
|
1883
|
-
}, [
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
const
|
|
1902
|
-
_(
|
|
1903
|
-
}, [
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
2066
|
+
a();
|
|
2067
|
+
}, [a]);
|
|
2068
|
+
const m = $(
|
|
2069
|
+
(E, L, K) => {
|
|
2070
|
+
switch (E) {
|
|
2071
|
+
case "pageChange":
|
|
2072
|
+
L != null && L.pageNumber && Q(L.pageNumber);
|
|
2073
|
+
break;
|
|
2074
|
+
// if (data?.annotationId) {
|
|
2075
|
+
// setAnnotations(prev => prev.filter(a => a.id !== data.annotationId));
|
|
2076
|
+
// }
|
|
2077
|
+
// break;
|
|
2078
|
+
default:
|
|
2079
|
+
f(E, L, K);
|
|
2080
|
+
break;
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
[f]
|
|
2084
|
+
), D = $(() => {
|
|
2085
|
+
const E = Math.min(3, k + 0.1);
|
|
2086
|
+
_(E), m("zoom:change", { scale: E });
|
|
2087
|
+
}, [k, m]), R = $(() => {
|
|
2088
|
+
const E = Math.max(0.3, k - 0.1);
|
|
2089
|
+
_(E), m("zoom:change", { scale: E });
|
|
2090
|
+
}, [k, m]), H = $(() => {
|
|
2091
|
+
if (U > 1) {
|
|
2092
|
+
const E = U - 1;
|
|
2093
|
+
Q(E), m("page:change", { page: E });
|
|
1907
2094
|
}
|
|
1908
|
-
}, [
|
|
1909
|
-
const
|
|
1910
|
-
if (
|
|
1911
|
-
const L =
|
|
1912
|
-
|
|
2095
|
+
}, [U, m]), q = $(() => {
|
|
2096
|
+
const E = (g == null ? void 0 : g.totalPages) || 0;
|
|
2097
|
+
if (E && U < E) {
|
|
2098
|
+
const L = U + 1;
|
|
2099
|
+
Q(L), m("page:change", { page: L });
|
|
1913
2100
|
}
|
|
1914
|
-
}, [
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
}, [
|
|
1918
|
-
|
|
1919
|
-
}, [
|
|
1920
|
-
|
|
1921
|
-
}, [
|
|
1922
|
-
|
|
1923
|
-
}, [
|
|
1924
|
-
|
|
1925
|
-
}, [
|
|
1926
|
-
const
|
|
2101
|
+
}, [U, g == null ? void 0 : g.totalPages, m]), G = $(() => {
|
|
2102
|
+
const E = !X;
|
|
2103
|
+
P(E), m("annotation:toggle", { isAnnotating: E });
|
|
2104
|
+
}, [X, m]), ee = $(() => {
|
|
2105
|
+
m("download:start", { fileUrl: e, fileName: u });
|
|
2106
|
+
}, [m, e, u]), N = $(() => {
|
|
2107
|
+
A((E) => (E - 90) % 360), m("rotate:left", { rotation: (Y - 90) % 360 });
|
|
2108
|
+
}, [Y, m]), j = $(() => {
|
|
2109
|
+
A((E) => (E + 90) % 360), m("rotate:right", { rotation: (Y + 90) % 360 });
|
|
2110
|
+
}, [Y, m]), V = $(() => {
|
|
2111
|
+
m("viewer:close");
|
|
2112
|
+
}, [m]), oe = $((E, L) => {
|
|
2113
|
+
const K = E === "pdf", W = E === "text" || E === "markdown" || E === "markdown_table" || E === "html";
|
|
1927
2114
|
return {
|
|
1928
2115
|
...L,
|
|
1929
2116
|
// 缩放功能:只有 PDF 和图片支持
|
|
1930
|
-
zoom: L.zoom && !
|
|
2117
|
+
zoom: L.zoom && !W,
|
|
1931
2118
|
// 导航功能:只有多页文件支持(PDF)
|
|
1932
|
-
navigation: L.navigation &&
|
|
2119
|
+
navigation: L.navigation && K,
|
|
1933
2120
|
// 标注功能:PDF、Markdown、Markdown表格都支持
|
|
1934
|
-
annotation: L.annotation && (
|
|
2121
|
+
annotation: L.annotation && (E === "pdf" || E === "markdown" || E === "markdown_table"),
|
|
1935
2122
|
// 旋转功能:只有图片支持
|
|
1936
|
-
rotate: L.rotate &&
|
|
2123
|
+
rotate: L.rotate && E === "image",
|
|
1937
2124
|
// 下载功能:所有文件都支持
|
|
1938
2125
|
download: L.download,
|
|
1939
2126
|
// 关闭功能:所有文件都支持
|
|
1940
2127
|
close: L.close
|
|
1941
2128
|
};
|
|
1942
2129
|
}, []);
|
|
1943
|
-
if (
|
|
1944
|
-
const
|
|
1945
|
-
...
|
|
2130
|
+
if (F) {
|
|
2131
|
+
const E = oe(t || "unknown", {
|
|
2132
|
+
...h,
|
|
1946
2133
|
navigation: !1
|
|
1947
2134
|
});
|
|
1948
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
2135
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
|
|
1949
2136
|
ce,
|
|
1950
2137
|
{
|
|
1951
2138
|
fileName: u || "\u52A0\u8F7D\u4E2D...",
|
|
1952
2139
|
currentPage: 1,
|
|
1953
2140
|
totalPage: 0,
|
|
1954
|
-
tools:
|
|
1955
|
-
styles:
|
|
2141
|
+
tools: E,
|
|
2142
|
+
styles: s,
|
|
1956
2143
|
onPrevPage: () => {
|
|
1957
2144
|
},
|
|
1958
2145
|
onNextPage: () => {
|
|
@@ -1965,38 +2152,26 @@ const Ce = G.div`
|
|
|
1965
2152
|
},
|
|
1966
2153
|
onDownload: () => {
|
|
1967
2154
|
},
|
|
1968
|
-
onClose:
|
|
2155
|
+
onClose: V,
|
|
1969
2156
|
scale: 1,
|
|
1970
2157
|
isAnnotating: !1,
|
|
1971
|
-
className:
|
|
1972
|
-
}
|
|
1973
|
-
), C != null && C.LoadingComponent ? /* @__PURE__ */ n.createElement(
|
|
1974
|
-
C.LoadingComponent,
|
|
1975
|
-
{
|
|
1976
|
-
status: Z,
|
|
1977
|
-
theme: a
|
|
1978
|
-
}
|
|
1979
|
-
) : /* @__PURE__ */ n.createElement(
|
|
1980
|
-
pt,
|
|
1981
|
-
{
|
|
1982
|
-
status: Z,
|
|
1983
|
-
theme: a
|
|
2158
|
+
className: w
|
|
1984
2159
|
}
|
|
1985
|
-
));
|
|
2160
|
+
), p != null && p.LoadingComponent ? /* @__PURE__ */ n.createElement(p.LoadingComponent, { status: S, theme: l }) : /* @__PURE__ */ n.createElement(pt, { status: S, theme: l }));
|
|
1986
2161
|
}
|
|
1987
|
-
if (
|
|
1988
|
-
const
|
|
1989
|
-
...
|
|
2162
|
+
if (d) {
|
|
2163
|
+
const E = oe(t || "unknown", {
|
|
2164
|
+
...h,
|
|
1990
2165
|
navigation: !1
|
|
1991
2166
|
});
|
|
1992
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
2167
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
|
|
1993
2168
|
ce,
|
|
1994
2169
|
{
|
|
1995
2170
|
fileName: u || "\u9519\u8BEF",
|
|
1996
2171
|
currentPage: 1,
|
|
1997
2172
|
totalPage: 0,
|
|
1998
|
-
tools:
|
|
1999
|
-
styles:
|
|
2173
|
+
tools: E,
|
|
2174
|
+
styles: s,
|
|
2000
2175
|
onPrevPage: () => {
|
|
2001
2176
|
},
|
|
2002
2177
|
onNextPage: () => {
|
|
@@ -2009,26 +2184,26 @@ const Ce = G.div`
|
|
|
2009
2184
|
},
|
|
2010
2185
|
onDownload: () => {
|
|
2011
2186
|
},
|
|
2012
|
-
onClose:
|
|
2187
|
+
onClose: V,
|
|
2013
2188
|
scale: 1,
|
|
2014
2189
|
isAnnotating: !1,
|
|
2015
|
-
className:
|
|
2190
|
+
className: w
|
|
2016
2191
|
}
|
|
2017
|
-
), /* @__PURE__ */ n.createElement(Ce, { $theme:
|
|
2192
|
+
), /* @__PURE__ */ n.createElement(Ce, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25"), /* @__PURE__ */ n.createElement("div", { style: { fontSize: "12px", marginTop: "8px" } }, d)));
|
|
2018
2193
|
}
|
|
2019
|
-
if (!
|
|
2020
|
-
const
|
|
2021
|
-
...
|
|
2194
|
+
if (!g) {
|
|
2195
|
+
const E = oe(t || "unknown", {
|
|
2196
|
+
...h,
|
|
2022
2197
|
navigation: !1
|
|
2023
2198
|
});
|
|
2024
|
-
return /* @__PURE__ */ n.createElement(de, { $theme:
|
|
2199
|
+
return /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
|
|
2025
2200
|
ce,
|
|
2026
2201
|
{
|
|
2027
2202
|
fileName: u || "\u672A\u77E5\u6587\u4EF6",
|
|
2028
2203
|
currentPage: 1,
|
|
2029
2204
|
totalPage: 0,
|
|
2030
|
-
tools:
|
|
2031
|
-
styles:
|
|
2205
|
+
tools: E,
|
|
2206
|
+
styles: s,
|
|
2032
2207
|
onPrevPage: () => {
|
|
2033
2208
|
},
|
|
2034
2209
|
onNextPage: () => {
|
|
@@ -2041,61 +2216,62 @@ const Ce = G.div`
|
|
|
2041
2216
|
},
|
|
2042
2217
|
onDownload: () => {
|
|
2043
2218
|
},
|
|
2044
|
-
onClose:
|
|
2219
|
+
onClose: V,
|
|
2045
2220
|
scale: 1,
|
|
2046
2221
|
isAnnotating: !1,
|
|
2047
|
-
className:
|
|
2222
|
+
className: w
|
|
2048
2223
|
}
|
|
2049
|
-
), /* @__PURE__ */ n.createElement(Ce, { $theme:
|
|
2224
|
+
), /* @__PURE__ */ n.createElement(Ce, { $theme: l }, /* @__PURE__ */ n.createElement("div", null, "\u65E0\u6CD5\u89E3\u6790\u6587\u4EF6")));
|
|
2050
2225
|
}
|
|
2051
|
-
const
|
|
2052
|
-
content:
|
|
2053
|
-
...(
|
|
2054
|
-
...(
|
|
2055
|
-
...
|
|
2056
|
-
},
|
|
2057
|
-
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:",
|
|
2226
|
+
const Z = {
|
|
2227
|
+
content: g.content,
|
|
2228
|
+
...(g.fileName || u) && { fileName: g.fileName || u },
|
|
2229
|
+
...(g.fileType || t) && { fileType: g.fileType || t },
|
|
2230
|
+
...g.totalPages && { totalPages: g.totalPages }
|
|
2231
|
+
}, T = oe(g.type, h);
|
|
2232
|
+
return console.log("=== viewerData \u51C6\u5907 ==="), console.log("viewerData:", Z), console.log("viewerData.content:", Z.content), console.log("viewerData.content.document:", (C = Z.content) == null ? void 0 : C.document), console.log("\u6587\u4EF6\u7C7B\u578B:", g.type), console.log("\u52A8\u6001\u5DE5\u5177\u914D\u7F6E:", T), console.log("=== \u6807\u6CE8\u6570\u636E\u4F20\u9012 ==="), console.log("annotations prop:", o), console.log("annotations \u957F\u5EA6:", (o == null ? void 0 : o.length) || 0), /* @__PURE__ */ n.createElement(de, { $theme: l, className: B }, /* @__PURE__ */ n.createElement(
|
|
2058
2233
|
ce,
|
|
2059
2234
|
{
|
|
2060
|
-
fileName:
|
|
2061
|
-
currentPage:
|
|
2062
|
-
totalPage:
|
|
2063
|
-
tools:
|
|
2064
|
-
styles:
|
|
2065
|
-
onPrevPage:
|
|
2235
|
+
fileName: Z.fileName || g.fileName || u || "\u672A\u77E5\u6587\u4EF6",
|
|
2236
|
+
currentPage: g.type === "pdf" ? U : 1,
|
|
2237
|
+
totalPage: g.type === "pdf" && g.totalPages || 0,
|
|
2238
|
+
tools: T,
|
|
2239
|
+
styles: s,
|
|
2240
|
+
onPrevPage: g.type === "pdf" ? H : () => {
|
|
2066
2241
|
},
|
|
2067
|
-
onNextPage:
|
|
2242
|
+
onNextPage: g.type === "pdf" ? q : () => {
|
|
2068
2243
|
},
|
|
2069
|
-
onZoomIn:
|
|
2244
|
+
onZoomIn: T.zoom ? D : () => {
|
|
2070
2245
|
},
|
|
2071
|
-
onZoomOut:
|
|
2246
|
+
onZoomOut: T.zoom ? R : () => {
|
|
2072
2247
|
},
|
|
2073
|
-
onAnnotationToggle:
|
|
2248
|
+
onAnnotationToggle: T.annotation ? G : () => {
|
|
2074
2249
|
},
|
|
2075
|
-
onDownload:
|
|
2250
|
+
onDownload: T.download ? ee : () => {
|
|
2076
2251
|
},
|
|
2077
|
-
onRotateLeft:
|
|
2252
|
+
onRotateLeft: T.rotate ? N : () => {
|
|
2078
2253
|
},
|
|
2079
|
-
onRotateRight:
|
|
2254
|
+
onRotateRight: T.rotate ? j : () => {
|
|
2080
2255
|
},
|
|
2081
|
-
onClose:
|
|
2082
|
-
scale:
|
|
2083
|
-
isAnnotating:
|
|
2084
|
-
className:
|
|
2256
|
+
onClose: V,
|
|
2257
|
+
scale: k,
|
|
2258
|
+
isAnnotating: X,
|
|
2259
|
+
className: w
|
|
2085
2260
|
}
|
|
2086
2261
|
), /* @__PURE__ */ n.createElement(
|
|
2087
2262
|
Xe,
|
|
2088
2263
|
{
|
|
2089
|
-
data:
|
|
2264
|
+
data: Z,
|
|
2090
2265
|
annotationData: o || [],
|
|
2091
|
-
totalPage:
|
|
2092
|
-
currentPage:
|
|
2093
|
-
scale:
|
|
2094
|
-
rotation:
|
|
2095
|
-
eventsEmit:
|
|
2096
|
-
styles:
|
|
2097
|
-
tools:
|
|
2098
|
-
className:
|
|
2266
|
+
totalPage: g.type === "pdf" && g.totalPages || 0,
|
|
2267
|
+
currentPage: g.type === "pdf" ? U : 1,
|
|
2268
|
+
scale: k,
|
|
2269
|
+
rotation: Y,
|
|
2270
|
+
eventsEmit: m,
|
|
2271
|
+
styles: s,
|
|
2272
|
+
tools: T,
|
|
2273
|
+
className: x,
|
|
2274
|
+
setScale: _
|
|
2099
2275
|
}
|
|
2100
2276
|
));
|
|
2101
2277
|
}, vt = () => !!re.GlobalWorkerOptions.workerSrc, Dt = () => re.GlobalWorkerOptions.workerSrc, Bt = (e = "/worker/pdf.worker.min.js") => {
|