diff --git a/packages/core/src/shared/common.ts b/packages/core/src/shared/common.ts index 5320faff715..0435da4d21c 100644 --- a/packages/core/src/shared/common.ts +++ b/packages/core/src/shared/common.ts @@ -361,7 +361,7 @@ export function handleStyleToString(style: IStyleData, isCell: boolean = false) 'tb', () => { if (style.tb === WrapStrategy.CLIP) { - str += 'white-space: clip; '; + str += 'white-space: nowrap; overflow-x: hidden; '; } else if (style.tb === WrapStrategy.WRAP) { str += 'white-space: normal;'; } diff --git a/packages/ui/src/utils/cell.ts b/packages/ui/src/utils/cell.ts index 7ccca7f2f9d..cd8f9437384 100644 --- a/packages/ui/src/utils/cell.ts +++ b/packages/ui/src/utils/cell.ts @@ -382,18 +382,20 @@ export function handleStringToStyle($dom?: HTMLElement, cssStyle: string = '') { } } - // wrap text - if (key === 'overflow-wrap' || key === 'word-wrap') { - if (value === 'break-word') { - styleList.tb = 3; - } - } else if (key === 'text-overflow') { - if (value === 'clip') { - styleList.tb = 2; - } - } else if (key === 'text-break') { - if (value === 'overflow') { - styleList.tb = 1; + // wrap text (`white-space` property has a higher priority.) + if (styleList.tb !== 1) { + if (key === 'overflow-wrap' || key === 'word-wrap') { + if (value === 'break-word') { + styleList.tb = 3; + } + } else if (key === 'text-overflow') { + if (value === 'clip') { + styleList.tb = 2; + } + } else if (key === 'text-break') { + if (value === 'overflow') { + styleList.tb = 1; + } } }