Esri / esri-leaflet

A lightweight set of tools for working with ArcGIS services in Leaflet. :rocket:
https://developers.arcgis.com/esri-leaflet/
Apache License 2.0
1.61k stars 799 forks source link

Esri attribution removes custom Leaflet prefix #1361

Closed markconnellypro closed 1 year ago

markconnellypro commented 1 year ago

Describe the bug

When Esri Leaflet adds Powered by Esri to the attribution, it overwrites the preexisting attribution prefix.

I submitted pull request #1360 to address this. This pull request changes this process to retrieve the existing attribution prefix first, so that it can be used in lieu of the constant when overwriting and so that it can be restored in the event that all Esri layers are moved from the map display.

Reproduction

In this sample, the state layer hosted by Esri is loaded on page load, and the custom prefix is not included at all, despite being included in the code:

https://output.jsbin.com/habugazata/1/

In this sample, the custom prefix is displayed when the page is loaded, but is overwritten when the state layer hosted by Esri is loaded, and is not restored if removed:

https://output.jsbin.com/habugazata/2/

Logs

No response

System Info

Leaflet: 1.9.3
Esri Leaflet: 3.0.10

Additional Information

No response