(e: React.MouseEvent)
| 18 | const sticker = pathState?.label?.sticker; |
| 19 | const color = pathState?.label?.color; |
| 20 | const triggerStickerContextMenu = (e: React.MouseEvent) => { |
| 21 | if (!pathState) return; |
| 22 | |
| 23 | e.preventDefault(); |
| 24 | e.stopPropagation(); |
| 25 | const menuOptions: SelectOption[] = []; |
| 26 | menuOptions.push({ |
| 27 | name: i18n.buttons.changeIcon, |
| 28 | icon: "ui//sticker", |
| 29 | onClick: (e) => { |
| 30 | props.superstate.ui.openPalette( |
| 31 | <StickerModal |
| 32 | ui={props.superstate.ui} |
| 33 | selectedSticker={(emoji) => |
| 34 | savePathSticker(props.superstate, pathState?.path, emoji) |
| 35 | } |
| 36 | />, |
| 37 | windowFromDocument(e.view.document) |
| 38 | ); |
| 39 | }, |
| 40 | }); |
| 41 | |
| 42 | menuOptions.push({ |
| 43 | name: i18n.menu.changeColor, |
| 44 | icon: "ui//palette", |
| 45 | onClick: (e) => { |
| 46 | const rect = (e.target as HTMLElement).getBoundingClientRect(); |
| 47 | showColorPickerMenu( |
| 48 | props.superstate, |
| 49 | rect, |
| 50 | windowFromDocument(e.view.document), |
| 51 | color || "", |
| 52 | (newColor) => { |
| 53 | savePathColor(props.superstate, pathState.path, newColor); |
| 54 | } |
| 55 | ); |
| 56 | }, |
| 57 | }); |
| 58 | |
| 59 | menuOptions.push({ |
| 60 | name: i18n.buttons.removeIcon, |
| 61 | icon: "ui//file-minus", |
| 62 | onClick: () => { |
| 63 | removeIconsForPaths(props.superstate, [pathState.path]); |
| 64 | }, |
| 65 | }); |
| 66 | |
| 67 | props.superstate.ui.openMenu( |
| 68 | (e.target as HTMLElement).getBoundingClientRect(), |
| 69 | { |
| 70 | ui: props.superstate.ui, |
| 71 | multi: false, |
| 72 | value: [], |
| 73 | editable: false, |
| 74 | options: menuOptions, |
| 75 | searchable: false, |
| 76 | showAll: true, |
| 77 | }, |
nothing calls this directly
no test coverage detected