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

Function createTaskCardContextMenuButton

src/ui/taskCardContextMenu.ts:34–61  ·  view source on GitHub ↗
(
	options: TaskCardContextMenuButtonOptions
)

Source from the content-addressed store, hash-verified

32}
33
34export function createTaskCardContextMenuButton(
35 options: TaskCardContextMenuButtonOptions
36): HTMLElement {
37 const { mainRow, taskPath, plugin, targetDate, promoteOccurrenceControls } = options;
38 const taskOptionsLabel = tTaskCard(plugin, "taskOptions");
39 const contextIcon = mainRow.createEl("div", {
40 cls: "task-card__context-menu",
41 attr: {
42 "aria-label": taskOptionsLabel,
43 },
44 });
45
46 setIcon(contextIcon, "ellipsis-vertical");
47 setTooltip(contextIcon, taskOptionsLabel, { placement: "top" });
48 prepareInteractiveControl(contextIcon);
49
50 contextIcon.addEventListener("click", (e) => {
51 e.stopPropagation();
52 e.preventDefault();
53 if (promoteOccurrenceControls === undefined) {
54 void showTaskContextMenu(e, taskPath, plugin, targetDate);
55 return;
56 }
57 void showTaskContextMenu(e, taskPath, plugin, targetDate, { promoteOccurrenceControls });
58 });
59
60 return contextIcon;
61}
62
63/**
64 * Show context menu for task card.

Callers 2

createTaskCardFunction · 0.90

Calls 5

setIconFunction · 0.90
setTooltipFunction · 0.90
showTaskContextMenuFunction · 0.85
tTaskCardFunction · 0.70

Tested by

no test coverage detected