|
9 | 9 |
|
10 | 10 | import {cn} from '../../classname';
|
11 | 11 | import {isFunction} from '../../lodash';
|
| 12 | +import {PreviewTooltip} from '../../toolbar/PreviewTooltip'; |
12 | 13 |
|
13 | 14 | import type {WToolbarBaseProps, WToolbarItemData} from './types';
|
14 | 15 |
|
@@ -46,28 +47,30 @@ export const ToolbarSelect: React.FC<ToolbarSelectProps> = ({
|
46 | 47 | text: isFunction(item.title) ? item.title() : item.title,
|
47 | 48 | }))}
|
48 | 49 | renderOption={({text, data}) => {
|
49 |
| - const {icon, hotkey, hint} = data as WToolbarItemData; |
| 50 | + const {icon, hotkey, hint, preview} = data as WToolbarItemData; |
50 | 51 | const hintText = isFunction(hint) ? hint() : hint;
|
51 | 52 | return (
|
52 |
| - <div aria-label={text} className={b('item')}> |
53 |
| - <div className={b('item-icon')}> |
54 |
| - <Icon data={icon.data} size={Number(icon.size ?? 16) + 2} /> |
55 |
| - </div> |
56 |
| - <div className={b('item-content')}> |
57 |
| - {text} |
58 |
| - <div className={b('item-extra')}> |
59 |
| - {hotkey && <Hotkey value={hotkey} />} |
60 |
| - {hintText && ( |
61 |
| - <HelpMark |
62 |
| - popoverProps={{modal: false}} |
63 |
| - className={b('item-hint')} |
64 |
| - > |
65 |
| - {hintText} |
66 |
| - </HelpMark> |
67 |
| - )} |
| 53 | + <PreviewTooltip preview={preview}> |
| 54 | + <div aria-label={text} className={b('item')}> |
| 55 | + <div className={b('item-icon')}> |
| 56 | + <Icon data={icon.data} size={Number(icon.size ?? 16) + 2} /> |
| 57 | + </div> |
| 58 | + <div className={b('item-content')}> |
| 59 | + {text} |
| 60 | + <div className={b('item-extra')}> |
| 61 | + {hotkey && <Hotkey value={hotkey} />} |
| 62 | + {hintText && ( |
| 63 | + <HelpMark |
| 64 | + popoverProps={{modal: false}} |
| 65 | + className={b('item-hint')} |
| 66 | + > |
| 67 | + {hintText} |
| 68 | + </HelpMark> |
| 69 | + )} |
| 70 | + </div> |
68 | 71 | </div>
|
69 | 72 | </div>
|
70 |
| - </div> |
| 73 | + </PreviewTooltip> |
71 | 74 | );
|
72 | 75 | }}
|
73 | 76 | onUpdate={([id]) => {
|
|
0 commit comments