diff --git a/.dumi/theme/builtins/DemoWrapper/index.tsx b/.dumi/theme/builtins/DemoWrapper/index.tsx index 57f4f810aa..262e437a17 100644 --- a/.dumi/theme/builtins/DemoWrapper/index.tsx +++ b/.dumi/theme/builtins/DemoWrapper/index.tsx @@ -35,6 +35,13 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => { previewerProps: { ...previewerProps, expand: expandAll, + // always override debug property, because dumi will hide debug demo in production + debug: false, + /** + * antd extra marker for the original debug + * @see https://github.com/ant-design/ant-design/pull/40130#issuecomment-1380208762 + */ + originDebug: debug, }, }); }, [] as typeof items), diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index 2f6c06568c..e119f2fc3e 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -8,7 +8,6 @@ import type { Project } from '@stackblitz/sdk'; import stackblitzSdk from '@stackblitz/sdk'; import { Alert, Badge, Space, Tooltip } from 'antd'; import classNames from 'classnames'; -import type { IPreviewerProps } from 'dumi'; import { FormattedMessage, useSiteData } from 'dumi'; import toReactElement from 'jsonml-to-react-element'; import JsonML from 'jsonml.js/lib/utils'; @@ -28,6 +27,7 @@ import RiddleIcon from '../../common/RiddleIcon'; import type { SiteContextProps } from '../../slots/SiteContext'; import SiteContext from '../../slots/SiteContext'; import { ping } from '../../utils'; +import type { AntdPreviewerProps } from '.'; const { ErrorBoundary } = Alert; @@ -88,7 +88,7 @@ function useShowRiddleButton() { return showRiddleButton; } -const CodePreviewer: React.FC = (props) => { +const CodePreviewer: React.FC = (props) => { const { asset, expand, @@ -97,7 +97,7 @@ const CodePreviewer: React.FC = (props) => { children, title, description, - debug, + originDebug, jsx, style, compact, @@ -189,7 +189,7 @@ const CodePreviewer: React.FC = (props) => { const codeBoxClass = classNames('code-box', { expand: codeExpand, - 'code-box-debug': debug, + 'code-box-debug': originDebug, }); const localizedTitle = title; @@ -394,7 +394,7 @@ createRoot(document.getElementById('container')).render();
- : ''}> + : ''}> {localizedTitle} diff --git a/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx b/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx index e0d083dafc..22ca70535d 100644 --- a/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx @@ -1,11 +1,11 @@ import type { FC } from 'react'; import React, { useRef } from 'react'; -import type { IPreviewerProps } from 'dumi'; import { createStyles, css } from 'antd-style'; import { CheckOutlined, SketchOutlined } from '@ant-design/icons'; import { nodeToGroup } from 'html2sketch'; import copy from 'copy-to-clipboard'; import { App } from 'antd'; +import type { AntdPreviewerProps } from '.'; const useStyle = createStyles(({ token }) => ({ wrapper: css` @@ -52,7 +52,7 @@ const useStyle = createStyles(({ token }) => ({ `, })); -const DesignPreviewer: FC = ({ children, title, description, tip, asset }) => { +const DesignPreviewer: FC = ({ children, title, description, tip, asset }) => { const { styles } = useStyle(); const demoRef = useRef(null); const [copied, setCopied] = React.useState(false); diff --git a/.dumi/theme/builtins/Previewer/index.tsx b/.dumi/theme/builtins/Previewer/index.tsx index 40b95fc0fc..b3785af952 100644 --- a/.dumi/theme/builtins/Previewer/index.tsx +++ b/.dumi/theme/builtins/Previewer/index.tsx @@ -5,7 +5,11 @@ import { useTabMeta } from 'dumi'; import CodePreviewer from './CodePreviewer'; import DesignPreviewer from './DesignPreviewer'; -const Previewer: FC = ({ ...props }) => { +export interface AntdPreviewerProps extends IPreviewerProps { + originDebug?: IPreviewerProps['debug']; +} + +const Previewer: FC = ({ ...props }) => { const tab = useTabMeta(); if (tab?.frontmatter.title === 'Design') {