mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 10:52:40 +08:00
@@ -1,5 +1,6 @@
|
|||||||
import { useDocMetaHelper } from '@affine/core/hooks/use-block-suite-page-meta';
|
import { useDocMetaHelper } from '@affine/core/hooks/use-block-suite-page-meta';
|
||||||
import { useJournalHelper } from '@affine/core/hooks/use-journal';
|
import { useJournalHelper } from '@affine/core/hooks/use-journal';
|
||||||
|
import { track } from '@affine/core/mixpanel';
|
||||||
import {
|
import {
|
||||||
PeekViewService,
|
PeekViewService,
|
||||||
useInsidePeekView,
|
useInsidePeekView,
|
||||||
@@ -123,9 +124,16 @@ export function AffinePageReference({
|
|||||||
|
|
||||||
const peekView = useService(PeekViewService).peekView;
|
const peekView = useService(PeekViewService).peekView;
|
||||||
const isInPeekView = useInsidePeekView();
|
const isInPeekView = useInsidePeekView();
|
||||||
|
const isJournal = journalHelper.isPageJournal(pageId);
|
||||||
|
|
||||||
const onClick = useCallback(
|
const onClick = useCallback(
|
||||||
(e: React.MouseEvent) => {
|
(e: React.MouseEvent) => {
|
||||||
|
if (isJournal) {
|
||||||
|
track.doc.editor.pageRef.navigate({
|
||||||
|
to: 'journal',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (e.shiftKey && ref.current) {
|
if (e.shiftKey && ref.current) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -141,7 +149,7 @@ export function AffinePageReference({
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
[isInPeekView, peekView]
|
[isInPeekView, isJournal, peekView]
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = useMemo(() => {
|
const query = useMemo(() => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { DocsService, initEmptyPage, useService } from '@toeverything/infra';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import { track } from '../mixpanel';
|
||||||
import { WorkbenchService } from '../modules/workbench';
|
import { WorkbenchService } from '../modules/workbench';
|
||||||
import type { DocCollection } from '../shared';
|
import type { DocCollection } from '../shared';
|
||||||
import { useCurrentWorkspacePropertiesAdapter } from './use-affine-adapter';
|
import { useCurrentWorkspacePropertiesAdapter } from './use-affine-adapter';
|
||||||
@@ -164,6 +165,9 @@ export const useJournalRouteHelper = (docCollection: DocCollection) => {
|
|||||||
workbench.openDoc(page.id, {
|
workbench.openDoc(page.id, {
|
||||||
at: newTab ? 'new-tab' : 'active',
|
at: newTab ? 'new-tab' : 'active',
|
||||||
});
|
});
|
||||||
|
track.$.navigationPanel.journal.navigate({
|
||||||
|
to: 'journal',
|
||||||
|
});
|
||||||
return page.id;
|
return page.id;
|
||||||
},
|
},
|
||||||
[getJournalByDate, workbench]
|
[getJournalByDate, workbench]
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ const PageEvents = {
|
|||||||
'openSettings',
|
'openSettings',
|
||||||
],
|
],
|
||||||
profileAndBadge: ['openSettings'],
|
profileAndBadge: ['openSettings'],
|
||||||
|
journal: ['navigate'],
|
||||||
},
|
},
|
||||||
aiOnboarding: {
|
aiOnboarding: {
|
||||||
dialog: ['viewPlans'],
|
dialog: ['viewPlans'],
|
||||||
@@ -263,6 +264,7 @@ const PageEvents = {
|
|||||||
slashMenu: ['linkDoc', 'createDoc'],
|
slashMenu: ['linkDoc', 'createDoc'],
|
||||||
atMenu: ['linkDoc'],
|
atMenu: ['linkDoc'],
|
||||||
formatToolbar: ['bold'],
|
formatToolbar: ['bold'],
|
||||||
|
pageRef: ['navigate'],
|
||||||
},
|
},
|
||||||
inlineDocInfo: {
|
inlineDocInfo: {
|
||||||
$: ['toggle'],
|
$: ['toggle'],
|
||||||
|
|||||||
Reference in New Issue
Block a user