Preserve QWord line breaks in DOCX
This commit is contained in:
@@ -95,6 +95,23 @@ describe("wordOffice DOCX import", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX line breaks from OOXML", async () => {
|
||||
const blob = await exportDocxBlob("LineBreak.docx", "<p>Line 1<br>Line 2</p>");
|
||||
const file = new File([blob], "LineBreak.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("Line 1<br>Line 2");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{
|
||||
type: "paragraph",
|
||||
text: "Line 1 Line 2",
|
||||
runs: [{ text: "Line 1\nLine 2" }]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
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", {
|
||||
|
||||
Reference in New Issue
Block a user