feat: add a quick link to layer's permalink

This will open a new page with only this given layer shown.
This commit is contained in:
Yohan Boniface 2025-02-26 15:38:48 +01:00
parent fc6ea191cc
commit df0faa75aa
2 changed files with 12 additions and 0 deletions

View file

@ -640,6 +640,12 @@ class Feature {
window.open(permalink)
},
})
items.push({
label: translate('Layer permalink'),
action: () => {
window.open(this.datalayer.getPermalink())
},
})
}
items.push({
label: translate('Copy as GeoJSON'),

View file

@ -1174,6 +1174,12 @@ export class DataLayer extends ServerStored {
return this.options.name || translate('Untitled layer')
}
getPermalink() {
return `${Utils.getBaseUrl()}?${Utils.buildQueryString({ datalayers: this.id })}${
window.location.hash
}`
}
tableEdit() {
if (!this.isVisible()) return
const editor = new TableEditor(this._umap, this, this._leafletMap)