fix: ci
This commit is contained in:
@@ -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 {
|
import {
|
||||||
fontBgColorPalette,
|
fontBgColorPalette,
|
||||||
fontColorPalette,
|
fontColorPalette,
|
||||||
} from '@toeverything/components/common';
|
} from '@toeverything/components/common';
|
||||||
import { ArrowDropDownIcon } from '@toeverything/components/icons';
|
import { ArrowDropDownIcon } from '@toeverything/components/icons';
|
||||||
import type { DropdownItemType, WithEditorSelectionType } from '../types';
|
|
||||||
import { uaHelper } from '@toeverything/utils';
|
|
||||||
import {
|
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,
|
inlineMenuNamesForFontColor,
|
||||||
|
inlineMenuNamesKeys,
|
||||||
MacInlineMenuShortcuts,
|
MacInlineMenuShortcuts,
|
||||||
WinInlineMenuShortcuts
|
WinInlineMenuShortcuts,
|
||||||
} from '../config';
|
} from '../config';
|
||||||
|
import type { DropdownItemType, WithEditorSelectionType } from '../types';
|
||||||
|
|
||||||
type MenuDropdownItemProps = DropdownItemType & WithEditorSelectionType;
|
type MenuDropdownItemProps = DropdownItemType & WithEditorSelectionType;
|
||||||
|
|
||||||
@@ -38,102 +38,100 @@ export const MenuDropdownItem = ({
|
|||||||
set_anchor_ele(null);
|
set_anchor_ele(null);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
//@ts-ignore
|
const shortcut = uaHelper.isMacOs
|
||||||
const shortcut = uaHelper.isMacOs ? MacInlineMenuShortcuts[nameKey] : WinInlineMenuShortcuts[nameKey];
|
? //@ts-ignore
|
||||||
|
MacInlineMenuShortcuts[nameKey]
|
||||||
|
: //@ts-ignore
|
||||||
|
WinInlineMenuShortcuts[nameKey];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Popover
|
||||||
<Popover
|
trigger="click"
|
||||||
trigger="click"
|
placement="bottom-start"
|
||||||
placement="bottom-start"
|
content={
|
||||||
|
<div className={styles('dropdownContainer')}>
|
||||||
|
{children.map(item => {
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
icon: ItemIcon,
|
||||||
|
onClick,
|
||||||
|
nameKey: itemNameKey,
|
||||||
|
} = item;
|
||||||
|
|
||||||
|
const StyledIcon = withStylesForIcon(ItemIcon);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={styles('dropdownItem')}
|
||||||
|
key={name}
|
||||||
|
onClick={() => {
|
||||||
|
if (
|
||||||
|
onClick &&
|
||||||
|
selectionInfo?.anchorNode?.id
|
||||||
|
) {
|
||||||
|
onClick({
|
||||||
|
editor,
|
||||||
|
type: itemNameKey,
|
||||||
|
anchorNodeId:
|
||||||
|
selectionInfo?.anchorNode?.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
handle_close_dropdown_menu();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<StyledIcon
|
||||||
|
fontColor={
|
||||||
|
nameKey ===
|
||||||
|
inlineMenuNamesKeys.currentFontColor
|
||||||
|
? fontColorPalette[
|
||||||
|
inlineMenuNamesForFontColor[
|
||||||
|
itemNameKey as keyof typeof inlineMenuNamesForFontColor
|
||||||
|
]
|
||||||
|
]
|
||||||
|
: nameKey ===
|
||||||
|
inlineMenuNamesKeys.currentFontBackground
|
||||||
|
? fontBgColorPalette[
|
||||||
|
inlineMenuNamesForFontColor[
|
||||||
|
itemNameKey as keyof typeof inlineMenuNamesForFontColor
|
||||||
|
]
|
||||||
|
]
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
// fontBgColor={
|
||||||
|
// nameKey=== inlineMenuNamesKeys.currentFontBackground ? fontBgColorPalette[
|
||||||
|
// inlineMenuNamesForFontColor[itemNameKey] as keyof typeof fontBgColorPalette
|
||||||
|
// ]:''
|
||||||
|
// }
|
||||||
|
/>
|
||||||
|
{/* <ItemIcon sx={{ width: 20, height: 20 }} /> */}
|
||||||
|
<span className={styles('dropdownItemItext')}>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Tooltip
|
||||||
content={
|
content={
|
||||||
<div className={styles('dropdownContainer')}>
|
<div style={{ padding: '2px 4px' }}>
|
||||||
{children.map(item => {
|
<p>{name}</p>
|
||||||
const {
|
{shortcut && <p>{shortcut}</p>}
|
||||||
name,
|
|
||||||
icon: ItemIcon,
|
|
||||||
onClick,
|
|
||||||
nameKey: itemNameKey,
|
|
||||||
} = item;
|
|
||||||
|
|
||||||
const StyledIcon = withStylesForIcon(ItemIcon);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
className={styles('dropdownItem')}
|
|
||||||
key={name}
|
|
||||||
onClick={() => {
|
|
||||||
if (
|
|
||||||
onClick &&
|
|
||||||
selectionInfo?.anchorNode?.id
|
|
||||||
) {
|
|
||||||
onClick({
|
|
||||||
editor,
|
|
||||||
type: itemNameKey,
|
|
||||||
anchorNodeId:
|
|
||||||
selectionInfo?.anchorNode
|
|
||||||
?.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
handle_close_dropdown_menu();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StyledIcon
|
|
||||||
fontColor={
|
|
||||||
nameKey ===
|
|
||||||
inlineMenuNamesKeys.currentFontColor
|
|
||||||
? fontColorPalette[
|
|
||||||
inlineMenuNamesForFontColor[
|
|
||||||
itemNameKey as keyof typeof inlineMenuNamesForFontColor
|
|
||||||
]
|
|
||||||
]
|
|
||||||
: nameKey ===
|
|
||||||
inlineMenuNamesKeys.currentFontBackground
|
|
||||||
? fontBgColorPalette[
|
|
||||||
inlineMenuNamesForFontColor[
|
|
||||||
itemNameKey as keyof typeof inlineMenuNamesForFontColor
|
|
||||||
]
|
|
||||||
]
|
|
||||||
: ''
|
|
||||||
}
|
|
||||||
// fontBgColor={
|
|
||||||
// nameKey=== inlineMenuNamesKeys.currentFontBackground ? fontBgColorPalette[
|
|
||||||
// inlineMenuNamesForFontColor[itemNameKey] as keyof typeof fontBgColorPalette
|
|
||||||
// ]:''
|
|
||||||
// }
|
|
||||||
/>
|
|
||||||
{/* <ItemIcon sx={{ width: 20, height: 20 }} /> */}
|
|
||||||
<span
|
|
||||||
className={styles('dropdownItemItext')}
|
|
||||||
>
|
|
||||||
{name}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
placement="top"
|
||||||
|
trigger="hover"
|
||||||
>
|
>
|
||||||
<Tooltip
|
<button
|
||||||
content={
|
className={styles('currentDropdownButton')}
|
||||||
<div style={{ padding: '2px 4px' }}>
|
aria-label={name}
|
||||||
<p>{name}</p>
|
|
||||||
{shortcut && <p>{shortcut}</p>}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
placement="top"
|
|
||||||
trigger="hover"
|
|
||||||
>
|
>
|
||||||
<button
|
<MenuIcon sx={{ width: 20, height: 20 }} />
|
||||||
className={styles('currentDropdownButton')}
|
<ArrowDropDownIcon sx={{ width: 20, height: 20 }} />
|
||||||
aria-label={name}
|
</button>
|
||||||
>
|
</Tooltip>
|
||||||
<MenuIcon sx={{ width: 20, height: 20 }} />
|
</Popover>
|
||||||
<ArrowDropDownIcon sx={{ width: 20, height: 20 }} />
|
|
||||||
</button>
|
|
||||||
</Tooltip>
|
|
||||||
</Popover>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import style9 from 'style9';
|
import style9 from 'style9';
|
||||||
|
|
||||||
import type { IconItemType, WithEditorSelectionType } from '../types';
|
|
||||||
import { inlineMenuNamesKeys, MacInlineMenuShortcuts, WinInlineMenuShortcuts } from '../config';
|
|
||||||
import { Tooltip } from '@toeverything/components/ui';
|
import { Tooltip } from '@toeverything/components/ui';
|
||||||
import { uaHelper } from '@toeverything/utils';
|
import { uaHelper } from '@toeverything/utils';
|
||||||
|
import {
|
||||||
|
inlineMenuNamesKeys,
|
||||||
|
MacInlineMenuShortcuts,
|
||||||
|
WinInlineMenuShortcuts,
|
||||||
|
} from '../config';
|
||||||
|
import type { IconItemType, WithEditorSelectionType } from '../types';
|
||||||
type MenuIconItemProps = IconItemType & WithEditorSelectionType;
|
type MenuIconItemProps = IconItemType & WithEditorSelectionType;
|
||||||
|
|
||||||
export const MenuIconItem = ({
|
export const MenuIconItem = ({
|
||||||
@@ -36,7 +40,11 @@ export const MenuIconItem = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const shortcut = uaHelper.isMacOs ? MacInlineMenuShortcuts[nameKey] : WinInlineMenuShortcuts[nameKey];
|
const shortcut = uaHelper.isMacOs
|
||||||
|
? //@ts-ignore
|
||||||
|
MacInlineMenuShortcuts[nameKey]
|
||||||
|
: //@ts-ignore
|
||||||
|
WinInlineMenuShortcuts[nameKey];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
|||||||
Reference in New Issue
Block a user