Preserve QWord subscript superscript in DOCX
This commit is contained in:
@@ -128,6 +128,29 @@ describe("wordOffice DOCX import", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX subscript and superscript from OOXML", async () => {
|
||||
const blob = await exportDocxBlob("Indexes.docx", "<p>H<sub>2</sub>O m<sup>2</sup></p>");
|
||||
const file = new File([blob], "Indexes.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("<sub>2</sub>");
|
||||
expect(imported.html).toContain("<sup>2</sup>");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{
|
||||
type: "paragraph",
|
||||
text: "H2O m2",
|
||||
runs: [
|
||||
{ text: "H" },
|
||||
{ text: "2", subscript: true },
|
||||
{ text: "O m" },
|
||||
{ text: "2", superscript: true }
|
||||
]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
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", {
|
||||
|
||||
Reference in New Issue
Block a user