Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a "Copy as GeoJSON" entry in the contextmenu #2108

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading