Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b2a2b35

Browse files
authored
Merge pull request #6565 from SimonBrandner/fix/codeblock-expand/18388
Fix missing expand button on codeblocks
2 parents 6a9ebc6 + 67fdbf9 commit b2a2b35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/views/messages/TextualBody.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
136136
private addCodeExpansionButton(div: HTMLDivElement, pre: HTMLPreElement): void {
137137
// Calculate how many percent does the pre element take up.
138138
// If it's less than 30% we don't add the expansion button.
139-
const percentageOfViewport = pre.offsetHeight / UIStore.instance.windowHeight * 100;
139+
// We also round the number as it sometimes can be 29.99...
140+
const percentageOfViewport = Math.round(pre.offsetHeight / UIStore.instance.windowHeight * 100);
140141
if (percentageOfViewport < 30) return;
141142

142143
const button = document.createElement("span");

0 commit comments

Comments
 (0)