diff --git a/editor/js/nodes.js b/editor/js/nodes.js index 8a6a50c03..7507798b0 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -87,13 +87,8 @@ RED.nodes = (function() { break; } } - for (i=0;i').html('remove').appendTo(buttonGroup); if (!entry.local) { removeButton.hide(); + } else { + removeButton.click(function() { + shade.show(); + removeNodeModule(entry.name, function(xhr) { + console.log(xhr); + }) + }) } var enableButton = $('').html('disable all').appendTo(buttonGroup); var contentRow = $('
',{class:"palette-module-content"}).appendTo(container); + var shade = $('
',{class:"palette-module-shade hide"}).appendTo(container); + $('').appendTo(shade); + object.elements = { removeButton: removeButton, enableButton: enableButton, setCount: setCount, container: container, + shade: shade, sets: {} } setButton.click(function() { @@ -249,7 +289,8 @@ RED.palette.editor = (function() { enableButton.click(function(evt) { if (object.setUseCount[setName] === 0) { var currentSet = RED.nodes.registry.getNodeSet(set.id); - changeNodeState(set.id,!currentSet.enabled,function(xhr){ + shade.show(); + changeNodeState(set.id,!currentSet.enabled,shade,function(xhr){ console.log(xhr) }); } @@ -264,7 +305,7 @@ RED.palette.editor = (function() { }); enableButton.click(function(evt) { if (object.totalUseCount === 0) { - changeNodeState(entry.name,(container.hasClass('disabled')),function(xhr){ + changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){ console.log(xhr) }); } @@ -292,7 +333,14 @@ RED.palette.editor = (function() { refreshNodeModule(ns.module); }); RED.events.on('registry:node-set-removed', function(ns) { - refreshNodeModule(ns.module); + var module = RED.nodes.registry.getModule(ns.module); + if (!module) { + var entry = nodeEntries[ns.module]; + if (entry) { + nodeList.editableList('removeItem', entry); + delete nodeEntries[ns.module]; + } + } }); RED.events.on('nodes:add', function(n) { typesInUse[n.type] = (typesInUse[n.type]||0)+1; diff --git a/editor/sass/palette-editor.scss b/editor/sass/palette-editor.scss index a5e96881f..5e8330c17 100644 --- a/editor/sass/palette-editor.scss +++ b/editor/sass/palette-editor.scss @@ -58,6 +58,15 @@ margin-left: 5px; } } + .palette-module-shade { + position: absolute; + top: 0; + bottom:0; + left:0; + right:0; + background: rgba(255,255,255,0.8); + text-align: center; + } .palette-module-meta { overflow: hidden; color: #666;