mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add backslash handling to library
This commit is contained in:
parent
6675fdf3c2
commit
08ef9ee682
@ -69,7 +69,7 @@ RED.library = (function() {
|
||||
if (field === "name") {
|
||||
data.name = name;
|
||||
} else if (field === "info") {
|
||||
data.info = activeLibrary.nodeInfoEditor.getValue().replace(/\n/g, "\\n");
|
||||
data.info = activeLibrary.nodeInfoEditor.getValue().replace(/\\/g, "\\\\").replace(/\n/g, "\\n");
|
||||
} else {
|
||||
data[field] = $("#" + elementPrefix + field).val();
|
||||
}
|
||||
@ -526,7 +526,7 @@ RED.library = (function() {
|
||||
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");
|
||||
var nodeInfo = selectedLibraryItem[field].split("\\\\").map(function (v) { return v.replace(/\\n/g, "\n"); }).join("\\");
|
||||
activeLibrary.nodeInfoEditor.setValue(nodeInfo, -1);
|
||||
} else {
|
||||
$("#" + elementPrefix + field).val(selectedLibraryItem[field]);
|
||||
|
Loading…
Reference in New Issue
Block a user