From 00c6c745f4fb54b354f1b2c2f50d2231e7ad41ac Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 10 Dec 2024 00:44:58 +0300 Subject: [PATCH] Add 'canEmbed' layer option --- app/assets/javascripts/leaflet.share.js | 2 +- config/layers.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/leaflet.share.js b/app/assets/javascripts/leaflet.share.js index 40ba020e6c..647d6c11f7 100644 --- a/app/assets/javascripts/leaflet.share.js +++ b/app/assets/javascripts/leaflet.share.js @@ -337,7 +337,7 @@ L.OSM.share = function (options) { } function update() { - var canEmbed = map.getMapBaseLayerId() !== "tracestracktopo"; + var canEmbed = map.getMapBaseLayer()?.options?.canEmbed; var bounds = map.getBounds(); $("#link_marker") diff --git a/config/layers.yml b/config/layers.yml index 3b5bc944fe..ea9a62a4cd 100644 --- a/config/layers.yml +++ b/config/layers.yml @@ -2,6 +2,7 @@ code: "M" keyId: "mapnik" nameId: "standard" + canEmbed: true credit: id: "make_a_donation" href: "https://supporting.openstreetmap.org" @@ -11,6 +12,7 @@ code: "Y" keyId: "cyclosm" nameId: "cyclosm" + canEmbed: true credit: id: "cyclosm_credit" children: @@ -26,6 +28,7 @@ keyId: "cyclemap" nameId: "cycle_map" apiKeyId: "THUNDERFOREST_KEY" + canEmbed: true credit: id: "thunderforest_credit" children: @@ -38,6 +41,7 @@ keyId: "transportmap" nameId: "transport_map" apiKeyId: "THUNDERFOREST_KEY" + canEmbed: true credit: id: "thunderforest_credit" children: @@ -61,6 +65,7 @@ code: "H" keyId: "hot" nameId: "hot" + canEmbed: true credit: id: "hotosm_credit" children: