@@ -16,6 +16,7 @@ import { RecentDocsService } from '@affine/core/modules/quicksearch';
|
|||||||
import { ViewService } from '@affine/core/modules/workbench';
|
import { ViewService } from '@affine/core/modules/workbench';
|
||||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||||
import { isNewTabTrigger } from '@affine/core/utils';
|
import { isNewTabTrigger } from '@affine/core/utils';
|
||||||
|
import track from '@affine/track';
|
||||||
import { RefNodeSlotsProvider } from '@blocksuite/affine/blocks';
|
import { RefNodeSlotsProvider } from '@blocksuite/affine/blocks';
|
||||||
import {
|
import {
|
||||||
type Disposable,
|
type Disposable,
|
||||||
@@ -190,6 +191,15 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
|||||||
event && isNewTabTrigger(event)
|
event && isNewTabTrigger(event)
|
||||||
? 'open-in-new-tab'
|
? 'open-in-new-tab'
|
||||||
: 'open-in-active-view';
|
: 'open-in-active-view';
|
||||||
|
|
||||||
|
if (openMode === 'open-in-new-view') {
|
||||||
|
track.doc.editor.toolbar.openInSplitView();
|
||||||
|
} else if (openMode === 'open-in-center-peek') {
|
||||||
|
track.doc.editor.toolbar.openInPeekView();
|
||||||
|
} else if (openMode === 'open-in-new-tab') {
|
||||||
|
track.doc.editor.toolbar.openInNewTab();
|
||||||
|
}
|
||||||
|
|
||||||
if (openMode !== 'open-in-center-peek') {
|
if (openMode !== 'open-in-center-peek') {
|
||||||
const at = (() => {
|
const at = (() => {
|
||||||
if (openMode === 'open-in-active-view') {
|
if (openMode === 'open-in-active-view') {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import type { AffineDNDData } from '@affine/core/types/dnd';
|
import type { AffineDNDData } from '@affine/core/types/dnd';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
|
import track from '@affine/track';
|
||||||
import {
|
import {
|
||||||
CloseIcon,
|
CloseIcon,
|
||||||
ExpandFullIcon,
|
ExpandFullIcon,
|
||||||
@@ -183,6 +184,10 @@ export const SplitViewPanel = memo(function SplitViewPanel({
|
|||||||
}
|
}
|
||||||
setDraggingView(null);
|
setDraggingView(null);
|
||||||
setDraggingOverView(null);
|
setDraggingOverView(null);
|
||||||
|
track.$.splitViewIndicator.$.splitViewAction({
|
||||||
|
control: 'indicator',
|
||||||
|
action: 'move',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onDragStart() {
|
onDragStart() {
|
||||||
setDraggingView({
|
setDraggingView({
|
||||||
@@ -292,18 +297,33 @@ const SplitViewMenu = ({
|
|||||||
|
|
||||||
const viewIndex = views.findIndex(v => v === view);
|
const viewIndex = views.findIndex(v => v === view);
|
||||||
|
|
||||||
const handleClose = useCallback(
|
const handleClose = useCallback(() => {
|
||||||
() => workbench.close(view),
|
workbench.close(view);
|
||||||
[view, workbench]
|
track.$.splitViewIndicator.$.splitViewAction({
|
||||||
);
|
control: 'menu',
|
||||||
|
action: 'close',
|
||||||
|
});
|
||||||
|
}, [view, workbench]);
|
||||||
const handleMoveLeft = useCallback(() => {
|
const handleMoveLeft = useCallback(() => {
|
||||||
onMove(viewIndex, viewIndex - 1);
|
onMove(viewIndex, viewIndex - 1);
|
||||||
|
track.$.splitViewIndicator.$.splitViewAction({
|
||||||
|
control: 'menu',
|
||||||
|
action: 'move',
|
||||||
|
});
|
||||||
}, [onMove, viewIndex]);
|
}, [onMove, viewIndex]);
|
||||||
const handleMoveRight = useCallback(() => {
|
const handleMoveRight = useCallback(() => {
|
||||||
onMove(viewIndex, viewIndex + 1);
|
onMove(viewIndex, viewIndex + 1);
|
||||||
|
track.$.splitViewIndicator.$.splitViewAction({
|
||||||
|
control: 'menu',
|
||||||
|
action: 'move',
|
||||||
|
});
|
||||||
}, [onMove, viewIndex]);
|
}, [onMove, viewIndex]);
|
||||||
const handleCloseOthers = useCallback(() => {
|
const handleCloseOthers = useCallback(() => {
|
||||||
workbench.closeOthers(view);
|
workbench.closeOthers(view);
|
||||||
|
track.$.splitViewIndicator.$.splitViewAction({
|
||||||
|
control: 'menu',
|
||||||
|
action: 'closeOthers',
|
||||||
|
});
|
||||||
}, [view, workbench]);
|
}, [view, workbench]);
|
||||||
|
|
||||||
const CloseItem =
|
const CloseItem =
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useDndMonitor } from '@affine/component';
|
import { useDndMonitor } from '@affine/component';
|
||||||
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
import { useAppSettingHelper } from '@affine/core/components/hooks/affine/use-app-setting-helper';
|
||||||
import type { AffineDNDData } from '@affine/core/types/dnd';
|
import type { AffineDNDData } from '@affine/core/types/dnd';
|
||||||
|
import track from '@affine/track';
|
||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
@@ -121,7 +122,10 @@ export const SplitView = ({
|
|||||||
const entity = data.source.data.entity;
|
const entity = data.source.data.entity;
|
||||||
const from = data.source.data.from;
|
const from = data.source.data.from;
|
||||||
|
|
||||||
if (dropTarget?.at === 'workbench:resize-handle') {
|
if (
|
||||||
|
dropTarget?.at === 'workbench:resize-handle' &&
|
||||||
|
entity?.type !== 'custom-property'
|
||||||
|
) {
|
||||||
const { edge, viewId } = dropTarget;
|
const { edge, viewId } = dropTarget;
|
||||||
const index = views.findIndex(v => v.id === viewId);
|
const index = views.findIndex(v => v.id === viewId);
|
||||||
const at = (() => {
|
const at = (() => {
|
||||||
@@ -148,6 +152,10 @@ export const SplitView = ({
|
|||||||
|
|
||||||
if (to) {
|
if (to) {
|
||||||
workbench.createView(at, to);
|
workbench.createView(at, to);
|
||||||
|
track.$.splitViewIndicator.$.openInSplitView({
|
||||||
|
type: entity?.type,
|
||||||
|
route: to,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ type AppEvents =
|
|||||||
type NavigationEvents =
|
type NavigationEvents =
|
||||||
| 'openInNewTab'
|
| 'openInNewTab'
|
||||||
| 'openInSplitView'
|
| 'openInSplitView'
|
||||||
|
| 'openInPeekView'
|
||||||
| 'switchTab'
|
| 'switchTab'
|
||||||
| 'switchSplitView'
|
| 'switchSplitView'
|
||||||
| 'tabAction'
|
| 'tabAction'
|
||||||
|
| 'splitViewAction'
|
||||||
| 'navigate'
|
| 'navigate'
|
||||||
| 'goBack'
|
| 'goBack'
|
||||||
| 'goForward'
|
| 'goForward'
|
||||||
@@ -314,6 +316,9 @@ const PageEvents = {
|
|||||||
newDoc: ['quickStart'],
|
newDoc: ['quickStart'],
|
||||||
template: ['openTemplateListMenu', 'quickStart'],
|
template: ['openTemplateListMenu', 'quickStart'],
|
||||||
},
|
},
|
||||||
|
splitViewIndicator: {
|
||||||
|
$: ['splitViewAction', 'openInSplitView', 'openInPeekView'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
doc: {
|
doc: {
|
||||||
editor: {
|
editor: {
|
||||||
@@ -322,7 +327,12 @@ const PageEvents = {
|
|||||||
quickSearch: ['createDoc'],
|
quickSearch: ['createDoc'],
|
||||||
formatToolbar: ['bold'],
|
formatToolbar: ['bold'],
|
||||||
pageRef: ['navigate'],
|
pageRef: ['navigate'],
|
||||||
toolbar: ['copyBlockToLink'],
|
toolbar: [
|
||||||
|
'copyBlockToLink',
|
||||||
|
'openInSplitView',
|
||||||
|
'openInNewTab',
|
||||||
|
'openInPeekView',
|
||||||
|
],
|
||||||
aiActions: ['requestSignIn'],
|
aiActions: ['requestSignIn'],
|
||||||
pageBlockHeader: ['openDocInfo'],
|
pageBlockHeader: ['openDocInfo'],
|
||||||
starterBar: ['quickStart', 'openTemplateListMenu'],
|
starterBar: ['quickStart', 'openTemplateListMenu'],
|
||||||
@@ -412,6 +422,9 @@ type TabActionType =
|
|||||||
| 'switchTab'
|
| 'switchTab'
|
||||||
| 'separateTabs';
|
| 'separateTabs';
|
||||||
|
|
||||||
|
type SplitViewActionControlType = 'menu' | 'indicator';
|
||||||
|
type SplitViewActionType = 'open' | 'close' | 'move' | 'closeOthers';
|
||||||
|
|
||||||
type AuthArgs = {
|
type AuthArgs = {
|
||||||
method: 'password' | 'magic-link' | 'oauth';
|
method: 'password' | 'magic-link' | 'oauth';
|
||||||
provider?: string;
|
provider?: string;
|
||||||
@@ -452,12 +465,16 @@ export type EventArgs = {
|
|||||||
deleteOrganizeItem: OrganizeItemArgs;
|
deleteOrganizeItem: OrganizeItemArgs;
|
||||||
orderOrganizeItem: OrganizeItemArgs;
|
orderOrganizeItem: OrganizeItemArgs;
|
||||||
openInNewTab: { type: OrganizeItemType };
|
openInNewTab: { type: OrganizeItemType };
|
||||||
openInSplitView: { type: OrganizeItemType };
|
openInSplitView: { type: OrganizeItemType; route?: string };
|
||||||
tabAction: {
|
tabAction: {
|
||||||
type?: OrganizeItemType;
|
type?: OrganizeItemType;
|
||||||
control: TabActionControlType;
|
control: TabActionControlType;
|
||||||
action: TabActionType;
|
action: TabActionType;
|
||||||
};
|
};
|
||||||
|
splitViewAction: {
|
||||||
|
control: SplitViewActionControlType;
|
||||||
|
action: SplitViewActionType;
|
||||||
|
};
|
||||||
toggleFavorite: OrganizeItemArgs & { on: boolean };
|
toggleFavorite: OrganizeItemArgs & { on: boolean };
|
||||||
toggle: { type: 'collapse' | 'expand' };
|
toggle: { type: 'collapse' | 'expand' };
|
||||||
createDoc: { mode?: 'edgeless' | 'page' };
|
createDoc: { mode?: 'edgeless' | 'page' };
|
||||||
|
|||||||
Reference in New Issue
Block a user