Skip to content

Commit

Permalink
fix(core): navigation shortcut keys can't be used when the sidebar is…
Browse files Browse the repository at this point in the history
… collapsed (#6903)

close #6877
  • Loading branch information
JimmFly committed May 13, 2024
1 parent 644bd8c commit df6d0a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/frontend/core/src/layouts/workspace-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
} from '../hooks/affine/use-global-dnd-helper';
import { useNavigateHelper } from '../hooks/use-navigate-helper';
import { useRegisterWorkspaceCommands } from '../hooks/use-register-workspace-commands';
import { useRegisterNavigationCommands } from '../modules/navigation/view/use-register-navigation-commands';
import { WorkbenchService } from '../modules/workbench';
import {
AllWorkspaceModals,
Expand Down Expand Up @@ -122,6 +123,7 @@ export const WorkspaceLayoutInner = ({ children }: PropsWithChildren) => {
);

useRegisterWorkspaceCommands();
useRegisterNavigationCommands();

useEffect(() => {
// hotfix for blockVersions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ import { useCallback, useEffect, useMemo } from 'react';
import { useGeneralShortcuts } from '../../../hooks/affine/use-shortcuts';
import { NavigatorService } from '../services/navigator';
import * as styles from './navigation-buttons.css';
import { useRegisterNavigationCommands } from './use-register-navigation-commands';

export const NavigationButtons = () => {
const t = useAFFiNEI18N();

const shortcuts = useGeneralShortcuts().shortcuts;

useRegisterNavigationCommands();

const shortcutsObject = useMemo(() => {
const goBack = t['com.affine.keyboardShortcuts.goBack']();
const goBackShortcut = shortcuts?.[goBack];
Expand Down

0 comments on commit df6d0a2

Please sign in to comment.