How can I remove the "clear all" action from the delete button in the leaflet-draw edit toolbar?
I know you can remove the whole delete button but still need to remove individual items. Basically looking for a way to prevent the user from deleting every item from the map.
The edit toolbar tests the existence of a
removeAllLayers
member on the button handler. So, a simple but probably heavy handed way to disable the clear all action is to nukeremoveAllLayers
on theL.EditToolbar.Delete
module:And a demo