diff --git a/.dumi/theme/builtins/Previewer/index.tsx b/.dumi/theme/builtins/Previewer/index.tsx index 0f82807af7..a898e98bb4 100644 --- a/.dumi/theme/builtins/Previewer/index.tsx +++ b/.dumi/theme/builtins/Previewer/index.tsx @@ -87,9 +87,12 @@ const Demo: React.FC = (props) => { const { theme } = useContext(SiteContext); const { hash, pathname, search } = location; - const isDev = process.env.NODE_ENV === 'development'; const docsOnlineUrl = `https://ant.design${pathname}${search}#${meta.id}`; + const regexp = /preview-(\d+)-ant-design/; // matching PR preview addresses + const showOnlineUrl = + process.env.NODE_ENV === 'development' || regexp.test(window.location.hostname); + const handleCodeExpand = (demo: string) => { setCodeExpand((prev) => !prev); track({ type: 'expand', demo }); @@ -347,7 +350,7 @@ const Demo: React.FC = (props) => {
{introChildren}
- {isDev && ( + {showOnlineUrl && ( }> ### 💡 需求背景和解决方案