fixup: allow to display asynchronous content in the panel too

This commit is contained in:
Yohan Boniface 2024-12-13 15:28:07 +01:00
parent 8a929d2352
commit b7173d4629
2 changed files with 8 additions and 6 deletions

View file

@ -199,8 +199,9 @@ class Feature {
this._umap.slideshow.current = this
}
this._umap.currentFeature = this
this.attachPopup()
this.attachPopup().then(() => {
this.ui.openPopup(latlng || this.center)
})
}
render(fields) {
@ -355,9 +356,11 @@ class Feature {
return loadPopup(this.getOption('popupShape') || old)
}
attachPopup() {
async attachPopup() {
const Class = this.getPopupClass()
this.ui.bindPopup(new Class(this))
const popup = new Class(this)
this.ui.bindPopup(popup)
return popup.loadContent()
}
async confirmDelete() {

View file

@ -22,10 +22,9 @@ const Popup = BasePopup.extend({
initialize: function (feature) {
this.feature = feature
BasePopup.prototype.initialize.call(this, {}, feature.ui)
this.getContentFromTemplate()
},
getContentFromTemplate: async function () {
loadContent: async function () {
const container = DomUtil.create('div', 'umap-popup')
const name = this.feature.getOption('popupTemplate')
this.content = await loadTemplate(name, this.feature, container)