mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 03:21:39 +03:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
bb30bb8ce5
@ -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',
|
||||
|
@ -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 (
|
||||
<>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user