# react-raise-editor

> Simple Editor Handler with textarea in react

Latest version **0.1.4** (published 2023-06-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-raise-editor
pnpm add react-raise-editor
yarn add react-raise-editor
bun add react-raise-editor
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2023-06-22 |
| First published | 2023-06-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | deep |
| Maintainers | deepdesign |
| Keywords | react, typescript, next.js, react-editor, editor-handler, react-raise-editor, raise-editor, editor, textarea |

## Links

- npm: https://www.npmjs.com/package/react-raise-editor
- Repository: https://github.com/deep-hwan/react-raise-editor
- Homepage: https://github.com/deep-hwan/react-raise-editor#readme
- Issues: https://github.com/deep-hwan/react-raise-editor/issues
- npm.io page: https://npm.io/package/react-raise-editor

## Dependencies (12)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [typescript](https://npm.io/package/typescript.md) ^4.9.5
- [web-vitals](https://npm.io/package/web-vitals.md) ^2.1.4
- [@types/jest](https://npm.io/package/@types/jest.md) ^27.5.2
- [@types/node](https://npm.io/package/@types/node.md) ^16.18.36
- [@types/react](https://npm.io/package/@types/react.md) ^18.2.12
- [react-scripts](https://npm.io/package/react-scripts.md) 5.0.1
- [@types/react-dom](https://npm.io/package/@types/react-dom.md) ^18.2.5
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^13.4.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.16.5
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^13.5.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2023-06-22
- 0.1.3 — 2023-06-18
- 0.1.2 — 2023-06-18
- 0.1.1 — 2023-06-18
- 0.1.0 — 2023-06-18

## README

# <div align="center">

<div align="center" style="width: 100px;" >
<img src="https://github.com/deep-hwan/react-raise-editor/blob/main/public/edit-img.png?raw=true" style="width: 100px;" alt="Title Image">
</div>
<h1 align="center">react-raise-editor</h1>

<p align="center">
Simple Editor Handler with textarea in react
</p>
</div>

## Install

    npm install react-raise-editor
    # or
    yarn add react-raise-editor

---

## Simple Usage

### hooks 
#### : useRaiseEditor

Load the useRaiseEditor and pass it to state and ref, respectively.
The hooks are hooks that provide the ability to **enter a textarea or to lengthen or decrease as much as the line is crossed** due to the amount of text is overflowing.


```jsx
import React, { useState, useRef } from 'react'
import { useRaiseEditor } from 'react-raise-editor';

export default function App() {
  const textRef = useRef<HTMLTextAreaElement | null>(null); 
  const [text, setText] = useState<string>('');

  useRaiseEditor({
    state: text,
    ref: textRef,
  })

  return (
    <textarea ref={textRef} value={text} onChange={e => setText(e.target.value)}/>
  )
}
```

---

### handler 
#### : handleLimitEnterEditor

Load the useRaiseEditor and pass it to state and ref, respectively.
The hooks are hooks that provide the ability to **enter a textarea or to lengthen or decrease as much as the line is crossed** due to the amount of text is overflowing.

Enter handleLimitEnterEditor, **If you don't write the first text, you can't enter.**
```jsx
<button disabled={text === ''}>submit</buton>.
```

When writing a post, the ender allows you to only do it once per line, limiting reckless spacing.
handleLimitEnterEditor delivers event, state, and handler.
**However, you must deliver fx to setState to hadler!**


```jsx
import React, { useState, useRef } from 'react'
import { useRaiseEditor , handleLimitEnterEditor } from 'react-raise-editor';

export default function App() {
  const textRef = useRef<HTMLTextAreaElement | null>(null); 
  const [text, setText] = useState<string>('');

  useRaiseEditor({
    state: text,
    ref: textRef,
  })

  return (
   <form>
     <textarea ref={textRef} value={text} onChange={e => handleLimitEnterEditor({
      event:e,
      state:text,
      handler:(fx) => setText(fx)
    })}/>
    
    <button disabled={text === ''}>submit</button>
   </form>
  )
}
```

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