fix: move dark mode and transparent body hook into renderer

These hooks are only necessary for the document and simple renderer. The slideshow handles theming itself.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-06-07 22:57:35 +02:00
parent e1a953c5bf
commit efac46858c
4 changed files with 27 additions and 9 deletions

View file

@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useApplyDarkModeStyle } from '../../../../hooks/dark-mode/use-apply-dark-mode-style'
import { cypressId } from '../../../../utils/cypress-attribute'
import { useMarkdownExtensions } from '../../../markdown-renderer/hooks/use-markdown-extensions'
import { MarkdownToReact } from '../../../markdown-renderer/markdown-to-react/markdown-to-react'
import { useOnHeightChange } from '../../hooks/use-on-height-change'
import { useTransparentBodyBackground } from '../../hooks/use-transparent-body-background'
import { RendererType } from '../../window-post-message-communicator/rendering-message'
import type { CommonMarkdownRendererProps, HeightChangeRendererProps } from '../common-markdown-renderer-props'
import React, { useRef } from 'react'
@ -31,6 +33,9 @@ export const SimpleMarkdownRenderer: React.FC<SimpleMarkdownRendererProps> = ({
useOnHeightChange(rendererRef, onHeightChange)
const extensions = useMarkdownExtensions(baseUrl, RendererType.SIMPLE, [])
useTransparentBodyBackground()
useApplyDarkModeStyle()
return (
<div className={`vh-100 bg-transparent overflow-y-hidden`}>
<div ref={rendererRef} className={`position-relative`}>