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();