From d43623bf592812b732fe7a7a8c74a9fb69ab2290 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 29 Mar 2022 12:22:24 +0200 Subject: [PATCH] =?UTF-8?q?feat(editor):=20=F0=9F=92=84=20Better=20code=20?= =?UTF-8?q?editor=20dynamic=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/builder/components/shared/CodeEditor.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/builder/components/shared/CodeEditor.tsx b/apps/builder/components/shared/CodeEditor.tsx index 0cb8829304..a6ce502ff2 100644 --- a/apps/builder/components/shared/CodeEditor.tsx +++ b/apps/builder/components/shared/CodeEditor.tsx @@ -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, @@ -94,12 +101,5 @@ export const CodeEditor = ({ return editor } - return ( - - ) + return }