Skip to content

Commit 643854e

Browse files
committed
Provide your own implementation to embed the URL.
1 parent f323b1b commit 643854e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ When integrate the plugin with `draft-js-side-toolbar-plugin` and click the Embe
4040
Pressing Enter will close and embed the URL; but, losing the focus, pressing ESC or DEL with empty text will close the Embedder.
4141

4242
## Configuration
43-
| Param | Default | Description |
44-
|--------------|-------------------------------------|-------------------------------------------------------------------|
45-
| embedderType | 'draft-js-iframely-plugin-embedder' | Type of entity created when inserting the embedder block. |
46-
| embedType | 'draft-js-iframely-plugin-embed' | Type of entity created when embedding the URL. |
47-
| decorator | - | Empty decorator that returns the same component. (No decorations) |
48-
| theme | Default styles | draft-js-iframely-plugin/lib/plugin.css |
49-
| options | Default behavior | List of options. |
43+
| Param | Default | Description |
44+
|----------------|-------------------------------------|-------------------------------------------------------------------------|
45+
| theme | Default styles | draft-js-iframely-plugin/lib/plugin.css |
46+
| options | Default behavior | List of options. |
47+
| embedderType | 'draft-js-iframely-plugin-embedder' | Type of entity created when inserting the embedder block. |
48+
| embedType | 'draft-js-iframely-plugin-embed' | Type of entity created when embedding the URL. |
49+
| decorator | - | Empty decorator that returns the same component. (No decorations) |
50+
| embedComponent | Default implementation | Provide your own implementation to embed the URL. |
5051

5152
#### Options
5253
| Option | Default | Description |

src/createIframelyPlugin.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default ({
3434
options = {},
3535
embedderType = 'draft-js-iframely-plugin-embedder',
3636
embedType = 'draft-js-iframely-plugin-embed',
37-
decorator = (component) => component
37+
decorator = (component) => component,
38+
embedComponent = Embed
3839
} = {}) => {
3940

4041
// Modifiers.
@@ -46,7 +47,7 @@ export default ({
4647
const pluginTheme = Object.assign({}, defaultTheme, theme);
4748

4849
const ThemedEmbedder = decorateComponentWithProps(Embedder, { theme: pluginTheme });
49-
const DecoratedEmbed = decorator(Embed);
50+
const DecoratedEmbed = decorator(embedComponent);
5051
const ThemedEmbed = decorateComponentWithProps(DecoratedEmbed, { theme: pluginTheme });
5152

5253
return {

0 commit comments

Comments
 (0)