Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(core): copy to the clipboard whilst creating a shared link (#6555)

JimmFly1217ef258bc9
diff --git a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx
index 373376710d..a6df8d736b 100644
--- a/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx
+++ b/packages/frontend/core/src/components/affine/share-page-modal/share-menu/share-page.tsx
@@ -3,7 +3,6 @@ import {
RadioButton,
RadioButtonGroup,
Switch,
- toast,
} from '@affine/component';
import { PublicLinkDisableModal } from '@affine/component/disable-public-link';
import { Button } from '@affine/component/ui/button';
@@ -86,13 +85,15 @@ export const AffineSharePage = (props: ShareMenuProps) => {
const onClickCreateLink = useCallback(() => {
enableShare(mode);
- }, [enableShare, mode]);
+ if (sharingUrl) {
+ navigator.clipboard.writeText(sharingUrl).catch(err => {
+ console.error(err);
+ });
+ }
+ }, [enableShare, mode, sharingUrl]);
const onDisablePublic = useCallback(() => {
disableShare();
- toast('Successfully disabled', {
- portal: document.body,
- });
setShowDisable(false);
}, [disableShare]);