@artibox/slate-blockquote
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
OS | Shortcut |
---|
![Apple Logo](https://cdn2.iconfinder.com/data/icons/designer-skills/128/apple-ios-system-platform-os-mac-linux-48.png) | ctrl+opt</kbd+q |
![Windows Logo](https://cdn2.iconfinder.com/data/icons/designer-skills/128/windows-48.png) | ctrl+alt</kbd+q |