src/js/controllers/flatpickr_controller.js in plutonium-0.15.23 vs src/js/controllers/flatpickr_controller.js in plutonium-0.15.24
- old
+ new
@@ -3,14 +3,20 @@
// Connects to data-controller="flatpickr"
export default class extends Controller {
connect() {
console.log(`flatpickr connected: ${this.element}`)
self.picker = new flatpickr(this.element, this.#buildOptions())
+ this.element.setAttribute("data-action", "turbo:morph-element->flatpickr#reconnect")
}
disconnect() {
self.picker.destroy()
self.picker = null
+ }
+
+ reconnect() {
+ this.disconnect()
+ this.connect()
}
#buildOptions() {
let options = { altInput: true }
if (this.element.attributes.type.value == "datetime-local") {