fix: deal with the modifier key under macOS
This commit is contained in:
parent
8c6f7d6a3f
commit
d00c394a99
4 changed files with 15 additions and 5 deletions
|
@ -392,7 +392,7 @@ U.EditControl = L.Control.extend({
|
|||
'mouseover',
|
||||
function () {
|
||||
map.ui.tooltip({
|
||||
content: `${L._('Switch to edit mode')} (<kbd>Ctrl+E</kbd>)`,
|
||||
content: map.help.displayLabel('TOGGLE_EDIT'),
|
||||
anchor: enableEditing,
|
||||
position: 'bottom',
|
||||
delay: 750,
|
||||
|
|
|
@ -314,6 +314,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) {
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue