Fixed #57: non-working option `indentation`

This commit is contained in:
josdejong 2013-07-08 20:29:45 +02:00
parent d1cee647cc
commit e5ccd9beac
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,11 @@
http://jsoneditoronline.org http://jsoneditoronline.org
## version 2.2.2
- Fixed non working option `indentation`.
## 2013-05-27, version 2.2.1 ## 2013-05-27, version 2.2.1
- Fixed undefined options in TextEditor. Thanks Wiseon3. - Fixed undefined options in TextEditor. Thanks Wiseon3.

View File

@ -42,6 +42,9 @@ TextEditor.prototype._create = function (container, options, json) {
if (options.indentation) { if (options.indentation) {
this.indentation = Number(options.indentation); this.indentation = Number(options.indentation);
} }
else {
this.indentation = 4; // number of spaces
}
this.mode = (options.mode == 'code') ? 'code' : 'text'; this.mode = (options.mode == 'code') ? 'code' : 'text';
if (this.mode == 'code') { if (this.mode == 'code') {
// verify whether Ace editor is available and supported // verify whether Ace editor is available and supported
@ -61,7 +64,6 @@ TextEditor.prototype._create = function (container, options, json) {
this.container = container; this.container = container;
this.editor = undefined; // ace code editor this.editor = undefined; // ace code editor
this.textarea = undefined; // plain text editor (fallback when Ace is not available) this.textarea = undefined; // plain text editor (fallback when Ace is not available)
this.indentation = 4; // number of spaces
this.width = container.clientWidth; this.width = container.clientWidth;
this.height = container.clientHeight; this.height = container.clientHeight;