README
YouTube tool
Provides Block Tool for embed YouTube videos for the Editor.js.
Installation
Install the package using NPM or Yarn
Via NPM
npm i --save editorjs-youtube
Via Yarn
yarn add editorjs-youtube
Import module at your application
import EditorJSYoutubeTool from "editorjs-youtube";
Download to your project's source dir
- Upload folder
dist
from repository - Add
dist/index.js
file to your page.
Load from CDN
You can load EditorJSYoutubeTool from jsDelivr CDN:
https://cdn.jsdelivr.net/npm/editorjs-youtube
Require this script on a page with Editor.js.
<script src="https://cdn.jsdelivr.net/npm/editorjs-youtube"></script>
Usage
Add a new Tool to the tools
property of the Editor.js initial config.
const editor = EditorJS({
...
tools: {
...
youtube: EditorJSYoutubeTool,
}
...
});
Output data
YoutubeTool block returns code:
{
"type" : "youtube",
"data" : {
"id": "AwJwgRH1wpg",
"url": "",
"embedUrl": "https://www.youtube.com/embed/AwJwgRH1wpg"
}
}