1.0.94 • Published 1 year ago

slate-rte v1.0.94

Weekly downloads
112
License
ISC
Repository
-
Last release
1 year 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

1 year ago

1.0.93

1 year ago

1.0.89

2 years ago

1.0.91

2 years ago

1.0.90

2 years ago

1.0.87

2 years ago

1.0.86

3 years ago

1.0.77

3 years ago

1.0.75

3 years ago

1.0.79

3 years ago

1.0.78

3 years ago

1.0.80

3 years ago

1.0.84

3 years ago

1.0.83

3 years ago

1.0.82

3 years ago

1.0.81

3 years ago

1.0.85

3 years ago

1.0.73

3 years ago

1.0.74

3 years ago

1.0.72

3 years ago

1.0.66

3 years ago

1.0.69

3 years ago

1.0.68

3 years ago

1.0.67

3 years ago

1.0.71

3 years ago

1.0.70

3 years ago

1.0.65

3 years ago

1.0.64

3 years ago

1.0.62

3 years ago

1.0.63

3 years ago

1.0.61

3 years ago

1.0.60

3 years ago

1.0.59

3 years ago

1.0.58

3 years ago

1.0.57

3 years ago

1.0.55

3 years ago

1.0.54

3 years ago

1.0.56

3 years ago

1.0.53

3 years ago

1.0.52

3 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

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.10

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago