1.2.0 • Published 4 years ago

@artibox/slate-blockquote v1.2.0

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

Slate blockquote.

npm package npm downloads

Installation

npm install @artibox/slate-blockquote --save

or

$ yarn add @artibox/slate-blockquote

Usage

Editor

import React from 'react';
import { Blockquote as BlockquoteIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createBlockquote } from '@artibox/slate-blockquote';

const Blockquote = createBlockquote();

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

const Editor = createArtiboxEditor({
  plugins
});

export default Editor;

Jsx Serializer

import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createBlockquoteJsxSerializerRule } from '@artibox/slate-blockquote';

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

...

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

API

Hotkey

OSShortcut
Apple Logoctrl+opt</kbd+q
Windows Logoctrl+alt</kbd+q