1
0
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:
Kazuhito Yokoi 2020-03-02 05:50:32 +00:00
parent c9ad5bea93
commit 6675fdf3c2
3 changed files with 22 additions and 13 deletions

View File

@ -1638,6 +1638,7 @@ RED.editor = (function() {
};
editorTabs.addTab(descriptionTab);
nodeInfoEditor = buildDescriptionForm(descriptionTab.content,node);
node.nodeInfoEditor = nodeInfoEditor;
}
var appearanceTab = {

View File

@ -66,8 +66,10 @@ RED.library = (function() {
var data = {};
for (var i=0; i < activeLibrary.fields.length; i++) {
var field = activeLibrary.fields[i];
if (field == "name") {
if (field === "name") {
data.name = name;
} else if (field === "info") {
data.info = activeLibrary.nodeInfoEditor.getValue().replace(/\n/g, "\\n");
} else {
data[field] = $("#" + elementPrefix + field).val();
}
@ -523,8 +525,13 @@ RED.library = (function() {
var elementPrefix = activeLibrary.elementPrefix || "node-input-";
for (var i = 0; i < activeLibrary.fields.length; i++) {
var field = activeLibrary.fields[i];
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);
}
$( this ).dialog( "close" );

View File

@ -74,8 +74,9 @@
url: "functions", // where to get the data from
type: "function", // the type of object the library is for
editor: this.editor, // the field name the main text body goes to
nodeInfoEditor: this.nodeInfoEditor,
mode: "ace/mode/nrjavascript",
fields:['name','outputs'],
fields: ['name', 'outputs', 'info'],
ext: "js"
});
this.editor.focus();