* Handler for contextmenu event * @param {TouchEvent|MouseEvent} e
(e)
| 320 | * @param {TouchEvent|MouseEvent} e |
| 321 | */ |
| 322 | function 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 |
no test coverage detected