@leeonfield/editor-plugin-video
v0.2.1
Published
Video Plugin for TOAST UI Editor
Downloads
13
Maintainers
Readme
Video Plugin for TOAST UI Editor
This is a plugin of TOAST UI Editor to embed video in Editor
Support video list and code language
- embed iframe
- [x] YouTube: youtube
- [x] Tecent Video: qq
- [x] Bilibili: bilibili
- [x] Youku: youku
- video source
- [x] Mp4: source-mp4
- [x] OGG: source-ogg
- [x] Youku: source-avi
📦 Usage npm
To use the plugin, @toast-ui/editor
must be installed.
Ref. Getting Started
Install
$ npm install @leeonfield/editor-plugin-video -S
Import Plugin
ES Modules
import videoPlugin from '@leeonfield/editor-plugin-video';
CommonJS
const videoPlugin = require('@leeonfield/editor-plugin-video');
Use in Editor
// ...
import Editor from '@toast-ui/editor';
import videoPlugin from '@leeonfield/editor-plugin-video';
const editor = new Editor({
// ...
plugins: [videoPlugin]
});
Use in Viewer
// ...
import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer';
import videoPlugin from '@leeonfield/editor-plugin-video';
// ...
const viewer = new Viewer({
// ...
plugins: [videoPlugin]
});
or
// ...
import Editor from '@toast-ui/editor';
import videoPlugin from '@leeonfield/editor-plugin-video';
// ...
const viewer = Editor.factory({
// ...
viewer: true,
plugins: [videoPlugin]
});
Custom Video list
// ...
import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer';
import videoPlugin from '@leeonfield/editor-plugin-video';
// ...
const viewer = new Viewer({
// ...
plugins: [
[
videoPlugin,
{
list: {
youtube: 'http://player.youku.com/embed/',
},
},
],
],
});
embed video in markdown
``` youtube
GveTAk727mM
```
video source
```source-mp4
video-source
```