Skip to content

Commit

Permalink
Add ability to set string format via options. #150
Browse files Browse the repository at this point in the history
Bump version.
  • Loading branch information
jdorn committed Jun 26, 2014
1 parent fb180e6 commit 5c8c99b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "json-editor",
"version": "0.6.17",
"version": "0.6.18",
"authors": [
"Jeremy Dorn <[email protected]>"
],
Expand Down
10 changes: 8 additions & 2 deletions dist/jsoneditor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! JSON Editor v0.6.17 - JSON Schema -> HTML Editor
/*! JSON Editor v0.6.18 - JSON Schema -> HTML Editor
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
* Released under the MIT license
*
* Date: 2014-06-22
* Date: 2014-06-26
*/

/**
Expand Down Expand Up @@ -1931,6 +1931,12 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
if(!this.format && this.schema.media && this.schema.media.type) {
this.format = this.schema.media.type.replace(/(^(application|text)\/(x-)?(script\.)?)|(-source$)/g,'');
}
if(!this.format && this.options.default_format) {
this.format = this.options.default_format;
}
if(this.options.format) {
this.format = this.options.format;
}

// Select box
if(this.schema.enum) {
Expand Down
12 changes: 6 additions & 6 deletions dist/jsoneditor.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/editors/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
if(!this.format && this.schema.media && this.schema.media.type) {
this.format = this.schema.media.type.replace(/(^(application|text)\/(x-)?(script\.)?)|(-source$)/g,'');
}
if(!this.format && this.options.default_format) {
this.format = this.options.default_format;
}
if(this.options.format) {
this.format = this.options.format;
}

// Select box
if(this.schema.enum) {
Expand Down
4 changes: 2 additions & 2 deletions src/intro.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! JSON Editor v0.6.17 - JSON Schema -> HTML Editor
/*! JSON Editor v0.6.18 - JSON Schema -> HTML Editor
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
* Released under the MIT license
*
* Date: 2014-06-22
* Date: 2014-06-26
*/

/**
Expand Down

0 comments on commit 5c8c99b

Please sign in to comment.