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.
66![ Demo] ( plugin.gif )
77
88## Installation
9+
910```
1011npm 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
1423This plugin embeds URLs in different ways:
15241 . When press Enter in a block that the text is a URL.
@@ -70,13 +79,16 @@ module.exports = {
7079 }
7180};
7281```
82+
73833 . Add the below import line to your component to tell Webpack to inject the style to your component.
7484
85+
7586``` js
7687import ' draft-js-iframely-plugin/lib/plugin.css' ;
7788```
7889
7990## Example
91+
8092``` js
8193import React from ' react' ;
8294import ReactDOM from ' react-dom' ;
@@ -212,6 +224,7 @@ class MyEditor extends React.Component {
212224ReactDOM .render (< MyEditor / > , document .getElementById (' root' ));
213225
214226```
227+
215228#### Axios
216229See 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
223236const 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 }
You can’t perform that action at this time.
0 commit comments