Preserve QWord DOCX hyperlinks on import

This commit is contained in:
Курнат Андрей
2026-06-01 07:50:01 +03:00
parent 2bb78dae74
commit 27eae3afac
3 changed files with 127 additions and 20 deletions
+21
View File
@@ -91,4 +91,25 @@ describe("wordOffice DOCX import", () => {
}
]);
});
it("imports DOCX external hyperlinks from OOXML relationships", async () => {
const blob = await exportDocxBlob("Hyperlink.docx", '<p>Open <a href="https://example.com/report"><strong>report</strong></a>.</p>');
const file = new File([blob], "Hyperlink.docx", {
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
});
const imported = await importDocxFile(file);
expect(imported.html).toContain('<a href="https://example.com/report">');
expect(htmlToWordBlocks(imported.html)).toEqual([
{
type: "paragraph",
text: "Open report.",
runs: [
{ text: "Open " },
{ text: "report", bold: true, href: "https://example.com/report" },
{ text: "." }
]
}
]);
});
});