Skip to content

Commit 6c7bbeb

Browse files
tea-artistcaoxing9
andauthored
[sync] fix: longtext losing max height when editing (#1498) (#2806)
Synced from teableio/teable-ee@0cfde14 Co-authored-by: Aries X <caoxing9@gmail.com>
1 parent 3e49dad commit 6c7bbeb

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/sdk/src/components/editor/long-text/ExpandMarkdownEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const ExpandedTextEditorInner = ({
130130
return (
131131
<textarea
132132
ref={textareaRef}
133-
className="flex-1 resize-none bg-transparent text-sm outline-none"
133+
className="flex-1 resize-none bg-transparent pt-2 text-sm outline-none"
134134
defaultValue={value}
135135
onChange={(e) => {
136136
latestValueRef.current = e.target.value;

packages/sdk/src/components/grid-enhancements/editor/GridMarkdownEditor.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
useRef,
99
useState,
1010
} from 'react';
11+
import AutoSizeTextarea from 'react-textarea-autosize';
1112
import { useTranslation } from '../../../context/app/i18n';
1213
import { ExpandMarkdownEditor, MarkdownLongTextEditor } from '../../editor';
1314
import { isMarkdownShowAs, normalizeMarkdownValue } from '../../editor/long-text/utils';
@@ -236,7 +237,9 @@ const GridMarkdownEditorBase: ForwardRefRenderFunction<
236237
{isMarkdown && (
237238
<div
238239
className={
239-
isReadonly ? getReadonlyClassName(canExpandReadonly, 'rounded-md text-sm') : undefined
240+
isReadonly
241+
? getReadonlyClassName(canExpandReadonly, 'rounded-md px-2 pt-1 text-sm')
242+
: undefined
240243
}
241244
>
242245
<MarkdownLongTextEditor
@@ -262,11 +265,12 @@ const GridMarkdownEditorBase: ForwardRefRenderFunction<
262265
)}
263266
{!isMarkdown && !isReadonly && (
264267
<>
265-
<textarea
268+
<AutoSizeTextarea
266269
ref={textareaRef}
267270
className="w-full resize-none rounded border-none bg-background px-2 pt-1 text-[13px] leading-[1.4rem] focus-visible:outline-none"
268271
value={editorValue}
269-
rows={2}
272+
minRows={2}
273+
maxRows={5}
270274
onBlur={() => persistValue(latestValueRef.current)}
271275
onChange={(e) => {
272276
const val = e.target.value;

0 commit comments

Comments
 (0)