2
0

fix(editor): ️ Improve code editor readiness

This commit is contained in:
Baptiste Arnaud
2022-02-16 15:47:26 +01:00
parent d2ac13ba5f
commit daaa8a0a2d
2 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,7 @@ export const CodeEditor = ({
if (!editorContainer.current) return
const updateListenerExtension = EditorView.updateListener.of((update) => {
if (update.docChanged && onChange)
setPlainTextValue(update.state.doc.toJSON().join(' '))
setPlainTextValue(update.state.doc.toJSON().join('\n'))
})
const extensions = [
updateListenerExtension,
@ -77,5 +77,12 @@ export const CodeEditor = ({
return editor
}
return <Box ref={editorContainer} data-testid="code-editor" {...props} />
return (
<Box
ref={editorContainer}
data-testid="code-editor"
h={isReadOnly ? 'auto' : '250px'}
{...props}
/>
)
}