From 66a7a5cf784c8a1c9eb42b37d4396c5dc8952437 Mon Sep 17 00:00:00 2001 From: RobTheFiveNine <49003204+RobTheFiveNine@users.noreply.github.com> Date: Mon, 5 Oct 2020 18:02:31 +0100 Subject: [PATCH] Fix serialisation bug when editing string properties --- build/litegraph.js | 6 +++++- build/litegraph.min.js | 2 +- src/litegraph.js | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build/litegraph.js b/build/litegraph.js index 598f8ff56..765b36964 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -10078,8 +10078,12 @@ LGraphNode.prototype.executeAction = function(action) input.addEventListener("blur", function(e) { this.focus(); }); + var v = node.properties[property] !== undefined ? node.properties[property] : ""; - v = JSON.stringify(v); + if (type !== 'string') { + v = JSON.stringify(v); + } + input.value = v; input.addEventListener("keydown", function(e) { if (e.keyCode != 13) { diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 4bbbb9879..b3675243a 100644 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -4381,7 +4381,7 @@ $jscomp.polyfill("Object.values", function(x) { if (l = h.querySelector("input")) { l.addEventListener("blur", function(a) { this.focus(); - }), n = void 0 !== a.properties[b] ? a.properties[b] : "", n = JSON.stringify(n), l.value = n, l.addEventListener("keydown", function(a) { + }), n = void 0 !== a.properties[b] ? a.properties[b] : "", "string" !== f && (n = JSON.stringify(n)), l.value = n, l.addEventListener("keydown", function(a) { 13 == a.keyCode && (e(), a.preventDefault(), a.stopPropagation()); }); } diff --git a/src/litegraph.js b/src/litegraph.js index 951e8c7f1..5fdf90aff 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -10078,8 +10078,12 @@ LGraphNode.prototype.executeAction = function(action) input.addEventListener("blur", function(e) { this.focus(); }); + var v = node.properties[property] !== undefined ? node.properties[property] : ""; - v = JSON.stringify(v); + if (type !== 'string') { + v = JSON.stringify(v); + } + input.value = v; input.addEventListener("keydown", function(e) { if (e.keyCode != 13) {