From ba9870ef5d9aedcb76d58f983cdd6df1bf877b7c Mon Sep 17 00:00:00 2001 From: Wuxh Date: Mon, 6 Feb 2023 13:03:14 +0800 Subject: [PATCH] chore: upgrade site && update pr-template (#40563) * docs: update pr-template * chore: update Previewer onlineUrl show logic --- .dumi/theme/builtins/Previewer/index.tsx | 7 +++++-- .github/PULL_REQUEST_TEMPLATE/pr_cn.md | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) 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 && ( }> ### 💡 需求背景和解决方案