diff --git a/umap/static/umap/js/modules/browser.js b/umap/static/umap/js/modules/browser.js index 4a20fab1..4509ce58 100644 --- a/umap/static/umap/js/modules/browser.js +++ b/umap/static/umap/js/modules/browser.js @@ -61,7 +61,7 @@ export default class Browser { DomEvent.on(zoom_to, 'click', viewFeature) DomEvent.on(title, 'click', viewFeature) DomEvent.on(edit, 'click', feature.edit, feature) - DomEvent.on(del, 'click', feature.confirmDelete, feature) + DomEvent.on(del, 'click', feature.del, feature) // HOTFIX. Remove when this is released: // https://github.com/Leaflet/Leaflet/pull/9052 DomEvent.disableClickPropagation(row) diff --git a/umap/static/umap/js/modules/data/features.js b/umap/static/umap/js/modules/data/features.js index cd04dba3..38a4c8b0 100644 --- a/umap/static/umap/js/modules/data/features.js +++ b/umap/static/umap/js/modules/data/features.js @@ -278,7 +278,8 @@ class Feature { ${translate('Delete')} `) button.addEventListener('click', () => { - this.confirmDelete().then(() => this._umap.editPanel.close()) + this.del() + this._umap.editPanel.close() }) container.appendChild(button) } @@ -363,17 +364,6 @@ class Feature { return popup.loadContent() } - async confirmDelete() { - const confirmed = await this._umap.dialog.confirm( - translate('Are you sure you want to delete the feature?') - ) - if (confirmed) { - this.del() - return true - } - return false - } - del(sync) { this.isDirty = true this._umap._leafletMap.closePopup() @@ -518,7 +508,7 @@ class Feature { icon: 'icon-edit', }, { - action: () => this.confirmDelete(), + action: () => this.del(), title: translate('Delete this feature'), icon: 'icon-delete', }, @@ -673,7 +663,7 @@ class Feature { }, { label: translate('Delete this feature'), - action: () => this.confirmDelete(), + action: () => this.del(), }, { label: translate('Clone this feature'), diff --git a/umap/tests/integration/test_browser.py b/umap/tests/integration/test_browser.py index cee5b27e..df959ca7 100644 --- a/umap/tests/integration/test_browser.py +++ b/umap/tests/integration/test_browser.py @@ -348,7 +348,6 @@ def test_should_redraw_list_on_feature_delete(live_server, openmap, page, bootst buttons = page.locator(".umap-browser .datalayer li .icon-delete") expect(buttons).to_have_count(3) buttons.first.click() - page.locator("dialog").get_by_role("button", name="OK").click() expect(buttons).to_have_count(2) page.get_by_role("button", name="Undo").click() expect(buttons).to_have_count(3) diff --git a/umap/tests/integration/test_websocket_sync.py b/umap/tests/integration/test_websocket_sync.py index ec50be44..dedd26bf 100644 --- a/umap/tests/integration/test_websocket_sync.py +++ b/umap/tests/integration/test_websocket_sync.py @@ -86,7 +86,6 @@ def test_websocket_connection_can_sync_markers(new_page, asgi_live_server, tilel # Delete a marker from peer A and check it's been deleted on peer B a_first_marker.click(button="right") peerA.get_by_role("button", name="Delete this feature").click() - peerA.locator("dialog").get_by_role("button", name="OK").click() expect(a_marker_pane).to_have_count(1) expect(b_marker_pane).to_have_count(1) @@ -166,7 +165,6 @@ def test_websocket_connection_can_sync_polygons(context, asgi_live_server, tilel # Delete a polygon from peer A and check it's been deleted on peer B a_polygon.click(button="right") peerA.get_by_role("button", name="Delete this feature").click() - peerA.locator("dialog").get_by_role("button", name="OK").click() expect(a_polygons).to_have_count(0) expect(b_polygons).to_have_count(0)