mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix handling of spacebar inside JSON visual editor
Fixes #3682 The treeList keyboard handling was consuming the event - used to select the item in the list. The fix here adds a 'selectable' flag on the treeList that can be used to disabled (=false) the keyboard selection of items.
This commit is contained in:
parent
7d7682b34e
commit
e3d6d242ac
@ -21,6 +21,7 @@
|
|||||||
* - multi : boolean - if true, .selected will return an array of results
|
* - multi : boolean - if true, .selected will return an array of results
|
||||||
* otherwise, returns the first selected item
|
* otherwise, returns the first selected item
|
||||||
* - sortable: boolean/string - TODO: see editableList
|
* - sortable: boolean/string - TODO: see editableList
|
||||||
|
* - selectable: boolean - default true - whether individual items can be selected
|
||||||
* - rootSortable: boolean - if 'sortable' is set, then setting this to
|
* - rootSortable: boolean - if 'sortable' is set, then setting this to
|
||||||
* false, prevents items being sorted to the
|
* false, prevents items being sorted to the
|
||||||
* top level of the tree
|
* top level of the tree
|
||||||
@ -118,6 +119,7 @@
|
|||||||
switch(evt.keyCode) {
|
switch(evt.keyCode) {
|
||||||
case 32: // SPACE
|
case 32: // SPACE
|
||||||
case 13: // ENTER
|
case 13: // ENTER
|
||||||
|
if (!that.options.selectable) { return }
|
||||||
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) {
|
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -534,6 +534,7 @@
|
|||||||
var container = $("#red-ui-editor-type-json-tab-ui-container").css({"height":"100%"});
|
var container = $("#red-ui-editor-type-json-tab-ui-container").css({"height":"100%"});
|
||||||
var filterDepth = Infinity;
|
var filterDepth = Infinity;
|
||||||
var list = $('<div class="red-ui-debug-msg-payload red-ui-editor-type-json-editor">').appendTo(container).treeList({
|
var list = $('<div class="red-ui-debug-msg-payload red-ui-editor-type-json-editor">').appendTo(container).treeList({
|
||||||
|
selectable: false,
|
||||||
rootSortable: false,
|
rootSortable: false,
|
||||||
sortable: ".red-ui-editor-type-json-editor-item-handle",
|
sortable: ".red-ui-editor-type-json-editor-item-handle",
|
||||||
}).on("treelistchangeparent", function(event, evt) {
|
}).on("treelistchangeparent", function(event, evt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user