A lightweight customizable React text editor built from scratch.
npm install editcoreA lightweight, customizable, line-based text editor for React — built completely from scratch without using contentEditable.
Designed for developers who want full control over rendering, cursor behavior, and text operations.
- Pure HTML + React implementation
- Custom rendering logic
- Developer-controlled cursor management
- Line-based architecture
- Simple undo/redo system
- Extendable for future code-editor capabilities
- Line-by-line rendering
- Custom decorator/highlighter for each line
- Basic text updating
- Exposed line APIs
- Simple structure for building advanced editors
``sh`
npm install editcore
or:
`sh`
yarn add editcore
`tsx
import React from "react";
import NewTextfeild from "react-text-editor";
export default function App() {
return (
onchangeDecorator={(text, index, extra) => {
return {text};
}}
/>
);
}
`
| Prop | Type | Description |
|------|------|-------------|
| initialData | string[] | Initial lines |onchangeDecorator
| | (text, index, extra) => ReactNode | Line rendering hook |ref
| | Editor ref | Exposes editor methods |
| Method | Description |
|--------|-------------|
| getAllLines() | Returns all text lines |setLine(index, text)
| | Set text of a line |undo()
| | Undo last action |redo()
| | Redo operation |focusLine(index)` | Scroll to line |
|
- Selection support
- Advanced cursor control
- Syntax highlighting presets
- Theme system
- Tabs & indentation
- Copy/paste logic
- Plugin support
- Full editor builder
Open to contributions, suggestions, and improvements.
MIT License.