Skip to content

Commit

Permalink
feat(editor): 💄 Better code editor dynamic height
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 29, 2022
1 parent 023a6f2 commit d43623b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/builder/components/shared/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export const CodeEditor = ({
if (lang === 'css') extensions.push(css())
if (lang === 'js') extensions.push(javascript())
if (lang === 'html') extensions.push(html())
extensions.push(
EditorView.theme({
'&': { maxHeight: '500px' },
'.cm-gutter,.cm-content': { minHeight: isReadOnly ? '0' : '250px' },
'.cm-scroller': { overflow: 'auto' },
})
)
const editor = new EditorView({
state: EditorState.create({
extensions,
Expand All @@ -94,12 +101,5 @@ export const CodeEditor = ({
return editor
}

return (
<Box
ref={editorContainer}
data-testid="code-editor"
h={isReadOnly ? 'auto' : '250px'}
{...props}
/>
)
return <Box ref={editorContainer} data-testid="code-editor" {...props} />
}

3 comments on commit d43623b

@vercel
Copy link

@vercel vercel bot commented on d43623b Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on d43623b Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on d43623b Mar 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.