/slate-editor

A complete rich text editor based on SlateJS framework

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Slate Editor

BONDE Logo

         Slate Editor NPM Version Slate Editor NPM Downloads
Licence Conventional Commits

Let's install!

It's just simply run yarn add slate-editor --save or npm install slate-editor --save

How to use

You can use which plugin you want. No need to use all plugins available.

In the example below we only add the Bold plugin with its button in the toolbar.

Basic example

import React from 'react'
import {
  SlateEditor, SlateToolbar, SlateContent,
  BoldPlugin, BoldButton
} from 'slate-editor'

const plugins = [BoldPlugin()]

const SlateRichTextEditor = () => (
  <SlateEditor plugins={plugins}>
    <SlateToolbar>
      <BoldButton />
    </SlateToolbar>

    <SlateContent />
  </SlateEditor>
)

export default SlateRichTextEditor

And it's done! 🚀

Take a look at the full working example.

Plugins docs

Contributing

To help us develop new features or fix bugs, to setup your development environment is too simple. Just follow the steps:

  • git clone git@github.com:nossas/slate-editor.git the project
  • yarn install or npm install to install all the dependency packages
  • yarn start or npm start

And it's done! Easy, isn't?!


To get the ImagePlugin working in 100% of its functionality, you need to define the environment variables below:

  • REACT_APP_API_URL: e.g. https://api.bonde.org
    • The URL of the API
  • REACT_APP_SIGNING_URL_ENDPOINT: e.g. /uploads
    • The endpoint that will sign the URL to upload the image to AWS S3.
    • To sign the URL on your API, you can check an example with RoR here.

References

  • SlateJS - A completely customizable framework for building rich text editors.