Provides Block Tool for embed YouTube videos for the Editor.js. This is just an example! Please use official Embed Tool instead.
Install the package using NPM or Yarn
npm i --save editorjs-youtube-tool
yarn add editorjs-youtube-tool
Import module at your application
import EditorJSYoutubeTool from "editorjs-youtube-tool";
- Upload folder
dist
from repository - Add
dist/index.js
file to your page.
You can load EditorJSYoutubeTool from jsDelivr CDN:
https://cdn.jsdelivr.net/npm/editorjs-youtube-tool
Require this script on a page with Editor.js.
<script src="https://cdn.jsdelivr.net/npm/editorjs-youtube-tool"></script>
Add a new Tool to the tools
property of the Editor.js initial config.
const editor = EditorJS({
...
tools: {
...
youtube: EditorJSYoutubeTool,
}
...
});
YoutubeTool block returns code:
{
"type" : "youtube",
"data" : {
"id": "LOPHWxybSCA",
"url": "https://www.youtube.com/watch?v=LOPHWxybSCA&t=2844s&ab_channel=AlexandrKupnyi",
"embedUrl": "https://www.youtube.com/embed/LOPHWxybSCA"
}
}