Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
94 changes: 52 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-json-editor-viewer",
"version": "1.0.7",
"version": "1.1.1",
"description": "React JSON Editor and JSON Viewer",
"main": "build/index.js",
"scripts": {
Expand Down Expand Up @@ -56,7 +56,7 @@
"raf": "3.4.0",
"react": "17.0.2",
"react-dev-utils": "^4.2.1",
"react-dom": "^16.2.0",
"react-dom": "17.0.2",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.6.2",
Expand Down
69 changes: 55 additions & 14 deletions src/demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,66 @@ import { JSONEditor } from "../lib";
// to compile a production version
//npm publish to publish

const App = () => (
<div>
<h3>Using default styles</h3>
<JSONEditor
data={data}
view="dual"
collapsible
onChange={this.onJsonChange}
/>
const App = () => {
const onJsonChange = (key, value, parent, data) => {
console.log(key, value, parent, data);
};
return (
<div>
<h3>Empty object</h3>
<JSONEditor
data={{}}
view="single"
collapsible
onChange={onJsonChange}
/>{" "}
<h3>Empty array</h3>
<JSONEditor
data={[]}
view="single"
collapsible
onChange={onJsonChange}
/>{" "}
<h3>Empty string</h3>
<JSONEditor
data={""}
view="single"
collapsible
onChange={onJsonChange}
/>{" "}
<h3>A number</h3>
<JSONEditor
data={1}
view="single"
collapsible
onChange={onJsonChange}
/>{" "}
<h3>A boolean</h3>
<JSONEditor
data={true}
view="single"
collapsible
onChange={onJsonChange}
/>{" "}
<h3>Data</h3>
<JSONEditor
data={data}
view="single"
collapsible
onChange={onJsonChange}
/>
{/*
<h3>Using customized styles</h3>
<JSONEditor
data={data}
view="dual"
view="single"
collapsible
onChange={this.onJsonChange}
onChange={onJsonChange}
styles={styles}
/>
</div>
);
/> */}
</div>
);
};

const styles = {
dualView: {
Expand Down
Loading