Skip to content

Commit 8e1ba4d

Browse files
authored
fix: allow input beyond the first line (#1602)
1 parent 4fed077 commit 8e1ba4d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

moon/apps/web/components/CodeView/NewCodeView/MarkdownEditor.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function MarkdownEditor({ contentState, disabled = false }: Markd
2626
},
2727
editorProps: {
2828
attributes: {
29-
class: 'max-w-full focus:outline-none font-mono text-sm leading-6'
29+
class: 'max-w-full focus:outline-none font-mono text-sm leading-6 h-full p-2'
3030
}
3131
}
3232
})
@@ -75,14 +75,21 @@ export default function MarkdownEditor({ contentState, disabled = false }: Markd
7575
<Markdown>{content}</Markdown>
7676
</div>
7777
) : (
78-
<div className='flex w-full font-mono text-sm leading-6'>
78+
<div className='flex h-full w-full font-mono text-sm leading-6'>
7979
<div className='select-none rounded-l-xl border-r border-gray-200 bg-gray-50 px-4 text-right text-gray-400'>
8080
{lineNumbers.map((n) => (
8181
<div key={n}>{n}</div>
8282
))}
8383
</div>
84-
<div className={`flex-1 pl-4 ${disabled ? 'cursor-not-allowed' : ''}`}>
85-
<EditorContent editor={textEditor} />
84+
<div
85+
className={`flex h-full flex-1 flex-col pl-4 ${disabled ? 'cursor-not-allowed' : 'cursor-text'}`}
86+
onClick={() => {
87+
if (!disabled && textEditor) {
88+
textEditor.commands.focus()
89+
}
90+
}}
91+
>
92+
<EditorContent editor={textEditor} className='h-full w-full' />
8693
</div>
8794
</div>
8895
)}

0 commit comments

Comments
 (0)