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

Function handleClick

src/utils/clickHandlers.ts:105–152  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

103 };
104
105 const handleClick = async (e: MouseEvent) => {
106 const target = e.target as HTMLElement;
107 if (target.closest(clickExcludeSelector)) {
108 return;
109 }
110
111 // Check for selection mode - only shift+click triggers selection
112 const selectionService = plugin.taskSelectionService;
113 if (selectionService) {
114 if (e.shiftKey) {
115 e.stopPropagation();
116
117 // Enter selection mode if not already active
118 if (!selectionService.isSelectionModeActive()) {
119 selectionService.enterSelectionMode();
120 }
121
122 // Toggle selection for this task
123 selectionService.toggleSelection(task.path);
124 return;
125 }
126
127 // Regular click without shift exits selection mode
128 if (selectionService.isSelectionModeActive()) {
129 selectionService.clearSelection();
130 selectionService.exitSelectionMode();
131 }
132 }
133
134 // Stop propagation to prevent clicks from bubbling to parent cards
135 e.stopPropagation();
136
137 if (plugin.settings.doubleClickAction === "none") {
138 await handleSingleClick(e);
139 return;
140 }
141
142 if (clickTimeout) {
143 window.clearTimeout(clickTimeout);
144 clickTimeout = null;
145 await handleDoubleClick(e);
146 } else {
147 clickTimeout = window.setTimeout(() => {
148 clickTimeout = null;
149 void handleSingleClick(e);
150 }, 250);
151 }
152 };
153
154 const clickHandler = (event: MouseEvent) => {
155 void handleClick(event);

Callers 2

clickHandlerFunction · 0.85

Calls 9

handleSingleClickFunction · 0.85
handleDoubleClickFunction · 0.85
isSelectionModeActiveMethod · 0.80
enterSelectionModeMethod · 0.80
toggleSelectionMethod · 0.80
clearSelectionMethod · 0.80
exitSelectionModeMethod · 0.80
clearTimeoutMethod · 0.65
setTimeoutMethod · 0.65

Tested by

no test coverage detected