Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(leaflet):opens-attribution-page-in-new-tab

Aswin Asok7d52240dcddb
diff --git a/web/apps/photos/src/components/TripLayout/TripMap.tsx b/web/apps/photos/src/components/TripLayout/TripMap.tsx
index 40958ed093..4279c60241 100644
--- a/web/apps/photos/src/components/TripLayout/TripMap.tsx
+++ b/web/apps/photos/src/components/TripLayout/TripMap.tsx
@@ -112,7 +112,7 @@ export const TripMap: React.FC<TripMapProps> = ({
attribution={
isMobileOrTablet
? ""
- : '&copy; <a href="https://stadiamaps.com/">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/">OpenMapTiles</a> &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors'
+ : '&copy; <a href="https://stadiamaps.com/" target="_blank" rel="noopener noreferrer">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/" target="_blank" rel="noopener noreferrer">OpenMapTiles</a> &copy; <a href="http://openstreetmap.org" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors'
}
url="https://tiles.stadiamaps.com/tiles/alidade_satellite/{z}/{x}/{y}{r}.jpg"
maxZoom={20}
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index ce330b842d..d5de591059 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -957,6 +957,9 @@ const RenameFileDialog: React.FC<RenameFileDialogProps> = ({
const openStreetMapLink = ({ latitude, longitude }: Location) =>
`https://www.openstreetmap.org/?mlat=${latitude}&mlon=${longitude}#map=15/${latitude}/${longitude}`;
+const leafletAttributionPrefix =
+ '<a href="https://leafletjs.com" target="_blank" rel="noopener noreferrer">Leaflet</a>';
+
interface MapBoxProps {
location: Location;
mapEnabled: boolean;
@@ -965,7 +968,7 @@ interface MapBoxProps {
const MapBox: React.FC<MapBoxProps> = ({ location, mapEnabled }) => {
const urlTemplate = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
const attribution =
- '&copy; <a target="_blank" rel="noopener" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
+ '&copy; <a target="_blank" rel="noopener noreferrer" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
const zoom = 16;
const mapBoxContainerRef = useRef<HTMLDivElement>(null);
@@ -990,6 +993,7 @@ const MapBox: React.FC<MapBoxProps> = ({ location, mapEnabled }) => {
if (!mapRef.current) {
// @ts-ignore
const map = leaflet.map(mapContainer).setView(position, zoom);
+ map.attributionControl.setPrefix(leafletAttributionPrefix);
// @ts-ignore
leaflet.tileLayer(urlTemplate, { attribution }).addTo(map);
// @ts-ignore