Skip to content

Commit fe41bbe

Browse files
committed
fix markdown scaling
1 parent d417830 commit fe41bbe

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

src/components/MarkdownEditor.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,20 @@ export function MarkdownEditor({
6868
value={content}
6969
onChange={(e) => onChange(e.currentTarget.value)}
7070
styles={{
71-
root: { height: '100%' },
72-
wrapper: { height: '100%' },
73-
input: {
71+
root: {
72+
height: '100%',
73+
display: 'flex',
74+
flexDirection: 'column'
75+
},
76+
wrapper: {
7477
height: '100%',
78+
display: 'flex',
79+
flexDirection: 'column',
80+
flex: 1
81+
},
82+
input: {
83+
flex: 1,
84+
minHeight: isMobile ? '300px' : '400px',
7585
padding: isMobile ? '1rem' : '1.5rem',
7686
fontSize: isMobile ? '16px' : '14px',
7787
lineHeight: isMobile ? '1.6' : '1.5',
@@ -87,9 +97,8 @@ export function MarkdownEditor({
8797
: '"SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace'
8898
}
8999
}}
90-
autosize={false}
91-
minRows={undefined}
92-
maxRows={undefined}
100+
autosize
101+
minRows={isMobile ? 15 : 20}
93102
/>
94103
)
95104
);
@@ -104,8 +113,7 @@ export function MarkdownEditor({
104113
background: 'var(--editor-bg)',
105114
color: 'var(--text-primary)',
106115
fontSize: isMobile ? '16px' : '14px',
107-
lineHeight: isMobile ? '1.6' : '1.5',
108-
WebkitOverflowScrolling: 'touch'
116+
lineHeight: isMobile ? '1.6' : '1.5'
109117
}}
110118
>
111119
<ReactMarkdown
@@ -122,11 +130,12 @@ export function MarkdownEditor({
122130
return (
123131
<Box style={{
124132
height: '100%',
125-
overflow: 'hidden',
133+
overflow: 'auto',
126134
display: 'flex',
127135
flexDirection: 'column',
128136
flex: 1,
129-
minHeight: 0
137+
minHeight: 0,
138+
WebkitOverflowScrolling: 'touch'
130139
}}>
131140
{view === 'edit' ? renderEditor() : renderPreview()}
132141
</Box>
@@ -238,7 +247,7 @@ export function MarkdownEditor({
238247
<Box
239248
style={{
240249
flex: 1,
241-
overflow: 'hidden',
250+
overflow: isMobile ? 'hidden' : 'auto',
242251
position: 'relative',
243252
minHeight: 0,
244253
display: 'flex',

0 commit comments

Comments
 (0)