feat(功能强化): 支持OFD网页外链点击跳转
build.yaml / build (push) Successful in 38s

This commit is contained in:
xiaoqidun committed 2026-09-12 20:17:15 +08:00
1 parent 299c2cbfdc
commit 8ddc2fdeed
7 files changed
+192 -109

No files matched your search

+10
View File
@@ -663,9 +663,19 @@ button.outline-link:hover {
}
.page-surface {
position: relative;
transform-origin: 0 0;
}
.page-link {
position: absolute;
}
.page-link:hover,
.page-link:focus-visible {
background: rgba(15, 123, 104, 0.08);
}
.page-placeholder {
position: absolute;
inset: 0;
+23
View File
@@ -1591,6 +1591,29 @@ function mountPageSVG(index, page, openSeq = state.openSeq) {
const svg = parseSVG(page.svg, `p${openSeq}-${index}`);
svg.classList.add("ofd-svg");
surface.replaceChildren(svg);
for (const link of page.links) {
let url;
try {
url = new URL(link.uri);
} catch {
continue;
}
if (url.protocol !== "http:" && url.protocol !== "https:") {
continue;
}
const anchor = document.createElement("a");
anchor.className = "page-link";
anchor.href = url.href;
anchor.target = "_blank";
anchor.rel = "noopener noreferrer";
anchor.title = url.href;
anchor.setAttribute("aria-label", url.href);
anchor.style.left = `${link.x / page.width * 100}%`;
anchor.style.top = `${link.y / page.height * 100}%`;
anchor.style.width = `${link.width / page.width * 100}%`;
anchor.style.height = `${link.height / page.height * 100}%`;
surface.append(anchor);
}
shell.classList.add("rendered");
if (state.doc?.pages?.[index]) {
layoutPageShell(shell, state.doc.pages[index]);