Skip to content

Commit

Permalink
Merge branch 'preview'
Browse files Browse the repository at this point in the history
  • Loading branch information
sestinj committed Mar 23, 2024
2 parents 729d31b + 47774c4 commit adcd079
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gui/src/components/markdown/CodeSnippetPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
const codeBlockRef = React.useRef<HTMLDivElement>(null);
const codeBlockHeight = `${Math.min(
MAX_PREVIEW_HEIGHT,
codeBlockRef.current?.scrollHeight
? codeBlockRef.current?.scrollHeight
: Number.MAX_SAFE_INTEGER
codeBlockRef.current?.scrollHeight ??
// Best estimate of height I currently could find
props.item.content.split("\n").length * 18 + 36,
)}px`;

return (
Expand All @@ -100,7 +100,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
new WebviewIde().showLines(
props.item.description,
parseInt(lines[0]) - 1,
parseInt(lines[1]) - 1
parseInt(lines[1]) - 1,
);
} else {
postToIde("showVirtualFile", {
Expand Down Expand Up @@ -154,7 +154,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
>
<StyledMarkdownPreview
source={`${fence}${getMarkdownLanguageTagForFile(
props.item.description
props.item.description,
)}\n${props.item.content.trim()}\n${fence}`}
showCodeBorder={false}
/>
Expand Down

0 comments on commit adcd079

Please sign in to comment.