Support for custom themes.

This commit is contained in:
Nuno Santos 2015-03-18 10:34:51 +01:00
parent 053f4f5113
commit 8bab1158bf
2 changed files with 4 additions and 1 deletions

View File

@ -34,6 +34,8 @@ Constructs a new JSONEditor.
Enables a search box in the upper right corner of the JSONEditor. True by default. Only applicable when `mode` is 'tree', 'view', or 'form'.
- `{Number} indentation`
Number of indentation spaces. 2 by default. Only applicable when `mode` is 'code' or 'text'.
- `{String} theme`
Set the Ace editor theme, uses included 'ace/theme/jsoneditor' by default. Please note that only the default theme is included with jsoneditor, so if you specify another one you need to make sure it is loaded.
- `{JSON} json`
Initial JSON data to be loaded into the JSONEditor. Alternatively, the method `JSONEditor.set(json)` can be used to load JSON data into the editor.

View File

@ -44,6 +44,7 @@ textmode.create = function (container, options) {
'Falling back to plain text editor');
}
}
this.theme = options.theme || 'ace/theme/jsoneditor';
var me = this;
this.container = container;
@ -117,7 +118,7 @@ textmode.create = function (container, options) {
this.content.appendChild(this.editorDom);
var editor = ace.edit(this.editorDom);
editor.setTheme('ace/theme/jsoneditor');
editor.setTheme(this.theme);
editor.setShowPrintMargin(false);
editor.setFontSize(13);
editor.getSession().setMode('ace/mode/json');