0.1.16 • Published 2 years ago

@ogauk/react-tiny-editor v0.1.16

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

react-tiny-editor

A tiny HTML rich text editor for React, based on Fabian Vilers tiny-editor and Ophir Lojkine's react-contenteditable.

A complete rewrite of the above projects as React functional components.

The toolbar is based directly on tiny-editor. The ContentEditable component is a subset of react-contenteditable hard-coded to use a DIV element.

How to install

npm install @ogauk/react-tiny-editor

How to use (Typescript)

import React, { type FC } from 'react'
import ReactTinyEditor from '@ogauk/react-tiny-editor'

const App: FC<null> = () => {
  return <ReactTinyEditor html='A <b>test</b> message' onChange={(html) => { console.log('app on change', html) }}/>
}

export default App

If you want a smaller bundle and don't mind sanitising the html yourself you can:

import { ReactReallyTinyEditor as ReactTinyEditor } from '@ogauk/react-tiny-editor'

How to use (Javascript)

import React from 'react'
import ReactTinyEditor from '@ogauk/react-tiny-editor'

export default function App() {
  return <ReactTinyEditor html='A <b>test</b> message' onChange={(html) => { console.log('app on change', html) }}/>
}

Options

The toolbar can be customised. The default toolbar is:

style font bold italic underline | justifyleft justifycenter justifyright | bullist numlist outdent indent | clear

Pass a string to the options property of the editor to re-order or omit some tool items or to add/remove separators

You can also pass an onBlur callback to the editor.

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago