# react-text-media-editor

> simple react web editor just support text and media

Latest version **1.2.1** (published 2019-07-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-text-media-editor
pnpm add react-text-media-editor
yarn add react-text-media-editor
bun add react-text-media-editor
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2019-07-12 |
| First published | 2019-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 107.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jinxin Hu |
| Maintainers | hjxenjoy |

## Links

- npm: https://www.npmjs.com/package/react-text-media-editor
- Repository: https://github.com/hjxenjoy/react-text-media-editor
- Homepage: https://github.com/hjxenjoy/react-text-media-editor#readme
- Issues: https://github.com/hjxenjoy/react-text-media-editor/issues
- npm.io page: https://npm.io/package/react-text-media-editor

## Dependencies (1)

- [array-move](https://npm.io/package/array-move.md) ^2.1.0

## Recent versions

- 1.2.1 (latest) — 2019-07-12
- 1.2.0 — 2019-07-08
- 1.1.0 — 2019-07-08
- 1.0.0 — 2019-07-07
- 0.2.0 — 2019-07-07

## README

# React Text Media Editor

Simple React Web Editor Only Support Text and Medias

## Demo

```sh
npm start
```

## Installation

Using [npm](https://www.npmjs.com/package/react-text-media-editor):

```sh
npm install --save react-text-media-editor react-sortable-hoc
```

## Usage

Basic Example

```js
import React, { useState } from 'react'
import ReactDOM from 'react-dom'

import RtmEditor from 'react-text-media-editor'
import 'react-text-media-editor/dist/style.css'

const IMAGE = 'https://picsum.photos/500/150'

const InitialValue = [
  { type: 'TEXT', raw: 'React Text Media Editor Example' },
  { type: 'IMAGE', url: IMAGE, name: 'Pic.png', width: 500, height: 150 },
]

function Example() {
  const [value, setValue] = useState(InitialValue)

  function updateValue(nextValue) {
    console.log(nextValue)
    // setValue(nextValue)
  }

  function uploadImages(files, callback) {
    // put your upload function here
    setTimeout(() => {
      callback(
        files.map(file => ({
          status: 'done',
          url: '', // 'https://your.domain.com/your/image/url',
          _id: file._id,
        }))
      )
    }, 1000)
  }

  return (
    <div className="example">
      <h1>React Text Media Editor Example</h1>
      <RtmEditor
        value={value}
        onChange={updateValue}
        uploadImages={uploadImages}
        placeholder="Please Input Your Idea"
      />
    </div>
  )
}

ReactDOM.render(<Example />, document.getElementById('root'))
```

---
_Source: https://npm.io/package/react-text-media-editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
