diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 2b349c7e..8bee0ff9 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -392,7 +392,7 @@ U.EditControl = L.Control.extend({ 'mouseover', function () { map.ui.tooltip({ - content: `${L._('Switch to edit mode')} (Ctrl+E)`, + content: map.help.displayLabel('TOGGLE_EDIT'), anchor: enableEditing, position: 'bottom', delay: 750, diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index ecf6c077..79c4021d 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -321,6 +321,14 @@ U.Help = L.Class.extend({ shortcut: 'Modifier+S', label: L._('Save current edits'), }, + EDIT_FEATURE_LAYER: { + shortcut: 'Modifier+⇧+Click', + label: L._("Edit feature's layer"), + }, + CONTINUE_LINE: { + shortcut: 'Modifier+Click', + label: L._('Continue line'), + }, }, displayLabel: function (action, withKbdTag = true) { diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index d9fbf737..5d4b0d86 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -448,7 +448,7 @@ U.FeatureMixin = { } items = items.concat( { - text: L._("Edit feature's layer") + ' (Ctrl+⇧+Click)', + text: this.map.help.displayLabel('EDIT_FEATURE_LAYER'), callback: this.datalayer.edit, context: this.datalayer, iconCls: 'umap-edit', @@ -1055,7 +1055,7 @@ U.Polyline = L.Polyline.extend({ }) } else if (index === 0 || index === e.vertex.getLastIndex()) { items.push({ - text: L._('Continue line (Ctrl+Click)'), + text: this.map.help.displayLabel('CONTINUE_LINE'), callback: e.vertex.continue, context: e.vertex.continue, }) diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index 6320965c..c67d5f07 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -1,4 +1,5 @@ import json +import platform import re from pathlib import Path from time import sleep @@ -13,7 +14,8 @@ pytestmark = pytest.mark.django_db def test_layers_list_is_updated(live_server, tilelayer, page): page.goto(f"{live_server.url}/map/new/") - page.get_by_role("link", name="Import data (Ctrl+I)").click() + modifier = "Cmd" if platform.system() == "Darwin" else "Ctrl" + page.get_by_role("link", name=f"Import data ({modifier}+I)").click() # Should work page.get_by_label("Choose the layer to import").select_option( label="Import in a new layer" @@ -22,7 +24,7 @@ def test_layers_list_is_updated(live_server, tilelayer, page): page.get_by_role("button", name="Add a layer").click() page.locator('input[name="name"]').click() page.locator('input[name="name"]').fill("foobar") - page.get_by_role("link", name="Import data (Ctrl+I)").click() + page.get_by_role("link", name=f"Import data ({modifier}+I)").click() # Should still work page.get_by_label("Choose the layer to import").select_option( label="Import in a new layer"