1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

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

View File

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