From aa38e60b1d5193c16d62cbfadc5ec0a24f7d47d4 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 16 Aug 2024 22:43:12 +0800 Subject: [PATCH] fix: minapp title null --- src/renderer/index.html | 2 +- src/renderer/src/components/MinApp/index.tsx | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/renderer/index.html b/src/renderer/index.html index 9157450dcb..8798d0a4c8 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -6,7 +6,7 @@ + content="default-src 'self'; connect-src *; script-src 'self' *; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' *; font-src 'self' data: *; img-src 'self' data:; frame-src * file:" />
diff --git a/src/renderer/src/components/MinApp/index.tsx b/src/renderer/src/components/MinApp/index.tsx index 541931aa59..10659260d0 100644 --- a/src/renderer/src/components/MinApp/index.tsx +++ b/src/renderer/src/components/MinApp/index.tsx @@ -8,7 +8,7 @@ import styled from 'styled-components' import { TopView } from '../TopView' interface ShowParams { - title: string + title?: string url: string } @@ -20,6 +20,8 @@ const PopupContainer: React.FC = ({ title, url, resolve }) => { const [open, setOpen] = useState(true) const iframeRef = useRef(null) + const canOpenExternalLink = url.startsWith('http://') || url.startsWith('https://') + const onClose = () => { setOpen(false) setTimeout(() => resolve({}), 300) @@ -37,7 +39,7 @@ const PopupContainer: React.FC = ({ title, url, resolve }) => { return ( } placement="bottom" onClose={onClose} open={open} @@ -53,9 +55,11 @@ const PopupContainer: React.FC = ({ title, url, resolve }) => { - + {canOpenExternalLink && ( + + )} @@ -70,6 +74,10 @@ const Frame = styled.iframe` border: none; ` +const Title = styled.div` + min-height: var(--navbar-height); +` + const ButtonsGroup = styled.div` position: absolute; top: 0;