This commit is contained in:
DarkSky
2022-09-05 23:32:24 +08:00
parent e52ee910c3
commit 9c619ea22f
2 changed files with 110 additions and 104 deletions

View File

@@ -1,24 +1,24 @@
import React, { useState, useCallback } from 'react';
import style9 from 'style9';
import {
Popover,
styled,
type SvgIconProps,
Tooltip,
} from '@toeverything/components/ui';
import {
fontBgColorPalette,
fontColorPalette,
} from '@toeverything/components/common';
import { ArrowDropDownIcon } from '@toeverything/components/icons';
import type { DropdownItemType, WithEditorSelectionType } from '../types';
import { uaHelper } from '@toeverything/utils';
import {
inlineMenuNamesKeys,
Popover,
styled,
Tooltip,
type SvgIconProps,
} from '@toeverything/components/ui';
import { uaHelper } from '@toeverything/utils';
import { useCallback, useState } from 'react';
import style9 from 'style9';
import {
inlineMenuNamesForFontColor,
inlineMenuNamesKeys,
MacInlineMenuShortcuts,
WinInlineMenuShortcuts
WinInlineMenuShortcuts,
} from '../config';
import type { DropdownItemType, WithEditorSelectionType } from '../types';
type MenuDropdownItemProps = DropdownItemType & WithEditorSelectionType;
@@ -38,11 +38,13 @@ export const MenuDropdownItem = ({
set_anchor_ele(null);
}, []);
//@ts-ignore
const shortcut = uaHelper.isMacOs ? MacInlineMenuShortcuts[nameKey] : WinInlineMenuShortcuts[nameKey];
const shortcut = uaHelper.isMacOs
? //@ts-ignore
MacInlineMenuShortcuts[nameKey]
: //@ts-ignore
WinInlineMenuShortcuts[nameKey];
return (
<>
<Popover
trigger="click"
placement="bottom-start"
@@ -71,8 +73,7 @@ export const MenuDropdownItem = ({
editor,
type: itemNameKey,
anchorNodeId:
selectionInfo?.anchorNode
?.id,
selectionInfo?.anchorNode?.id,
});
}
handle_close_dropdown_menu();
@@ -103,9 +104,7 @@ export const MenuDropdownItem = ({
// }
/>
{/* <ItemIcon sx={{ width: 20, height: 20 }} /> */}
<span
className={styles('dropdownItemItext')}
>
<span className={styles('dropdownItemItext')}>
{name}
</span>
</button>
@@ -133,7 +132,6 @@ export const MenuDropdownItem = ({
</button>
</Tooltip>
</Popover>
</>
);
};

View File

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