diff --git a/src/layout/RepeatingGroup/RepeatingGroup.module.css b/src/layout/RepeatingGroup/RepeatingGroup.module.css index 2bfb131de9..a59bb9dfaa 100644 --- a/src/layout/RepeatingGroup/RepeatingGroup.module.css +++ b/src/layout/RepeatingGroup/RepeatingGroup.module.css @@ -117,9 +117,10 @@ table > tbody > tr.editingRow:hover { .contentFormatting { --cell-text-alignment: left; + --cell-word-break: break-word; overflow: hidden; text-overflow: ellipsis; - word-break: break-word; + word-break: var(--cell-word-break); display: -webkit-box; -webkit-box-orient: vertical; text-align: var(--cell-text-alignment); diff --git a/src/utils/formComponentUtils.test.ts b/src/utils/formComponentUtils.test.ts index 4a26b80d90..17f8fd90ee 100644 --- a/src/utils/formComponentUtils.test.ts +++ b/src/utils/formComponentUtils.test.ts @@ -44,6 +44,7 @@ describe('formComponentUtils', () => { '--cell-max-number-of-lines': 3, '--cell-text-alignment': 'center', '--cell-width': '100px', + '--cell-word-break': 'break-word', }); }); @@ -55,6 +56,7 @@ describe('formComponentUtils', () => { }; const columnStyles = getColumnStyles(columnSettings); expect(columnStyles['--cell-max-number-of-lines']).toEqual(0); + expect(columnStyles['--cell-word-break']).toEqual('normal'); }); }); }); diff --git a/src/utils/formComponentUtils.ts b/src/utils/formComponentUtils.ts index 7650e5df61..0106c5e50c 100644 --- a/src/utils/formComponentUtils.ts +++ b/src/utils/formComponentUtils.ts @@ -151,8 +151,8 @@ export function useColumnStylesRepeatingGroups( } export function getColumnStyles(columnSettings: ITableColumnProperties) { - const lineClampToggle = - columnSettings.textOverflow?.lineWrap || columnSettings.textOverflow?.lineWrap === undefined ? 1 : 0; + const lineWrap = columnSettings.textOverflow?.lineWrap || columnSettings.textOverflow?.lineWrap === undefined; + const lineClampToggle = lineWrap ? 1 : 0; let width: string | number | undefined = columnSettings.width ?? 'auto'; const widthPercentage = Number(width.substring(0, width.length - 1)); @@ -167,6 +167,7 @@ export function getColumnStyles(columnSettings: ITableColumnProperties) { '--cell-max-number-of-lines': (columnSettings.textOverflow?.maxHeight ?? 2) * lineClampToggle, '--cell-text-alignment': columnSettings.alignText, '--cell-width': width, + '--cell-word-break': lineWrap ? 'break-word' : 'normal', }; return columnStyleVariables as React.CSSProperties;