Sha256: 35f0cde017d383bf7abe3e3aea668420508c84f83f22aa6ee74162796d9d6a4b

Contents?: true

Size: 588 Bytes

Versions: 15

Compression:

Stored size: 588 Bytes

Contents

(function() {
  const Thredded = window.Thredded;
  Thredded.isSubmitHotkey = (evt) => {
    // Ctrl+Enter.
    return evt.ctrlKey && (evt.keyCode === 13 || evt.keyCode === 10 /* http://crbug.com/79407 */);
  };

  document.addEventListener('keypress', (evt) => {
    if (Thredded.isSubmitHotkey(evt)) {
      const submitButton = document.querySelector('[data-thredded-submit-hotkey] [type="submit"]');
      if (!submitButton) return;
      evt.preventDefault();
      // Focus first for better visual feedback.
      submitButton.focus();
      submitButton.click();
    }
  });
})();

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
thredded-0.16.13 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.12 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.11 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.10 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.9 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.8 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.7 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.6 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.5 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.4 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.3 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.1 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.16.0 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.15.5 app/assets/javascripts/thredded/components/submit_hotkey.es6
thredded-0.15.4 app/assets/javascripts/thredded/components/submit_hotkey.es6