UNPKG

ds-markdown

Version:

> 🚀 React Markdown 打字动画组件,提供现代聊天界面效果

20 lines 1.06 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { useMarkdownThemeContext } from '../../../context/MarkdownThemeProvider.js'; import CodeBlockWrap from '../CodeBlockWrap/index.js'; import CodeBlockActions from '../CodeBlockActions/index.js'; import './index.css'; const BlockWrap = ({ children, language, codeContent }) => { const { state: themeState } = useMarkdownThemeContext(); // 从 context 中获取主题配置 const currentCodeBlock = themeState.codeBlock; const { headerActions = true } = currentCodeBlock || {}; const renderHeaderActions = () => { if (headerActions === true) { return _jsx(CodeBlockActions, { codeContent: codeContent, language: language }); } return headerActions; }; return (_jsx(CodeBlockWrap, { title: _jsxs(_Fragment, { children: [_jsx("div", { className: "md-code-block-language", children: language }), renderHeaderActions()] }), children: children })); }; export default BlockWrap; //# sourceMappingURL=index.js.map