@m9hmoods/editorjs-yte-tool
v1.0.2
Published
Youtube Embed Tool for Editor.js
Downloads
18
Maintainers
Readme
Youtube Embed Tool
Provides Youtube Embed for the EditorJS.
Installation
Install via NPM
Get the package
npm i --save-dev @m9hmoods/editorjs-yte-tool
Include module at your application
const YteEmbed = require('@m9hmoods/editorjs-yte-tool');
Download to your project's source dir
- Upload folder
dist
from repository - Add
dist/bundle.js
file to your page.
Load from CDN
You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/@m9hmoods/editorjs-yte-tool@latest
Then require this script on page with CodeX Editor.
<script src="..."></script>
Usage
Add a new Tool to the tools
property of the EditorJS initial config.
var editor = new EditorJS({
...
tools: {
...
youtube: YteEmbed,
},
...
});
Or init Youtube Embed Tool with additional settings
var editor = EditorJS({
...
tools: {
...
youtube: {
class: YteEmbed,
config: {
wrapperClass: '...',
inputClass: '...',
inputPlaceholder: '...',
buttonClass: '...',
buttonText: '...',
invalidText: '...',
},
},
},
...
});
Output data
| Field | Type | Description |
| --------- | -------- | -----------------|
| url | string
| Youtube Embed URL|
{
"type" : "youtube",
"data" : {
"url": "https://www.youtube.com/embed/[VIDEO_KEY]"
}
}