@artibox/slate-strikethrough
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

@artibox/slate-strikethrough

Slate strikethrough.

npm package npm downloads

Installation

npm install @artibox/slate-strikethrough --save

or

$ yarn add @artibox/slate-strikethrough

Usage

Editor

import React from 'react';
import { Strikethrough as StrikethroughIcon } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createStrikethrough } from '@artibox/slate-strikethrough';

const Strikethrough = createStrikethrough();

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

const Editor = createArtiboxEditor({
  plugins
});

export default Editor;

Jsx Serializer

import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createStrikethroughJsxSerializerRule } from '@artibox/slate-strikethrough';

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

...

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

API

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

Hotkey

OS Shortcut
Apple Logo ++s
Windows Logo ctrl+alt+s

Readme

Keywords

none

Package Sidebar

Install

npm i @artibox/slate-strikethrough

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

15.4 kB

Total Files

28

Last publish

Collaborators

  • fantasywind