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 = {
|
||||||
|
@ -66,8 +66,10 @@ RED.library = (function() {
|
|||||||
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();
|
||||||
}
|
}
|
||||||
@ -523,8 +525,13 @@ RED.library = (function() {
|
|||||||
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];
|
||||||
|
if (field === "info") {
|
||||||
|
var nodeInfo = selectedLibraryItem[field].replace(/\\n/g, "\n");
|
||||||
|
activeLibrary.nodeInfoEditor.setValue(nodeInfo, -1);
|
||||||
|
} else {
|
||||||
$("#" + elementPrefix + field).val(selectedLibraryItem[field]);
|
$("#" + elementPrefix + field).val(selectedLibraryItem[field]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
activeLibrary.editor.setValue(libraryEditor.getValue(), -1);
|
activeLibrary.editor.setValue(libraryEditor.getValue(), -1);
|
||||||
}
|
}
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
|
@ -74,8 +74,9 @@
|
|||||||
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
|
||||||
|
nodeInfoEditor: this.nodeInfoEditor,
|
||||||
mode: "ace/mode/nrjavascript",
|
mode: "ace/mode/nrjavascript",
|
||||||
fields:['name','outputs'],
|
fields: ['name', 'outputs', 'info'],
|
||||||
ext: "js"
|
ext: "js"
|
||||||
});
|
});
|
||||||
this.editor.focus();
|
this.editor.focus();
|
||||||
|
Loading…
Reference in New Issue
Block a user