Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oakfang/draft-js-regex-decorator
A RegEx based DraftJS decorator
https://github.com/oakfang/draft-js-regex-decorator
Last synced: 20 days ago
JSON representation
A RegEx based DraftJS decorator
- Host: GitHub
- URL: https://github.com/oakfang/draft-js-regex-decorator
- Owner: oakfang
- License: mit
- Created: 2019-11-06T08:59:16.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T00:37:43.000Z (about 2 years ago)
- Last Synced: 2024-11-09T18:19:25.336Z (3 months ago)
- Language: TypeScript
- Size: 2.02 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# draft-js-regex-decorator
A RegEx based DraftJS decorator
## Usage:
```jsx
import { Editor, EditorState, CompositeDecorator } from 'draft-js';
import createRegExDecorator from 'draft-js-regex-decorator';function TextEditor() {
const [editorState, setEditorState] = useState(EditorState.createEmpty());
const onChange = editorState => {
setEditorState(
EditorState.set(editorState, {
decorator: new CompositeDecorator(createRegExDecorator(/hello/gi)),
})
);
};return ;
}
```