ees-jsoneditor 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ees-jsoneditor/README.md +200 -0
- package/dist/ees-jsoneditor/fesm2022/ees-jsoneditor.mjs +257 -0
- package/dist/ees-jsoneditor/fesm2022/ees-jsoneditor.mjs.map +1 -0
- package/dist/ees-jsoneditor/index.d.ts +191 -0
- package/package.json +10 -2
- package/projects/ees-jsoneditor/package.json +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Angular Json Editor
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Angular Json Editor (wrapper for [jsoneditor](https://github.com/josdejong/jsoneditor)). View/Edit Json file with formatting.
|
|
5
|
+
|
|
6
|
+
[StackBlitz template](https://stackblitz.com/edit/ees-jsoneditor)
|
|
7
|
+
|
|
8
|
+
Working with latest Angular 20.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
To install this library with npm, run below command:
|
|
15
|
+
|
|
16
|
+
$ npm install --save jsoneditor ees-jsoneditor
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<json-editor [options]="editorOptions" [data]="data" (change)="getData($event)"></json-editor>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Configuration
|
|
28
|
+
|
|
29
|
+
First, Import Angular JsonEditor module in root
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { NgJsonEditorModule } from 'ees-jsoneditor'
|
|
33
|
+
|
|
34
|
+
@NgModule({
|
|
35
|
+
declarations: [
|
|
36
|
+
AppComponent
|
|
37
|
+
],
|
|
38
|
+
imports: [
|
|
39
|
+
....,
|
|
40
|
+
NgJsonEditorModule
|
|
41
|
+
],
|
|
42
|
+
providers: [],
|
|
43
|
+
bootstrap: [AppComponent]
|
|
44
|
+
})
|
|
45
|
+
export class AppModule { }
|
|
46
|
+
```
|
|
47
|
+
Then setup your component models as below :
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { Component, ViewChild } from '@angular/core';
|
|
51
|
+
import { EeJsonEditorComponent, JsonEditorOptions } from 'ees-jsoneditor';
|
|
52
|
+
|
|
53
|
+
@Component({
|
|
54
|
+
selector: 'app-root',
|
|
55
|
+
template: '<json-editor [options]="editorOptions" [data]="data"></json-editor>',
|
|
56
|
+
styleUrls: ['./app.component.css']
|
|
57
|
+
})
|
|
58
|
+
export class AppComponent {
|
|
59
|
+
public editorOptions: JsonEditorOptions;
|
|
60
|
+
public data: any;
|
|
61
|
+
@ViewChild(EeJsonEditorComponent, { static: false }) editor: EeJsonEditorComponent;
|
|
62
|
+
|
|
63
|
+
constructor() {
|
|
64
|
+
this.editorOptions = new JsonEditorOptions()
|
|
65
|
+
this.editorOptions.modes = ['code', 'text', 'tree', 'view']; // set all allowed modes
|
|
66
|
+
//this.options.mode = 'code'; //set only one mode
|
|
67
|
+
|
|
68
|
+
this.data = {"products":[{"name":"car","product":[{"name":"honda","model":[{"id":"civic","name":"civic"},{"id":"accord","name":"accord"},{"id":"crv","name":"crv"},{"id":"pilot","name":"pilot"},{"id":"odyssey","name":"odyssey"}]}]}]}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
Note : For better styling, add below line to your main style.css file
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
@import "~jsoneditor/dist/jsoneditor.min.css";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Forms
|
|
81
|
+
|
|
82
|
+
Build it integrated with ReactiveForms:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
this.form = this.fb.group({
|
|
86
|
+
myinput: [this.data]
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
```html
|
|
90
|
+
<form [formGroup]="form" (submit)="submit()">
|
|
91
|
+
<json-editor [options]="editorOptions2" formControlName="myinput">
|
|
92
|
+
</json-editor>
|
|
93
|
+
</form>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Extra Features
|
|
97
|
+
|
|
98
|
+
Besides all the
|
|
99
|
+
[configuration options](https://github.com/josdejong/jsoneditor/blob/master/docs/api.md)
|
|
100
|
+
from the original jsoneditor, Angular Json Editor supports one additional option:
|
|
101
|
+
|
|
102
|
+
_expandAll_ - to automatically expand all nodes upon json loaded with the _data_ input.
|
|
103
|
+
|
|
104
|
+
# Troubleshoot
|
|
105
|
+
|
|
106
|
+
If you have issue with the height of the component, you can try one of those solutions:
|
|
107
|
+
|
|
108
|
+
When you import CSS:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
@import "~jsoneditor/dist/jsoneditor.min.css";
|
|
112
|
+
textarea.jsoneditor-text{min-height:350px;}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or Customizing the CSS:
|
|
116
|
+
|
|
117
|
+
```css
|
|
118
|
+
:host ::ng-deep json-editor,
|
|
119
|
+
:host ::ng-deep json-editor .jsoneditor,
|
|
120
|
+
:host ::ng-deep json-editor > div,
|
|
121
|
+
:host ::ng-deep json-editor jsoneditor-outer {
|
|
122
|
+
height: 500px;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Or as a inner style in component:
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<json-editor class="col-md-12" #editorExample style="min-height: 300px;" [options]="editorOptionsData" [data]="dataStructure"></json-editor>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For code view you can change the height using this example:
|
|
133
|
+
```css
|
|
134
|
+
.ace_editor.ace-jsoneditor {
|
|
135
|
+
min-height: 500px;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Use debug mode to see in your console the data and options passed to jsoneditor. Copy this and paste in your issue when reporting bugs.
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<json-editor [debug]="true" [options]="editorOptionsData" [data]="dataStructure"></json-editor>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## JSONOptions missing params
|
|
146
|
+
|
|
147
|
+
If you find youself trying to use an custom option that is not mapped here, you can do:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
let editorOptions: JsonEditorOptions = new JsonEditorOptions(); (<any>this.editorOptions).templates = [{menu options objects as in json editor documentation}]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
See the [issue](https://github.com/yasir-nazir/ees-jsoneditor/issues/57)
|
|
154
|
+
|
|
155
|
+
## Internet Explorer
|
|
156
|
+
|
|
157
|
+
If you want to support IE, please follow this guide:
|
|
158
|
+
* https://github.com/yasir-nazir/ees-jsoneditor/issues/44#issuecomment-508650610
|
|
159
|
+
|
|
160
|
+
## Multiple editors
|
|
161
|
+
|
|
162
|
+
To use multiple jsoneditors in your view you cannot use the same editor options.
|
|
163
|
+
|
|
164
|
+
You should have something like:
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<div *ngFor="let prd of data.products" class="w-100-p p-24" >
|
|
168
|
+
<json-editor [options]="makeOptions()" [data]="prd" (change)="showJson($event)"></json-editor>
|
|
169
|
+
</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
makeOptions = () => {
|
|
174
|
+
const options = new JsonEditorOptions();
|
|
175
|
+
options.modes = ['code', 'text', 'tree', 'view'];
|
|
176
|
+
return options;
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
# Demo
|
|
181
|
+
|
|
182
|
+
Demo component files are included in Git Project.
|
|
183
|
+
|
|
184
|
+
Demo Project with a lot of different implementations (ngInit, change event and others):
|
|
185
|
+
[https://github.com/yasir-nazir/ees-jsoneditor/tree/master/src/app/demo)
|
|
186
|
+
|
|
187
|
+
When publishing it to npm, look over this docs: https://docs.npmjs.com/misc/developers
|
|
188
|
+
|
|
189
|
+
# Collaborate
|
|
190
|
+
|
|
191
|
+
Fork, clone this repo and install dependencies.
|
|
192
|
+
This project just works with webpack 4 (dont change to 5):
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
npm i -g rimraf
|
|
196
|
+
npm i
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
# License
|
|
200
|
+
MIT(./LICENSE)
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import JSONEditor from 'jsoneditor';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { EventEmitter, forwardRef, Input, Output, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
7
|
+
class JsonEditorOptions {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.enableSort = true;
|
|
10
|
+
this.enableTransform = true;
|
|
11
|
+
this.escapeUnicode = false;
|
|
12
|
+
this.expandAll = false;
|
|
13
|
+
this.sortObjectKeys = false;
|
|
14
|
+
this.history = true;
|
|
15
|
+
this.mode = 'tree';
|
|
16
|
+
this.search = true;
|
|
17
|
+
this.indentation = 2;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
22
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
|
23
|
+
/* eslint-disable @angular-eslint/no-output-native */
|
|
24
|
+
class EeJsonEditorComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.options = new JsonEditorOptions();
|
|
27
|
+
this.change = new EventEmitter();
|
|
28
|
+
this.jsonChange = new EventEmitter();
|
|
29
|
+
this.debug = false;
|
|
30
|
+
this.optionsChanged = false;
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
this.isFocused = false;
|
|
33
|
+
this.id = 'angjsoneditor' + Math.floor(Math.random() * 1000000);
|
|
34
|
+
this._data = {};
|
|
35
|
+
this.onChange = () => {
|
|
36
|
+
if (this.editor) {
|
|
37
|
+
try {
|
|
38
|
+
const json = this.editor.get();
|
|
39
|
+
this.onChangeModel(json);
|
|
40
|
+
this.change.emit(json);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (this.debug) {
|
|
44
|
+
console.log(error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.onChangeJSON = () => {
|
|
50
|
+
if (this.editor) {
|
|
51
|
+
try {
|
|
52
|
+
this.jsonChange.emit(this.editor.get());
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (this.debug) {
|
|
56
|
+
console.log(error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
// Implemented as part of ControlValueAccessor.
|
|
62
|
+
this.onTouched = () => {
|
|
63
|
+
};
|
|
64
|
+
// Implemented as part of ControlValueAccessor.
|
|
65
|
+
this.onChangeModel = (e) => {
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
set data(value) {
|
|
69
|
+
this._data = value;
|
|
70
|
+
if (this.editor) {
|
|
71
|
+
this.editor.destroy();
|
|
72
|
+
this.ngOnInit();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
ngOnInit() {
|
|
76
|
+
let optionsBefore = this.options;
|
|
77
|
+
if (!this.optionsChanged && this.editor) {
|
|
78
|
+
//TODO: check if this is needed
|
|
79
|
+
optionsBefore = this.editor.options;
|
|
80
|
+
}
|
|
81
|
+
if (!this.options.onChangeJSON && this.jsonChange) {
|
|
82
|
+
this.options.onChangeJSON = this.onChangeJSON;
|
|
83
|
+
}
|
|
84
|
+
if (!this.options.onChange && this.change) {
|
|
85
|
+
this.options.onChange = this.onChange;
|
|
86
|
+
}
|
|
87
|
+
const optionsCopy = Object.assign({}, optionsBefore);
|
|
88
|
+
// expandAll is an option only supported by ees-jsoneditor and not by the the original jsoneditor.
|
|
89
|
+
delete optionsCopy.expandAll;
|
|
90
|
+
if (this.debug) {
|
|
91
|
+
console.log(optionsCopy, this._data);
|
|
92
|
+
}
|
|
93
|
+
if (!this.jsonEditorContainer.nativeElement) {
|
|
94
|
+
console.error(`Can't find the ElementRef reference for jsoneditor)`);
|
|
95
|
+
}
|
|
96
|
+
if (optionsCopy.mode === 'text' || optionsCopy.mode === 'code' ||
|
|
97
|
+
(optionsCopy.modes &&
|
|
98
|
+
(optionsCopy.modes.indexOf('text') !== -1 || optionsCopy.modes.indexOf('code') !== -1))) {
|
|
99
|
+
optionsCopy.onChangeJSON = undefined;
|
|
100
|
+
}
|
|
101
|
+
this.editor = new JSONEditor(this.jsonEditorContainer.nativeElement, optionsCopy, this._data);
|
|
102
|
+
if (this.options.expandAll) {
|
|
103
|
+
this.editor.expandAll();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ngOnDestroy() {
|
|
107
|
+
this.destroy();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* ngModel
|
|
111
|
+
* ControlValueAccessor
|
|
112
|
+
*/
|
|
113
|
+
// ControlValueAccessor implementation
|
|
114
|
+
writeValue(value) {
|
|
115
|
+
this.data = value;
|
|
116
|
+
}
|
|
117
|
+
// Implemented as part of ControlValueAccessor
|
|
118
|
+
registerOnChange(fn) {
|
|
119
|
+
this.onChangeModel = fn;
|
|
120
|
+
}
|
|
121
|
+
// Implemented as part of ControlValueAccessor.
|
|
122
|
+
registerOnTouched(fn) {
|
|
123
|
+
this.onTouched = fn;
|
|
124
|
+
}
|
|
125
|
+
// Implemented as part of ControlValueAccessor.
|
|
126
|
+
setDisabledState(isDisabled) {
|
|
127
|
+
this.disabled = isDisabled;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* JSON EDITOR FUNCTIONS
|
|
131
|
+
*/
|
|
132
|
+
collapseAll() {
|
|
133
|
+
this.editor.collapseAll();
|
|
134
|
+
}
|
|
135
|
+
expandAll() {
|
|
136
|
+
this.editor.expandAll();
|
|
137
|
+
}
|
|
138
|
+
focus() {
|
|
139
|
+
this.editor.focus();
|
|
140
|
+
}
|
|
141
|
+
get() {
|
|
142
|
+
return this.editor.get();
|
|
143
|
+
}
|
|
144
|
+
getMode() {
|
|
145
|
+
return this.editor.getMode();
|
|
146
|
+
}
|
|
147
|
+
getName() {
|
|
148
|
+
return this.editor.getName();
|
|
149
|
+
}
|
|
150
|
+
getText() {
|
|
151
|
+
return this.editor.getText();
|
|
152
|
+
}
|
|
153
|
+
set(json) {
|
|
154
|
+
this.editor.set(json);
|
|
155
|
+
}
|
|
156
|
+
setMode(mode) {
|
|
157
|
+
this.editor.setMode(mode);
|
|
158
|
+
}
|
|
159
|
+
setName(name) {
|
|
160
|
+
this.editor.setName(name);
|
|
161
|
+
}
|
|
162
|
+
setSelection(start, end) {
|
|
163
|
+
this.editor.setSelection(start, end);
|
|
164
|
+
}
|
|
165
|
+
getSelection() {
|
|
166
|
+
return this.editor.getSelection();
|
|
167
|
+
}
|
|
168
|
+
getValidateSchema() {
|
|
169
|
+
//TODO: check if this is needed
|
|
170
|
+
return this.editor.validateSchema;
|
|
171
|
+
}
|
|
172
|
+
setSchema(schema, schemaRefs) {
|
|
173
|
+
this.editor.setSchema(schema, schemaRefs);
|
|
174
|
+
}
|
|
175
|
+
search(query) {
|
|
176
|
+
//TODO: check if this is needed
|
|
177
|
+
this.editor.search(query);
|
|
178
|
+
}
|
|
179
|
+
setOptions(newOptions) {
|
|
180
|
+
if (this.editor) {
|
|
181
|
+
this.editor.destroy();
|
|
182
|
+
}
|
|
183
|
+
this.optionsChanged = true;
|
|
184
|
+
this.options = newOptions;
|
|
185
|
+
this.ngOnInit();
|
|
186
|
+
}
|
|
187
|
+
update(json) {
|
|
188
|
+
this.editor.update(json);
|
|
189
|
+
}
|
|
190
|
+
destroy() {
|
|
191
|
+
this.editor.destroy();
|
|
192
|
+
}
|
|
193
|
+
getEditor() {
|
|
194
|
+
//TODO: made it any because of the missing type definition
|
|
195
|
+
return this.editor;
|
|
196
|
+
}
|
|
197
|
+
isValidJson() {
|
|
198
|
+
try {
|
|
199
|
+
JSON.parse(this.getText());
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
catch (e) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: EeJsonEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
207
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: EeJsonEditorComponent, isStandalone: true, selector: "json-editor", inputs: { options: "options", debug: "debug", data: "data" }, outputs: { change: "change", jsonChange: "jsonChange" }, providers: [
|
|
208
|
+
{
|
|
209
|
+
provide: NG_VALUE_ACCESSOR,
|
|
210
|
+
useExisting: forwardRef(() => EeJsonEditorComponent),
|
|
211
|
+
multi: true
|
|
212
|
+
}
|
|
213
|
+
], viewQueries: [{ propertyName: "jsonEditorContainer", first: true, predicate: ["jsonEditorContainer"], descendants: true, static: true }], ngImport: i0, template: `<div [id]="id" #jsonEditorContainer></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
214
|
+
}
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: EeJsonEditorComponent, decorators: [{
|
|
216
|
+
type: Component,
|
|
217
|
+
args: [{
|
|
218
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
219
|
+
selector: 'json-editor',
|
|
220
|
+
standalone: true,
|
|
221
|
+
template: `<div [id]="id" #jsonEditorContainer></div>`,
|
|
222
|
+
providers: [
|
|
223
|
+
{
|
|
224
|
+
provide: NG_VALUE_ACCESSOR,
|
|
225
|
+
useExisting: forwardRef(() => EeJsonEditorComponent),
|
|
226
|
+
multi: true
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
preserveWhitespaces: false,
|
|
230
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
231
|
+
}]
|
|
232
|
+
}], ctorParameters: () => [], propDecorators: { jsonEditorContainer: [{
|
|
233
|
+
type: ViewChild,
|
|
234
|
+
args: ['jsonEditorContainer', { static: true }]
|
|
235
|
+
}], options: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], change: [{
|
|
238
|
+
type: Output
|
|
239
|
+
}], jsonChange: [{
|
|
240
|
+
type: Output
|
|
241
|
+
}], debug: [{
|
|
242
|
+
type: Input
|
|
243
|
+
}], data: [{
|
|
244
|
+
type: Input,
|
|
245
|
+
args: ['data']
|
|
246
|
+
}] } });
|
|
247
|
+
|
|
248
|
+
/*
|
|
249
|
+
* Public API Surface of my-lib
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Generated bundle index. Do not edit.
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
export { EeJsonEditorComponent, JsonEditorOptions };
|
|
257
|
+
//# sourceMappingURL=ees-jsoneditor.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ees-jsoneditor.mjs","sources":["../../../projects/ees-jsoneditor/src/lib/jsoneditoroptions.ts","../../../projects/ees-jsoneditor/src/lib/jsoneditor.component.ts","../../../projects/ees-jsoneditor/src/public-api.ts","../../../projects/ees-jsoneditor/src/ees-jsoneditor.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\n\nexport type JsonEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text';\n\nexport interface JsonEditorTreeNode {\n field: String,\n value: String,\n path: String[]\n}\n\nexport interface IError {\n path: (string | number)[];\n message: string;\n}\n\nexport class JsonEditorOptions {\n public ace: any;\n public ajv: Object;\n\n\n /**\n * {function} onChange Callback method, triggered\n on change of contents.\n Does not pass the contents itself.\n See also `onChangeJSON` and\n `onChangeText`.\n */\n public onChange: () => void;\n\n /**\n * // {function} onChangeJSON Callback method, triggered\n// in modes on change of contents,\n// passing the changed contents\n// as JSON.\n// Only applicable for modes\n// 'tree', 'view', and 'form'.\n */\n public onChangeJSON?: () => void;\n\n\n public onNodeName: () => void;\n public onCreateMenu: (items: Array<any>, node: object) => Array<any>;\n public onColorPicker: () => void;\n\n /**\n // {function} onChangeText Callback method, triggered\n // in modes on change of contents,\n // passing the changed contents\n // as stringified JSON.\n */\n public onChangeText: (jsonstr: string) => void;\n\n\n /**\n * {function} onSelectionChange Callback method,\n triggered on node selection change\n Only applicable for modes\n 'tree', 'view', and 'form'\n */\n public onSelectionChange: () => void;\n\n /**\n * {function} onTextSelectionChange Callback method,\n triggered on text selection change\n Only applicable for modes\n */\n public onTextSelectionChange: () => void;\n\n\n /**\n * // {function} onEvent Callback method, triggered\n // when an event occurs in\n // a JSON field or value.\n // Only applicable for\n // modes 'form', 'tree' and\n // 'view'\n */\n public onEvent: () => void;\n\n /**\n * // * {function} onFocus Callback method, triggered\n// when the editor comes into focus,\n// passing an object {type, target},\n// Applicable for all modes\n */\n public onFocus: () => void;\n\n // * {function} onBlur Callback method, triggered\n // when the editor goes out of focus,\n // passing an object {type, target},\n // Applicable for all modes\n public onBlur: () => void;\n\n /**\n * // * {function} onClassName Callback method, triggered\n// when a Node DOM is rendered. Function returns\n// a css class name to be set on a node.\n// Only applicable for\n// modes 'form', 'tree' and\n// 'view'\n */\n public onClassName: (node: JsonEditorTreeNode) => void;\n\n public onEditable: (node: JsonEditorTreeNode | {}) => boolean | { field: boolean, value: boolean };\n\n /**\n * {function} onError Callback method, triggered\n when an error occurs\n */\n public onError: (error: any) => void;\n public onModeChange: (newMode: JsonEditorMode, oldMode: JsonEditorMode) => void;\n public onValidate: (json: Object) => IError[];\n public onValidationError: (errors: object[]) => void;\n\n public enableSort: boolean;\n public enableTransform: boolean;\n public escapeUnicode: boolean;\n public expandAll?: boolean;\n public sortObjectKeys: boolean;\n public history: boolean;\n public mode: JsonEditorMode;\n public modes: JsonEditorMode[];\n public name: String;\n public schema: Object;\n public search: boolean;\n public indentation: Number;\n public templates: Object;\n public theme: Number;\n public language: String;\n public languages: Object;\n public limitDragging: boolean;\n\n /**\n * Adds main menu bar - Contains format, sort, transform, search etc. functionality. True\n * by default. Applicable in all types of mode.\n */\n public mainMenuBar: boolean;\n\n /**\n * Adds navigation bar to the menu - the navigation bar visualize the current position on\n * the tree structure as well as allows breadcrumbs navigation.\n * True by default.\n * Only applicable when mode is 'tree', 'form' or 'view'.\n */\n public navigationBar: boolean;\n\n /**\n * Adds status bar to the bottom of the editor - the status bar shows the cursor position\n * and a count of the selected characters.\n * True by default.\n * Only applicable when mode is 'code' or 'text'.\n */\n public statusBar: boolean;\n\n constructor() {\n this.enableSort = true;\n this.enableTransform = true;\n this.escapeUnicode = false;\n this.expandAll = false;\n this.sortObjectKeys = false;\n this.history = true;\n this.mode = 'tree';\n this.search = true;\n this.indentation = 2;\n }\n}\n","/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @angular-eslint/no-input-rename */\n/* eslint-disable @angular-eslint/no-output-native */\n\nimport JSONEditor from 'jsoneditor';\n\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewChild,\n forwardRef\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { IError, JsonEditorMode, JsonEditorOptions, JsonEditorTreeNode } from './jsoneditoroptions';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'json-editor',\n standalone: true,\n template: `<div [id]=\"id\" #jsonEditorContainer></div>`,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => EeJsonEditorComponent),\n multi: true\n }\n ],\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\n\nexport class EeJsonEditorComponent implements ControlValueAccessor, OnInit, OnDestroy {\n @ViewChild('jsonEditorContainer', { static: true }) jsonEditorContainer: ElementRef;\n @Input() options: JsonEditorOptions = new JsonEditorOptions();\n @Output()\n change: EventEmitter<any> = new EventEmitter<any>();\n @Output()\n jsonChange: EventEmitter<any> = new EventEmitter<any>();\n @Input() debug = false;\n public optionsChanged = false;\n\n disabled = false;\n isFocused = false;\n\n public id = 'angjsoneditor' + Math.floor(Math.random() * 1000000);\n private _data: Object = {};\n private editor: JSONEditor;\n\n constructor() { }\n\n @Input('data')\n set data(value: Object) {\n this._data = value;\n if (this.editor) {\n this.editor.destroy();\n this.ngOnInit();\n }\n }\n\n ngOnInit() {\n let optionsBefore = this.options;\n if (!this.optionsChanged && this.editor) {\n //TODO: check if this is needed\n optionsBefore = (this.editor as any).options;\n }\n\n if (!this.options.onChangeJSON && this.jsonChange) {\n this.options.onChangeJSON = this.onChangeJSON;\n }\n if (!this.options.onChange && this.change) {\n this.options.onChange = this.onChange;\n }\n const optionsCopy = Object.assign({}, optionsBefore);\n\n // expandAll is an option only supported by ees-jsoneditor and not by the the original jsoneditor.\n delete optionsCopy.expandAll;\n if (this.debug) {\n console.log(optionsCopy, this._data);\n }\n if (!this.jsonEditorContainer.nativeElement) {\n console.error(`Can't find the ElementRef reference for jsoneditor)`);\n }\n\n if (\n optionsCopy.mode === 'text' || optionsCopy.mode === 'code' ||\n (\n optionsCopy.modes &&\n (optionsCopy.modes.indexOf('text') !== -1 || optionsCopy.modes.indexOf('code') !== -1)\n )\n ) {\n optionsCopy.onChangeJSON = undefined;\n }\n this.editor = new JSONEditor(this.jsonEditorContainer.nativeElement, optionsCopy as any, this._data);\n\n if (this.options.expandAll) {\n this.editor.expandAll();\n }\n }\n\n ngOnDestroy() {\n this.destroy();\n }\n\n\n /**\n * ngModel\n * ControlValueAccessor\n */\n\n // ControlValueAccessor implementation\n writeValue(value: any) {\n this.data = value;\n }\n\n // Implemented as part of ControlValueAccessor\n registerOnChange(fn: any) {\n this.onChangeModel = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n // Implemented as part of ControlValueAccessor.\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n public onChange = () => {\n if (this.editor) {\n try {\n const json = this.editor.get();\n this.onChangeModel(json);\n this.change.emit(json);\n } catch (error) {\n if (this.debug) {\n console.log(error);\n }\n }\n }\n }\n\n public onChangeJSON = () => {\n if (this.editor) {\n try {\n this.jsonChange.emit(this.editor.get());\n } catch (error) {\n if (this.debug) {\n console.log(error);\n }\n }\n }\n }\n\n\n /**\n * JSON EDITOR FUNCTIONS\n */\n\n public collapseAll() {\n this.editor.collapseAll();\n }\n\n public expandAll() {\n this.editor.expandAll();\n }\n\n public focus() {\n this.editor.focus();\n }\n\n public get(): JSON {\n return this.editor.get();\n }\n\n public getMode(): JsonEditorMode {\n return this.editor.getMode() as JsonEditorMode;\n }\n\n public getName(): string {\n return this.editor.getName()!;\n }\n\n public getText(): string {\n return this.editor.getText();\n }\n\n public set(json: JSON) {\n this.editor.set(json);\n }\n\n public setMode(mode: JsonEditorMode) {\n this.editor.setMode(mode);\n }\n\n public setName(name: string) {\n this.editor.setName(name);\n }\n\n public setSelection(start: any, end: any) {\n this.editor.setSelection(start, end);\n }\n\n public getSelection(): any {\n return this.editor.getSelection();\n }\n\n public getValidateSchema(): any {\n //TODO: check if this is needed\n return (this.editor as any).validateSchema;\n }\n\n public setSchema(schema: any, schemaRefs: any) {\n this.editor.setSchema(schema, schemaRefs);\n }\n\n public search(query: string) {\n //TODO: check if this is needed\n (this.editor as any).search(query);\n }\n\n public setOptions(newOptions: JsonEditorOptions) {\n if (this.editor) {\n this.editor.destroy();\n }\n this.optionsChanged = true;\n this.options = newOptions;\n this.ngOnInit();\n }\n\n public update(json: JSON) {\n this.editor.update(json);\n }\n\n public destroy() {\n this.editor.destroy();\n }\n\n public getEditor(){\n //TODO: made it any because of the missing type definition\n return this.editor as any;\n }\n\n public isValidJson() {\n try {\n JSON.parse(this.getText());\n return true;\n } catch (e) {\n return false;\n }\n }\n\n // Implemented as part of ControlValueAccessor.\n private onTouched = () => {\n };\n\n // Implemented as part of ControlValueAccessor.\n private onChangeModel = (e: any) => {\n };\n}\n\nexport { JsonEditorOptions, JsonEditorMode, JsonEditorTreeNode, IError };\n","/*\n * Public API Surface of my-lib\n */\n\nexport * from './lib/jsoneditor.component';\nexport * from './lib/jsoneditoroptions';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;MAea,iBAAiB,CAAA;AA2I5B,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI;AAC3B,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK;AAC1B,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK;AACtB,QAAA,IAAI,CAAC,cAAc,GAAG,KAAK;AAC3B,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,MAAM;AAClB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI;AAClB,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC;IACtB;AACD;;ACrKD;AACA;AACA;MAmCa,qBAAqB,CAAA;AAiBhC,IAAA,WAAA,GAAA;AAfS,QAAA,IAAA,CAAA,OAAO,GAAsB,IAAI,iBAAiB,EAAE;AAE7D,QAAA,IAAA,CAAA,MAAM,GAAsB,IAAI,YAAY,EAAO;AAEnD,QAAA,IAAA,CAAA,UAAU,GAAsB,IAAI,YAAY,EAAO;QAC9C,IAAA,CAAA,KAAK,GAAG,KAAK;QACf,IAAA,CAAA,cAAc,GAAG,KAAK;QAE7B,IAAA,CAAA,QAAQ,GAAG,KAAK;QAChB,IAAA,CAAA,SAAS,GAAG,KAAK;AAEV,QAAA,IAAA,CAAA,EAAE,GAAG,eAAe,GAAG,IAAI,CAAC,KAAK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,EAAE,CAAA,0CAAA,CAA4C;AACtD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE;AACR;AACF,qBAAA;AACD,oBAAA,mBAAmB,EAAE,KAAK;oBAC1B,eAAe,EAAE,uBAAuB,CAAC;AAC1C,iBAAA;;sBAGE,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,qBAAqB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBACjD;;sBACA;;sBAEA;;sBAEA;;sBAYA,KAAK;uBAAC,MAAM;;;ACxDf;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, ElementRef, EventEmitter } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
type JsonEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text';
|
|
6
|
+
interface JsonEditorTreeNode {
|
|
7
|
+
field: String;
|
|
8
|
+
value: String;
|
|
9
|
+
path: String[];
|
|
10
|
+
}
|
|
11
|
+
interface IError {
|
|
12
|
+
path: (string | number)[];
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
declare class JsonEditorOptions {
|
|
16
|
+
ace: any;
|
|
17
|
+
ajv: Object;
|
|
18
|
+
/**
|
|
19
|
+
* {function} onChange Callback method, triggered
|
|
20
|
+
on change of contents.
|
|
21
|
+
Does not pass the contents itself.
|
|
22
|
+
See also `onChangeJSON` and
|
|
23
|
+
`onChangeText`.
|
|
24
|
+
*/
|
|
25
|
+
onChange: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* // {function} onChangeJSON Callback method, triggered
|
|
28
|
+
// in modes on change of contents,
|
|
29
|
+
// passing the changed contents
|
|
30
|
+
// as JSON.
|
|
31
|
+
// Only applicable for modes
|
|
32
|
+
// 'tree', 'view', and 'form'.
|
|
33
|
+
*/
|
|
34
|
+
onChangeJSON?: () => void;
|
|
35
|
+
onNodeName: () => void;
|
|
36
|
+
onCreateMenu: (items: Array<any>, node: object) => Array<any>;
|
|
37
|
+
onColorPicker: () => void;
|
|
38
|
+
/**
|
|
39
|
+
// {function} onChangeText Callback method, triggered
|
|
40
|
+
// in modes on change of contents,
|
|
41
|
+
// passing the changed contents
|
|
42
|
+
// as stringified JSON.
|
|
43
|
+
*/
|
|
44
|
+
onChangeText: (jsonstr: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* {function} onSelectionChange Callback method,
|
|
47
|
+
triggered on node selection change
|
|
48
|
+
Only applicable for modes
|
|
49
|
+
'tree', 'view', and 'form'
|
|
50
|
+
*/
|
|
51
|
+
onSelectionChange: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* {function} onTextSelectionChange Callback method,
|
|
54
|
+
triggered on text selection change
|
|
55
|
+
Only applicable for modes
|
|
56
|
+
*/
|
|
57
|
+
onTextSelectionChange: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* // {function} onEvent Callback method, triggered
|
|
60
|
+
// when an event occurs in
|
|
61
|
+
// a JSON field or value.
|
|
62
|
+
// Only applicable for
|
|
63
|
+
// modes 'form', 'tree' and
|
|
64
|
+
// 'view'
|
|
65
|
+
*/
|
|
66
|
+
onEvent: () => void;
|
|
67
|
+
/**
|
|
68
|
+
* // * {function} onFocus Callback method, triggered
|
|
69
|
+
// when the editor comes into focus,
|
|
70
|
+
// passing an object {type, target},
|
|
71
|
+
// Applicable for all modes
|
|
72
|
+
*/
|
|
73
|
+
onFocus: () => void;
|
|
74
|
+
onBlur: () => void;
|
|
75
|
+
/**
|
|
76
|
+
* // * {function} onClassName Callback method, triggered
|
|
77
|
+
// when a Node DOM is rendered. Function returns
|
|
78
|
+
// a css class name to be set on a node.
|
|
79
|
+
// Only applicable for
|
|
80
|
+
// modes 'form', 'tree' and
|
|
81
|
+
// 'view'
|
|
82
|
+
*/
|
|
83
|
+
onClassName: (node: JsonEditorTreeNode) => void;
|
|
84
|
+
onEditable: (node: JsonEditorTreeNode | {}) => boolean | {
|
|
85
|
+
field: boolean;
|
|
86
|
+
value: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* {function} onError Callback method, triggered
|
|
90
|
+
when an error occurs
|
|
91
|
+
*/
|
|
92
|
+
onError: (error: any) => void;
|
|
93
|
+
onModeChange: (newMode: JsonEditorMode, oldMode: JsonEditorMode) => void;
|
|
94
|
+
onValidate: (json: Object) => IError[];
|
|
95
|
+
onValidationError: (errors: object[]) => void;
|
|
96
|
+
enableSort: boolean;
|
|
97
|
+
enableTransform: boolean;
|
|
98
|
+
escapeUnicode: boolean;
|
|
99
|
+
expandAll?: boolean;
|
|
100
|
+
sortObjectKeys: boolean;
|
|
101
|
+
history: boolean;
|
|
102
|
+
mode: JsonEditorMode;
|
|
103
|
+
modes: JsonEditorMode[];
|
|
104
|
+
name: String;
|
|
105
|
+
schema: Object;
|
|
106
|
+
search: boolean;
|
|
107
|
+
indentation: Number;
|
|
108
|
+
templates: Object;
|
|
109
|
+
theme: Number;
|
|
110
|
+
language: String;
|
|
111
|
+
languages: Object;
|
|
112
|
+
limitDragging: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Adds main menu bar - Contains format, sort, transform, search etc. functionality. True
|
|
115
|
+
* by default. Applicable in all types of mode.
|
|
116
|
+
*/
|
|
117
|
+
mainMenuBar: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Adds navigation bar to the menu - the navigation bar visualize the current position on
|
|
120
|
+
* the tree structure as well as allows breadcrumbs navigation.
|
|
121
|
+
* True by default.
|
|
122
|
+
* Only applicable when mode is 'tree', 'form' or 'view'.
|
|
123
|
+
*/
|
|
124
|
+
navigationBar: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Adds status bar to the bottom of the editor - the status bar shows the cursor position
|
|
127
|
+
* and a count of the selected characters.
|
|
128
|
+
* True by default.
|
|
129
|
+
* Only applicable when mode is 'code' or 'text'.
|
|
130
|
+
*/
|
|
131
|
+
statusBar: boolean;
|
|
132
|
+
constructor();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare class EeJsonEditorComponent implements ControlValueAccessor, OnInit, OnDestroy {
|
|
136
|
+
jsonEditorContainer: ElementRef;
|
|
137
|
+
options: JsonEditorOptions;
|
|
138
|
+
change: EventEmitter<any>;
|
|
139
|
+
jsonChange: EventEmitter<any>;
|
|
140
|
+
debug: boolean;
|
|
141
|
+
optionsChanged: boolean;
|
|
142
|
+
disabled: boolean;
|
|
143
|
+
isFocused: boolean;
|
|
144
|
+
id: string;
|
|
145
|
+
private _data;
|
|
146
|
+
private editor;
|
|
147
|
+
constructor();
|
|
148
|
+
set data(value: Object);
|
|
149
|
+
ngOnInit(): void;
|
|
150
|
+
ngOnDestroy(): void;
|
|
151
|
+
/**
|
|
152
|
+
* ngModel
|
|
153
|
+
* ControlValueAccessor
|
|
154
|
+
*/
|
|
155
|
+
writeValue(value: any): void;
|
|
156
|
+
registerOnChange(fn: any): void;
|
|
157
|
+
registerOnTouched(fn: any): void;
|
|
158
|
+
setDisabledState(isDisabled: boolean): void;
|
|
159
|
+
onChange: () => void;
|
|
160
|
+
onChangeJSON: () => void;
|
|
161
|
+
/**
|
|
162
|
+
* JSON EDITOR FUNCTIONS
|
|
163
|
+
*/
|
|
164
|
+
collapseAll(): void;
|
|
165
|
+
expandAll(): void;
|
|
166
|
+
focus(): void;
|
|
167
|
+
get(): JSON;
|
|
168
|
+
getMode(): JsonEditorMode;
|
|
169
|
+
getName(): string;
|
|
170
|
+
getText(): string;
|
|
171
|
+
set(json: JSON): void;
|
|
172
|
+
setMode(mode: JsonEditorMode): void;
|
|
173
|
+
setName(name: string): void;
|
|
174
|
+
setSelection(start: any, end: any): void;
|
|
175
|
+
getSelection(): any;
|
|
176
|
+
getValidateSchema(): any;
|
|
177
|
+
setSchema(schema: any, schemaRefs: any): void;
|
|
178
|
+
search(query: string): void;
|
|
179
|
+
setOptions(newOptions: JsonEditorOptions): void;
|
|
180
|
+
update(json: JSON): void;
|
|
181
|
+
destroy(): void;
|
|
182
|
+
getEditor(): any;
|
|
183
|
+
isValidJson(): boolean;
|
|
184
|
+
private onTouched;
|
|
185
|
+
private onChangeModel;
|
|
186
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EeJsonEditorComponent, never>;
|
|
187
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EeJsonEditorComponent, "json-editor", never, { "options": { "alias": "options"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "data": { "alias": "data"; "required": false; }; }, { "change": "change"; "jsonChange": "jsonChange"; }, never, never, true, never>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export { EeJsonEditorComponent, JsonEditorOptions };
|
|
191
|
+
export type { IError, JsonEditorMode, JsonEditorTreeNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ees-jsoneditor",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -70,7 +70,15 @@
|
|
|
70
70
|
"typescript": "5.9.3"
|
|
71
71
|
},
|
|
72
72
|
"description": "",
|
|
73
|
-
"main": "
|
|
73
|
+
"main": "./projects/ees-jsoneditor/src/public-api.ts",
|
|
74
|
+
"module": "./projects/ees-jsoneditor/src/public-api.ts",
|
|
75
|
+
"types": "./projects/ees-jsoneditor/src/public-api.ts",
|
|
76
|
+
"exports": {
|
|
77
|
+
".": {
|
|
78
|
+
"types": "./projects/ees-jsoneditor/src/public-api.ts",
|
|
79
|
+
"default": "./projects/ees-jsoneditor/src/public-api.ts"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
74
82
|
"author": "Yasir Nazir",
|
|
75
83
|
"bugs": {
|
|
76
84
|
"url": "https://github.com/yasir-nazir/ees-jsoneditor/issues"
|