mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix(core): navigation shortcut keys can't be used when the sidebar is collapsed (#6903)
close #6877
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
|||||||
} from '../hooks/affine/use-global-dnd-helper';
|
} from '../hooks/affine/use-global-dnd-helper';
|
||||||
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
import { useNavigateHelper } from '../hooks/use-navigate-helper';
|
||||||
import { useRegisterWorkspaceCommands } from '../hooks/use-register-workspace-commands';
|
import { useRegisterWorkspaceCommands } from '../hooks/use-register-workspace-commands';
|
||||||
|
import { useRegisterNavigationCommands } from '../modules/navigation/view/use-register-navigation-commands';
|
||||||
import { WorkbenchService } from '../modules/workbench';
|
import { WorkbenchService } from '../modules/workbench';
|
||||||
import {
|
import {
|
||||||
AllWorkspaceModals,
|
AllWorkspaceModals,
|
||||||
@@ -122,6 +123,7 @@ export const WorkspaceLayoutInner = ({ children }: PropsWithChildren) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useRegisterWorkspaceCommands();
|
useRegisterWorkspaceCommands();
|
||||||
|
useRegisterNavigationCommands();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// hotfix for blockVersions
|
// hotfix for blockVersions
|
||||||
|
|||||||
@@ -7,15 +7,12 @@ import { useCallback, useEffect, useMemo } from 'react';
|
|||||||
import { useGeneralShortcuts } from '../../../hooks/affine/use-shortcuts';
|
import { useGeneralShortcuts } from '../../../hooks/affine/use-shortcuts';
|
||||||
import { NavigatorService } from '../services/navigator';
|
import { NavigatorService } from '../services/navigator';
|
||||||
import * as styles from './navigation-buttons.css';
|
import * as styles from './navigation-buttons.css';
|
||||||
import { useRegisterNavigationCommands } from './use-register-navigation-commands';
|
|
||||||
|
|
||||||
export const NavigationButtons = () => {
|
export const NavigationButtons = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
|
|
||||||
const shortcuts = useGeneralShortcuts().shortcuts;
|
const shortcuts = useGeneralShortcuts().shortcuts;
|
||||||
|
|
||||||
useRegisterNavigationCommands();
|
|
||||||
|
|
||||||
const shortcutsObject = useMemo(() => {
|
const shortcutsObject = useMemo(() => {
|
||||||
const goBack = t['com.affine.keyboardShortcuts.goBack']();
|
const goBack = t['com.affine.keyboardShortcuts.goBack']();
|
||||||
const goBackShortcut = shortcuts?.[goBack];
|
const goBackShortcut = shortcuts?.[goBack];
|
||||||
|
|||||||
Reference in New Issue
Block a user