1.0.94 • Published 2 years ago

slate-rte v1.0.94

Weekly downloads
112
License
ISC
Repository
-
Last release
2 years ago

SlateJS Rich Text Editor

Pre-built rich text editor for Slate in React. On it's own, Slate.JS has a longer set up time and requires manual configuration of different options, etc. There are not many open source libraries that implement a rich text editor in Slate, so this library is designed to do exactly that.

Note: This module has been tested with Create React App

Installation

Run npm install slate-rte or yarn add slate-rte to add the SlateJS Rich Text Editor into your project.

Additionally, this project requires the installation of react-bootstrap.

Usage

Here's an example of basic usage:

import React, { Component } from "react";
import SlateRTE from "slate-rte";

class App extends Component {
  render() {
    return (
      <SlateRTE />
    );
  }
}

export default App;    

Development

Run npm run build to build a local version of the package. Test using the demo CRA.

Available methods

Pass in the value (generated from SlateRTE) into the following helpers

1) extractText(slateContent) returns a string representing all the text within your current slate editor

2) getBackgroundColor(slateContent) takes slate content adn returns the background color of the content (if any)

Utility methods

Parameter Types

  • slateContent: SlateNode[]
    • Slate-rte generated content (renders rich text when passed as a value for slate-rte)
  • onFileLoad: (opts: { id: string }) => Promise<{ url: string }>
  • Function to load images / video files from a server based on a UUID
  • variables: { variableName: string: string }
    • Mapping of variables in rich text to their expected values

Available Utility Methods

  • parseAsHTML(SlateNode[], variables: { variableName: string: string }, onFileLoad: (opts: { id: string }) => Promise<{ url: string }>): string
    • parseAsHTML returns an HTML stringified version of the slate content w/ variables filled in
  • deserializeHTMLString(htmlString: string): SlateNode[]
    • converts html string (generated from parseAsHTML) into the slate-rte compatible format
1.0.94

2 years ago

1.0.93

2 years ago

1.0.89

3 years ago

1.0.91

3 years ago

1.0.90

3 years ago

1.0.87

3 years ago

1.0.86

3 years ago

1.0.77

4 years ago

1.0.75

4 years ago

1.0.79

4 years ago

1.0.78

4 years ago

1.0.80

4 years ago

1.0.84

3 years ago

1.0.83

3 years ago

1.0.82

3 years ago

1.0.81

4 years ago

1.0.85

3 years ago

1.0.73

4 years ago

1.0.74

4 years ago

1.0.72

4 years ago

1.0.66

4 years ago

1.0.69

4 years ago

1.0.68

4 years ago

1.0.67

4 years ago

1.0.71

4 years ago

1.0.70

4 years ago

1.0.65

4 years ago

1.0.64

4 years ago

1.0.62

4 years ago

1.0.63

4 years ago

1.0.61

4 years ago

1.0.60

4 years ago

1.0.59

4 years ago

1.0.58

4 years ago

1.0.57

4 years ago

1.0.55

4 years ago

1.0.54

4 years ago

1.0.56

4 years ago

1.0.53

4 years ago

1.0.52

4 years ago

1.0.48

4 years ago

1.0.47

4 years ago

1.0.46

4 years ago

1.0.49

4 years ago

1.0.51

4 years ago

1.0.50

4 years ago

1.0.40

4 years ago

1.0.44

4 years ago

1.0.42

4 years ago

1.0.45

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.10

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago