diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js index 29725636a32..2395e4d7dd8 100644 --- a/django/contrib/gis/static/gis/js/OLMapWidget.js +++ b/django/contrib/gis/static/gis/js/OLMapWidget.js @@ -107,6 +107,13 @@ ol.inherits(GeometryTypeControl, ol.control.Control); if (initial_value && !this.options.is_collection) { this.disableDrawing(); } + const clearNode = document.getElementById(this.map.getTarget()).nextElementSibling; + if (clearNode.classList.contains('clear_features')) { + clearNode.querySelector('a').addEventListener('click', (ev) => { + ev.preventDefault(); + self.clearFeatures(); + }); + } this.ready = true; } diff --git a/django/contrib/gis/templates/gis/openlayers.html b/django/contrib/gis/templates/gis/openlayers.html index 90ecf1b44b7..128654d5aa2 100644 --- a/django/contrib/gis/templates/gis/openlayers.html +++ b/django/contrib/gis/templates/gis/openlayers.html @@ -9,7 +9,7 @@
- {% if not disabled %}{% translate "Delete all Features" %}{% endif %} + {% if not disabled %}{% translate "Delete all Features" %}{% endif %} {% if display_raw %}

{% translate "Debugging window (serialized value)" %}

{% endif %}