1 |
|
2 | # Draft Regex
|
3 |
|
4 | These plugins are written for Draft.js and React to improve TextEditor capabilities.
|
5 |
|
6 | ## In details
|
7 |
|
8 | 1. `git clone https://github.com/YozhikM/draft-regex.git`
|
9 | 2. `npm install` *or* `yarn install`
|
10 | 3. `npm start` *or* `yarn start` for demo
|
11 | 4. `npm run build` *or* `yarn build` for build of modules
|
12 |
|
13 | To use static typing, make sure [that you have installed Flow](https://flow.org/en/docs/install).
|
14 |
|
15 | ## How to use
|
16 |
|
17 | ![Draft Regex](https://i.imgur.com/xzQyZpj.png)
|
18 |
|
19 | ## API
|
20 |
|
21 | All plugin as an argument are taken by EditorState and options and returned EditorState.
|
22 |
|
23 | #### `clearEmptyBlock`
|
24 | Prevents the ability to add blank lines more than 3 (varies in settings).
|
25 |
|
26 | #### `replaceTextRegex`
|
27 | Apply regular expressions to the entire text, in the process of typing or after copy/pasting text.
|
28 |
|
29 | #### `clearPastedStyle`
|
30 | Clears styles of copy/pasted text to those that you have.
|