1.2.0 • Published 4 years ago

@artibox/slate-video v1.2.0

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

Slate video.

npm package npm downloads

Installation

npm install @artibox/slate-video --save

or

$ yarn add @artibox/slate-video

Usage

Editor

import React from 'react';
import { Video as VideoIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createVideo } from '@artibox/slate-video';

const Video = createVideo();

const plugins = [
  Video.forPlugin(),
  Toolbar.forPlugin({
    collapsedTools: [{ icon: VideoIcon, hook: Video.forToolHook() }]
  })
];

const Editor = createArtiboxEditor({
  plugins
});

export default Editor;

Jsx Serializer

import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createVideoJsxSerializerRule } from '@artibox/slate-video';

const jsxSerializer = createJsxSerializer({
  blocks: [
    createVideoJsxSerializerRule()
  ]
});

...

return (
  <div>
    {jsxSerializer(valueJSON /* from slate */)}
  </div>
);

API

Utils

Components