2.0.2 • Published 6 months ago

@connectedxm/editor v2.0.2

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

Editor Component

A reusable rich-text editor component built with React, TipTap, and Tailwind CSS. This editor allows you to initialize with existing content, handle content changes, and toggle read-only mode.

Table of Contents

Installation

Install the editor component via npm:

npm install @connectedxm/editor

Peer Dependencies

Ensure your project has the following packages installed:

  • React
  • React DOM

You can install them using

npm install react react-dom

Usage

Importing the Component

Import the Editor component into your React application:

import Editor from "@connectedxm/editor";

Importing Styles

The Editor component relies on a style sheet styling.

import "@connectedxm/editor/dist/styles.css";

Example Usage

Use the Editor component in your React components:

import "@connectedxm/editor/dist/styles.css";

function MyComponent() {
  const [content, setContent] = useState("<p>Initial content</p>");

  const handleContentChange = (newContent) => {
    setContent(newContent);
  };

  return (
    <Editor
      initialContent={content}
      onChange={handleContentChange}
      readOnly={false}
      className="custom-editor-class"
    />
  );
}

Props

The Editor component accepts the following props:

NameDescriptionTypeRequired
initialContentThe initial HTML content to load into the editor.stringYes
onChangeCallback function that is called whenever the content changes.(content: string) => voidYes
readOnlyIf set to true, the editor will be in read-only mode.booleanNo
classNameAdditional custom classes to apply to the editor container.stringNo

License

This project is licensed under the MIT License.

1.0.2

6 months ago

1.0.0

7 months ago

0.0.20

12 months ago

0.0.21

11 months ago

0.0.22

11 months ago

0.0.23

9 months ago

0.0.24

9 months ago

0.0.25

9 months ago

1.0.3

6 months ago

2.0.2

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

0.0.30

9 months ago

0.0.31

9 months ago

0.0.32

9 months ago

0.0.26

9 months ago

0.0.27

9 months ago

0.0.28

9 months ago

0.0.29

9 months ago

0.0.19

12 months ago

0.0.17

12 months ago

0.0.18

12 months ago

0.0.16

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago