@artibox/slate-separation-line
v1.2.0
Published
<div align="center"> <img src="https://raw.githubusercontent.com/ianstormtaylor/slate/master/docs/images/banner.png" height="200" /> </div>
Downloads
3
Readme
Slate separation line.
Installation
npm install @artibox/slate-separation-line --save
or
$ yarn add @artibox/slate-separation-line
Usage
Editor
import React from 'react';
import { SeparationLine as SeparationLineIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createSeparationLine } from '@artibox/slate-separation-line';
const SeparationLine = createSeparationLine();
const plugins = [
SeparationLine.forPlugin(),
Toolbar.forPlugin({
collapsedTools: [{ icon: SeparationLine, hook: SeparationLine.forToolHook() }]
})
];
const Editor = createArtiboxEditor({
plugins
});
export default Editor;
Jsx Serializer
import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createSeparationLineJsxSerializerRule } from '@artibox/slate-separation-line';
const jsxSerializer = createJsxSerializer({
blocks: [
createSeparationLineJsxSerializerRule()
]
});
...
return (
<div>
{jsxSerializer(valueJSON /* from slate */)}
</div>
);