diff --git a/editor/js/ui/clipboard.js b/editor/js/ui/clipboard.js index 66206fc28..6db81f22e 100644 --- a/editor/js/ui/clipboard.js +++ b/editor/js/ui/clipboard.js @@ -296,8 +296,6 @@ RED.clipboard = (function() { RED.events.on("search:close",function() { disabled = false; }); RED.events.on("type-search:open",function() { disabled = true; }); RED.events.on("type-search:close",function() { disabled = false; }); - RED.events.on("palette-editor:open",function() { disabled = true; }); - RED.events.on("palette-editor:close",function() { disabled = false; }); $('#chart').on("dragenter",function(event) { diff --git a/editor/js/ui/common/searchBox.js b/editor/js/ui/common/searchBox.js index 21932d100..85e5cea87 100644 --- a/editor/js/ui/common/searchBox.js +++ b/editor/js/ui/common/searchBox.js @@ -91,6 +91,9 @@ } else { this.resultCount.text(val).show(); } + }, + change: function() { + this._trigger("change"); } }); })(jQuery); diff --git a/editor/js/ui/keyboard.js b/editor/js/ui/keyboard.js index e7ec433bc..9da7452b1 100644 --- a/editor/js/ui/keyboard.js +++ b/editor/js/ui/keyboard.js @@ -90,7 +90,12 @@ RED.keyboard = (function() { RED.userSettings.add({ id:'keyboard', title: 'Keyboard', - get: getSettingsPane + get: getSettingsPane, + focus: function() { + setTimeout(function() { + $("#user-settings-tab-keyboard-filter").focus(); + },200); + } }) } @@ -463,7 +468,7 @@ RED.keyboard = (function() { var pane = $('
'); $('
'+ - '
'+ + '
'+ '
shortcut
'+ '
scope
'+ '
').appendTo(pane); diff --git a/editor/js/ui/palette-editor.js b/editor/js/ui/palette-editor.js index aecf54184..cd1d06812 100644 --- a/editor/js/ui/palette-editor.js +++ b/editor/js/ui/palette-editor.js @@ -207,10 +207,7 @@ RED.palette.editor = (function() { } } nodeEntries[module].index = index.join(",").toLowerCase(); - nodeList.editableList('addItem', nodeEntries[module]); - //console.log(nodeList.editableList('items')); - } else { var moduleInfo = nodeEntries[module].info; var nodeEntry = nodeEntries[module].elements; @@ -274,7 +271,7 @@ RED.palette.editor = (function() { } else { nodeEntry.enableButton.removeClass('disabled'); if (moduleInfo.local) { - nodeEntry.removeButton.show(); + nodeEntry.removeButton.css('display', 'inline-block'); } if (activeTypeCount === 0) { nodeEntry.enableButton.html(RED._('palette.editor.enableall')); @@ -299,49 +296,6 @@ RED.palette.editor = (function() { } } - } - function showPaletteEditor() { - if (RED.settings.theme('palette.editable') === false) { - return; - } - if (disabled) { - return; - } - - initInstallTab(); - // $("#header-shade").show(); - // $("#editor-shade").show(); - // $("#sidebar-shade").show(); - // $("#sidebar-separator").hide(); - - editorTabs.activateTab('nodes'); - - // $("#main-container").addClass("palette-expanded"); - setTimeout(function() { - editorTabs.resize(); - filterInput.focus(); - },250); - // RED.events.emit("palette-editor:open"); - // RED.keyboard.add("*","escape",function(){hidePaletteEditor()}); - - RED.userSettings.show('palette'); - - } - function hidePaletteEditor() { - RED.keyboard.remove("escape"); - $("#main-container").removeClass("palette-expanded"); - $("#header-shade").hide(); - $("#editor-shade").hide(); - $("#sidebar-shade").hide(); - $("#sidebar-separator").show(); - $("#palette-editor").find('.expanded').each(function(i,el) { - $(el).find(".palette-module-content").slideUp(); - $(el).removeClass('expanded'); - }); - filterInput.searchBox('value',""); - searchInput.searchBox('value',""); - RED.events.emit("palette-editor:close"); - } function filterChange(val) { @@ -406,6 +360,7 @@ RED.palette.editor = (function() { loadedList = []; loadedIndex = {}; packageList.editableList('empty'); + $(".palette-module-shade-status").html(RED._('palette.editor.loading')); var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json']; catalogueLoadStatus = []; @@ -416,12 +371,18 @@ RED.palette.editor = (function() { } $("#palette-module-install-shade").show(); catalogueLoadStart = Date.now(); + var handled = 0; catalogues.forEach(function(catalog,index) { $.getJSON(catalog, {_: new Date().getTime()},function(v) { handleCatalogResponse(null,catalog,index,v); refreshNodeModuleList(); }).fail(function(jqxhr, textStatus, error) { handleCatalogResponse(jqxhr,catalog,index); + }).always(function() { + handled++; + if (handled === catalogueCount) { + searchInput.searchBox('change'); + } }) }); } @@ -429,6 +390,11 @@ RED.palette.editor = (function() { function refreshFilteredItems() { packageList.editableList('empty'); + var currentFilter = searchInput.searchBox('value').trim(); + if (currentFilter === ""){ + packageList.editableList('addItem',{count:loadedList.length}) + return; + } filteredList.sort(activeSort); for (var i=0;i'); var content = $('
'+ @@ -625,6 +598,7 @@ RED.palette.editor = (function() { var buttonGroup = $('
',{class:"palette-module-button-group"}).appendTo(buttonRow); var updateButton = $('').html(RED._('palette.editor.update')).appendTo(buttonGroup); + updateButton.attr('id','up_'+Math.floor(Math.random()*1000000000)); updateButton.click(function(evt) { evt.preventDefault(); if ($(this).hasClass('disabled')) { @@ -652,6 +626,7 @@ RED.palette.editor = (function() { var removeButton = $('').html(RED._('palette.editor.remove')).appendTo(buttonGroup); + removeButton.attr('id','up_'+Math.floor(Math.random()*1000000000)); removeButton.click(function(evt) { evt.preventDefault(); @@ -760,7 +735,7 @@ RED.palette.editor = (function() { .searchBox({ delay: 300, change: function() { - var searchTerm = $(this).val().toLowerCase(); + var searchTerm = $(this).val().trim().toLowerCase(); if (searchTerm.length > 0) { filteredList = loadedList.filter(function(m) { return (m.index.indexOf(searchTerm) > -1); @@ -770,6 +745,8 @@ RED.palette.editor = (function() { } else { searchInput.searchBox('count',loadedList.length); packageList.editableList('empty'); + packageList.editableList('addItem',{count:loadedList.length}); + } } }); @@ -816,7 +793,10 @@ RED.palette.editor = (function() { addButton: false, scrollOnAdd: false, addItem: function(container,i,object) { - + if (object.count) { + $('
',{class:"red-ui-search-empty"}).html(RED._('palette.editor.moduleCount',{count:object.count})).appendTo(container); + return + } if (object.more) { container.addClass('palette-module-more'); var moreRow = $('
',{class:"palette-module-header palette-module"}).appendTo(container); @@ -962,7 +942,6 @@ RED.palette.editor = (function() { } return { - init: init, - show: showPaletteEditor + init: init } })(); diff --git a/editor/js/ui/search.js b/editor/js/ui/search.js index 693154436..df36f7f5d 100644 --- a/editor/js/ui/search.js +++ b/editor/js/ui/search.js @@ -265,8 +265,6 @@ RED.search = (function() { RED.events.on("editor:open",function() { disabled = true; }); RED.events.on("editor:close",function() { disabled = false; }); - RED.events.on("palette-editor:open",function() { disabled = true; }); - RED.events.on("palette-editor:close",function() { disabled = false; }); RED.events.on("type-search:open",function() { disabled = true; }); RED.events.on("type-search:close",function() { disabled = false; }); diff --git a/editor/js/ui/userSettings.js b/editor/js/ui/userSettings.js index f36102f69..cd70e57e2 100644 --- a/editor/js/ui/userSettings.js +++ b/editor/js/ui/userSettings.js @@ -60,6 +60,9 @@ RED.userSettings = (function() { setTimeout(function() { $("#user-settings-tabs-content").children().hide(); $("#" + tab.id).show(); + if (tab.pane.focus) { + tab.pane.focus(); + } },50); } }); @@ -68,12 +71,14 @@ RED.userSettings = (function() { panes.forEach(function(pane) { settingsTabs.addTab({ id: "user-settings-tab-"+pane.id, - label: pane.title + label: pane.title, + pane: pane }); pane.get().hide().appendTo(tabContents); }); settingsContent.i18n(); settingsTabs.activateTab("user-settings-tab-"+(initialTab||'view')) + $("#sidebar-shade").show(); }, close: function() { settingsVisible = false; @@ -82,6 +87,8 @@ RED.userSettings = (function() { pane.close(); } }); + $("#sidebar-shade").hide(); + }, show: function() {} } diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json index c572ed4b0..ffbdb9407 100644 --- a/red/api/locales/en-US/editor.json +++ b/red/api/locales/en-US/editor.json @@ -293,6 +293,8 @@ }, "nodeCount": "__label__ node", "nodeCount_plural": "__label__ nodes", + "moduleCount": "__count__ module available", + "moduleCount_plural": "__count__ modules available", "inuse": "in use", "enableall": "enable all", "disableall": "disable all",