diff --git a/src/modules/blocks/code/RenderCode.tsx b/src/modules/blocks/code/RenderCode.tsx index 1b4d04683..cc6b761a7 100644 --- a/src/modules/blocks/code/RenderCode.tsx +++ b/src/modules/blocks/code/RenderCode.tsx @@ -9,6 +9,7 @@ import EditRoundedIcon from '@mui/icons-material/EditRounded'; import FitScreenIcon from '@mui/icons-material/FitScreen'; import HtmlIcon from '@mui/icons-material/Html'; import NumbersRoundedIcon from '@mui/icons-material/NumbersRounded'; +import ReplayRoundedIcon from '@mui/icons-material/ReplayRounded'; import SquareTwoToneIcon from '@mui/icons-material/SquareTwoTone'; import WrapTextIcon from '@mui/icons-material/WrapText'; import ZoomOutMapIcon from '@mui/icons-material/ZoomOutMap'; @@ -124,6 +125,7 @@ function RenderCodeImpl(props: RenderCodeBaseProps & { // state // const [isHovering, setIsHovering] = React.useState(false); const [fitScreen, setFitScreen] = React.useState(!!props.fitScreen); + const [htmlReloadKey, setHtmlReloadKey] = React.useState(0); const [showHTML, setShowHTML] = React.useState(props.initialShowHTML === true); const [showMermaid, setShowMermaid] = React.useState(true); const [showPlantUML, setShowPlantUML] = React.useState(true); @@ -280,7 +282,7 @@ function RenderCodeImpl(props: RenderCodeBaseProps & { */} {/* Renders HTML, or inline SVG, inline plantUML rendered, or highlighted code */} - {renderHTML ? + {renderHTML ? : renderMermaid ? : renderSVG ? : (renderPlantUML && (plantUmlSvgData || plantUmlError)) ? @@ -300,11 +302,18 @@ function RenderCodeImpl(props: RenderCodeBaseProps & { {/* [row 1] */} - {/* Show HTML */} + {/* Show HTML + Reload */} {isHTMLCode && ( - setShowHTML(!showHTML)}> - - + + setShowHTML(!showHTML)}> + + + {renderHTML && ( + setHtmlReloadKey(k => k + 1)}> + + + )} + )} {/* SVG, Mermaid, PlantUML -- including a max-out button */}