mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
refactor node.libs to a function getLibsList
- preparation for monaco integration
This commit is contained in:
parent
1f7884dc70
commit
5bba50f01f
@ -312,6 +312,30 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getLibsList() {
|
||||
var _libs = [];
|
||||
if (RED.settings.functionExternalModules === true) {
|
||||
var libs = $("#node-input-libs-container").editableList("items");
|
||||
libs.each(function(i) {
|
||||
var item = $(this);
|
||||
var v = item.find(".node-input-libs-var").val();
|
||||
var n = item.find(".node-input-libs-val").typedInput("type");
|
||||
if (n === "_custom_") {
|
||||
n = item.find(".node-input-libs-val").val();
|
||||
}
|
||||
if ((!v || (v === "")) ||
|
||||
(!n || (n === ""))) {
|
||||
return;
|
||||
}
|
||||
_libs.push({
|
||||
var: v,
|
||||
module: n
|
||||
});
|
||||
});
|
||||
}
|
||||
return _libs;
|
||||
}
|
||||
|
||||
RED.nodes.registerType('function',{
|
||||
color:"#fdd0a2",
|
||||
@ -523,28 +547,7 @@
|
||||
|
||||
$("#node-input-noerr").val(noerr);
|
||||
this.noerr = noerr;
|
||||
if (RED.settings.functionExternalModules === true) {
|
||||
var libs = $("#node-input-libs-container").editableList("items");
|
||||
node.libs = [];
|
||||
libs.each(function(i) {
|
||||
var item = $(this);
|
||||
var v = item.find(".node-input-libs-var").val();
|
||||
var n = item.find(".node-input-libs-val").typedInput("type");
|
||||
if (n === "_custom_") {
|
||||
n = item.find(".node-input-libs-val").val();
|
||||
}
|
||||
if ((!v || (v === "")) ||
|
||||
(!n || (n === ""))) {
|
||||
return;
|
||||
}
|
||||
node.libs.push({
|
||||
var: v,
|
||||
module: n
|
||||
});
|
||||
});
|
||||
} else {
|
||||
node.libs = [];
|
||||
}
|
||||
node.libs = getLibsList();
|
||||
},
|
||||
oneditcancel: function() {
|
||||
var node = this;
|
||||
|
Loading…
Reference in New Issue
Block a user