From ffe727849e0d61b61bf4a7568be5518927043ae0 Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 17 Aug 2018 20:20:36 +0200 Subject: [PATCH] Fixed #566: transform function broken, regression since `v5.20.0` --- HISTORY.md | 5 +++++ src/js/Node.js | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 63ed964..95b1945 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,6 +3,11 @@ https://github.com/josdejong/jsoneditor +## 2018-08-17, version 5.23.1 + +- Fixed #566: transform function broken, regression since `v5.20.0`. + + ## 2018-08-15, version 5.23.0 - Implemented support for custom validation using a new `onValidate` callback. diff --git a/src/js/Node.js b/src/js/Node.js index d2e5206..95cb815 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -3621,15 +3621,18 @@ Node.prototype.transform = function (query) { try { // apply the JMESPath query - var oldValue = this.getInternalValue(); - var newValue = jmespath.search(oldValue, query); + var oldInternalValue = this.getInternalValue(); + var oldValue = this.getValue(); + var newValue = jmespath.search(oldValue, query); this.setValue(newValue); + var newInternalValue = this.getInternalValue(); + this.editor._onAction('transform', { path: this.getInternalPath(), - oldValue: oldValue, - newValue: this.getInternalValue() + oldValue: oldInternalValue, + newValue: newInternalValue }); this.showChilds();