Sha256: c671f2e8ff8fb15261755e8aa57394d85d2aaa351ab36203a76f3f409bfa897f
Contents?: true
Size: 978 Bytes
Versions: 5
Compression:
Stored size: 978 Bytes
Contents
import { Turbo } from "@hotwired/turbo-rails"; import { Modal } from "./modal"; export class ContentModal extends Modal { constructor(id, src = null) { super(id); if (src) this.src = src; } async dismiss() { await super.dismiss(); if (this.visitStarted) { this.debug("skipping dismiss, visit started"); return; } if (!this.isCurrentLocation) { this.debug("skipping dismiss, not current location"); return; } return this.pop("turbo:load", () => { this.debug("turbo-visit", this.fallbackLocationValue); Turbo.visit(this.fallbackLocationValue); }); // no specific close action required, this is turbo's responsibility } beforeVisit(frame, e) { super.beforeVisit(frame, e); this.visitStarted = true; frame.scrimOutlet.hide({ animate: false }); } get src() { return new URL( this.currentLocationValue.toString(), document.baseURI ).toString(); } }
Version data entries
5 entries across 5 versions & 1 rubygems