@artibox/slate-list

<div align="center"> <img src="https://raw.githubusercontent.com/ianstormtaylor/slate/master/docs/images/banner.png" height="200" /> </div>

Usage no npm install needed!

<script type="module">
  import artiboxSlateList from 'https://cdn.skypack.dev/@artibox/slate-list';
</script>

README

@artibox/slate-list

Slate list.

npm package npm downloads

Installation

npm install @artibox/slate-list --save

or

$ yarn add @artibox/slate-list

Usage

Editor

import React from 'react';
import { UnorderedList, OrderedList } from '@artibox/icons';
import { createArtiboxEditor } from '@artibox/slate-editor';
import { Toolbar } from '@artibox/slate-toolbar';
import { createList } from '@artibox/slate-list';

const List = createList();

const plugins = [
  ...List.forPlugin(),
  Toolbar.forPlugin({
    collapsedTools: [
      { icon: UnorderedList, hook: List.forToolHook({ orderedType: 'unordered' }) },
      { icon: OrderedList, hook: List.forToolHook({ orderedType: 'ordered' }) }
    ]
  })
];

const Editor = createArtiboxEditor({
  plugins
});

export default Editor;

Jsx Serializer

import { createJsxSerializer } from '@artibox/slate-jsx-serializer';
import { createListJsxSerializerRules } from '@artibox/slate-list';

const jsxSerializer = createJsxSerializer({
  blocks: [
    ...createListJsxSerializerRules()
  ]
});

...

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

API

Hotkey

OS Feature Shortcut
Apple Logo Windows Logo Increase item depth tab
Apple Logo Windows Logo Decrease item depth shift+tab