Skip to content

Commit

Permalink
#55
Browse files Browse the repository at this point in the history
  • Loading branch information
mariohmol committed Feb 8, 2020
1 parent 71db660 commit 22ef5fc
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 62 deletions.
2 changes: 1 addition & 1 deletion ang-jsoneditor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ang-jsoneditor",
"version": "1.9.0",
"version": "1.9.1",
"license": "MIT",
"homepage": "https://github.com/mariohmol/ang-jsoneditor",
"repository": {
Expand Down
1 change: 0 additions & 1 deletion ang-jsoneditor/src/jsoneditor/jsoneditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class JsonEditorComponent implements ControlValueAccessor, OnInit {
}
}


public onChangeJSON(e) {
if (this.editor) {
this.jsonChange.emit(this.editor.get());
Expand Down
204 changes: 146 additions & 58 deletions ang-jsoneditor/src/jsoneditor/jsoneditoroptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,150 @@ export interface IError {
}

export class JsonEditorOptions {
public ace: any;
public ajv: Object;
public onChange: () => void;
public onChangeJSON: () => void;
public onEditable: (node: JsonEditorTreeNode | {}) => boolean | { field: boolean, value: boolean };
public onError: (error: any) => void;
public onModeChange: (newMode: JsonEditorMode, oldMode: JsonEditorMode) => void;
public onValidate: (json: Object) => IError[];
public enableSort: boolean;
public enableTransform: boolean;
public escapeUnicode: boolean;
public expandAll: boolean;
public sortObjectKeys: boolean;
public history: boolean;
public mode: JsonEditorMode;
public modes: JsonEditorMode[];
public name: String;
public schema: Object;
public search: boolean;
public indentation: Number;
public template: Object;
public theme: Number;
public language: String;
public languages: Object;

/**
* Adds main menu bar - Contains format, sort, transform, search etc. functionality. True
* by default. Applicable in all types of mode.
*/
public mainMenuBar: boolean;

/**
* Adds navigation bar to the menu - the navigation bar visualize the current position on
* the tree structure as well as allows breadcrumbs navigation.
* True by default.
* Only applicable when mode is 'tree', 'form' or 'view'.
*/
public navigationBar: boolean;

/**
* Adds status bar to the bottom of the editor - the status bar shows the cursor position
* and a count of the selected characters.
* True by default.
* Only applicable when mode is 'code' or 'text'.
*/
public statusBar: boolean;

constructor() {
this.enableSort = true;
this.enableTransform = true;
this.escapeUnicode = false;
this.expandAll = false;
this.sortObjectKeys = false;
this.history = true;
this.mode = 'tree';
this.search = true;
this.indentation = 2;
}
public ace: any;
public ajv: Object;


/**
* {function} onChange Callback method, triggered
on change of contents.
Does not pass the contents itself.
See also `onChangeJSON` and
`onChangeText`.
*/
public onChange: () => void;

/**
* // {function} onChangeJSON Callback method, triggered
// in modes on change of contents,
// passing the changed contents
// as JSON.
// Only applicable for modes
// 'tree', 'view', and 'form'.
*/
public onChangeJSON: () => void;


public onNodeName: () => void;
public onCreateMenu: () => void;
public onColorPicker: () => void;

/**
* // {function} onChangeText Callback method, triggered
// in modes on change of contents,
// passing the changed contents
// as stringified JSON.
*/
public onChangeText: () => void;


/**
* {function} onSelectionChange Callback method,
triggered on node selection change
Only applicable for modes
'tree', 'view', and 'form'
*/
public onSelectionChange: () => void;

/**
* {function} onTextSelectionChange Callback method,
triggered on text selection change
Only applicable for modes
*/
public onTextSelectionChange: () => void;


/**
* // {function} onEvent Callback method, triggered
// when an event occurs in
// a JSON field or value.
// Only applicable for
// modes 'form', 'tree' and
// 'view'
*/
public onEvent: () => void;

/**
* // * {function} onFocus Callback method, triggered
// when the editor comes into focus,
// passing an object {type, target},
// Applicable for all modes
*/
public onFocus: () => void;

// * {function} onBlur Callback method, triggered
// when the editor goes out of focus,
// passing an object {type, target},
// Applicable for all modes
public onBlur: () => void;

/**
* // * {function} onClassName Callback method, triggered
// when a Node DOM is rendered. Function returns
// a css class name to be set on a node.
// Only applicable for
// modes 'form', 'tree' and
// 'view'
*/
public onClassName: () => void;

public onEditable: (node: JsonEditorTreeNode | {}) => boolean | { field: boolean, value: boolean };

/**
* {function} onError Callback method, triggered
when an error occurs
*/
public onError: (error: any) => void;
public onModeChange: (newMode: JsonEditorMode, oldMode: JsonEditorMode) => void;
public onValidate: (json: Object) => IError[];
public enableSort: boolean;
public enableTransform: boolean;
public escapeUnicode: boolean;
public expandAll: boolean;
public sortObjectKeys: boolean;
public history: boolean;
public mode: JsonEditorMode;
public modes: JsonEditorMode[];
public name: String;
public schema: Object;
public search: boolean;
public indentation: Number;
public template: Object;
public theme: Number;
public language: String;
public languages: Object;

/**
* Adds main menu bar - Contains format, sort, transform, search etc. functionality. True
* by default. Applicable in all types of mode.
*/
public mainMenuBar: boolean;

/**
* Adds navigation bar to the menu - the navigation bar visualize the current position on
* the tree structure as well as allows breadcrumbs navigation.
* True by default.
* Only applicable when mode is 'tree', 'form' or 'view'.
*/
public navigationBar: boolean;

/**
* Adds status bar to the bottom of the editor - the status bar shows the cursor position
* and a count of the selected characters.
* True by default.
* Only applicable when mode is 'code' or 'text'.
*/
public statusBar: boolean;

constructor() {
this.enableSort = true;
this.enableTransform = true;
this.escapeUnicode = false;
this.expandAll = false;
this.sortObjectKeys = false;
this.history = true;
this.mode = 'tree';
this.search = true;
this.indentation = 2;
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ang-jsoneditor",
"version": "1.9.0",
"private": true,
"version": "1.9.1",
"private": false,
"repository": {
"type": "git",
"url": "https://github.com/mariohmol/ang-jsoneditor"
Expand Down

0 comments on commit 22ef5fc

Please sign in to comment.