diff --git a/HISTORY.md b/HISTORY.md index 551d1e1..fbe7379 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ https://github.com/josdejong/jsoneditor ## not yet released, version 5.1.2 - Improvements in sanitizing invalid JSON. +- Fixed clicking format/compact not triggering an onChange event. ## 2016-01-16, version 5.1.1 diff --git a/src/js/textmode.js b/src/js/textmode.js index 8e8de00..452b5ff 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -99,6 +99,7 @@ textmode.create = function (container, options) { buttonFormat.onclick = function () { try { me.format(); + me._onChange(); } catch (err) { me._onError(err); @@ -113,6 +114,7 @@ textmode.create = function (container, options) { buttonCompact.onclick = function () { try { me.compact(); + me._onChange(); } catch (err) { me._onError(err); @@ -235,9 +237,11 @@ textmode._onKeyDown = function (event) { if (keynum == 220 && event.ctrlKey) { if (event.shiftKey) { // Ctrl+Shift+\ this.compact(); + this._onChange(); } else { // Ctrl+\ this.format(); + this._onChange(); } handled = true; }