import { PreviewPlaceholder, ReactCustomBlockRenderProps, SourceBlockWithPreview, } from "@blocknote/react"; import { TbMathFunction } from "react-icons/tb"; import { MathBlockConfig } from "../../createReactMathBlockSpec.js"; import { plainContentToString } from "@blocknote/core"; import { useLatexToMathMLString } from "../../../helpers/render/useLatexToMathML.js"; import { getMathDictionary } from "../../../i18n/dictionary.js"; export const MathBlockPreviewWithPopup = ( props: ReactCustomBlockRenderProps, ) => { const source = plainContentToString(props.block.content).trim(); const { mathMLString, error } = useLatexToMathMLString(source); const dict = getMathDictionary(props.editor).block; return ( ) : undefined } error={error} errorPreview={ } text={dict.preview_error_text} /> } emptySourcePlaceholder={ } text={dict.add_source_text} /> } sourcePlaceholder={dict.input_placeholder} /> ); };