mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
feat(core): responsive detail page header (#7263)
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import { registerAffineCommand } from '@affine/core/commands';
|
||||
import { useSharingUrl } from '@affine/core/hooks/affine/use-share-url';
|
||||
import { useIsActiveView } from '@affine/core/modules/workbench';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useRegisterCopyLinkCommands({
|
||||
workspaceId,
|
||||
workspaceMeta,
|
||||
docId,
|
||||
isActiveView,
|
||||
}: {
|
||||
workspaceId: string;
|
||||
workspaceMeta: WorkspaceMetadata;
|
||||
docId: string;
|
||||
isActiveView: boolean;
|
||||
}) {
|
||||
const isActiveView = useIsActiveView();
|
||||
const workspaceId = workspaceMeta.id;
|
||||
const isCloud = workspaceMeta.flavour === WorkspaceFlavour.AFFINE_CLOUD;
|
||||
const { onClickCopyLink } = useSharingUrl({
|
||||
workspaceId,
|
||||
pageId: docId,
|
||||
@@ -31,12 +35,12 @@ export function useRegisterCopyLinkCommands({
|
||||
label: '',
|
||||
icon: null,
|
||||
run() {
|
||||
isActiveView && onClickCopyLink();
|
||||
isActiveView && isCloud && onClickCopyLink();
|
||||
},
|
||||
})
|
||||
);
|
||||
return () => {
|
||||
unsubs.forEach(unsub => unsub());
|
||||
};
|
||||
}, [docId, isActiveView, onClickCopyLink]);
|
||||
}, [docId, isActiveView, isCloud, onClickCopyLink]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user