1.0.6 • Published 2 years ago

@codifytools/react-text-editor v1.0.6

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

React Text Editor

A small, simple and customizable text editor for React applications.

npm bundle size npm bundle size npm downloads GitHub license

Table of Contents

Installation

To install, you can use npm or yarn:

npm install @codifytools/react-text-editor

Usage

import React, { useState, Fragment } from 'react';
import ReactDOM from 'react-dom';
import Editor from '@codifytools/react-text-editor';

const Example = () => {
  const [values, setValues] = useState({ text: '<p>Editor example text</p>' });

  const handleChange = (event) => {
    const { name, value } = event.target;
    setValues({ ...values, [name]: value });
  }

  return (
    <Fragment>
        <Editor
          field="text"
          html={values.text}
          classes="example-class"
          saveCallback={handleChange}
          placeholder="custon placeholder text..."
       />

       <button onClick={() => console.log(values.text)}>Preview Text</button>
    </Fragment>
  );
};

ReactDOM.render(<Example />, document.body);

Props

PropTypeDescription
fieldStringField that callback event.target.name will replace
htmlStringCurrent html text value
classesStringClass names for custom styles
saveCallbackFunctionSave changes function. The Editor returns a event with the updated information
placeholderStringText editor custom placeholder

Requirements

The minimum supported version of React is v16.8.0. If you use an older version, upgrade React to use this library.

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago