Fix duplicated br tags (#2717)
* Adjust test to demo duplicated br tags * Fix patchDocument duplicating br tags * Only include w:Pr * Fix tag condition --------- Co-authored-by: Dolan <dolan_miu@hotmail.com>
This commit is contained in:
@ -62,6 +62,10 @@ export const MOCK_JSON = {
|
||||
name: "w:t",
|
||||
elements: [{ type: "text", text: "What a {{bold}} text!" }],
|
||||
},
|
||||
{
|
||||
type: "element",
|
||||
name: "w:br",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
@ -176,6 +180,10 @@ describe("replacer", () => {
|
||||
name: "w:t",
|
||||
elements: [{ type: "text", text: " text!" }],
|
||||
},
|
||||
{
|
||||
name: "w:br",
|
||||
type: "element",
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
@ -64,7 +64,7 @@ export const replacer = ({
|
||||
|
||||
if (keepOriginalStyles) {
|
||||
const runElementNonTextualElements = runElementToBeReplaced.elements!.filter(
|
||||
(e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br" && e.name !== "w:tab",
|
||||
(e) => e.type === "element" && e.name === "w:rPr",
|
||||
);
|
||||
|
||||
newRunElements = textJson.map((e) => ({
|
||||
|
Reference in New Issue
Block a user