aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/shikiCodeblocks/components
diff options
context:
space:
mode:
authorJustice Almanzar <superdash993@gmail.com>2022-12-08 09:54:19 -0500
committerGitHub <noreply@github.com>2022-12-08 15:54:19 +0100
commit2de461985dadadbaae1b2b0a83cf291dd8d3a972 (patch)
tree349f7b635cf6e0ce93da2789509e510a163b2c7f /src/plugins/shikiCodeblocks/components
parent2d08dd8a9c289bcdb6395e8bdf28b6b729946ab1 (diff)
downloadVencord-2de461985dadadbaae1b2b0a83cf291dd8d3a972.tar.gz
Vencord-2de461985dadadbaae1b2b0a83cf291dd8d3a972.tar.bz2
Vencord-2de461985dadadbaae1b2b0a83cf291dd8d3a972.zip
fix(ShikiCodeblocks): spoilers (#298)
* fix(ShikiCodeblocks): spoilers * fix a settings bug i thikn
Diffstat (limited to 'src/plugins/shikiCodeblocks/components')
-rw-r--r--src/plugins/shikiCodeblocks/components/Highlighter.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/shikiCodeblocks/components/Highlighter.tsx b/src/plugins/shikiCodeblocks/components/Highlighter.tsx
index d86e772..d26cd81 100644
--- a/src/plugins/shikiCodeblocks/components/Highlighter.tsx
+++ b/src/plugins/shikiCodeblocks/components/Highlighter.tsx
@@ -46,9 +46,11 @@ export interface HighlighterProps {
}
export const createHighlighter = (props: HighlighterProps) => (
- <ErrorBoundary>
- <Highlighter {...props} />
- </ErrorBoundary>
+ <pre className={cl("container")}>
+ <ErrorBoundary>
+ <Highlighter {...props} />
+ </ErrorBoundary>
+ </pre>
);
export const Highlighter = ({
lang,
@@ -66,7 +68,7 @@ export const Highlighter = ({
const shikiLang = lang ? resolveLang(lang) : null;
const useHljs = shouldUseHljs({ lang, tryHljs });
- const [preRef, isIntersecting] = useIntersection(true);
+ const [rootRef, isIntersecting] = useIntersection(true);
const [tokens] = useAwaiter(async () => {
if (!shikiLang || useHljs || !isIntersecting) return null;
@@ -93,8 +95,8 @@ export const Highlighter = ({
if (isPreview) preClasses.push(cl("preview"));
return (
- <pre
- ref={preRef}
+ <div
+ ref={rootRef}
className={preClasses.join(" ")}
style={{
backgroundColor: useHljs
@@ -123,7 +125,7 @@ export const Highlighter = ({
theme={themeBase}
/>}
</code>
- </pre>
+ </div>
);
};