Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
DarkSky 2022-09-05 22:24:37 +08:00
commit bb30bb8ce5
3 changed files with 15 additions and 5 deletions

View File

@ -12,13 +12,20 @@ export const INLINE_MENU_UI_TYPES = {
} as const;
/** inline menu item { key : display-name } */
export const inlineMenuShortcuts = {
export const MacInlineMenuShortcuts = {
textBold: '⌘+B',
textItalic: '⌘+I',
textStrikethrough: '⌘+S',
link: '⌘+K',
[Protocol.Block.Type.code]: '⌘+E',
};
export const WinInlineMenuShortcuts = {
textBold: 'Ctrl+B',
textItalic: 'Ctrl+I',
textStrikethrough: 'Ctrl+S',
link: 'Ctrl+K',
[Protocol.Block.Type.code]: 'Ctrl+E',
};
export const inlineMenuNames = {
currentText: 'TEXT SIZE',
[Protocol.Block.Type.heading1]: 'Heading 1',

View File

@ -12,10 +12,12 @@ import {
} from '@toeverything/components/common';
import { ArrowDropDownIcon } from '@toeverything/components/icons';
import type { DropdownItemType, WithEditorSelectionType } from '../types';
import { uaHelper } from '@toeverything/utils';
import {
inlineMenuNamesKeys,
inlineMenuNamesForFontColor,
inlineMenuShortcuts,
MacInlineMenuShortcuts,
WinInlineMenuShortcuts
} from '../config';
type MenuDropdownItemProps = DropdownItemType & WithEditorSelectionType;
@ -37,7 +39,7 @@ export const MenuDropdownItem = ({
}, []);
//@ts-ignore
const shortcut = inlineMenuShortcuts[nameKey];
const shortcut = uaHelper.isMacOs ? MacInlineMenuShortcuts[nameKey] : WinInlineMenuShortcuts[nameKey];
return (
<>

View File

@ -2,8 +2,9 @@ import React, { useCallback } from 'react';
import style9 from 'style9';
import type { IconItemType, WithEditorSelectionType } from '../types';
import { inlineMenuNamesKeys, inlineMenuShortcuts } from '../config';
import { inlineMenuNamesKeys, MacInlineMenuShortcuts, WinInlineMenuShortcuts } from '../config';
import { Tooltip } from '@toeverything/components/ui';
import { uaHelper } from '@toeverything/utils';
type MenuIconItemProps = IconItemType & WithEditorSelectionType;
export const MenuIconItem = ({
@ -35,7 +36,7 @@ export const MenuIconItem = ({
);
//@ts-ignore
const shortcut = inlineMenuShortcuts[nameKey];
const shortcut = uaHelper.isMacOs ? MacInlineMenuShortcuts[nameKey] : WinInlineMenuShortcuts[nameKey];
return (
<Tooltip