mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-22 11:23:02 +00:00
1b7731e506
* add destroy hook * refresh details modal in interval * refactor to refresh assets list * disable create snapshot button when there is a pending snapshot
23 lines
678 B
JavaScript
23 lines
678 B
JavaScript
import { Behavior, registerBehavior } from "./index";
|
|
|
|
class ModalBehavior extends Behavior {
|
|
constructor(element) {
|
|
super(element);
|
|
|
|
const modalOverlay = element.querySelector(".modal-overlay");
|
|
const closeButton = element.querySelector("button.close");
|
|
modalOverlay.addEventListener("click", this.onClose.bind(this));
|
|
closeButton.addEventListener("click", this.onClose.bind(this));
|
|
}
|
|
|
|
onClose() {
|
|
this.element.classList.add("closing");
|
|
this.element.addEventListener("animationend", (event) => {
|
|
if (event.animationName === "fade-out") {
|
|
this.element.remove();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
registerBehavior("ld-modal", ModalBehavior);
|