Preserve QWord internal hyperlinks in DOCX
This commit is contained in:
@@ -167,6 +167,23 @@ describe("wordOffice DOCX import", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX internal hyperlink anchors from OOXML", async () => {
|
||||
const blob = await exportDocxBlob("InternalHyperlink.docx", '<p>Open <a href="#Section1"><strong>section</strong></a>.</p>');
|
||||
const file = new File([blob], "InternalHyperlink.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain('<a href="#Section1">');
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{
|
||||
type: "paragraph",
|
||||
text: "Open section.",
|
||||
runs: [{ text: "Open " }, { text: "section", bold: true, href: "#Section1" }, { text: "." }]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports simple DOCX tables from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Table.docx",
|
||||
|
||||
Reference in New Issue
Block a user