
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
jsoneditor-react18
Advanced tools
React implementation of https://github.com/josdejong/jsoneditor
react18 fork of vankop/jsoneditor-react
react wrapper implementation for josdejong/jsoneditor
npm install --save jsoneditor jsoneditor-react18
jsoneditor-react18
using minimalist version of jsoneditor
to minimize flat bundle size, so if you want to use Ajv or Ace Editor install them as well
Version 3.0.0
and higher provide only es build. Also you need some loaders (in terms of webpack) to load json editor icons and css, e.g.:
module.exports = {
module: {
rules: [
{test: /\.css$/, loader: 'css-loader'},
{test: /\.svg$/, loader: 'file-loader'}
]
}
};
import { JsonEditor as Editor } from 'jsoneditor-react18';
import 'jsoneditor-react18/es/editor.min.css';
later in render method:
render() {
return (
<Editor
value={yourJson}
onChange={this.handleChange}
/>
);
}
If you want use with Ajv:
import Ajv from 'ajv';
const ajv = new Ajv({ allErrors: true, verbose: true });
...
render() {
return (
<Editor
value={yourJson}
onChange={this.handleChange}
ajv={ajv}
schema={yourSchema}
/>
);
}
If you want use with Ace Editor:
import ace from 'brace';
import 'brace/mode/json';
import 'brace/theme/github';
...
render() {
return (
<Editor
value={yourJson}
onChange={this.handleChange}
ace={ace}
theme="ace/theme/github"
schema={yourSchema}
/>
);
}
Or:
import 'brace';
import 'brace/mode/json';
import 'brace/theme/github';
...
render() {
return (
<Editor
value={yourJson}
onChange={this.handleChange}
theme="ace/theme/github"
schema={yourSchema}
/>
);
}
Or define your own ace theme
If you using webpack and es6 dynamic imports you can load jsoneditor-react18
asynchronously.
You can use react-imported-component or your own implementation
import importedComponent from 'react-imported-component';
const JsonEditor = importedComponent(() => import(/* webpackChunkName:'jsoneditor' */'jsoneditor-react18'));
Or with Ajv and Ace Editor:
const JsonEditor = importedComponent(() => Promise.all([
import(/* webpackChunkName:'jsoneditor' */'jsoneditor-react18'),
import(/* webpackChunkName:'jsoneditor' */'brace'),
import(/* webpackChunkName:'jsoneditor' */'ajv'),
import(/* webpackChunkName:'jsoneditor' */'brace/mode/json'),
import(/* webpackChunkName:'jsoneditor' */'brace/theme/github')
]).then(([{ JsonEditor: Editor }, ace, Ajv ]) => {
const ajv = new Ajv();
return function EditorHoc(props) {
return (
<Editor
ace={ace}
ajv={ajv}
theme="ace/theme/github"
{...props}
/>
);
}
}));
You can view usage of jsoneditor-react18
using our storybook.
npm run dev
http://localhost:9001
Right now only one story exporting in storybook: /stories/Editor.jsx
, to add more use /.storybook/config.js
Working on docs
folder.
Right now you can use props declaration
Will be soon!😁
FAQs
React implementation of https://github.com/josdejong/jsoneditor
The npm package jsoneditor-react18 receives a total of 690 weekly downloads. As such, jsoneditor-react18 popularity was classified as not popular.
We found that jsoneditor-react18 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.