This repository has been archived by the owner on Mar 21, 2021. It is now read-only.
forked from viasocket/ng-jsoneditor
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major rewrite, now using es6, webpack and jsonedit > 5.0.0
- Loading branch information
Showing
13 changed files
with
427 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": ["es2015"], | ||
"plugins": [ | ||
"add-module-exports" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
{ | ||
"parser": "esprima", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"amd": true | ||
}, | ||
"globals": { | ||
"angular": true | ||
}, | ||
"rules": { | ||
"no-cond-assign": "error", | ||
"no-console": ["warn", { "allow": ["error", "warn"] }], | ||
"no-constant-condition": "error", | ||
"no-control-regex": "error", | ||
"no-debugger": "error", | ||
"no-dupe-args": "error", | ||
"no-dupe-keys": "error", | ||
"no-duplicate-case": "error", | ||
"no-empty-character-class": "error", | ||
"no-empty": "error", | ||
"no-ex-assign": "error", | ||
"no-extra-boolean-cast": "error", | ||
"no-extra-parens": "warn", | ||
"no-extra-semi": "error", | ||
"no-func-assign": "error", | ||
"no-inner-declarations": "error", | ||
"no-invalid-regexp": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-obj-calls": "error", | ||
"no-regex-spaces": "error", | ||
"no-sparse-arrays": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-unexpected-multiline": "error", | ||
"no-unreachable": "error", | ||
"no-unsafe-finally": "error", | ||
"no-unsafe-negation": "error", | ||
"use-isnan": "error", | ||
"valid-typeof": "error", | ||
// Best Practices | ||
"accessor-pairs": "warn", | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
"class-methods-use-this": "error", | ||
"consistent-return": "error", | ||
"curly": "error", | ||
"default-case": "error", | ||
"dot-notation": "error", | ||
"eqeqeq": "error", | ||
"guard-for-in": "error", | ||
"no-alert": "error", | ||
"no-caller": "error", | ||
"no-case-declarations": "error", | ||
"no-div-regex": "error", | ||
"no-else-return": "error", | ||
"no-empty-function": "error", | ||
"no-empty-pattern": "error", | ||
"no-eq-null": "error", | ||
"no-eval": "error", | ||
"no-extend-native": "error", | ||
"no-extra-bind": "error", | ||
"no-extra-label": "error", | ||
"no-fallthrough": "error", | ||
"no-floating-decimal": "error", | ||
"no-global-assign": "error", | ||
"no-implicit-coercion": "error", | ||
"no-implicit-globals": "error", | ||
"no-implied-eval": "error", | ||
"no-invalid-this": "error", | ||
"no-iterator": "error", | ||
"no-labels": "error", | ||
"no-lone-blocks": "error", | ||
"no-loop-func": "error", | ||
"no-multi-spaces": "error", | ||
"no-multi-str": "error", | ||
"no-new-func": "error", | ||
"no-new-wrappers": "error", | ||
"no-new": "error", | ||
"no-octal-escape": "error", | ||
"no-octal": "error", | ||
"no-param-reassign": "error", | ||
"no-proto": "error", | ||
"no-redeclare": "error", | ||
"no-restricted-properties": "error", | ||
"no-return-assign": "error", | ||
"no-script-url": "error", | ||
"no-self-assign": "error", | ||
"no-self-compare": "error", | ||
"no-sequences": "error", | ||
"no-throw-literal": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-unused-expressions": "error", | ||
"no-unused-labels": "error", | ||
"no-useless-call": "error", | ||
"no-useless-concat": "error", | ||
"no-useless-escape": "error", | ||
"no-useless-return": "error", | ||
"no-void": "error", | ||
"no-warning-comments": "error", | ||
"no-with": "error", | ||
"radix": "error", | ||
"vars-on-top": "error", | ||
"wrap-iife": "error", | ||
"yoda": ["error", "never"], | ||
// Strict Mode | ||
"strict": "error", | ||
"no-undef": "error", | ||
"no-undefined": "error", | ||
"no-unused-vars": "error", | ||
"no-use-before-define": "error", | ||
// Style | ||
"array-bracket-spacing": "error", | ||
"block-spacing": "error", | ||
"brace-style": "error", | ||
"camelcase": "error", | ||
"comma-dangle": "error", | ||
"comma-spacing": "error", | ||
"comma-style": "error", | ||
"computed-property-spacing": "error", | ||
"consistent-this": "error", | ||
"eol-last": "error", | ||
"func-call-spacing": "error", | ||
"indent": ["error", 4, {"SwitchCase": 1}], | ||
"key-spacing": "error", | ||
"keyword-spacing": "error", | ||
"line-comment-position": "error", | ||
"linebreak-style": "error", | ||
"lines-around-comment": ["error", { "beforeBlockComment": false }], | ||
"lines-around-directive": "error", | ||
"new-cap": "error", | ||
"new-parens": "error", | ||
"no-array-constructor": "error", | ||
"no-bitwise": "error", | ||
"no-continue": "error", | ||
"no-lonely-if": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multiple-empty-lines": "error", | ||
"no-negated-condition": "error", | ||
"no-new-object": "error", | ||
"no-trailing-spaces": "error", | ||
"no-unneeded-ternary": "error", | ||
"no-whitespace-before-property": "error", | ||
"one-var-declaration-per-line": "error", | ||
"one-var": ["error", "never"], | ||
"quotes": ["error", "single"], | ||
"semi-spacing": "error", | ||
"spaced-comment": "error", | ||
"unicode-bom": "error", | ||
// ES6 | ||
"arrow-body-style": ["error", "as-needed"], | ||
"arrow-parens": "error", | ||
"arrow-spacing": "error", | ||
"constructor-super": "error", | ||
"generator-star-spacing": "error", | ||
"no-class-assign": "error", | ||
"no-const-assign": "error", | ||
"no-dupe-class-members": "error", | ||
"no-duplicate-imports": "error", | ||
"no-new-symbol": "error", | ||
"no-this-before-super": "error", | ||
"no-useless-computed-key": "error", | ||
"no-useless-constructor": "error", | ||
"no-var": "error", | ||
"object-shorthand": "error", | ||
"prefer-arrow-callback": "error", | ||
"prefer-const": "error", | ||
"prefer-numeric-literals": "error", | ||
"prefer-rest-params": "error", | ||
"prefer-template": "warn", | ||
"require-yield": "error", | ||
"rest-spread-spacing": "error" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,72 @@ | ||
<!doctype html> | ||
<html ng-app="ngApp"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Demo for NG-JSONEDITOR</title> | ||
<link href="../../dist/jsoneditor.css" rel="stylesheet" type="text/css"> | ||
<script src="./scripts/angular.min.js" type="text/javascript"></script> | ||
<script src="../../dist/jsoneditor.js?q=8934397"></script> | ||
<script src="./scripts/ng-jsoneditor.js?q=8934397" type="text/javascript"></script> | ||
<!-- <script src="https://rawgithub.com/ajaxorg/ace-builds/master/src/ext-language_tools.js" type="text/javascript" charset="utf-8"></script> --> | ||
<style type="text/css" media="screen"> | ||
.wrapper{margin: 50px auto; width: 1000px;} | ||
.col{float: left; width: 50%} | ||
.pdL4{padding-left:40px;} | ||
</style> | ||
<meta charset="utf-8"> | ||
<title>Demo for angular-jsoneditor</title> | ||
<script src="../node_modules/angular/angular.js" type="text/javascript"></script> | ||
<script src="../dist/angular-jsoneditor.js" type="text/javascript"></script> | ||
<style type="text/css" media="screen"> | ||
.wrapper { | ||
margin: 50px auto; | ||
width: 1000px; | ||
} | ||
|
||
.col { | ||
float: left; | ||
width: 50% | ||
} | ||
|
||
.pdL4 { | ||
padding-left: 40px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div ng-controller="ngCtrl" class="wrapper"> | ||
<div class="col"> | ||
<div ng-jsoneditor="onLoad" ng-model="obj.data" options="obj.options" style="width: 100%; height: 400px;"></div> | ||
</div> | ||
<div ng-controller="ngCtrl" class="wrapper"> | ||
<div class="col"> | ||
<angular-jsoneditor ng-model="obj.data" options="obj.options" style="width: 100%; height: 400px;"></angular-jsoneditor> | ||
</div> | ||
|
||
<div class="col"> | ||
<div class="col"> | ||
<div class="pdL4"> | ||
<button type="button" class="btn btn-primary" ng-click="changeData()"><i class="fa fa-check-circle"></i> change data</button> | ||
|
||
<button type="button" class="btn btn-primary" ng-click="changeOptions()"><i class="fa fa-check-circle"></i> change options</button> | ||
|
||
<pre>{{pretty(obj.data)}}</pre> | ||
<button type="button" class="btn btn-primary" ng-click="changeData()"><i class="fa fa-check-circle"></i> | ||
change data | ||
</button> | ||
<button type="button" class="btn btn-primary" ng-click="changeOptions()"><i class="fa fa-check-circle"></i> | ||
change options | ||
</button> | ||
<pre>{{pretty(obj.data)}}</pre> | ||
<input type="text" ng-model="obj.data.String"> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
|
||
// let | ||
|
||
var json = { | ||
"Array": [1, 2, 3], "Boolean": true, "Null": null, "Number": 123, | ||
"Object": {"a": "b", "c": "d"}, "String": "Hello World", | ||
"auto": "$Hello World" | ||
<script type="text/javascript"> | ||
var json = { | ||
"Array": [1, 2, 3], "Boolean": true, "Null": null, "Number": 123, | ||
"Object": {"a": "b", "c": "d"}, "String": "Hello World", | ||
"auto": "$Hello World" | ||
}; | ||
angular.module('ngApp', ['angular-jsoneditor']).controller('ngCtrl', function ($scope) { | ||
$scope.obj = {data: json, options: {mode: 'tree'}}; | ||
$scope.onLoad = function (instance) { | ||
instance.expandAll(); | ||
this.options.mode = 'code'; | ||
this.options.completer = [ | ||
{value: "$sameer", score: 1000, meta: "custom"}, | ||
{value: "$rathore", score: 1000, meta: "custom"} | ||
]; | ||
}; | ||
// | ||
angular.module('ngApp', ['ng.jsoneditor']).controller('ngCtrl', function ($scope) { | ||
$scope.obj = {data: json, options: {mode: 'tree'}}; | ||
$scope.onLoad = function (instance) { | ||
instance.expandAll(); | ||
this.options.mode = 'code'; | ||
this.options.completer = [ | ||
{value: "$sameer", score: 1000, meta: "custom"}, | ||
{value: "$rathore", score: 1000, meta: "custom"} | ||
]; | ||
}; | ||
$scope.changeData = function () { | ||
$scope.obj.data = {foo: 'bar'}; | ||
}; | ||
$scope.changeOptions = function () { | ||
$scope.obj.options.mode = $scope.obj.options.mode == 'tree' ? 'code' : 'tree'; | ||
}; | ||
|
||
//other | ||
$scope.pretty = function (obj) { | ||
console.log(obj); | ||
return obj; | ||
// return angular.toJson(obj, true); | ||
} | ||
$scope.funcChange = function(obj){ | ||
console.log("funcChange", obj) | ||
} | ||
|
||
}); | ||
</script> | ||
$scope.changeData = function () { | ||
$scope.obj.data = {foo: 'bar'}; | ||
}; | ||
$scope.changeOptions = function () { | ||
$scope.obj.options.mode = $scope.obj.options.mode == 'tree' ? 'code' : 'tree'; | ||
}; | ||
$scope.pretty = function (obj) { | ||
return obj; | ||
}; | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.