mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Tidy up nls of command prompt and selection handling
This commit is contained in:
		| @@ -710,7 +710,8 @@ | ||||
|     }, | ||||
|     "search": { | ||||
|         "empty": "No matches found", | ||||
|         "addNode": "add a node..." | ||||
|         "addNode": "add a node...", | ||||
|         "actions": "search available actions" | ||||
|     }, | ||||
|     "expressionEditor": { | ||||
|         "functions": "Functions", | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
|         "ctrl-alt-o": "core:open-project", | ||||
|         "ctrl-g v": "core:show-version-control-tab", | ||||
|         "ctrl-shift-l": "core:show-event-log", | ||||
|         "ctrl-shift-p":"core:show-command-prompt" | ||||
|         "alt-shift-p":"core:show-command-prompt" | ||||
|     }, | ||||
|     "red-ui-sidebar-node-config": { | ||||
|         "backspace": "core:delete-config-selection", | ||||
|   | ||||
| @@ -21,7 +21,6 @@ RED.commandPrompt = (function() { | ||||
|     var searchResults; | ||||
|     var selected = -1; | ||||
|     var visible = false; | ||||
|     var activeElement; | ||||
|  | ||||
|     var results = []; | ||||
|  | ||||
| @@ -29,6 +28,8 @@ RED.commandPrompt = (function() { | ||||
|  | ||||
|     function search(val) { | ||||
|         scopes = {}; | ||||
|         results = []; | ||||
|         selected = -1; | ||||
|         val = val ||""; | ||||
|         searchResults.editableList('empty'); | ||||
|  | ||||
| @@ -40,18 +41,6 @@ RED.commandPrompt = (function() { | ||||
|         val = val.trim().toLowerCase(); | ||||
|  | ||||
|         actions.forEach(function(action) { | ||||
|             if (action.scope && action.scope !== "*") { | ||||
|                 if (!scopes.hasOwnProperty(action.scope)) { | ||||
|                     var target = activeElement; | ||||
|                     while (target.nodeName !== 'BODY' && target.id !== action.scope) { | ||||
|                         target = target.parentElement; | ||||
|                     } | ||||
|                     scopes[action.scope] = (target.nodeName !== 'BODY') | ||||
|                 } | ||||
|                 if (!scopes[action.scope]) { | ||||
|                     return; | ||||
|                 } | ||||
|             } | ||||
|             action.label = action.id.replace(/:/,": ").replace(/-/g," ").replace(/(^| )./g,function() { return arguments[0].toUpperCase()}); | ||||
|             if (val !== "" && action.label.toLowerCase().indexOf(val) === -1) { | ||||
|                 return; | ||||
| @@ -59,8 +48,6 @@ RED.commandPrompt = (function() { | ||||
|             results.push(action); | ||||
|             searchResults.editableList('addItem',action) | ||||
|         }) | ||||
|         // searchResults.editableList('addItem',{}); | ||||
|         console.log(document.activeElement); | ||||
|  | ||||
|     } | ||||
|  | ||||
| @@ -83,7 +70,7 @@ RED.commandPrompt = (function() { | ||||
|     function createDialog() { | ||||
|         dialog = $("<div>",{id:"red-ui-commandPrompt",class:"red-ui-search"}).appendTo("#red-ui-main-container"); | ||||
|         var searchDiv = $("<div>",{class:"red-ui-search-container"}).appendTo(dialog); | ||||
|         searchInput = $('<input type="text" data-i18n="[placeholder]menu.label.searchInput">').appendTo(searchDiv).searchBox({ | ||||
|         searchInput = $('<input type="text" data-i18n="[placeholder]search.actions">').appendTo(searchDiv).searchBox({ | ||||
|             delay: 200, | ||||
|             change: function() { | ||||
|                 search($(this).val()); | ||||
| @@ -158,7 +145,6 @@ RED.commandPrompt = (function() { | ||||
|     function selectCommand(command) { | ||||
|         hide(); | ||||
|         RED.actions.invoke(command.id); | ||||
|         console.log(command); | ||||
|     } | ||||
|  | ||||
|     function show(v) { | ||||
| @@ -166,7 +152,6 @@ RED.commandPrompt = (function() { | ||||
|             return; | ||||
|         } | ||||
|         if (!visible) { | ||||
|             activeElement = document.activeElement; | ||||
|             RED.keyboard.add("*","escape",function(){hide()}); | ||||
|             $("#red-ui-header-shade").show(); | ||||
|             $("#red-ui-editor-shade").show(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user