Fix color dialog behavior
This commit is contained in:
@@ -2,9 +2,26 @@ import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "dialog" ]
|
||||
static values = {
|
||||
modal: { type: Boolean, default: false }
|
||||
}
|
||||
|
||||
open() {
|
||||
this.dialogTarget.showModal()
|
||||
const modal = this.modalValue
|
||||
|
||||
if (modal) {
|
||||
this.dialogTarget.showModal()
|
||||
} else {
|
||||
this.dialogTarget.show()
|
||||
}
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if (this.dialogTarget.open) {
|
||||
this.close()
|
||||
} else {
|
||||
this.open()
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
Reference in New Issue
Block a user