Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2373,11 +2373,11 @@ it("renders EPUB publisher styles and follows an anchored link to a fixed-layout
.file(
"OPS/illustration.svg",
`<?xml-stylesheet href="styles/poster.css" type="text/css"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="figure" viewBox="0 0 200 100">
<defs><marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5" orient="auto">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker></defs>
<rect id="poster" width="200" height="100"/>
<rect id="poster" epub:type="cover-image" width="200" height="100"/>
<line x1="10" y1="10" x2="100" y2="10" stroke="black" marker-end="url(#arrow)"/>
</svg>`,
)
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/components/files/epubPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,10 @@ export async function openEpub(archive: JSZip) {
if (formTag && staticControls.has(tag) && node.attrs.disabled === undefined)
props += " disabled";
if (tag === "svg")
props += ' xmlns="http://www.w3.org/2000/svg"' + attr("xml:space", node.attrs["xml:space"]);
props +=
' xmlns="http://www.w3.org/2000/svg"' +
(svgDepth ? ' xmlns:epub="http://www.idpf.org/2007/ops"' : "") +
attr("xml:space", node.attrs["xml:space"]);
if (tag === "math") props += ' xmlns="http://www.w3.org/1998/Math/MathML"';
if (tag === "table" && node.children.some((child) => tagName(child) === "tr"))
props += ' data-epub-direct-rows=""';
Expand Down
Loading