Skip to content

Commit

Permalink
Update readme: add config example
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Orlandau committed Feb 11, 2021
1 parent 29a5880 commit 99162cf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React Jodit Wrapper

A React wrapper for Jodit that supports SSR and it's fully written in Typescript.
A React wrapper for Jodit that works.

[![NPM version][npm-image]][npm-url] ![ci](https://github.com/fedeorlandau/jodit-react-ts/workflows/CI/badge.svg)
[![Downloads][downloads-image]][npm-url]
Expand Down Expand Up @@ -62,6 +62,34 @@ const MyEditorWrapper = () => {
};
```

## Config
- Example of jodit config

```tsx
import * as React from 'react';
import JoditReact from "jodit-react-ts";
import 'jodit/build/jodit.min.css';

/**
* This needs to be defined outside the scope of our wrapper otherwise will cause multiple re-renders
**/

const config = {
preset: 'inline'
};

const App = () => {
const [value, setValue] = React.useState<string>();

return (
<>
<JoditReact onChange={(content) => setValue(content)} defaultValue="Hi" config={config} />
{value}
</>
);
};
```

## Props


Expand Down
2 changes: 1 addition & 1 deletion example/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'react-app-polyfill/ie11';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import JoditReact from '../src/';
import 'jodit/build/jodit.min.css'
import 'jodit/build/jodit.min.css';

const App = () => {
const [value, setValue] = React.useState<string>();
Expand Down

0 comments on commit 99162cf

Please sign in to comment.