MCPcopy
hub / github.com/callumalpass/tasknotes / ContextMenu

Class ContextMenu

src/components/ContextMenu.ts:3–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import { Menu } from "obsidian";
2
3export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected