Skip to content

Commit

Permalink
fix: center peek support open in new tab (#7848)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Aug 13, 2024
1 parent 171a974 commit d86f7f4
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
import { useI18n } from '@affine/i18n';
import {
CloseIcon,
DualLinkIcon,
ExpandFullIcon,
OpenInNewIcon,
SplitViewIcon,
} from '@blocksuite/icons/rc';
import { type DocMode, useService } from '@toeverything/infra';
Expand Down Expand Up @@ -124,6 +124,15 @@ export const DocPeekViewControls = ({
peekView.close('none');
},
},
{
icon: <OpenInNewIcon />,
nameKey: 'new-tab',
name: t['com.affine.peek-view-controls.open-doc-in-new-tab'](),
onClick: () => {
workbench.openDoc(docId, { at: 'new-tab' });
peekView.close('none');
},
},
environment.isDesktop && {
icon: <SplitViewIcon />,
nameKey: 'split-view',
Expand All @@ -133,18 +142,6 @@ export const DocPeekViewControls = ({
peekView.close('none');
},
},
!environment.isDesktop && {
icon: <DualLinkIcon />,
nameKey: 'new-tab',
name: t['com.affine.peek-view-controls.open-doc-in-new-tab'](),
onClick: () => {
window.open(
`/workspace/${workspace.id}/${docId}#${blockId ?? ''}`,
'_blank'
);
peekView.close('none');
},
},
].filter((opt): opt is ControlButtonProps => Boolean(opt));
}, [
blockId,
Expand Down

0 comments on commit d86f7f4

Please sign in to comment.