This commit is contained in:
Dolan Miu
2023-02-25 22:18:56 +00:00
parent ce485dbc29
commit c9d86619de
9 changed files with 31 additions and 30 deletions

View File

@ -1,5 +1,5 @@
import { Element } from "xml-js";
import { createTextElementContents } from "./util";
import { createTextElementContents, patchSpaceAttribute } from "./util";
export const findRunElementIndexWithToken = (paragraphElement: Element, token: string): number => {
for (let i = 0; i < (paragraphElement.elements ?? []).length; i++) {
@ -29,9 +29,7 @@ export const splitRunElement = (runElement: Element, token: string): { readonly
const splitText = text.split(token);
const newElements = splitText.map((t) => ({
...e,
attributes: {
"xml:space": "preserve",
},
...patchSpaceAttribute(e),
elements: createTextElementContents(t),
}));
splitIndex = i;