0482670fec
We don't need the service worker to cache itself, or pages that won't work offline anyway.
22 lines
460 B
JavaScript
22 lines
460 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
import { onNextEventLoopTick } from "helpers/timing_helpers"
|
|
|
|
export default class extends Controller {
|
|
static targets = [ "input" ]
|
|
|
|
submitOnEnter(event) {
|
|
event.preventDefault()
|
|
this.submit()
|
|
}
|
|
|
|
submitOnPaste() {
|
|
onNextEventLoopTick(() => this.submit())
|
|
}
|
|
|
|
submit() {
|
|
if (this.inputTarget.disabled) return
|
|
this.element.requestSubmit()
|
|
this.inputTarget.disabled = true
|
|
}
|
|
}
|