@@ -7,6 +7,7 @@ import { InlineCellEditor } from "./InlineCellEditor";
77import { ColumnTypes } from "widgets/TableWidgetV2/constants" ;
88import { ALIGN_ITEMS , TABLE_SIZES , VerticalAlignment } from "../Constants" ;
99import { InputTypes } from "widgets/BaseInputWidget/constants" ;
10+ import { CELL_WRAPPER_LINE_HEIGHT } from "../TableStyledWrappers" ;
1011
1112const Container = styled . div < {
1213 isCellEditMode ?: boolean ;
@@ -78,6 +79,10 @@ const UnsavedChangesMarker = styled.div<{ accentColor: string }>`
7879 transform: rotateZ(45deg);
7980` ;
8081
82+ const Content = styled . div `
83+ display: inline;
84+ ` ;
85+
8186interface PropType extends RenderDefaultPropsType {
8287 onChange : ( text : string ) => void ;
8388 onDiscard : ( ) => void ;
@@ -121,18 +126,13 @@ export function TextCell({
121126 [ toggleCellEditMode , value ] ,
122127 ) ;
123128
124- const isMultiline = useCallback ( ( ) => {
125- const rowHeight = TABLE_SIZES [ compactMode ] . ROW_HEIGHT ;
126-
127- return (
128- ! ! contentRef . current ?. offsetHeight &&
129- contentRef . current ?. offsetHeight - rowHeight > 10
130- ) ;
131- } , [ contentRef . current , compactMode ] ) ;
132-
133129 let editor ;
134130
135131 if ( isCellEditMode ) {
132+ const isMultiline =
133+ ! ! contentRef . current ?. offsetHeight &&
134+ contentRef . current ?. offsetHeight / CELL_WRAPPER_LINE_HEIGHT > 1 ;
135+
136136 editor = (
137137 < InlineCellEditor
138138 accentColor = { accentColor }
@@ -143,7 +143,7 @@ export function TextCell({
143143 ? InputTypes . NUMBER
144144 : InputTypes . TEXT
145145 }
146- multiline = { isMultiline ( ) }
146+ multiline = { isMultiline }
147147 onChange = { onChange }
148148 onDiscard = { onDiscard }
149149 onSave = { onSave }
@@ -164,7 +164,6 @@ export function TextCell({
164164 compactMode = { compactMode }
165165 isCellEditMode = { isCellEditMode }
166166 onDoubleClick = { onEditHandler }
167- ref = { contentRef }
168167 >
169168 { hasUnsavedChanged && (
170169 < UnsavedChangesMarker accentColor = { accentColor } />
@@ -185,7 +184,7 @@ export function TextCell({
185184 title = { ! ! value ? value . toString ( ) : "" }
186185 verticalAlignment = { verticalAlignment }
187186 >
188- { value }
187+ < Content ref = { contentRef } > { value } </ Content >
189188 </ StyledAutoToolTipComponent >
190189 { isCellEditable && (
191190 < StyledEditIcon
0 commit comments