Skip to content

Commit

Permalink
Merge pull request #2108 from umap-project/copy-as-geojson
Browse files Browse the repository at this point in the history
feat: add a "Copy as GeoJSON" entry in the contextmenu
  • Loading branch information
yohanboniface committed Sep 5, 2024
2 parents 64d63ff + b8abc03 commit dd79e8f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion umap/static/umap/js/modules/rendering/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,21 @@ const FeatureMixin = {
getContextMenuItems: function (event) {
const permalink = this.feature.getPermalink()
let items = []
if (permalink)
if (permalink) {
items.push({
text: translate('Permalink'),
callback: () => {
window.open(permalink)
},
})
}
items.push({
text: translate('Copy as GeoJSON'),
callback: () => {
L.Util.copyToClipboard(JSON.stringify(this.feature.toGeoJSON()))
this._map.tooltip.open({content: L._('Copied!')})
},
})
if (this._map.editEnabled && !this.feature.isReadOnly()) {
items = items.concat(this.getContextMenuEditItems(event))
}
Expand Down

0 comments on commit dd79e8f

Please sign in to comment.