Fixed #58: css not being loaded in case of AMD and multiple scripts

This commit is contained in:
josdejong 2013-07-30 22:13:26 +02:00
parent 38a356a5c3
commit 02c5fa416b
6 changed files with 13 additions and 9 deletions

View File

@ -6,6 +6,7 @@ http://jsoneditoronline.org
## version 2.2.2 ## version 2.2.2
- Fixed non working option `indentation`. - Fixed non working option `indentation`.
- Fixed css not being loaded with AMD in case of multiple scripts.
## 2013-05-27, version 2.2.1 ## 2013-05-27, version 2.2.1

View File

@ -11,7 +11,7 @@
"http://jsoneditoronline.org/NOTICE" "http://jsoneditoronline.org/NOTICE"
], ],
"launch": { "launch": {
"web_url": "http://jsoneditoronline.org/" "web_url": "http://jsoneditoronline.org/index.html?referrer=chrome_app"
} }
}, },
"icons": { "icons": {

6
jsoneditor-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -28,7 +28,7 @@
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 2.3.0-SNAPSHOT * @version 2.3.0-SNAPSHOT
* @date 2013-05-28 * @date 2013-07-30
*/ */
(function () { (function () {
@ -1054,6 +1054,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
@ -1073,7 +1076,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;
@ -2308,7 +2310,7 @@ Node.prototype._updateDomValue = function () {
color = 'red'; color = 'red';
} }
else if (t == 'boolean') { else if (t == 'boolean') {
color = 'orange'; color = 'darkorange';
} }
else if (this._hasChilds()) { else if (this._hasChilds()) {
// note: typeof(null)=="object", therefore check this.type instead of t // note: typeof(null)=="object", therefore check this.type instead of t
@ -2984,6 +2986,7 @@ Node.prototype._createDomTree = function () {
var domTree = document.createElement('table'); var domTree = document.createElement('table');
var tbody = document.createElement('tbody'); var tbody = document.createElement('tbody');
domTree.style.borderCollapse = 'collapse'; // TODO: put in css domTree.style.borderCollapse = 'collapse'; // TODO: put in css
domTree.className = 'values';
domTree.appendChild(tbody); domTree.appendChild(tbody);
var tr = document.createElement('tr'); var tr = document.createElement('tr');
tbody.appendChild(tr); tbody.appendChild(tr);
@ -6054,8 +6057,8 @@ if (typeof(module) != 'undefined' && typeof(exports) != 'undefined') {
* AMD module exports * AMD module exports
*/ */
if (typeof(require) != 'undefined' && typeof(define) != 'undefined') { if (typeof(require) != 'undefined' && typeof(define) != 'undefined') {
loadCss();
define(function () { define(function () {
loadCss();
return jsoneditor; return jsoneditor;
}); });
} }

View File

@ -39,8 +39,8 @@ if (typeof(module) != 'undefined' && typeof(exports) != 'undefined') {
* AMD module exports * AMD module exports
*/ */
if (typeof(require) != 'undefined' && typeof(define) != 'undefined') { if (typeof(require) != 'undefined' && typeof(define) != 'undefined') {
loadCss();
define(function () { define(function () {
loadCss();
return jsoneditor; return jsoneditor;
}); });
} }