/editor-plugin-video

video plugin for tui.editor

Primary LanguageJavaScriptMIT LicenseMIT

Video Plugin for TOAST UI Editor

This is a plugin of TOAST UI Editor to embed video in Editor

npm version

Support video list and code language

📦 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
```