MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / oncontextmenu

Function oncontextmenu

src/handlers/quickToolsInit.js:322–349  ·  view source on GitHub ↗

* Handler for contextmenu event * @param {TouchEvent|MouseEvent} e

(e)

Source from the content-addressed store, hash-verified

320 * @param {TouchEvent|MouseEvent} e
321 */
322function oncontextmenu(e) {
323 const $el = e.target;
324 const { lock } = $el.dataset;
325
326 if (lock === "true") {
327 return; // because button with lock=true is locked when clicked so contextmenu doesn't make sense
328 }
329
330 const { editor, activeFile } = editorManager;
331
332 if (isClickMode && appSettings.value.vibrateOnTap) {
333 navigator.vibrate(config.VIBRATION_TIME_LONG);
334 $el.classList.add("active");
335 }
336
337 const dispatchEventWithTimeout = () => {
338 if (time > 50) {
339 time -= 10;
340 }
341 click($el);
342 timeout = setTimeout(dispatchEventWithTimeout, time);
343 };
344
345 if (activeFile.focused) {
346 editor.focus();
347 }
348 dispatchEventWithTimeout();
349}
350
351/**
352 * Executes the action associated with the button

Callers 1

touchstartFunction · 0.85

Calls 3

dispatchEventWithTimeoutFunction · 0.85
addMethod · 0.80
focusMethod · 0.80

Tested by

no test coverage detected