Sha256: 7f84731a589ce5bece6ef8fceb86b2492a6e8395ad95c944ee2a975701c38efc
Contents?: true
Size: 846 Bytes
Versions: 33
Compression:
Stored size: 846 Bytes
Contents
import { Controller } from '@hotwired/stimulus' // References: // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API export default class extends Controller { static get targets () { return ['input'] } connect () { // Drag this.inputTarget.addEventListener('dragover', (event) => { this.element.classList.add('focus') }) this.inputTarget.addEventListener('dragleave', (event) => { this.element.classList.remove('focus') }) this.inputTarget.addEventListener('drop', (event) => { this.element.classList.remove('focus') }) // Focus this.inputTarget.addEventListener('focusin', (event) => { this.element.classList.add('focus') }) this.inputTarget.addEventListener('focusout', (event) => { this.element.classList.remove('focus') }) } }
Version data entries
33 entries across 33 versions & 2 rubygems