Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit b75ef88

Browse files
committed
clarify entityType
1 parent 8f72816 commit b75ef88

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const markdownPlugin = createMarkdownPlugin({ renderLanguageSelect })
5757
```
5858

5959
### `languages`
60+
6061
Dictionary for languages available to code block switcher
6162

6263
#### Example:
@@ -70,6 +71,7 @@ const markdownPlugin = createMarkdownPlugin({ languages })
7071
```
7172

7273
### `features`
74+
7375
A list of enabled features, by default all features are turned on.
7476

7577
```js
@@ -126,17 +128,28 @@ import { CHECKABLE_LIST_ITEM } from "draft-js-checkable-list-item"
126128
```
127129

128130
### `entityType`
129-
Dictionary for `IMAGE` and `LINK` entity.
131+
132+
To interoperate this plugin with other DraftJS plugins, i.e. [`draft-js-plugins`](https://github.com/draft-js-plugins/draft-js-plugins), you might need to customize the `LINK` and `IMAGE` entity type created by `draft-js-markdown-plugin`.
130133

131134
#### Example:
132135

133136
```js
137+
import createMarkdownPlugin from "draft-js-markdown-plugin";
138+
import createFocusPlugin from "draft-js-focus-plugin";
139+
import createImagePlugin from "draft-js-image-plugin";
140+
134141
const entityType = {
135142
IMAGE: "IMAGE",
136-
LINK: "LINK",
137-
}
143+
};
144+
145+
const focusPlugin = createFocusPlugin();
146+
const imagePlugin = createImagePlugin({
147+
decorator: focusPlugin.decorator,
148+
});
149+
// For `draft-js-image-plugin` to work, the entity type of an image must be `IMAGE`.
150+
const markdownPlugin = createMarkdownPlugin({ entityType });
138151

139-
const markdownPlugin = createMarkdownPlugin({ entityType })
152+
const editorPlugins = [focusPlugin, imagePlugin, markdownPlugin];
140153
```
141154

142155
## Usage

0 commit comments

Comments
 (0)