Fixed clicking format/compact not triggering an onChange event

This commit is contained in:
jos 2016-01-17 15:24:46 +01:00
parent 8ec471b6dc
commit f4492de1ca
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ https://github.com/josdejong/jsoneditor
## not yet released, version 5.1.2 ## not yet released, version 5.1.2
- Improvements in sanitizing invalid JSON. - Improvements in sanitizing invalid JSON.
- Fixed clicking format/compact not triggering an onChange event.
## 2016-01-16, version 5.1.1 ## 2016-01-16, version 5.1.1

View File

@ -99,6 +99,7 @@ textmode.create = function (container, options) {
buttonFormat.onclick = function () { buttonFormat.onclick = function () {
try { try {
me.format(); me.format();
me._onChange();
} }
catch (err) { catch (err) {
me._onError(err); me._onError(err);
@ -113,6 +114,7 @@ textmode.create = function (container, options) {
buttonCompact.onclick = function () { buttonCompact.onclick = function () {
try { try {
me.compact(); me.compact();
me._onChange();
} }
catch (err) { catch (err) {
me._onError(err); me._onError(err);
@ -235,9 +237,11 @@ textmode._onKeyDown = function (event) {
if (keynum == 220 && event.ctrlKey) { if (keynum == 220 && event.ctrlKey) {
if (event.shiftKey) { // Ctrl+Shift+\ if (event.shiftKey) { // Ctrl+Shift+\
this.compact(); this.compact();
this._onChange();
} }
else { // Ctrl+\ else { // Ctrl+\
this.format(); this.format();
this._onChange();
} }
handled = true; handled = true;
} }