Include unassigned keys to shortcut dialog

This commit is contained in:
Nick O'Leary 2017-01-11 11:41:25 +00:00
parent b1684e82d8
commit 3cd53f617a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 18 additions and 7 deletions

View File

@ -272,9 +272,14 @@ RED.keyboard = (function() {
scrollOnAdd: false,
addItem: function(container,i,object) {
var item = $('<div class="keyboard-shortcut-entry">').appendTo(container);
var key = $('<div class="keyboard-shortcut-entry-key">').appendTo(item);
key.append(formatKey(object.key));
if (object.key) {
key.append(formatKey(object.key));
} else {
item.addClass("keyboard-shortcut-entry-unassigned");
key.html(RED._('keyboard.unassigned'));
}
var text = object.id.replace(/(^.+:([a-z]))|(-([a-z]))/g,function(_,_,A,_,B,pos) {
if (pos === 0) {
@ -284,8 +289,9 @@ RED.keyboard = (function() {
}
});
var label = $('<div>').html(text).appendTo(item);
var scope = $('<div class="keyboard-shortcut-entry-scope">').html(object.scope).appendTo(item);
if (object.scope) {
$('<div class="keyboard-shortcut-entry-scope">').html(object.scope).appendTo(item);
}
},
@ -295,9 +301,7 @@ RED.keyboard = (function() {
return A.id.localeCompare(B.id);
});
shortcuts.forEach(function(s) {
if (s.key) {
shortcutList.editableList('addItem',s);
}
shortcutList.editableList('addItem',s);
})
shortcutDialog.dialog({

View File

@ -37,6 +37,12 @@
float: right;
color: #999;
}
.keyboard-shortcut-entry-unassigned {
color: #999;
.keyboard-shortcut-entry-key {
font-style: italic;
}
}
.help-key {
border: 1px solid #ddd;

View File

@ -189,6 +189,7 @@
},
"keyboard": {
"title": "Keyboard Shortcuts",
"unassigned": "Unassigned",
"selectAll": "Select all nodes",
"selectAllConnected": "Select all connected nodes",
"addRemoveNode": "Add/remove node from selection",