mirror of
https://github.com/umap-project/umap.git
synced 2025-04-30 12:12:36 +02:00
Merge pull request #2108 from umap-project/copy-as-geojson
feat: add a "Copy as GeoJSON" entry in the contextmenu
This commit is contained in:
commit
dd79e8f923
1 changed files with 9 additions and 1 deletions
|
@ -93,13 +93,21 @@ const FeatureMixin = {
|
||||||
getContextMenuItems: function (event) {
|
getContextMenuItems: function (event) {
|
||||||
const permalink = this.feature.getPermalink()
|
const permalink = this.feature.getPermalink()
|
||||||
let items = []
|
let items = []
|
||||||
if (permalink)
|
if (permalink) {
|
||||||
items.push({
|
items.push({
|
||||||
text: translate('Permalink'),
|
text: translate('Permalink'),
|
||||||
callback: () => {
|
callback: () => {
|
||||||
window.open(permalink)
|
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()) {
|
if (this._map.editEnabled && !this.feature.isReadOnly()) {
|
||||||
items = items.concat(this.getContextMenuEditItems(event))
|
items = items.concat(this.getContextMenuEditItems(event))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue