@mxmweb/fviewer 1.2.0 → 1.2.1
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/index.js +89 -83
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/stats.html +1 -1
package/index.js
CHANGED
|
@@ -184,14 +184,14 @@ const Pe = {
|
|
|
184
184
|
onAnnotationDelete: w,
|
|
185
185
|
styles: b
|
|
186
186
|
}) => {
|
|
187
|
-
const [v, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [F, k] = R(!0), O = (b == null ? void 0 : b.theme) || Pe, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((
|
|
187
|
+
const [v, B] = R(!1), [a, l] = R(null), [D, C] = R(0), [q, N] = R(0), [c, x] = R(!1), [F, k] = R(!0), O = (b == null ? void 0 : b.theme) || Pe, L = X(null), A = X(null), P = X(!1), V = X(null), ee = $((s) => {
|
|
188
188
|
if (!A.current || !F || !g) return null;
|
|
189
|
-
const
|
|
189
|
+
const i = A.current, y = i.offsetWidth - 40, m = i.offsetHeight - 40, _ = y / s.width, T = m / s.height, I = Math.min(_, T, 1), Z = Math.max(0.3, Math.min(1, I));
|
|
190
190
|
return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:", {
|
|
191
191
|
containerWidth: y,
|
|
192
192
|
containerHeight: m,
|
|
193
|
-
viewportWidth:
|
|
194
|
-
viewportHeight:
|
|
193
|
+
viewportWidth: s.width,
|
|
194
|
+
viewportHeight: s.height,
|
|
195
195
|
scaleX: _,
|
|
196
196
|
scaleY: T,
|
|
197
197
|
autoScale: I,
|
|
@@ -205,21 +205,21 @@ const Pe = {
|
|
|
205
205
|
}
|
|
206
206
|
try {
|
|
207
207
|
V.current = t, P.current = !0;
|
|
208
|
-
const
|
|
209
|
-
if (console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${
|
|
210
|
-
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${
|
|
211
|
-
const
|
|
208
|
+
const s = t - o + 1;
|
|
209
|
+
if (console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${o}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${t}, \u76F8\u5BF9\u9875\u7801=${s}`), s < 1 || s > e.numPages)
|
|
210
|
+
throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${s}, PDF\u603B\u9875\u6570=${e.numPages}`), new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${t}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${e.numPages}\u9875`);
|
|
211
|
+
const i = await e.getPage(s), y = L.current, m = y.getContext("2d");
|
|
212
212
|
console.log("\u5F53\u524Dscale\u503C:", u);
|
|
213
|
-
const _ =
|
|
214
|
-
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), F && k(!1), y.width = _.width, y.height = _.height, await
|
|
213
|
+
const _ = i.getViewport({ scale: 1 });
|
|
214
|
+
if (console.log("viewport\u5C3A\u5BF8:", _.width, "x", _.height), F && k(!1), y.width = _.width, y.height = _.height, await i.render({
|
|
215
215
|
canvasContext: m,
|
|
216
216
|
viewport: _
|
|
217
217
|
}).promise, console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:", y.width, "x", y.height), A.current) {
|
|
218
218
|
const T = A.current;
|
|
219
219
|
console.log("\u5BB9\u5668\u5C3A\u5BF8:", T.offsetWidth, "x", T.offsetHeight), console.log("Canvas\u663E\u793A\u5C3A\u5BF8:", y.offsetWidth, "x", y.offsetHeight);
|
|
220
220
|
}
|
|
221
|
-
} catch (
|
|
222
|
-
console.error("PDF\u6E32\u67D3\u5931\u8D25:",
|
|
221
|
+
} catch (s) {
|
|
222
|
+
console.error("PDF\u6E32\u67D3\u5931\u8D25:", s);
|
|
223
223
|
} finally {
|
|
224
224
|
P.current = !1;
|
|
225
225
|
}
|
|
@@ -621,37 +621,37 @@ const Pe = {
|
|
|
621
621
|
var u, r, d, p, f, g, h, w, b, v, B, a;
|
|
622
622
|
const l = X(null), D = X(null), C = X(null), q = X(!1);
|
|
623
623
|
X(0), X(null);
|
|
624
|
-
const [N] = R(!1), c = (
|
|
625
|
-
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop:
|
|
624
|
+
const [N] = R(!1), c = (s, i) => {
|
|
625
|
+
console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="), console.log("\u6EDA\u52A8\u4F4D\u7F6E:", { scrollTop: s, scrollHeight: i }), t.eventsEmit && t.eventsEmit("markdown_scroll", { scrollTop: s, scrollHeight: i });
|
|
626
626
|
}, x = () => {
|
|
627
627
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_top");
|
|
628
628
|
}, F = () => {
|
|
629
629
|
console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="), t.eventsEmit && t.eventsEmit("markdown_scroll_to_bottom");
|
|
630
630
|
}, k = X();
|
|
631
|
-
k.current = (
|
|
632
|
-
var
|
|
631
|
+
k.current = (s) => {
|
|
632
|
+
var i, y;
|
|
633
633
|
try {
|
|
634
634
|
if (!o) return;
|
|
635
|
-
const m = typeof e.content == "string" ? e.content : ((
|
|
635
|
+
const m = typeof e.content == "string" ? e.content : ((i = e.content) == null ? void 0 : i.content) || "";
|
|
636
636
|
if (!m || P.length === 0) return;
|
|
637
637
|
const _ = JSON.stringify(P.map((Z) => ({ o: Z.offsets, c: Z.color }))), T = `${m.length}:${m.substring(0, 64)}:${m.substring(m.length - 64)}|${_}`;
|
|
638
|
-
if (((y =
|
|
638
|
+
if (((y = s.dataset) == null ? void 0 : y.tableAnnoRuntimeSig) === T) return;
|
|
639
639
|
setTimeout(() => {
|
|
640
|
-
ee(),
|
|
640
|
+
ee(), s.dataset && (s.dataset.tableAnnoRuntimeSig = T);
|
|
641
641
|
}, 50);
|
|
642
642
|
} catch (m) {
|
|
643
643
|
console.warn("[MarkdownRendered] apply failed", m);
|
|
644
644
|
}
|
|
645
645
|
};
|
|
646
|
-
const O = n.useCallback((
|
|
647
|
-
var s;
|
|
648
|
-
return (s = k.current) == null ? void 0 : s.call(k, i);
|
|
649
|
-
}, []), L = $(() => {
|
|
646
|
+
const O = n.useCallback((s) => {
|
|
650
647
|
var i;
|
|
648
|
+
return (i = k.current) == null ? void 0 : i.call(k, s);
|
|
649
|
+
}, []), L = $(() => {
|
|
650
|
+
var s;
|
|
651
651
|
if (!N || !l.current) return;
|
|
652
|
-
const
|
|
653
|
-
if (!
|
|
654
|
-
const y =
|
|
652
|
+
const i = window.getSelection();
|
|
653
|
+
if (!i || i.isCollapsed) return;
|
|
654
|
+
const y = i.getRangeAt(0), m = y.toString().trim();
|
|
655
655
|
if (!m) return;
|
|
656
656
|
const _ = l.current;
|
|
657
657
|
let T = 0, I = 0;
|
|
@@ -671,7 +671,7 @@ const Pe = {
|
|
|
671
671
|
I = T + y.startOffset;
|
|
672
672
|
break;
|
|
673
673
|
}
|
|
674
|
-
T += ((
|
|
674
|
+
T += ((s = U.textContent) == null ? void 0 : s.length) || 0, U = Z.nextNode();
|
|
675
675
|
}
|
|
676
676
|
console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:", {
|
|
677
677
|
text: m,
|
|
@@ -685,35 +685,35 @@ const Pe = {
|
|
|
685
685
|
end: I + m.length,
|
|
686
686
|
color: "#FFE599"
|
|
687
687
|
};
|
|
688
|
-
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M),
|
|
688
|
+
console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:", M), t.eventsEmit && t.eventsEmit("md_annotation_add", M), i.removeAllRanges();
|
|
689
689
|
}, [N, t.eventsEmit]), A = o ? [] : (t.annotationData || []).filter(
|
|
690
|
-
(
|
|
690
|
+
(s) => "start" in s && "end" in s && !("pageNumber" in s)
|
|
691
691
|
), P = o ? (t.annotationData || []).filter(
|
|
692
|
-
(
|
|
692
|
+
(s) => "offsets" in s && Array.isArray(s.offsets)
|
|
693
693
|
) : [], V = $(() => {
|
|
694
694
|
if (console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="), !l.current) {
|
|
695
695
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");
|
|
696
696
|
return;
|
|
697
697
|
}
|
|
698
|
-
const
|
|
699
|
-
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",
|
|
700
|
-
const y =
|
|
701
|
-
y && y.replaceChild(document.createTextNode(
|
|
698
|
+
const s = l.current.querySelectorAll(".md-annotation");
|
|
699
|
+
console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:", s.length), s.length > 0 && s.forEach((i) => {
|
|
700
|
+
const y = i.parentNode;
|
|
701
|
+
y && y.replaceChild(document.createTextNode(i.textContent || ""), i);
|
|
702
702
|
}), console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A");
|
|
703
703
|
}, []), ee = $(() => {
|
|
704
704
|
if (console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="), console.log("tableAnnotations:", P), !l.current || !P.length) {
|
|
705
705
|
console.log("\u8868\u683C\u6807\u6CE8\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u9000\u51FA");
|
|
706
706
|
return;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
709
|
-
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",
|
|
708
|
+
const s = l.current.querySelectorAll("table");
|
|
709
|
+
if (console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:", s.length), s.length === 0) {
|
|
710
710
|
console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");
|
|
711
711
|
return;
|
|
712
712
|
}
|
|
713
|
-
q.current = !0, P.forEach((
|
|
714
|
-
const m =
|
|
715
|
-
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",
|
|
716
|
-
console.warn("[TableAnnotation] annotation.offsets is not valid",
|
|
713
|
+
q.current = !0, P.forEach((i, y) => {
|
|
714
|
+
const m = i.offsets;
|
|
715
|
+
if (console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:", i), !Array.isArray(m) || !m.length || !Array.isArray(m[0]) || m[0].length !== 2) {
|
|
716
|
+
console.warn("[TableAnnotation] annotation.offsets is not valid", i);
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
719
719
|
m.forEach((_, T) => {
|
|
@@ -722,7 +722,7 @@ const Pe = {
|
|
|
722
722
|
console.warn("[TableAnnotation] offset is not [number, number]", _);
|
|
723
723
|
return;
|
|
724
724
|
}
|
|
725
|
-
|
|
725
|
+
s.forEach((U, M) => {
|
|
726
726
|
var j, K, oe;
|
|
727
727
|
let Q;
|
|
728
728
|
const H = U.tBodies && U.tBodies.length > 0 ? Array.from(U.tBodies[0].rows) : [];
|
|
@@ -741,8 +741,8 @@ const Pe = {
|
|
|
741
741
|
console.warn("[TableAnnotation] cell is undefined", { row: I, col: Z, tableIndex: M });
|
|
742
742
|
return;
|
|
743
743
|
}
|
|
744
|
-
const E =
|
|
745
|
-
W.getAttribute("data-table-annotated") === "1" && (z === E || W.style.backgroundColor === E) || (W.style.setProperty("background", E, "important"), W.style.setProperty("background-color", E, "important"), W.setAttribute("data-table-annotated", "1")),
|
|
744
|
+
const E = i.color || "rgba(255, 229, 153, 0.5)", z = getComputedStyle(W).backgroundColor;
|
|
745
|
+
W.getAttribute("data-table-annotated") === "1" && (z === E || W.style.backgroundColor === E) || (W.style.setProperty("background", E, "important"), W.style.setProperty("background-color", E, "important"), W.setAttribute("data-table-annotated", "1")), i.content && (W.title = i.content), T === 0 && y === 0 && setTimeout(() => {
|
|
746
746
|
W.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
747
747
|
}, 300);
|
|
748
748
|
});
|
|
@@ -756,10 +756,10 @@ const Pe = {
|
|
|
756
756
|
return;
|
|
757
757
|
}
|
|
758
758
|
D.current && clearTimeout(D.current);
|
|
759
|
-
const
|
|
760
|
-
var
|
|
759
|
+
const s = () => {
|
|
760
|
+
var i;
|
|
761
761
|
console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");
|
|
762
|
-
const y = (
|
|
762
|
+
const y = (i = l.current) == null ? void 0 : i.querySelectorAll(".md-annotation");
|
|
763
763
|
console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:", (y == null ? void 0 : y.length) || 0), y == null || y.forEach((M) => {
|
|
764
764
|
const j = M.parentNode;
|
|
765
765
|
j && j.replaceChild(document.createTextNode(M.textContent || ""), M);
|
|
@@ -779,7 +779,7 @@ const Pe = {
|
|
|
779
779
|
_.push(T);
|
|
780
780
|
if (console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:", _.length), _.length === 0) {
|
|
781
781
|
console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."), D.current = setTimeout(() => {
|
|
782
|
-
|
|
782
|
+
s();
|
|
783
783
|
}, 200);
|
|
784
784
|
return;
|
|
785
785
|
}
|
|
@@ -804,36 +804,36 @@ const Pe = {
|
|
|
804
804
|
);
|
|
805
805
|
console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:", Q.length), Q.forEach(({ node: H, start: W }) => {
|
|
806
806
|
var E, z, Y, S, me, Fe;
|
|
807
|
-
const le = Math.max(0, j - W),
|
|
808
|
-
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd:
|
|
807
|
+
const le = Math.max(0, j - W), se = Math.min(((E = H.textContent) == null ? void 0 : E.length) || 0, K - W);
|
|
808
|
+
if (console.log("\u672C\u5730\u4F4D\u7F6E:", { localStart: le, localEnd: se, nodeTextLength: (z = H.textContent) == null ? void 0 : z.length }), le >= se) {
|
|
809
809
|
console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
|
-
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le,
|
|
812
|
+
const ge = ((Y = H.textContent) == null ? void 0 : Y.slice(0, le)) || "", fe = ((S = H.textContent) == null ? void 0 : S.slice(le, se)) || "", Ee = ((me = H.textContent) == null ? void 0 : me.slice(se)) || "";
|
|
813
813
|
console.log("\u5206\u5272\u6587\u672C:", { before: ge, annotatedText: fe, after: Ee });
|
|
814
|
-
const
|
|
815
|
-
|
|
814
|
+
const ie = document.createElement("span");
|
|
815
|
+
ie.className = "md-annotation", ie.style.backgroundColor = oe || "#FFE599", ie.textContent = fe;
|
|
816
816
|
const ae = document.createDocumentFragment();
|
|
817
|
-
ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(
|
|
817
|
+
ge && ae.appendChild(document.createTextNode(ge)), ae.appendChild(ie), Ee && ae.appendChild(document.createTextNode(Ee)), (Fe = H.parentNode) == null || Fe.replaceChild(ae, H), console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:", fe);
|
|
818
818
|
});
|
|
819
819
|
});
|
|
820
820
|
};
|
|
821
821
|
D.current = setTimeout(() => {
|
|
822
|
-
|
|
822
|
+
s();
|
|
823
823
|
}, 100);
|
|
824
824
|
}, [A]);
|
|
825
825
|
return te(() => {
|
|
826
|
-
var
|
|
826
|
+
var s;
|
|
827
827
|
if (o) {
|
|
828
828
|
console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");
|
|
829
829
|
return;
|
|
830
830
|
}
|
|
831
|
-
const
|
|
832
|
-
if (!
|
|
831
|
+
const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
|
|
832
|
+
if (!i || typeof i != "string") {
|
|
833
833
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");
|
|
834
834
|
return;
|
|
835
835
|
}
|
|
836
|
-
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", A), console.log("tableAnnotations:", P), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:",
|
|
836
|
+
if (console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="), console.log("markdownRef.current:", l.current), console.log("isTableMode:", o), console.log("mdAnnotations:", A), console.log("tableAnnotations:", P), console.log("data.content:", e.content), console.log("\u5B9E\u9645\u5185\u5BB9:", i), !l.current) {
|
|
837
837
|
console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");
|
|
838
838
|
return;
|
|
839
839
|
}
|
|
@@ -848,18 +848,18 @@ const Pe = {
|
|
|
848
848
|
document.removeEventListener("mouseup", L);
|
|
849
849
|
};
|
|
850
850
|
}, [L, o]), te(() => {
|
|
851
|
-
var
|
|
852
|
-
const
|
|
853
|
-
if (!
|
|
851
|
+
var s;
|
|
852
|
+
const i = typeof e.content == "string" ? e.content : ((s = e.content) == null ? void 0 : s.content) || "";
|
|
853
|
+
if (!i || typeof i != "string") {
|
|
854
854
|
console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
|
-
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:",
|
|
857
|
+
console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="), console.log("isTableMode:", o), console.log("\u5185\u5BB9\u957F\u5EA6:", i.length || 0), typeof i == "string" ? (console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:", i.substring(0, 100)), console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:", i.substring(i.length - 100))) : (console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:", typeof i), console.log("\u5185\u5BB9\u503C:", i)), console.log("\u6807\u6CE8\u6570\u636E:", A), console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:", P);
|
|
858
858
|
}, [A, P, o]), te(() => {
|
|
859
859
|
if (o && l.current) {
|
|
860
|
-
const
|
|
861
|
-
var
|
|
862
|
-
const y = (
|
|
860
|
+
const s = setTimeout(() => {
|
|
861
|
+
var i;
|
|
862
|
+
const y = (i = l.current) == null ? void 0 : i.querySelectorAll("table");
|
|
863
863
|
y && y.length > 0 && (console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:", y.length), y.forEach((m, _) => {
|
|
864
864
|
if (m instanceof HTMLTableElement) {
|
|
865
865
|
m.style.width = "100%", m.style.minWidth = "100%", m.style.tableLayout = "auto";
|
|
@@ -868,7 +868,7 @@ const Pe = {
|
|
|
868
868
|
}
|
|
869
869
|
}));
|
|
870
870
|
}, 500);
|
|
871
|
-
return () => clearTimeout(
|
|
871
|
+
return () => clearTimeout(s);
|
|
872
872
|
}
|
|
873
873
|
}, [o, e.content]), te(() => () => {
|
|
874
874
|
D.current && clearTimeout(D.current), C.current && (C.current.disconnect(), C.current = null);
|
|
@@ -890,8 +890,8 @@ const Pe = {
|
|
|
890
890
|
dataSource: {
|
|
891
891
|
type: ve.MARKDOWN,
|
|
892
892
|
content: (() => {
|
|
893
|
-
var
|
|
894
|
-
return typeof e.content == "string" ? e.content : (
|
|
893
|
+
var s, i;
|
|
894
|
+
return typeof e.content == "string" ? e.content : (s = e.content) != null && s.text ? e.content.text : (i = e.content) != null && i.content ? e.content.content : "";
|
|
895
895
|
})()
|
|
896
896
|
},
|
|
897
897
|
size: "md",
|
|
@@ -1287,13 +1287,13 @@ const rt = ue("ZoomOut", [
|
|
|
1287
1287
|
border-bottom: 1px solid ${(e) => e.$theme.colors.border};
|
|
1288
1288
|
background: ${(e) => e.$theme.colors.background};
|
|
1289
1289
|
min-height: 52px;
|
|
1290
|
-
`,
|
|
1290
|
+
`, st = G.div`
|
|
1291
1291
|
display: flex;
|
|
1292
1292
|
align-items: center;
|
|
1293
1293
|
gap: 8px;
|
|
1294
1294
|
flex: 1;
|
|
1295
1295
|
min-width: 0;
|
|
1296
|
-
`,
|
|
1296
|
+
`, it = G.div`
|
|
1297
1297
|
font-size: 14px;
|
|
1298
1298
|
font-weight: 500;
|
|
1299
1299
|
color: ${(e) => e.$theme.colors.text};
|
|
@@ -1321,6 +1321,12 @@ const rt = ue("ZoomOut", [
|
|
|
1321
1321
|
cursor: pointer;
|
|
1322
1322
|
transition: all 0.2s ease;
|
|
1323
1323
|
|
|
1324
|
+
/* 确保图标有默认颜色 */
|
|
1325
|
+
& > svg {
|
|
1326
|
+
color: currentColor;
|
|
1327
|
+
stroke: currentColor;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1324
1330
|
&:hover {
|
|
1325
1331
|
background: ${(e) => e.$theme.colors.primary + "10"};
|
|
1326
1332
|
color: ${(e) => e.$theme.colors.primary};
|
|
@@ -1351,13 +1357,13 @@ const rt = ue("ZoomOut", [
|
|
|
1351
1357
|
disabledText: "#808080"
|
|
1352
1358
|
},
|
|
1353
1359
|
space: {
|
|
1354
|
-
sidebar: "
|
|
1355
|
-
size: "
|
|
1356
|
-
radius: "
|
|
1357
|
-
padding: "
|
|
1358
|
-
margin: "
|
|
1359
|
-
shadow: "
|
|
1360
|
-
lineHeight: "
|
|
1360
|
+
sidebar: "12px",
|
|
1361
|
+
size: "12px",
|
|
1362
|
+
radius: "4px",
|
|
1363
|
+
padding: "8px 12px",
|
|
1364
|
+
margin: "4px",
|
|
1365
|
+
shadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
1366
|
+
lineHeight: "1.5"
|
|
1361
1367
|
}
|
|
1362
1368
|
}, ce = n.memo(({
|
|
1363
1369
|
fileName: e = "\u672A\u77E5\u6587\u4EF6",
|
|
@@ -1386,7 +1392,7 @@ const rt = ue("ZoomOut", [
|
|
|
1386
1392
|
className: D
|
|
1387
1393
|
}) => {
|
|
1388
1394
|
const C = (r == null ? void 0 : r.theme) || mt;
|
|
1389
|
-
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(lt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(
|
|
1395
|
+
return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:", t, "totalPage:", o), /* @__PURE__ */ n.createElement(lt, { $theme: C, className: D }, /* @__PURE__ */ n.createElement(st, { $theme: C }, /* @__PURE__ */ n.createElement(it, { $theme: C }, e)), /* @__PURE__ */ n.createElement(ct, { $theme: C }, u.navigation && /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1390
1396
|
ne,
|
|
1391
1397
|
{
|
|
1392
1398
|
$theme: C,
|
|
@@ -1847,11 +1853,11 @@ const pe = G.div`
|
|
|
1847
1853
|
contentClass: B
|
|
1848
1854
|
}) => {
|
|
1849
1855
|
var a;
|
|
1850
|
-
const l = (g == null ? void 0 : g.theme) || vt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [F, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J,
|
|
1851
|
-
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0),
|
|
1856
|
+
const l = (g == null ? void 0 : g.theme) || vt, [D, C] = R(!0), [q, N] = R("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), [c, x] = R(null), [F, k] = R(null), [O, L] = R(d), [A, P] = R(1), [V, ee] = R(0), [J, s] = R(!1), i = $(() => {
|
|
1857
|
+
C(!0), N("\u6587\u4EF6\u4E0B\u8F7D\u4E2D..."), x(null), k(null), L(d), P(1), ee(0), s(!1);
|
|
1852
1858
|
}, [d]), y = $(async () => {
|
|
1853
1859
|
var E, z;
|
|
1854
|
-
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }),
|
|
1860
|
+
if (console.log("=== loadFile \u5F00\u59CB ==="), console.log("\u5F53\u524D\u53C2\u6570:", { fileUrl: e, fileName: u, fileType: t, data: p }), i(), p) {
|
|
1855
1861
|
C(!1), x(null), k({
|
|
1856
1862
|
type: p.fileType || t || "text",
|
|
1857
1863
|
content: p.content,
|
|
@@ -1880,7 +1886,7 @@ const pe = G.div`
|
|
|
1880
1886
|
} finally {
|
|
1881
1887
|
C(!1);
|
|
1882
1888
|
}
|
|
1883
|
-
}, [e, u, t, r, p,
|
|
1889
|
+
}, [e, u, t, r, p, i]);
|
|
1884
1890
|
te(() => {
|
|
1885
1891
|
y();
|
|
1886
1892
|
}, [y]);
|
|
@@ -1916,7 +1922,7 @@ const pe = G.div`
|
|
|
1916
1922
|
}
|
|
1917
1923
|
}, [O, F == null ? void 0 : F.totalPages, m]), U = $(() => {
|
|
1918
1924
|
const E = !J;
|
|
1919
|
-
|
|
1925
|
+
s(E), m("annotation:toggle", { isAnnotating: E });
|
|
1920
1926
|
}, [J, m]), M = $(() => {
|
|
1921
1927
|
m("download:start", { fileUrl: e, fileName: u });
|
|
1922
1928
|
}, [m, e, u]), j = $(() => {
|