From bd391963bce05b17a723849989318fc5a327aa77 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 20 Oct 2016 14:01:37 +0100 Subject: [PATCH] Add Crtl/Shift/p shortcut for manage palette --- editor/js/ui/keyboard.js | 1 + editor/js/ui/palette-editor.js | 15 ++++++++++++++- editor/js/ui/search.js | 2 ++ red/api/locales/en-US/editor.json | 3 ++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/editor/js/ui/keyboard.js b/editor/js/ui/keyboard.js index 07ff5790e..49f660edf 100644 --- a/editor/js/ui/keyboard.js +++ b/editor/js/ui/keyboard.js @@ -125,6 +125,7 @@ RED.keyboard = (function() { ''+ ''+ ''+ + ''+ ''+ ''+ ''+ diff --git a/editor/js/ui/palette-editor.js b/editor/js/ui/palette-editor.js index 3390e5b8e..e18fc6785 100644 --- a/editor/js/ui/palette-editor.js +++ b/editor/js/ui/palette-editor.js @@ -15,6 +15,8 @@ **/ RED.palette.editor = (function() { + var disabled = false; + var editorTabs; var filterInput; var searchInput; @@ -259,6 +261,11 @@ RED.palette.editor = (function() { if (RED.settings.theme('palette.editable') === false) { return; } + if (disabled) { + return; + } + + initInstallTab(); $("#header-shade").show(); $("#editor-shade").show(); $("#sidebar-shade").show(); @@ -379,6 +386,13 @@ RED.palette.editor = (function() { 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({ id:"palette-editor-tabs", onchange:function(tab) { @@ -391,7 +405,6 @@ RED.palette.editor = (function() { searchInput.searchBox('value',""); } if (tab.id === 'install') { - initInstallTab(); if (searchInput) { searchInput.focus(); } diff --git a/editor/js/ui/search.js b/editor/js/ui/search.js index 9804418fb..75a649b60 100644 --- a/editor/js/ui/search.js +++ b/editor/js/ui/search.js @@ -250,6 +250,7 @@ RED.search = (function() { createDialog(); } dialog.slideDown(); + RED.events.emit("search:open"); visible = true; } searchInput.focus(); @@ -268,6 +269,7 @@ RED.search = (function() { searchInput.searchBox('value',''); }); } + RED.events.emit("search:close"); } } diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json index df7bebf85..ab3cf05cd 100644 --- a/red/api/locales/en-US/editor.json +++ b/red/api/locales/en-US/editor.json @@ -178,7 +178,8 @@ "cutNode": "Cut selected nodes", "pasteNode": "Paste nodes", "undoChange": "Undo the last change performed", - "searchBox": "Open search box" + "searchBox": "Open search box", + "managePalette": "Manage palette" }, "library": { "openLibrary": "Open Library...",
Ctrl/⌘ + Space'+RED._("keyboard.toggleSidebar")+'
Ctrl/⌘ + .'+RED._("keyboard.searchBox")+'
Ctrl/⌘ + Shift + p'+RED._("keyboard.managePalette")+'
Delete'+RED._("keyboard.deleteSelected")+'
Backspace