Dropped support for IE8 (was already broken). Improved error message for unsupported browsers.

This commit is contained in:
josdejong 2013-11-15 14:56:12 +01:00
parent 02843155b6
commit 35568380f2
10 changed files with 31 additions and 46 deletions

View File

@ -3,7 +3,7 @@
*/
var jake = require('jake'),
path = require('path'),
cleanCss = require('clean-css'),
CleanCSS = require('clean-css'),
archiver = require('archiver'),
fs = require('fs');
@ -79,7 +79,7 @@ task('build', ['clear'], function () {
console.log('Created ' + JSONEDITOR_CSS);
// minify the css file
write(JSONEDITOR_CSS_MIN, cleanCss.process(String(read(JSONEDITOR_CSS))));
write(JSONEDITOR_CSS_MIN, new CleanCSS().minify(String(read(JSONEDITOR_CSS))));
// create a folder img and copy the icons
jake.mkdirP('./img');
@ -214,7 +214,7 @@ task('webapp', ['build', 'minify'], function () {
});
// minify css file
write(appCssMin, cleanCss.process(String(read(appCss))));
write(appCssMin, new CleanCSS().minify(String(read(appCss))));
// remove non minified javascript and css file
fs.unlinkSync(appJs);

View File

@ -11,6 +11,8 @@ editor.
The editor can be used as a component in your own web application. The library
can be loaded as CommonJS module, AMD module, or as a regular javascript file.
Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 9+.
### Screenshot
The web application shows two panels side by side: a code editor on the left,

View File

@ -149,7 +149,9 @@ Splitter.prototype.setValue = function (value) {
localStorage['splitterValue'] = value;
}
catch (e) {
console.log(e);
if (console && console.log) {
console.log(e);
}
}
return value;
};

2
jsoneditor-min.css vendored

File diff suppressed because one or more lines are too long

10
jsoneditor-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -27,8 +27,8 @@
* Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <wjosdejong@gmail.com>
* @version 2.3.3
* @date 2013-10-17
* @version 2.3.4-SNAPSHOT
* @date 2013-11-15
*/
(function () {
@ -63,6 +63,13 @@ function JSONEditor (container, options, json) {
throw new Error('JSONEditor constructor called without "new".');
}
// check availability of JSON parser (not available in IE7 and older)
if (typeof JSON === 'undefined') {
throw new Error ('Your browser does not support JSON. \n\n' +
'Please install the newest version of your browser.\n' +
'(all modern browsers support JSON).');
}
if (arguments.length) {
this._create(container, options, json);
}
@ -271,13 +278,6 @@ function TreeEditor(container, options, json) {
* @private
*/
TreeEditor.prototype._create = function (container, options, json) {
// check availability of JSON parser (not available in IE7 and older)
if (typeof(JSON) == 'undefined') {
throw new Error ('Your browser does not support JSON. \n\n' +
'Please install the newest version of your browser.\n' +
'(all modern browsers support JSON).');
}
if (!container) {
throw new Error('No container element provided.');
}
@ -1043,13 +1043,6 @@ function TextEditor(container, options, json) {
* @private
*/
TextEditor.prototype._create = function (container, options, json) {
// check availability of JSON parser (not available in IE7 and older)
if (typeof(JSON) == 'undefined') {
throw new Error('Your browser does not support JSON. \n\n' +
'Please install the newest version of your browser.\n' +
'(all modern browsers support JSON).');
}
// read options
options = options || {};
this.options = options;

View File

@ -29,6 +29,13 @@ function JSONEditor (container, options, json) {
throw new Error('JSONEditor constructor called without "new".');
}
// check for unsupported browser (IE8 and older)
var ieVersion = util.getInternetExplorerVersion();
if (ieVersion != -1 && ieVersion < 9) {
throw new Error('Unsupported browser, IE9 or newer required. ' +
'Please install the newest version of your browser.');
}
if (arguments.length) {
this._create(container, options, json);
}

View File

@ -29,13 +29,6 @@ function TextEditor(container, options, json) {
* @private
*/
TextEditor.prototype._create = function (container, options, json) {
// check availability of JSON parser (not available in IE7 and older)
if (typeof(JSON) == 'undefined') {
throw new Error('Your browser does not support JSON. \n\n' +
'Please install the newest version of your browser.\n' +
'(all modern browsers support JSON).');
}
// read options
options = options || {};
this.options = options;
@ -53,11 +46,6 @@ TextEditor.prototype._create = function (container, options, json) {
util.log('WARNING: Cannot load code editor, Ace library not loaded. ' +
'Falling back to plain text editor');
}
if (util.getInternetExplorerVersion() == 8) {
this.mode = 'text';
util.log('WARNING: Cannot load code editor, Ace is not supported on IE8. ' +
'Falling back to plain text editor');
}
}
var me = this;

View File

@ -30,13 +30,6 @@ function TreeEditor(container, options, json) {
* @private
*/
TreeEditor.prototype._create = function (container, options, json) {
// check availability of JSON parser (not available in IE7 and older)
if (typeof(JSON) == 'undefined') {
throw new Error ('Your browser does not support JSON. \n\n' +
'Please install the newest version of your browser.\n' +
'(all modern browsers support JSON).');
}
if (!container) {
throw new Error('No container element provided.');
}

View File

@ -95,7 +95,7 @@ util.clear = function clear (a) {
* @param {...*} args
*/
util.log = function log (args) {
if (console && typeof console.log === 'function') {
if (typeof console !== 'undefined' && typeof console.log === 'function') {
console.log.apply(console, arguments);
}
};