File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,19 @@ Embed links with iframe.ly into your draft-js editor.
6
6
![ Demo] ( plugin.gif )
7
7
8
8
## Installation
9
+
9
10
```
10
11
npm install draft-js-iframely-plugin
11
12
```
12
13
14
+ * Optional*
15
+ In your index.html include the embed.js provided by Iframely.
16
+ In case of omit it, it will be included with thr first embedded URL.
17
+
18
+ ``` html
19
+ <script src =" //cdn.iframe.ly/embed.js" async ></script >
20
+ ```
21
+
13
22
## Usage
14
23
This plugin embeds URLs in different ways:
15
24
1 . When press Enter in a block that the text is a URL.
@@ -70,13 +79,16 @@ module.exports = {
70
79
}
71
80
};
72
81
```
82
+
73
83
3 . Add the below import line to your component to tell Webpack to inject the style to your component.
74
84
85
+
75
86
``` js
76
87
import ' draft-js-iframely-plugin/lib/plugin.css' ;
77
88
```
78
89
79
90
## Example
91
+
80
92
``` js
81
93
import React from ' react' ;
82
94
import ReactDOM from ' react-dom' ;
@@ -212,6 +224,7 @@ class MyEditor extends React.Component {
212
224
ReactDOM .render (< MyEditor / > , document .getElementById (' root' ));
213
225
214
226
```
227
+
215
228
#### Axios
216
229
See how to provide your own implementation to fetch the URL.
217
230
` onRequest ` Must return a ` Promise ` that resolves to a JSON with the metadata.
@@ -222,7 +235,7 @@ import axios from 'axios';
222
235
223
236
const iframelyPlugin = createIframelyPlugin ({
224
237
options: {
225
- apiKey: ' <my-pi -key>' ,
238
+ apiKey: ' <my-api -key>' ,
226
239
onRequest : (url ) => {
227
240
return axios .get (url).then (res => res .data );
228
241
}
You can’t perform that action at this time.
0 commit comments