0.0.5 • Published 4 years ago
editorjs-youtube-tool v0.0.5
YouTube tool
Provides Block Tool for embed YouTube videos for the Editor.js. This is just an example! Please use official Embed Tool instead.
Installation
Install the package using NPM or Yarn
Via NPM
npm i --save editorjs-youtube-toolVia Yarn
yarn add editorjs-youtube-toolImport module at your application
import EditorJSYoutubeTool from "editorjs-youtube-tool";Download to your project's source dir
- Upload folder
distfrom repository - Add
dist/index.jsfile to your page.
Load from CDN
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>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": "LOPHWxybSCA",
"url": "https://www.youtube.com/watch?v=LOPHWxybSCA&t=2844s&ab_channel=AlexandrKupnyi",
"embedUrl": "https://www.youtube.com/embed/LOPHWxybSCA"
}
}0.0.5
4 years ago