Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update docs
  • Loading branch information
mac-s-g committed Jun 25, 2017
commit d6e0c5e5390c29872bde1be787365b597591f58c
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ Name|Type|Default|Description
`enableClipboard`|`boolean`|`true`|When set to `true`, the user can copy objects and arrays to clipboard
`displayObjectSize`|`boolean`|`true`|When set to `true`, objects and arrays are labeled with size
`displayDataTypes`|`boolean`|`true`|When set to `true`, data type labels prefix values
`onEdit`|`(edit) => {}`|`false`|When a callback function is passed in, value edits are enabled. The callback is invoked when edits are made. [see: onEdit docs](#onedit-interaction)
`onAdd`|`(add) => {}`|`false`|When a callback function is passed in, `add` functionality is enabled. The callback is invoked before additions are completed. Returning `false` from `onAdd` will prevent the change from being made.
`onDelete`|`(delete) => {}`|`false`|When a callback function is passed in, `delete` functionality is enabled. The callback is invoked before deletions are completed. Returning `false` from `onDelete` will prevent the change from being made.
`onEdit`|`(edit) => {}`|`false`|When a callback function is passed in, `edit` functionality is enabled. The callback is invoked before edits are completed. Returning `false` from `onEdit` will prevent the change from being made. [see: onEdit docs](#onedit-interaction)

### Features
* Object and array nodes can be collapsed and expanded
Expand Down Expand Up @@ -144,5 +146,6 @@ I drew a ton of design ideas from [react-json-tree](https://github.com/alexkuz/r
I'm also inspired by users who come up with interesting feature requests. Reach out to me with ideas for this project or other projects you want to collaborate on. My email address is listed on my [github user page](https://github.com/mac-s-g).

### To-Do's
1. Support "delete" capability when `onEdit` is enabled
2. Support "add" capability when `onEdit` is enabled
1. Improve documentation for `onAdd` and `onDelete` props
2. Improve style organization
3. Support integer input to `collapsed` prop to collapse at a particular depth.
6 changes: 3 additions & 3 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ ReactDom.render(
<JsonViewer
src={getExampleJson1()}
collapseStringsAfterLength={12}
onEdit={(e)=>{console.log(e)}}
onDelete={(e)=>{console.log(e)}}
onAdd={(e)=>{console.log(e)}} />
onEdit={(e)=>{console.log(e); return false;}}
onDelete={(e)=>{console.log(e); return false;}}
onAdd={(e)=>{console.log(e); return false;}} />

<br />

Expand Down