0.1.9 • Published 5 years ago

editorjs-react v0.1.9

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

EditorJS-React

npm version

React wrapper component for Editor.js

Install

npm install --save editorjs-react

// or Yarn

yarn add editorjs-react

Usage

import React, { Component } from 'react'
import Editor from '@stfy/react-editor.js'

const App => (
  <>
    <Editor
        autofocus
        holderId="editorjs-container"
        excludeDefaultTools={['header']}
        placeholder="Add content here..."
        onChange={(data) => console.log(data)}
        customTools={{
          header: CustomHeader
        }}
        onReady={() => console.log('Start!')}
        data={{
          "time" : 1554920381017,
          "blocks" : [
              {
                  "type" : "header",
                  "data" : {
                      "text" : "Hello Editor.js",
                      "level" : 2
                  }
              },
          ],
          "version" : "2.12.4"
        }}
      />
  </>
)

Props

NameTypeDefaultDescription
autofocusbooleantrueSet Caret to the Editor after initialisation
holderIdstringeditorjs-holderId of Element that should contain the Editor
placeholderstringnullOption to set placeholder text
onChangefunctionnullonChange callback
onReadyfunctionnullonReady callback
dataobjectnullPreviously saved data that should be rendered
customToolsobjectnullSet custom tools config or overwrite existed
excludeDefaultToolsarraynullExclude default tool by tool name

Default tools

NamePackage
header@editorjs/header
list@editorjs/list
inlineCode@editorjs/inlineCode
image@editorjs/image
embed@editorjs/embed
quote@editorjs/quote
marker@editorjs/marker
code@editorjs/code
link@editorjs/link
delimiter@editorjs/delimiter
raw@editorjs/raw
table@editorjs/table
warning@editorjs/warning
paragraph@editorjs/paragraph
checklist@editorjs/checklist

Contributing

Welcome to contribute.

License

MIT Licensed. License 2019