Preserve QWord DOCX hyperlinks on import
This commit is contained in:
@@ -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: "." }
|
||||
]
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user