File tree 1 file changed +5
-5
lines changed
gui/src/components/markdown
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) {
73
73
const codeBlockRef = React . useRef < HTMLDivElement > ( null ) ;
74
74
const codeBlockHeight = `${ Math . min (
75
75
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 ,
79
79
) } px`;
80
80
81
81
return (
@@ -100,7 +100,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
100
100
new WebviewIde ( ) . showLines (
101
101
props . item . description ,
102
102
parseInt ( lines [ 0 ] ) - 1 ,
103
- parseInt ( lines [ 1 ] ) - 1
103
+ parseInt ( lines [ 1 ] ) - 1 ,
104
104
) ;
105
105
} else {
106
106
postToIde ( "showVirtualFile" , {
@@ -154,7 +154,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
154
154
>
155
155
< StyledMarkdownPreview
156
156
source = { `${ fence } ${ getMarkdownLanguageTagForFile (
157
- props . item . description
157
+ props . item . description ,
158
158
) } \n${ props . item . content . trim ( ) } \n${ fence } `}
159
159
showCodeBorder = { false }
160
160
/>
You can’t perform that action at this time.
0 commit comments