Skip to content

Commit f323b1b

Browse files
committed
Installation
1 parent 9c204ae commit f323b1b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ Embed links with iframe.ly into your draft-js editor.
66
![Demo](plugin.gif)
77

88
## Installation
9+
910
```
1011
npm install draft-js-iframely-plugin
1112
```
1213

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+
1322
## Usage
1423
This plugin embeds URLs in different ways:
1524
1. When press Enter in a block that the text is a URL.
@@ -70,13 +79,16 @@ module.exports = {
7079
}
7180
};
7281
```
82+
7383
3. Add the below import line to your component to tell Webpack to inject the style to your component.
7484

85+
7586
```js
7687
import 'draft-js-iframely-plugin/lib/plugin.css';
7788
```
7889

7990
## Example
91+
8092
```js
8193
import React from 'react';
8294
import ReactDOM from 'react-dom';
@@ -212,6 +224,7 @@ class MyEditor extends React.Component {
212224
ReactDOM.render(<MyEditor />, document.getElementById('root'));
213225

214226
```
227+
215228
#### Axios
216229
See how to provide your own implementation to fetch the URL.
217230
`onRequest` Must return a `Promise` that resolves to a JSON with the metadata.
@@ -222,7 +235,7 @@ import axios from 'axios';
222235

223236
const iframelyPlugin = createIframelyPlugin({
224237
options: {
225-
apiKey: '<my-pi-key>',
238+
apiKey: '<my-api-key>',
226239
onRequest: (url) => {
227240
return axios.get(url).then(res => res.data);
228241
}

0 commit comments

Comments
 (0)