PageSourceSearch

https://railsblocks.com/assets/controllers/hotkey_controller-49067…db16cbd3023b5c9d88a279134af3cbe119992ddd.js

js railsblocks.com collected 2026-09-25 20:23:27 UTC 972 bytes, 30 lines download raw bytes

1import { Controller } from "@hotwired/stimulus";
2
3export default class extends Controller {
4  static values = {
5    allowWhileTyping: { type: Boolean, default: false },
6  };
7
8  click(event) {
9    this.#isClickable && !this.#shouldIgnore(event) && this.element.click();
10  }
11
12  #shouldIgnore(event) {
13    // Always respect events that have already been handled
14    if (event.defaultPrevented) return true;
15
16    // If explicitly allowed, do not ignore while typing/focused in inputs
17    if (this.hasAllowWhileTypingValue && this.allowWhileTypingValue === true) return false;
18
19    const targetElement =
20      event.target instanceof Element ? event.target : event.target instanceof Node ? event.target.parentElement : null;
21
22    if (!targetElement) return false;
23
24    return !!targetElement.closest("input, textarea, [contenteditable], lexxy-editor, lexxy-link-dropdown");
25  }
26
27  get #isClickable() {
28    return getComputedStyle(this.element).pointerEvents !== "none";
29  }
30};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.