Skip to content

Commit dfc06e6

Browse files
Fix #3088 & #3139: Remove unneeded paddings from Word Desktop (#3147)
* Fix word paste bug * Try fix build * fix * revert
1 parent 92daf85 commit dfc06e6

File tree

5 files changed

+750
-535
lines changed

5 files changed

+750
-535
lines changed

packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processPastedContentFromWordDesktop.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ const listLevelParser: FormatParser<ContentModelListItemLevelFormat> = (
8080
format.marginBottom = undefined;
8181
};
8282

83-
const wordTableParser: FormatParser<ContentModelTableFormat> = (format): void => {
83+
const wordTableParser: FormatParser<ContentModelTableFormat> = (format, element): void => {
8484
if (format.marginLeft?.startsWith('-')) {
8585
delete format.marginLeft;
8686
}
87+
if (format.htmlAlign) {
88+
delete format.htmlAlign;
89+
}
8790
};

packages/roosterjs-content-model-plugins/lib/paste/WordDesktop/processWordLists.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ function wordListPaddingParser(
227227
format: ContentModelListItemLevelFormat,
228228
element: HTMLElement
229229
): void {
230-
if (element.style.marginLeft && element.style.marginLeft != '0in') {
230+
if (element.style.marginLeft && parseInt(element.style.marginLeft) != 0) {
231231
format.paddingLeft = '0px';
232232
}
233-
if (element.style.marginRight && element.style.marginRight != '0in') {
233+
if (element.style.marginRight && parseInt(element.style.marginRight) != 0) {
234234
format.paddingRight = '0px';
235235
}
236236
}

0 commit comments

Comments
 (0)