1.2.0 ā€¢ Published 4 years ago

@artibox/slate-bold v1.2.0

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

Slate bold.

npm package npm downloads

Installation

npm install @artibox/slate-bold --save

or

$ yarn add @artibox/slate-bold

Usage

Editor

import React from 'react';
import { Bold as BoldIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createBold } from '@artibox/slate-bold';

const Bold = createBold();

const plugins = [
  Bold.forPlugin(),
  Toolbar.forPlugin({
    expandedTools: [{ icon: BoldIcon, hook: Bold.forToolHook() }]
  })
];

const Editor = createArtiboxEditor({
  plugins
});

export default Editor;

Jsx Serializer

import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createBoldJsxSerializerRule } from '@artibox/slate-bold';

const jsxSerializer = createJsxSerializer({
  marks: [
    createBoldJsxSerializerRule()
  ]
});

...

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

API

This package is based on based on @artibox/slate-toggle-mark.

Hotkey

OSShortcut
Apple LogoāŒ˜+b
Windows Logoctrl+b
1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago