import { EnterOutlined, FileAddOutlined, ReadOutlined, RedoOutlined, SaveOutlined, SearchOutlined, UndoOutlined } from '@ant-design/icons'; import { f } from '@src/resource/string'; import React from 'react'; import { IconBtn } from '../../docs/plugins/Components'; import './index.less'; export const HotkeyHelperContent = () => ( <>
{getHotkeyGroup( f('globalHotkey'), [ { icon: , cardInfo: f('undo'), hotkey: ['Ctrl', 'Z'] }, { icon: , cardInfo: f('redo'), hotkey: ['Ctrl', 'Y'] }, { icon: , cardInfo: f('save'), hotkey: ['Ctrl', 'S'] }, ], false )} {getHotkeyGroup( f('textHotkey'), [ { icon: , cardInfo: f('bold'), hotkey: ['Ctrl', 'B'] }, { icon: , cardInfo: f('italic'), hotkey: ['Ctrl', 'I'] }, { icon: , cardInfo: f('code'), hotkey: ['Ctrl', 'E'] }, { icon: , cardInfo: f('underline'), hotkey: ['Ctrl', 'U'] }, { icon: , cardInfo: f('strikethrough'), hotkey: ['Ctrl', 'Shift', 'X'] }, { icon: , cardInfo: f('softEnter'), hotkey: ['Shift', 'Enter'] }, ], false )} {getHotkeyGroup( 'Markdown', [ { icon: , cardInfo: f('bold'), hotkey: ['**' + f('text') + '**', f('space')] }, { icon: , cardInfo: f('italic'), hotkey: ['*' + f('text') + '*', f('space')] }, { icon: , cardInfo: f('quote'), hotkey: ['>', f('space')] }, { icon: , cardInfo: f('code'), hotkey: ['`' + f('code') + '`'] }, { icon: , cardInfo: f('numberedList'), hotkey: ['1.', f('space')] }, { icon: , cardInfo: f('bulletedList'), hotkey: ['*', f('space')] }, { icon: , cardInfo: f('codeBlock'), hotkey: ['```', f('space')] }, { icon: , cardInfo: f('heading1'), hotkey: ['#', f('space')] }, { icon: , cardInfo: f('heading'), hotkey: ['##', f('space')] }, { icon: , cardInfo: f('heading3'), hotkey: ['###', f('space')] }, { icon: , cardInfo: f('heading4'), hotkey: ['####', f('space')] }, { icon: , cardInfo: f('heading5'), hotkey: ['#####', f('space')] }, { icon: , cardInfo: f('heading6'), hotkey: ['######', f('space')] }, ], true )}
); function toItemKey(...rest) { const args: any = [...rest]; return args.map((item: any, index: number) => index === args.length - 1 ? ( {item} ) : ( {item} + ) ); } function toSpaceItemKey(...rest) { const args: any = [...rest]; return args.map((item: any, index: number) => index === args.length - 1 ? ( {item} ) : ( {item} ) ); } function getHotkeyGroup(groupname: string, groupItemList: { icon: any; cardInfo: string; hotkey: string[] }[], withSpace: boolean) { return (
{groupname}
{groupItemList.map((item: { icon: any; cardInfo: string; hotkey: string[] }, index: number) => (
{item.icon}
{item.cardInfo}
{withSpace ? toSpaceItemKey(...item.hotkey) : toItemKey(...item.hotkey)}
))}
); }