From 22ef5fc9121e57f5964db6f578aee7b1e617fe9b Mon Sep 17 00:00:00 2001 From: Mario Mol Date: Fri, 7 Feb 2020 23:53:26 -0300 Subject: [PATCH] #55 --- ang-jsoneditor/package.json | 2 +- .../src/jsoneditor/jsoneditor.component.ts | 1 - .../src/jsoneditor/jsoneditoroptions.ts | 204 +++++++++++++----- package.json | 4 +- 4 files changed, 149 insertions(+), 62 deletions(-) diff --git a/ang-jsoneditor/package.json b/ang-jsoneditor/package.json index a1f6d59..b98c880 100644 --- a/ang-jsoneditor/package.json +++ b/ang-jsoneditor/package.json @@ -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": { diff --git a/ang-jsoneditor/src/jsoneditor/jsoneditor.component.ts b/ang-jsoneditor/src/jsoneditor/jsoneditor.component.ts index 9f7bf11..ef74c1e 100644 --- a/ang-jsoneditor/src/jsoneditor/jsoneditor.component.ts +++ b/ang-jsoneditor/src/jsoneditor/jsoneditor.component.ts @@ -123,7 +123,6 @@ export class JsonEditorComponent implements ControlValueAccessor, OnInit { } } - public onChangeJSON(e) { if (this.editor) { this.jsonChange.emit(this.editor.get()); diff --git a/ang-jsoneditor/src/jsoneditor/jsoneditoroptions.ts b/ang-jsoneditor/src/jsoneditor/jsoneditoroptions.ts index 308a561..295542a 100644 --- a/ang-jsoneditor/src/jsoneditor/jsoneditoroptions.ts +++ b/ang-jsoneditor/src/jsoneditor/jsoneditoroptions.ts @@ -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; + } } diff --git a/package.json b/package.json index 012c90c..2cc8f9f 100644 --- a/package.json +++ b/package.json @@ -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"