mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 05:29:08 +08:00
fix: unexpected pop ups (#4468)
This commit is contained in:
@@ -42,6 +42,7 @@ const CloudSvg = () => (
|
|||||||
|
|
||||||
export const LocalSharePage = (props: ShareMenuProps) => {
|
export const LocalSharePage = (props: ShareMenuProps) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.titleContainerStyle}>
|
<div className={styles.titleContainerStyle}>
|
||||||
@@ -73,15 +74,21 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
workspace: { id: workspaceId },
|
workspace: { id: workspaceId },
|
||||||
currentPage: { id: pageId },
|
currentPage: { id: pageId },
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const [isPublic, setIsPublic] = props.useIsSharedPage(workspaceId, pageId);
|
const [isPublic, setIsPublic] = props.useIsSharedPage(workspaceId, pageId);
|
||||||
|
|
||||||
const [showDisable, setShowDisable] = useState(false);
|
const [showDisable, setShowDisable] = useState(false);
|
||||||
|
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
|
|
||||||
const sharingUrl = useMemo(() => {
|
const sharingUrl = useMemo(() => {
|
||||||
return `${runtimeConfig.serverUrlPrefix}/share/${workspaceId}/${pageId}`;
|
return `${runtimeConfig.serverUrlPrefix}/share/${workspaceId}/${pageId}`;
|
||||||
}, [workspaceId, pageId]);
|
}, [workspaceId, pageId]);
|
||||||
|
|
||||||
const onClickCreateLink = useCallback(() => {
|
const onClickCreateLink = useCallback(() => {
|
||||||
setIsPublic(true);
|
setIsPublic(true);
|
||||||
}, [setIsPublic]);
|
}, [setIsPublic]);
|
||||||
|
|
||||||
const onClickCopyLink = useCallback(() => {
|
const onClickCopyLink = useCallback(() => {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(sharingUrl)
|
.writeText(sharingUrl)
|
||||||
@@ -92,11 +99,13 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}, [sharingUrl, t]);
|
}, [sharingUrl, t]);
|
||||||
|
|
||||||
const onDisablePublic = useCallback(() => {
|
const onDisablePublic = useCallback(() => {
|
||||||
setIsPublic(false);
|
setIsPublic(false);
|
||||||
toast('Successfully disabled', {
|
toast('Successfully disabled', {
|
||||||
portal: document.body,
|
portal: document.body,
|
||||||
});
|
});
|
||||||
|
setShowDisable(false);
|
||||||
}, [setIsPublic]);
|
}, [setIsPublic]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user