Aways package jsonlint, it's essential. Also some small fixes.

This commit is contained in:
jos 2016-09-30 17:05:23 +02:00
parent ae90077ed6
commit ceea59b30d
6 changed files with 14 additions and 10 deletions

View File

@ -71,7 +71,6 @@ var compilerMinimalist = webpack({
bannerPlugin, bannerPlugin,
new webpack.NormalModuleReplacementPlugin(new RegExp('^brace$'), EMPTY), new webpack.NormalModuleReplacementPlugin(new RegExp('^brace$'), EMPTY),
new webpack.NormalModuleReplacementPlugin(new RegExp('^ajv'), EMPTY), new webpack.NormalModuleReplacementPlugin(new RegExp('^ajv'), EMPTY),
new webpack.NormalModuleReplacementPlugin(new RegExp('jsonlint$'), EMPTY),
new webpack.optimize.UglifyJsPlugin() // TODO: don't minify when watching new webpack.optimize.UglifyJsPlugin() // TODO: don't minify when watching
], ],
module: { module: {

View File

@ -198,9 +198,9 @@ export default class TreeMode extends Component {
*/ */
handlePatch = (actions) => { handlePatch = (actions) => {
// apply changes // apply changes
const revert = this.patch(actions) const result = this.patch(actions)
this.emitOnChange (actions, revert) this.emitOnChange (actions, result.revert)
} }
/** @private */ /** @private */

View File

@ -2,7 +2,7 @@
* Jison generated parser * Jison generated parser
* Refactored into an ES6 module * Refactored into an ES6 module
**/ **/
export var parser = (function(){ var parser = (function(){
var parser = {trace: function trace() { }, var parser = {trace: function trace() { },
yy: {}, yy: {},
symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1}, symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
@ -417,4 +417,8 @@ export var parser = (function(){
return parser; return parser;
})(); })();
export var parse = parser.parse.bind(parser);
export default {
parse: parser.parse.bind(parser),
parser
}

View File

@ -7,7 +7,7 @@
<!-- For IE and Edge --> <!-- For IE and Edge -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min.js"></script>--> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min.js"></script>-->
<script src="../dist/jsoneditor.js"></script> <script src="../dist/jsoneditor-minimalist.js"></script>
<style> <style>
#container { #container {
height: 300px; height: 300px;

View File

@ -1 +1,2 @@
// This file is used to replace excluded dependencies with an empty placeholder // This file is used to replace excluded dependencies with an empty placeholder
export default null

View File

@ -1,4 +1,4 @@
let jsonlint = require('../assets/jsonlint/jsonlint') import jsonlint from '../assets/jsonlint/jsonlint'
/** /**
* Parse JSON using the parser built-in in the browser. * Parse JSON using the parser built-in in the browser.
@ -28,11 +28,11 @@ export function parseJSON(jsonString) {
* @throws Error * @throws Error
*/ */
export function validate(jsonString) { export function validate(jsonString) {
if (jsonlint && jsonlint.parse) { if (jsonlint) {
// use embedded jsonlint // use embedded jsonlint
jsonlint.parse(jsonString) jsonlint.parse(jsonString)
} }
else if (window.jsonlint && window.jsonlint.parse) { else if (window.jsonlint) {
// use global jsonlint // use global jsonlint
window.jsonlint.parse(jsonString) window.jsonlint.parse(jsonString)
} }