| 1 | import { Menu } from "obsidian"; |
| 2 | |
| 3 | export class ContextMenu extends Menu { |
| 4 | |
| 5 | public show(event: UIEvent) { |
| 6 | // Use cross-window compatible instanceOf checks for pop-out window support |
| 7 | if (event.instanceOf(MouseEvent)) { |
| 8 | this.showAtMouseEvent(event); |
| 9 | } else if (event.instanceOf(KeyboardEvent)) { |
| 10 | const element = event.currentTarget; |
| 11 | if (!element || !(element as Node).instanceOf?.(HTMLElement)) { |
| 12 | return; |
| 13 | } |
| 14 | this.showAtPosition({ |
| 15 | x: (element as HTMLElement).getBoundingClientRect().left, |
| 16 | y: (element as HTMLElement).getBoundingClientRect().bottom + 4, |
| 17 | }); |
| 18 | } |
| 19 | } |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected