From 42672eeef50733216a5dc0be31849d2a0ec8195c Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 5 Feb 2020 10:11:37 +0100 Subject: [PATCH] Fix history (undo/redo) being cleared in mode `code` and `text` after transforming or sorting --- HISTORY.md | 2 ++ src/js/textmode.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 0fcaa20..bda4e16 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,8 @@ https://github.com/josdejong/jsoneditor Transform modal. New options `createQuery`, `executeQuery`, and `queryDescription` are available for this now. An example is available in `examples/23_custom_query_language.html`. See #857, #871. +- Fix history (undo/redo) being cleared in mode `code` and `text` after + transforming or sorting. ## 2020-01-25, version 8.4.1 diff --git a/src/js/textmode.js b/src/js/textmode.js index 0d9a300..0cc2117 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -408,14 +408,14 @@ textmode._showSortModal = function () { const sortedJson = sort(json, sortedBy.path, sortedBy.direction) me.sortedBy = sortedBy - me.set(sortedJson) + me.update(sortedJson) } if (isObject(json)) { const sortedJson = sortObjectKeys(json, sortedBy.direction) me.sortedBy = sortedBy - me.set(sortedJson) + me.update(sortedJson) } } @@ -438,7 +438,7 @@ textmode._showTransformModal = function () { executeQuery, onTransform: query => { const updatedJson = executeQuery(json, query) - this.set(updatedJson) + this.update(updatedJson) } }) }