@ryzeup/richtexteditor 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,249 @@
1
+ # πŸ“ texteditor β€” A Modern React Rich Text Editor
2
+
3
+ ![NPM Version](https://img.shields.io/npm/v/texteditor.svg?style=flat&color=blue)
4
+ ![License](https://img.shields.io/npm/l/texteditor.svg?style=flat&color=green)
5
+ ![Build](https://img.shields.io/badge/build-passing-brightgreen.svg)
6
+ ![Vite](https://img.shields.io/badge/bundler-vite-orange.svg)
7
+ ![TypeScript](https://img.shields.io/badge/language-typescript-blue.svg)
8
+
9
+ > ✨ A lightweight, fully customizable **Rich Text Editor for React** β€” built with **TypeScript**, **Vite**, and **React 19**.
10
+ > Create visually appealing messages with custom fonts, colors, media, and more β€” in just a few lines of code.
11
+
12
+ ---
13
+
14
+ ## πŸš€ Features
15
+
16
+ βœ… Built with **React + TypeScript**
17
+ βœ… Bundled using **Vite** (super fast builds)
18
+ βœ… Customizable toolbar β€” bold, italic, underline, color, alignment, etc.
19
+ βœ… Supports **images**, **links**, **videos**, and **emojis**
20
+ βœ… Includes **TypeScript types**
21
+ βœ… CSS bundled or importable separately
22
+ βœ… Lightweight & dependency-minimal
23
+ βœ… Plug-and-play usage
24
+
25
+ ---
26
+
27
+ ## πŸ“¦ Installation
28
+
29
+ ```bash
30
+ # Using npm
31
+ npm install @shaikabdularshad/texteditor
32
+
33
+ # Or yarn
34
+ yarn add @shaikabdularshad/texteditor
35
+
36
+ # Or pnpm
37
+ pnpm add @shaikabdularshad/texteditor
38
+
39
+ ---
40
+
41
+ ## βš™οΈ Peer Dependencies
42
+
43
+ Make sure your project includes React:
44
+
45
+ npm install react react-dom
46
+
47
+
48
+ ---
49
+
50
+ ## 🧩 Usage
51
+
52
+ 1️⃣ Import the component
53
+ import React from 'react';
54
+ import { RichTextEditor } from 'texteditor';
55
+ import 'texteditor/dist/style.css'; // import styles if not auto-bundled
56
+
57
+ 2️⃣ Use it in your app
58
+ function App() {
59
+ return (
60
+ <RichTextEditor
61
+ atSuggestions={["@Arshad", "@Irfan", "@Meera"]}
62
+ showOutput={true}
63
+ showPreview={true}
64
+ toolbarConfig={{
65
+ link: true,
66
+ image: true,
67
+ emoji: true,
68
+ table: true,
69
+ color: true,
70
+ fontFamily: true,
71
+ fontSize: true,
72
+ }}
73
+ classNames={{
74
+ wrapper: "custom-wrapper",
75
+ editor: "custom-editor",
76
+ }}
77
+ styles={{
78
+ editor: {
79
+ border: "1px solid #ccc",
80
+ padding: "12px",
81
+ minHeight: "200px",
82
+ borderRadius: "8px",
83
+ },
84
+ }}
85
+ handleGetHtml={(html) => console.log("Editor HTML:", html)}
86
+ />
87
+ );
88
+ }
89
+
90
+ export default App;
91
+
92
+ ---
93
+
94
+ ## 🧠 Props Reference
95
+
96
+ The RichTextEditor component is fully customizable via the following props:
97
+
98
+ Prop Type Default Description
99
+ atSuggestions string[] [] List of mention suggestions (e.g., ["@Arshad", "@Irfan", "@Meera""]). When the user types β€œ@”, a popup appears showing these names.
100
+ showOutput boolean false Displays a live HTML preview of the editor’s content below the editor box. Useful for debugging or data preview.
101
+ showPreview boolean false Displays a rendered HTML preview beside the editor (using <RtePreview />).
102
+ toolbarConfig ToolbarConfig All false Controls which toolbar actions are visible. Example: { link: true, image: true, emoji: true }.
103
+ classNames { wrapper?: string; toolbar?: string; editor?: string; preview?: string; output?: string } {} Custom class names for different sections of the editor (useful for applying your own CSS).
104
+ styles { wrapper?: React.CSSProperties; toolbar?: React.CSSProperties; editor?: React.CSSProperties; preview?: React.CSSProperties; output?: React.CSSProperties } {} Inline styles for each section (wrapper, toolbar, editor, etc.).
105
+ handleGetHtml (html: string) => void () => {} Callback triggered whenever the editor’s HTML content changes. Returns sanitized HTML.
106
+
107
+ ---
108
+
109
+
110
+ ### 🧰 ToolbarConfig Type
111
+
112
+ You can control toolbar buttons selectively via this object:
113
+
114
+ Key Type Default Description
115
+ link boolean false Enables inserting hyperlinks.
116
+ image boolean false Enables inserting images (from local files).
117
+ emoji boolean false Enables emoji picker.
118
+ table boolean false Enables inserting and resizing tables.
119
+ color boolean false Enables text color picker.
120
+ fontFamily boolean false Enables font family dropdown.
121
+ fontSize boolean false Enables font size dropdown.
122
+
123
+ ---
124
+
125
+ ## 🧰 Build & Development
126
+
127
+ If you cloned or downloaded this repository, use the following scripts:
128
+
129
+ # Install dependencies
130
+ npm install
131
+
132
+ # Start dev server
133
+ npm run dev
134
+
135
+ # Build the library (for npm publish)
136
+ npm run build
137
+
138
+ # Lint code
139
+ npm run lint
140
+
141
+ # Preview the build
142
+ npm run preview
143
+
144
+
145
+ The build will output into the dist/ folder:
146
+
147
+ dist/
148
+ β”œβ”€β”€ index.js (CommonJS build)
149
+ β”œβ”€β”€ index.esm.js (ES Module build)
150
+ β”œβ”€β”€ index.d.ts (TypeScript types)
151
+ └── style.css (Editor styles)
152
+
153
+ ---
154
+
155
+ ## πŸ—‚ Folder Structure
156
+ texteditor/
157
+ β”œβ”€β”€ src/
158
+ β”‚ β”œβ”€β”€ components/
159
+ β”‚ β”‚ β”œβ”€β”€ RteToolbar.tsx
160
+ β”‚ β”‚ β”œβ”€β”€ RtePreview.tsx
161
+ β”‚ β”‚ β”œβ”€β”€ ...
162
+ β”‚ β”œβ”€β”€ data/
163
+ β”‚ β”‚ └── emojis.json
164
+ β”‚ β”œβ”€β”€ RichTextEditor.tsx
165
+ β”‚ β”œβ”€β”€ index.ts
166
+ β”‚ └── style.css
167
+ β”œβ”€β”€ dist/
168
+ β”‚ β”œβ”€β”€ index.js
169
+ β”‚ β”œβ”€β”€ index.esm.js
170
+ β”‚ └── style.css
171
+ β”œβ”€β”€ package.json
172
+ β”œβ”€β”€ tsconfig.json
173
+ β”œβ”€β”€ vite.config.ts
174
+ └── README.md
175
+
176
+ ---
177
+
178
+ ## βš’οΈ Tech Stack
179
+
180
+ React 19
181
+
182
+ TypeScript
183
+
184
+ Vite 7
185
+
186
+ ESLint
187
+
188
+ React Icons
189
+
190
+ Rollup (via Vite) for library bundling
191
+
192
+ ---
193
+
194
+ ## 🎨 Styling
195
+ Option 1 – Manual Import
196
+
197
+ If your build does not automatically include styles:
198
+
199
+ import 'texteditor/dist/style.css';
200
+
201
+ Option 2 – Automatic Bundling
202
+
203
+ If you import your CSS in src/index.ts:
204
+
205
+ import './style.css';
206
+
207
+
208
+ Vite will automatically bundle your styles in the JS build.
209
+
210
+ ---
211
+
212
+ ## πŸ§ͺ Example Output
213
+
214
+ ---
215
+
216
+ ## πŸ›  Troubleshooting
217
+ Issue Solution
218
+ CSS not applied Import texteditor/dist/style.css in your app
219
+ Cannot find module '../data/emojis.json' Add "resolveJsonModule": true to tsconfig.json
220
+ TypeScript import error (.tsx) Remove .tsx from imports (use import App from './App')
221
+ Toolbar icons missing Ensure react-icons is installed
222
+
223
+ ---
224
+
225
+ ## 🀝 Contributing
226
+
227
+ Contributions, issues, and feature requests are welcome!
228
+ Feel free to open a PR or create an issue in the repository.
229
+
230
+ git clone https://github.com/<your-username>/texteditor.git
231
+ cd texteditor
232
+ npm install
233
+ npm run dev
234
+
235
+ 🧾 License
236
+
237
+ This project is licensed under the MIT License β€” free for personal and commercial use.
238
+
239
+ πŸ’¬ Author
240
+
241
+ πŸ‘¨β€πŸ’» Arshad Babblu
242
+ 🌐 Portfolio
243
+
244
+ 🌟 Support
245
+
246
+ If you find this project useful, please ⭐ it on GitHub
247
+ !
248
+ Your support motivates continued updates and improvements.
249
+ ```