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

Merge pull request #3661 from Steve-Mcl/backport-3633

fix new folder menu of save to library dialog (backport #3633 to v2.x)
This commit is contained in:
Nick O'Leary 2022-06-16 11:14:43 +01:00 committed by GitHub
commit ea303495b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,14 +363,22 @@ RED.library = (function() {
options.onconfirm(item);
}
});
var itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
var itemTools = null;
if (options.folderTools) {
dirList.on('treelistselect', function(event, item) {
if (item.writable !== false && item.treeList) {
if (itemTools) {
itemTools.remove();
}
itemTools = $("<div>").css({position: "absolute",bottom:"6px",right:"8px"});
var menuButton = $('<button class="red-ui-button red-ui-button-small" type="button"><i class="fa fa-ellipsis-h"></i></button>')
.on("click", function(evt) {
evt.preventDefault();
evt.stopPropagation();
var elementPos = menuButton.offset();
var menuOptionMenu = RED.menu.init({id:"red-ui-library-browser-menu",
var menuOptionMenu
= RED.menu.init({id:"red-ui-library-browser-menu",
options: [
{id:"red-ui-library-browser-menu-addFolder",label:RED._("library.newFolder"), onselect: function() {
var defaultFolderName = "new-folder";
@ -460,9 +468,7 @@ RED.library = (function() {
}).show();
}).appendTo(itemTools);
if (options.folderTools) {
dirList.on('treelistselect', function(event, item) {
if (item.writable !== false && item.treeList) {
itemTools.appendTo(item.treeList.label);
}
});