Fix iframe preview loading bug in old client library versions
This commit is contained in:
parent
cdd85c4d11
commit
4b4610f581
|
@ -73,7 +73,17 @@
|
||||||
// Initialise the app when mounted
|
// Initialise the app when mounted
|
||||||
iframe.contentWindow.addEventListener(
|
iframe.contentWindow.addEventListener(
|
||||||
"ready",
|
"ready",
|
||||||
() => refreshContent(strippedJson),
|
() => {
|
||||||
|
loading = false
|
||||||
|
refreshContent(strippedJson)
|
||||||
|
},
|
||||||
|
{ once: true }
|
||||||
|
)
|
||||||
|
|
||||||
|
// Use iframe loading event to support old client versions
|
||||||
|
iframe.contentWindow.addEventListener(
|
||||||
|
"iframe-loaded",
|
||||||
|
() => (loading = false),
|
||||||
{ once: true }
|
{ once: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -98,7 +108,7 @@
|
||||||
idToDelete = data.id
|
idToDelete = data.id
|
||||||
confirmDeleteDialog.show()
|
confirmDeleteDialog.show()
|
||||||
} else if (type === "preview-loaded") {
|
} else if (type === "preview-loaded") {
|
||||||
loading = false
|
// loading = false
|
||||||
} else {
|
} else {
|
||||||
console.warning(`Client sent unknown event type: ${type}`)
|
console.warning(`Client sent unknown event type: ${type}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ export default `
|
||||||
if (window.loadBudibase) {
|
if (window.loadBudibase) {
|
||||||
window.loadBudibase()
|
window.loadBudibase()
|
||||||
document.documentElement.classList.add("loaded")
|
document.documentElement.classList.add("loaded")
|
||||||
|
window.dispatchEvent(new Event("iframe-loaded"))
|
||||||
} else {
|
} else {
|
||||||
throw "The client library couldn't be loaded"
|
throw "The client library couldn't be loaded"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue