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

Add Crtl/Shift/p shortcut for manage palette

This commit is contained in:
Nick O'Leary 2016-10-20 14:01:37 +01:00
parent 97fa28fb10
commit bd391963bc
4 changed files with 19 additions and 2 deletions

View File

@ -125,6 +125,7 @@ RED.keyboard = (function() {
'<table class="keyboard-shortcuts">'+ '<table class="keyboard-shortcuts">'+
'<tr><td><span class="help-key">Ctrl/&#8984;</span> + <span class="help-key">Space</span></td><td>'+RED._("keyboard.toggleSidebar")+'</td></tr>'+ '<tr><td><span class="help-key">Ctrl/&#8984;</span> + <span class="help-key">Space</span></td><td>'+RED._("keyboard.toggleSidebar")+'</td></tr>'+
'<tr><td><span class="help-key">Ctrl/&#8984;</span> + <span class="help-key">.</span></td><td>'+RED._("keyboard.searchBox")+'</td></tr>'+ '<tr><td><span class="help-key">Ctrl/&#8984;</span> + <span class="help-key">.</span></td><td>'+RED._("keyboard.searchBox")+'</td></tr>'+
'<tr><td><span class="help-key">Ctrl/&#8984;</span> + <span class="help-key">Shift</span> + <span class="help-key">p</span></td><td>'+RED._("keyboard.managePalette")+'</td></tr>'+
'<tr><td></td><td></td></tr>'+ '<tr><td></td><td></td></tr>'+
'<tr><td><span class="help-key">Delete</span></td><td rowspan="2">'+RED._("keyboard.deleteSelected")+'</td></tr>'+ '<tr><td><span class="help-key">Delete</span></td><td rowspan="2">'+RED._("keyboard.deleteSelected")+'</td></tr>'+
'<tr><td><span class="help-key">Backspace</span></td></tr>'+ '<tr><td><span class="help-key">Backspace</span></td></tr>'+

View File

@ -15,6 +15,8 @@
**/ **/
RED.palette.editor = (function() { RED.palette.editor = (function() {
var disabled = false;
var editorTabs; var editorTabs;
var filterInput; var filterInput;
var searchInput; var searchInput;
@ -259,6 +261,11 @@ RED.palette.editor = (function() {
if (RED.settings.theme('palette.editable') === false) { if (RED.settings.theme('palette.editable') === false) {
return; return;
} }
if (disabled) {
return;
}
initInstallTab();
$("#header-shade").show(); $("#header-shade").show();
$("#editor-shade").show(); $("#editor-shade").show();
$("#sidebar-shade").show(); $("#sidebar-shade").show();
@ -379,6 +386,13 @@ RED.palette.editor = (function() {
return; return;
} }
RED.events.on("editor:open",function() { disabled = true; });
RED.events.on("editor:close",function() { disabled = false; });
RED.events.on("search:open",function() { disabled = true; });
RED.events.on("search:close",function() { disabled = false; });
RED.keyboard.add("*", /* p */ 80,{shift:true,ctrl:true},function() {RED.palette.editor.show();d3.event.preventDefault();});
editorTabs = RED.tabs.create({ editorTabs = RED.tabs.create({
id:"palette-editor-tabs", id:"palette-editor-tabs",
onchange:function(tab) { onchange:function(tab) {
@ -391,7 +405,6 @@ RED.palette.editor = (function() {
searchInput.searchBox('value',""); searchInput.searchBox('value',"");
} }
if (tab.id === 'install') { if (tab.id === 'install') {
initInstallTab();
if (searchInput) { if (searchInput) {
searchInput.focus(); searchInput.focus();
} }

View File

@ -250,6 +250,7 @@ RED.search = (function() {
createDialog(); createDialog();
} }
dialog.slideDown(); dialog.slideDown();
RED.events.emit("search:open");
visible = true; visible = true;
} }
searchInput.focus(); searchInput.focus();
@ -268,6 +269,7 @@ RED.search = (function() {
searchInput.searchBox('value',''); searchInput.searchBox('value','');
}); });
} }
RED.events.emit("search:close");
} }
} }

View File

@ -178,7 +178,8 @@
"cutNode": "Cut selected nodes", "cutNode": "Cut selected nodes",
"pasteNode": "Paste nodes", "pasteNode": "Paste nodes",
"undoChange": "Undo the last change performed", "undoChange": "Undo the last change performed",
"searchBox": "Open search box" "searchBox": "Open search box",
"managePalette": "Manage palette"
}, },
"library": { "library": {
"openLibrary": "Open Library...", "openLibrary": "Open Library...",