File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
gui/src/components/markdown Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
7373 const codeBlockRef = React . useRef < HTMLDivElement > ( null ) ;
7474 const codeBlockHeight = `${ Math . min (
7575 MAX_PREVIEW_HEIGHT ,
76- codeBlockRef . current ?. scrollHeight
77- ? codeBlockRef . current ?. scrollHeight
78- : Number . MAX_SAFE_INTEGER
76+ codeBlockRef . current ?. scrollHeight ??
77+ // Best estimate of height I currently could find
78+ props . item . content . split ( "\n" ) . length * 18 + 36 ,
7979 ) } px`;
8080
8181 return (
@@ -100,7 +100,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
100100 new WebviewIde ( ) . showLines (
101101 props . item . description ,
102102 parseInt ( lines [ 0 ] ) - 1 ,
103- parseInt ( lines [ 1 ] ) - 1
103+ parseInt ( lines [ 1 ] ) - 1 ,
104104 ) ;
105105 } else {
106106 postToIde ( "showVirtualFile" , {
@@ -154,7 +154,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
154154 >
155155 < StyledMarkdownPreview
156156 source = { `${ fence } ${ getMarkdownLanguageTagForFile (
157- props . item . description
157+ props . item . description ,
158158 ) } \n${ props . item . content . trim ( ) } \n${ fence } `}
159159 showCodeBorder = { false }
160160 />
You can’t perform that action at this time.
0 commit comments