forked from CGM_Public/pretix_original
Widget: fix loading spinner not showing on API-request (#5228)
* Widget: fix loading spinner not showing while API-request * remove not needed showModal as it is handled be frame_loading-watcher * add double check if dialog is open before closing it
This commit is contained in:
committed by
GitHub
parent
d53af424cf
commit
b75f8bf893
@@ -2182,11 +2182,22 @@ var create_overlay = function (app) {
|
|||||||
// show loading spinner only when previously no frame_src was set
|
// show loading spinner only when previously no frame_src was set
|
||||||
if (newValue && !oldValue) {
|
if (newValue && !oldValue) {
|
||||||
this.frame_loading = true;
|
this.frame_loading = true;
|
||||||
this.$el?.querySelector('dialog.pretix-widget-frame-holder').showModal();
|
|
||||||
}
|
}
|
||||||
// to close and unload the iframe, frame_src can be empty -> make it valid HTML with about:blank
|
// to close and unload the iframe, frame_src can be empty -> make it valid HTML with about:blank
|
||||||
this.$el.querySelector("iframe").src = newValue || "about:blank";
|
this.$el.querySelector("iframe").src = newValue || "about:blank";
|
||||||
},
|
},
|
||||||
|
frame_loading: function (newValue) {
|
||||||
|
var dialog = this.$el?.querySelector('dialog.pretix-widget-frame-holder');
|
||||||
|
if (newValue) {
|
||||||
|
if (!dialog.open) {
|
||||||
|
dialog.showModal();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.frame_src && dialog.open) {// finished loading, but no iframe to display => close
|
||||||
|
dialog.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
app.$root.overlay = framechild;
|
app.$root.overlay = framechild;
|
||||||
|
|||||||
Reference in New Issue
Block a user