@artibox/slate-italic
v1.2.0
Published
<div align="center"> <img src="https://raw.githubusercontent.com/ianstormtaylor/slate/master/docs/images/banner.png" height="200" /> </div>
Downloads
5
Readme
Slate italic.
Installation
npm install @artibox/slate-italic --save
or
$ yarn add @artibox/slate-italic
Usage
Editor
import React from 'react';
import { Italic as ItalicIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createItalic } from '@artibox/slate-italic';
const Italic = createItalic();
const plugins = [
Italic.forPlugin(),
Toolbar.forPlugin({
expandedTools: [{ icon: ItalicIcon, hook: Italic.forToolHook() }]
})
];
const Editor = createArtiboxEditor({
plugins
});
export default Editor;
Jsx Serializer
import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createItalicJsxSerializerRule } from '@artibox/slate-italic';
const jsxSerializer = createJsxSerializer({
marks: [
createItalicJsxSerializerRule()
]
});
...
return (
<div>
{jsxSerializer(valueJSON /* from slate */)}
</div>
);
API
This package is based on based on @artibox/slate-toggle-mark.
Hotkey
| OS | Shortcut | | ------------------------ | ---------------------------- | | | ⌘+i | | | ctrl+i |