Fixed enum select boxes not being rendered/removed when setting or removing a JSON schema via `editor.setSchema(schema)`

This commit is contained in:
jos 2016-04-16 12:36:14 +02:00
parent a78b99f71d
commit 444d2b3631
3 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,12 @@
https://github.com/josdejong/jsoneditor https://github.com/josdejong/jsoneditor
## not yet released, version 5.5.1
- Fixed enum select boxes not being rendered/removed when setting or removing
a JSON schema via `editor.setSchema(schema)`.
## 2016-04-16, version 5.5.0 ## 2016-04-16, version 5.5.0
- Implemented a dropdown for values having an JSON Schema enum. - Implemented a dropdown for values having an JSON Schema enum.

View File

@ -297,12 +297,15 @@ JSONEditor.prototype.setSchema = function (schema) {
// validate now // validate now
this.validate(); this.validate();
} }
this.refresh(); // update DOM
} }
else { else {
// remove current schema // remove current schema
this.validateSchema = null; this.validateSchema = null;
this.options.schema = null; this.options.schema = null;
this.validate(); // to clear current error messages this.validate(); // to clear current error messages
this.refresh(); // update DOM
} }
}; };
@ -314,6 +317,13 @@ JSONEditor.prototype.validate = function () {
// must be implemented by treemode and textmode // must be implemented by treemode and textmode
}; };
/**
* Refresh the rendered contents
*/
JSONEditor.prototype.refresh = function () {
// can be implemented by treemode and textmode
};
/** /**
* Register a plugin with one ore multiple modes for the JSON Editor. * Register a plugin with one ore multiple modes for the JSON Editor.
* *

View File

@ -446,6 +446,15 @@ treemode.validate = function () {
}); });
}; };
/**
* Refresh the rendered contents
*/
treemode.refresh = function () {
if (this.node) {
this.node.updateDom({recurse: true});
}
};
/** /**
* Start autoscrolling when given mouse position is above the top of the * Start autoscrolling when given mouse position is above the top of the
* editor contents, or below the bottom. * editor contents, or below the bottom.