Skip to content

replacer duplicates line breaks when keepOriginalStyles: true #2716

@SebKranz

Description

@SebKranz

I presume that the following line duplicates non-textual elements in order to move w:Pr tags over to the inserted, and the right run.

if (keepOriginalStyles) {
const runElementNonTextualElements = runElementToBeReplaced.elements!.filter(
(e) => e.type === "element" && e.name !== "w:t",
);
newRunElements = textJson.map((e) => ({
...e,
elements: [...runElementNonTextualElements, ...e.elements!],
}));
patchedRightElement = {
...right,
elements: [...runElementNonTextualElements, ...right.elements!],
};
}

However, the function for filtering non-textual elements currently doesn't account for <w:br>.

As a result, the w:br tag is added to the inserted run and also the right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions