This commit is contained in:
13
app/javascript/controllers/autoselect_controller.js
Normal file
13
app/javascript/controllers/autoselect_controller.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
if (this.autoselect) {
|
||||
this.element.select()
|
||||
}
|
||||
}
|
||||
|
||||
get autoselect() {
|
||||
return this.element.autofocus
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user