fix: normalize shortcut display (#14196)

Normalize shortcut tokens and remove stray whitespace.
Uncomment group/ungroup shortcuts now that the feature is implemented.
Fix Windows redo shortcut display.

<img width="142" height="230" alt="image"
src="https://github.com/user-attachments/assets/989e061e-1ca2-489c-ab8e-6baad853d438"
/><img width="142" height="37" alt="image"
src="https://github.com/user-attachments/assets/671ed9b2-ccad-44ad-8889-7810bb01143c"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Standardized keyboard shortcut representations across the application
for improved consistency and clarity in shortcut displays.
* Corrected spacing inconsistencies in shortcut entries to ensure
uniform formatting.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com>
This commit is contained in:
zetaloop
2026-01-01 21:07:35 +08:00
committed by GitHub
parent 1e8095c224
commit 9f96633b33
2 changed files with 30 additions and 31 deletions

View File

@@ -28,7 +28,7 @@ export const openDocActions: Array<OpenDocAction> = [
type: 'open-in-new-view', type: 'open-in-new-view',
label: I18n['com.affine.peek-view-controls.open-doc-in-split-view'](), label: I18n['com.affine.peek-view-controls.open-doc-in-split-view'](),
icon: SplitViewIcon(), icon: SplitViewIcon(),
shortcut: '⌘ ⌥ + click', shortcut: '⌘ + ⌥ + click',
enabled: BUILD_CONFIG.isElectron, enabled: BUILD_CONFIG.isElectron,
}, },
{ {

View File

@@ -82,11 +82,11 @@ export const useWinGeneralKeyboardShortcuts = (): ShortcutMap => {
[t('quickSearch')]: ['Ctrl', 'K'], [t('quickSearch')]: ['Ctrl', 'K'],
[t('newPage')]: ['Ctrl', 'N'], [t('newPage')]: ['Ctrl', 'N'],
// not implement yet // not implement yet
// [t('appendDailyNote')]: 'Ctrl + Alt + A', // [t('appendDailyNote')]: ['Ctrl', 'Alt', 'A'],
[t('expandOrCollapseSidebar')]: ['Ctrl', '/'], [t('expandOrCollapseSidebar')]: ['Ctrl', '/'],
[t('goBack')]: ['Ctrl', '['], [t('goBack')]: ['Ctrl', '['],
[t('goForward')]: ['Ctrl', ']'], [t('goForward')]: ['Ctrl', ']'],
[t('copy-private-link')]: ['Ctrl', '⇧', 'C'], [t('copy-private-link')]: ['Ctrl', 'Shift', 'C'],
}), }),
[t] [t]
); );
@@ -99,10 +99,10 @@ export const useMacGeneralKeyboardShortcuts = (): ShortcutMap => {
[t('quickSearch')]: ['⌘', 'K'], [t('quickSearch')]: ['⌘', 'K'],
[t('newPage')]: ['⌘', 'N'], [t('newPage')]: ['⌘', 'N'],
// not implement yet // not implement yet
// [t('appendDailyNote')]: '⌘ + ⌥ + A', // [t('appendDailyNote')]: ['⌘', '⌥', 'A'],
[t('expandOrCollapseSidebar')]: ['⌘', '/'], [t('expandOrCollapseSidebar')]: ['⌘', '/'],
[t('goBack')]: ['⌘ ', '['], [t('goBack')]: ['⌘', '['],
[t('goForward')]: ['⌘ ', ']'], [t('goForward')]: ['⌘', ']'],
[t('copy-private-link')]: ['⌘', '⇧', 'C'], [t('copy-private-link')]: ['⌘', '⇧', 'C'],
}), }),
[t] [t]
@@ -118,9 +118,9 @@ export const useMacEdgelessKeyboardShortcuts = (): ShortcutMap => {
[t('redo')]: ['⌘', '⇧', 'Z'], [t('redo')]: ['⌘', '⇧', 'Z'],
[t('zoomIn')]: ['⌘', '+'], [t('zoomIn')]: ['⌘', '+'],
[t('zoomOut')]: ['⌘', '-'], [t('zoomOut')]: ['⌘', '-'],
[t('zoomTo100')]: ['Alt', '0'], [t('zoomTo100')]: ['⌥', '0'],
[t('zoomToFit')]: ['Alt', '1'], [t('zoomToFit')]: ['⌥', '1'],
[t('zoomToSelection')]: ['Alt', '2'], [t('zoomToSelection')]: ['⌥', '2'],
[t('select')]: ['V'], [t('select')]: ['V'],
[t('text')]: ['T'], [t('text')]: ['T'],
[t('shape')]: ['S'], [t('shape')]: ['S'],
@@ -129,9 +129,9 @@ export const useMacEdgelessKeyboardShortcuts = (): ShortcutMap => {
[t('pen')]: ['P'], [t('pen')]: ['P'],
[t('hand')]: ['H'], [t('hand')]: ['H'],
[t('note')]: ['N'], [t('note')]: ['N'],
// not implement yet [t('switch')]: ['⌥', 'S'],
// [t('group')]: '⌘ + G', [t('group')]: ['⌘', 'G'],
// [t('unGroup')]: '⌘ + ⇧ + G', [t('unGroup')]: ['⌘', '⇧', 'G'],
}), }),
[t] [t]
); );
@@ -142,7 +142,7 @@ export const useWinEdgelessKeyboardShortcuts = (): ShortcutMap => {
() => ({ () => ({
[t('selectAll')]: ['Ctrl', 'A'], [t('selectAll')]: ['Ctrl', 'A'],
[t('undo')]: ['Ctrl', 'Z'], [t('undo')]: ['Ctrl', 'Z'],
[t('redo')]: ['Ctrl', 'Y/Ctrl', 'Shift', 'Z'], [t('redo')]: ['Ctrl', 'Y'],
[t('zoomIn')]: ['Ctrl', '+'], [t('zoomIn')]: ['Ctrl', '+'],
[t('zoomOut')]: ['Ctrl', '-'], [t('zoomOut')]: ['Ctrl', '-'],
[t('zoomTo100')]: ['Alt', '0'], [t('zoomTo100')]: ['Alt', '0'],
@@ -156,10 +156,9 @@ export const useWinEdgelessKeyboardShortcuts = (): ShortcutMap => {
[t('pen')]: ['P'], [t('pen')]: ['P'],
[t('hand')]: ['H'], [t('hand')]: ['H'],
[t('note')]: ['N'], [t('note')]: ['N'],
[t('switch')]: ['Alt ', ''], [t('switch')]: ['Alt', 'S'],
// not implement yet [t('group')]: ['Ctrl', 'G'],
// [t('group')]: 'Ctrl + G', [t('unGroup')]: ['Ctrl', 'Shift', 'G'],
// [t('unGroup')]: 'Ctrl + Shift + G',
}), }),
[t] [t]
); );
@@ -194,8 +193,8 @@ export const useMacPageKeyboardShortcuts = (): ShortcutMap => {
[t('groupDatabase')]: ['⌘', 'G'], [t('groupDatabase')]: ['⌘', 'G'],
[t('switch')]: ['⌥', 'S'], [t('switch')]: ['⌥', 'S'],
// not implement yet // not implement yet
// [t('moveUp')]: '⌘ + ⌥ + ↑', // [t('moveUp')]: ['⌘', '⌥', '↑'],
// [t('moveDown')]: '⌘ + ⌥ + ↓', // [t('moveDown')]: ['⌘', '⌥', '↓'],
}), }),
[t, tH] [t, tH]
); );
@@ -211,7 +210,7 @@ export const useMacMarkdownShortcuts = (): ShortcutMap => {
[t('underline')]: ['~Text~'], [t('underline')]: ['~Text~'],
[t('strikethrough')]: ['~~Text~~'], [t('strikethrough')]: ['~~Text~~'],
[t('divider')]: ['***'], [t('divider')]: ['***'],
[t('inlineCode')]: ['`Text` '], [t('inlineCode')]: ['`Text`'],
[t('codeBlock')]: ['``` Space'], [t('codeBlock')]: ['``` Space'],
[tH('1')]: ['# Text'], [tH('1')]: ['# Text'],
[tH('2')]: ['## Text'], [tH('2')]: ['## Text'],
@@ -235,7 +234,7 @@ export const useWinPageKeyboardShortcuts = (): ShortcutMap => {
[t('italic')]: ['Ctrl', 'I'], [t('italic')]: ['Ctrl', 'I'],
[t('underline')]: ['Ctrl', 'U'], [t('underline')]: ['Ctrl', 'U'],
[t('strikethrough')]: ['Ctrl', 'Shift', 'S'], [t('strikethrough')]: ['Ctrl', 'Shift', 'S'],
[t('inlineCode')]: [' Ctrl', 'E'], [t('inlineCode')]: ['Ctrl', 'E'],
[t('codeBlock')]: ['Ctrl', 'Alt', 'C'], [t('codeBlock')]: ['Ctrl', 'Alt', 'C'],
[t('link')]: ['Ctrl', 'K'], [t('link')]: ['Ctrl', 'K'],
[t('quickSearch')]: ['Ctrl', 'K'], [t('quickSearch')]: ['Ctrl', 'K'],
@@ -247,15 +246,15 @@ export const useWinPageKeyboardShortcuts = (): ShortcutMap => {
[tH('5')]: ['Ctrl', 'Shift', '5'], [tH('5')]: ['Ctrl', 'Shift', '5'],
[tH('6')]: ['Ctrl', 'Shift', '6'], [tH('6')]: ['Ctrl', 'Shift', '6'],
[t('increaseIndent')]: ['Tab'], [t('increaseIndent')]: ['Tab'],
[t('reduceIndent')]: ['Shift+Tab'], [t('reduceIndent')]: ['Shift', 'Tab'],
[t('alignLeft')]: ['Ctrl', 'Shift', 'L'], [t('alignLeft')]: ['Ctrl', 'Shift', 'L'],
[t('alignCenter')]: ['Ctrl', 'Shift', 'E'], [t('alignCenter')]: ['Ctrl', 'Shift', 'E'],
[t('alignRight')]: ['Ctrl', 'Shift', 'R'], [t('alignRight')]: ['Ctrl', 'Shift', 'R'],
[t('groupDatabase')]: ['Ctrl + G'], [t('groupDatabase')]: ['Ctrl', 'G'],
['Switch']: ['Alt + S'], [t('switch')]: ['Alt', 'S'],
// not implement yet // not implement yet
// [t('moveUp')]: 'Ctrl + Alt + ↑', // [t('moveUp')]: ['Ctrl', 'Alt', '↑'],
// [t('moveDown')]: 'Ctrl + Alt + ↓', // [t('moveDown')]: ['Ctrl', 'Alt', '↓'],
}), }),
[t, tH] [t, tH]
); );
@@ -265,12 +264,12 @@ export const useWinMarkdownShortcuts = (): ShortcutMap => {
const tH = useHeadingKeyboardShortcutsI18N(); const tH = useHeadingKeyboardShortcutsI18N();
return useMemo( return useMemo(
() => ({ () => ({
[t('bold')]: ['**Text** '], [t('bold')]: ['**Text**'],
[t('italic')]: ['*Text* '], [t('italic')]: ['*Text*'],
[t('underline')]: ['~Text~ '], [t('underline')]: ['~Text~'],
[t('strikethrough')]: ['~~Text~~ '], [t('strikethrough')]: ['~~Text~~'],
[t('divider')]: ['***'], [t('divider')]: ['***'],
[t('inlineCode')]: ['`Text` '], [t('inlineCode')]: ['`Text`'],
[t('codeBlock')]: ['``` Text'], [t('codeBlock')]: ['``` Text'],
[tH('1')]: ['# Text'], [tH('1')]: ['# Text'],
[tH('2')]: ['## Text'], [tH('2')]: ['## Text'],