mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Saving the node description property to the library
This commit is contained in:
parent
c9ad5bea93
commit
6675fdf3c2
@ -1638,6 +1638,7 @@ RED.editor = (function() {
|
|||||||
};
|
};
|
||||||
editorTabs.addTab(descriptionTab);
|
editorTabs.addTab(descriptionTab);
|
||||||
nodeInfoEditor = buildDescriptionForm(descriptionTab.content,node);
|
nodeInfoEditor = buildDescriptionForm(descriptionTab.content,node);
|
||||||
|
node.nodeInfoEditor = nodeInfoEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
var appearanceTab = {
|
var appearanceTab = {
|
||||||
|
@ -64,12 +64,14 @@ RED.library = (function() {
|
|||||||
|
|
||||||
var queryArgs = [];
|
var queryArgs = [];
|
||||||
var data = {};
|
var data = {};
|
||||||
for (var i=0; i<activeLibrary.fields.length; i++) {
|
for (var i=0; i < activeLibrary.fields.length; i++) {
|
||||||
var field = activeLibrary.fields[i];
|
var field = activeLibrary.fields[i];
|
||||||
if (field == "name") {
|
if (field === "name") {
|
||||||
data.name = name;
|
data.name = name;
|
||||||
|
} else if (field === "info") {
|
||||||
|
data.info = activeLibrary.nodeInfoEditor.getValue().replace(/\n/g, "\\n");
|
||||||
} else {
|
} else {
|
||||||
data[field] = $("#"+elementPrefix+field).val();
|
data[field] = $("#" + elementPrefix + field).val();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.text = activeLibrary.editor.getValue();
|
data.text = activeLibrary.editor.getValue();
|
||||||
@ -518,14 +520,19 @@ RED.library = (function() {
|
|||||||
{
|
{
|
||||||
text: RED._("common.label.load"),
|
text: RED._("common.label.load"),
|
||||||
class: "primary",
|
class: "primary",
|
||||||
click: function() {
|
click: function () {
|
||||||
if (selectedLibraryItem) {
|
if (selectedLibraryItem) {
|
||||||
var elementPrefix = activeLibrary.elementPrefix || "node-input-";
|
var elementPrefix = activeLibrary.elementPrefix || "node-input-";
|
||||||
for (var i=0; i<activeLibrary.fields.length; i++) {
|
for (var i = 0; i < activeLibrary.fields.length; i++) {
|
||||||
var field = activeLibrary.fields[i];
|
var field = activeLibrary.fields[i];
|
||||||
$("#"+elementPrefix+field).val(selectedLibraryItem[field]);
|
if (field === "info") {
|
||||||
|
var nodeInfo = selectedLibraryItem[field].replace(/\\n/g, "\n");
|
||||||
|
activeLibrary.nodeInfoEditor.setValue(nodeInfo, -1);
|
||||||
|
} else {
|
||||||
|
$("#" + elementPrefix + field).val(selectedLibraryItem[field]);
|
||||||
}
|
}
|
||||||
activeLibrary.editor.setValue(libraryEditor.getValue(),-1);
|
}
|
||||||
|
activeLibrary.editor.setValue(libraryEditor.getValue(), -1);
|
||||||
}
|
}
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
RED.library.create({
|
RED.library.create({
|
||||||
url:"functions", // where to get the data from
|
url: "functions", // where to get the data from
|
||||||
type:"function", // the type of object the library is for
|
type: "function", // the type of object the library is for
|
||||||
editor:this.editor, // the field name the main text body goes to
|
editor: this.editor, // the field name the main text body goes to
|
||||||
mode:"ace/mode/nrjavascript",
|
nodeInfoEditor: this.nodeInfoEditor,
|
||||||
fields:['name','outputs'],
|
mode: "ace/mode/nrjavascript",
|
||||||
ext:"js"
|
fields: ['name', 'outputs', 'info'],
|
||||||
|
ext: "js"
|
||||||
});
|
});
|
||||||
this.editor.focus();
|
this.editor.focus();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user