0.0.17 • Published 4 years ago

lerna-editor v0.0.17

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

lerna-editor

NPM JavaScript Style Guide

Introduction

lerna-editor is a rich text editor component used for React project

Demo

alt text

Install

npm install --save lerna-editor

Usage

Before using the editor, you must add the following tags to your index.html file

<link rel="stylesheet" href="https://cdn.quilljs.com/1.2.6/quill.snow.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js"></script>

Editor

The following code shows how to use the rich text editor:

import React, { Component } from "react";
import { Editor } from "lerna-editor";

class Example extends Component {
  render() {
    return <Editor />;
  }
}
Properties
NameDescriptionTypeDefault value
initialContentInitial content of the editorstring | HTMLnull
placeholderPlaceholder of the editorstringnull
Methods
NameDescriptionDefault value
onChange(html, deltas, text)Event firing when editor's content changesnull

Note that:

  • html is HTML generated by the editor
  • deltas is array of delta, which is editor content's representation in object
  • text is text inferred from HTML

EditorContent

When you want to render the HTML generated from editor, you use the following code:

import React, { Component } from "react";
import { EditorContent } from "lerna-editor";

class Example extends Component {
  render() {
    return <EditorContent content={"Editor"}/>;
  }
}
Properties
NameDescriptionTypeDefault value
contentContent of the editorstring | HTMLnull
inlineWhether editor is inline or blockboolfalse
classNameclassName of the editor contentstringnull

License

MIT © ntncsebku

0.0.18

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago