@innoviatech/lexical-text-editor 2.0.6 → 3.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.
Files changed (111) hide show
  1. package/README.md +390 -241
  2. package/dist/components/AlignmentSelectionList.js +19 -0
  3. package/dist/components/ColorPicker.js +30 -0
  4. package/dist/components/ContentPreview.js +11 -0
  5. package/dist/components/DisplayControls.d.ts +16 -0
  6. package/dist/components/DropdownList.js +18 -0
  7. package/dist/components/FindReplaceModal.d.ts +11 -0
  8. package/dist/components/FindReplaceModal.js +120 -0
  9. package/dist/components/FontSelectionList.d.ts +17 -0
  10. package/dist/components/FontSelectionList.js +17 -0
  11. package/dist/components/HeadingSelectionList.js +19 -0
  12. package/dist/components/ImageComponent.d.ts +1 -0
  13. package/dist/components/ImageComponent.js +111 -0
  14. package/dist/components/InsertDropdownList.js +17 -0
  15. package/dist/components/LexicalTextEditor.d.ts +11 -0
  16. package/dist/components/LexicalTextEditor.js +128 -0
  17. package/dist/components/LinkModal.js +47 -0
  18. package/dist/components/Separator.js +4 -0
  19. package/dist/components/SourceView.d.ts +13 -0
  20. package/dist/components/SourceView.js +50 -0
  21. package/dist/components/StatusBar.d.ts +14 -0
  22. package/dist/components/StatusBar.js +30 -0
  23. package/dist/components/ToolbarOverflowModal.d.ts +15 -0
  24. package/dist/components/common/Dialog.js +27 -0
  25. package/dist/components/common/Popover.d.ts +10 -1
  26. package/dist/components/common/Popover.js +37 -0
  27. package/dist/components/common/Tooltip.d.ts +7 -0
  28. package/dist/components/common/Tooltip.js +20 -0
  29. package/dist/components/ui/button.js +35 -0
  30. package/dist/components/ui/command.js +33 -0
  31. package/dist/components/ui/dialog.js +35 -0
  32. package/dist/components/ui/input.js +6 -0
  33. package/dist/components/ui/popover.js +16 -0
  34. package/dist/components/ui/scroll-area.js +12 -0
  35. package/dist/components/ui/tooltip.js +16 -0
  36. package/dist/constants/index.d.ts +23 -1
  37. package/dist/constants/index.js +224 -0
  38. package/dist/index.d.ts +11 -0
  39. package/dist/index.esm.js +1 -1
  40. package/dist/index.esm.js.map +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/lexical-editor.css +1 -1
  44. package/dist/lib/utils.js +5 -0
  45. package/dist/nodes/ExtendedTextNode.js +140 -0
  46. package/dist/nodes/ImageNode.d.ts +5 -1
  47. package/dist/nodes/ImageNode.js +149 -0
  48. package/dist/nodes/VideoNode.js +80 -0
  49. package/dist/nodes/YoutubeNode.js +64 -0
  50. package/dist/plugins/CodeBlockPlugin.d.ts +1 -0
  51. package/dist/plugins/CodeBlockPlugin.js +88 -0
  52. package/dist/plugins/ColorPlugin.js +47 -0
  53. package/dist/plugins/CustomOnChangePlugin.js +33 -0
  54. package/dist/plugins/FontFamilyPlugin.d.ts +1 -0
  55. package/dist/plugins/FontFamilyPlugin.js +53 -0
  56. package/dist/plugins/FontSizePlugin.d.ts +1 -0
  57. package/dist/plugins/FontSizePlugin.js +48 -0
  58. package/dist/plugins/ImagePlugin.d.ts +3 -1
  59. package/dist/plugins/ImagePlugin.js +91 -0
  60. package/dist/plugins/ListPlugin.js +44 -0
  61. package/dist/plugins/TablePlugin.d.ts +1 -0
  62. package/dist/plugins/TablePlugin.js +92 -0
  63. package/dist/plugins/ToolbarPlugin.d.ts +14 -1
  64. package/dist/plugins/ToolbarPlugin.js +381 -0
  65. package/dist/plugins/VideoPlugin.js +49 -0
  66. package/dist/plugins/YoutubePlugin.js +30 -0
  67. package/dist/tsconfig.tsbuildinfo +1 -0
  68. package/editor_screenshot.png +0 -0
  69. package/package.json +11 -4
  70. package/googlebd703883f12c69e4.html +0 -1
  71. package/rollup.config.js +0 -55
  72. package/src/components/AlignmentSelectionList.tsx +0 -61
  73. package/src/components/ColorPicker.tsx +0 -66
  74. package/src/components/ContentPreview.tsx +0 -51
  75. package/src/components/DropdownList.tsx +0 -57
  76. package/src/components/HeadingSelectionList.tsx +0 -61
  77. package/src/components/ImageComponent.tsx +0 -140
  78. package/src/components/InsertDropdownList.tsx +0 -36
  79. package/src/components/LexicalTextEditor.tsx +0 -119
  80. package/src/components/LinkModal.tsx +0 -127
  81. package/src/components/Separator.tsx +0 -7
  82. package/src/components/common/Dialog.tsx +0 -47
  83. package/src/components/common/Popover.tsx +0 -87
  84. package/src/components/common/Tooltip.tsx +0 -43
  85. package/src/components/ui/button.tsx +0 -58
  86. package/src/components/ui/command.tsx +0 -183
  87. package/src/components/ui/dialog.tsx +0 -142
  88. package/src/components/ui/input.tsx +0 -21
  89. package/src/components/ui/popover.tsx +0 -46
  90. package/src/components/ui/scroll-area.tsx +0 -56
  91. package/src/components/ui/tooltip.tsx +0 -59
  92. package/src/constants/index.tsx +0 -177
  93. package/src/index.ts +0 -6
  94. package/src/lib/utils.ts +0 -6
  95. package/src/nodes/ExtendedTextNode.tsx +0 -185
  96. package/src/nodes/ImageNode.tsx +0 -195
  97. package/src/nodes/VideoNode.tsx +0 -134
  98. package/src/nodes/YoutubeNode.tsx +0 -101
  99. package/src/plugins/ColorPlugin.tsx +0 -85
  100. package/src/plugins/CustomOnChangePlugin.tsx +0 -50
  101. package/src/plugins/ImagePlugin.tsx +0 -118
  102. package/src/plugins/ListPlugin.tsx +0 -58
  103. package/src/plugins/ToolbarPlugin.tsx +0 -500
  104. package/src/plugins/VideoPlugin.tsx +0 -100
  105. package/src/plugins/YoutubePlugin.tsx +0 -83
  106. package/src/styles/lexical-editor.css +0 -1053
  107. package/src/types/global.d.ts +0 -34
  108. package/src/types/other.d.ts +0 -11
  109. package/src/types/react-icons.d.ts +0 -11
  110. package/tailwind.config.js +0 -10
  111. package/tsconfig.json +0 -32
package/README.md CHANGED
@@ -1,241 +1,390 @@
1
- # @innoviatech/lexical-text-editor v2.0
2
-
3
- A powerful, customizable rich text editor component built with Lexical and React. Features a modern toolbar, image support, video embedding, and comprehensive text formatting options.
4
-
5
- ![Editor Preview](./editor_screenshot.png)
6
-
7
-
8
- ## What's New in v2.0
9
-
10
- - **No Tailwind CSS Required** - Now uses raw CSS for styling
11
- - **Reduced Dependencies** - Fewer peer dependencies to install
12
- - **Simpler Setup** - Import CSS and start using immediately
13
- - **Lightweight** - Smaller bundle size
14
- - **Better Compatibility** - Works with any React project setup
15
-
16
-
17
-
18
-
19
- ## Features
20
-
21
- - 🎨 **Rich Text Editing** — Bold, italic, underline, strikethrough, code blocks
22
- - 📝 **Text Formatting** — Headers, paragraphs, lists (bulleted & numbered), quotes
23
- - 🔗 **Link Support** — Insert and edit hyperlinks
24
- - 🖼️ **Media Embedding** — Images and YouTube videos with resizing
25
- - 🎯 **Customizable Toolbar** — Modern, intuitive interface
26
- - 🎨 **Color Picker** — Text and background color options
27
- - 📱 **Responsive Design** — Works on desktop and mobile
28
- - ⚡ **TypeScript Support** — Fully typed for better development experience
29
-
30
-
31
-
32
- ## Installation
33
-
34
- ```bash
35
- npm install @innoviatech/lexical-text-editor
36
- ```
37
-
38
- ### No Peer Dependencies Required! 🎉
39
-
40
- Version 2.0 eliminates the need for Tailwind CSS and multiple UI libraries. Just install the package and start using it!
41
-
42
-
43
- ## Quick Start
44
-
45
- ```tsx
46
- import React, { useState } from 'react';
47
- import { LexicalTextEditor } from '@innoviatech/lexical-text-editor';
48
- import '@innoviatech/lexical-text-editor/style.css';
49
-
50
- function App() {
51
- const [content, setContent] = useState('');
52
-
53
- return (
54
- <>
55
- <LexicalTextEditor
56
- name="my-editor"
57
- value={content}
58
- onChange={setContent}
59
- placeholder="Start typing your content here..."
60
- />
61
- </>
62
- );
63
- }
64
-
65
- export default App;
66
- ```
67
-
68
-
69
-
70
- ## Props
71
-
72
- | Prop | Type | Required | Default | Description |
73
- |-------------|-------------------------------------|----------|---------------|---------------------------------------------|
74
- | `name` | `string` | Yes | — | Unique identifier for the editor instance |
75
- | `value` | `string` | Yes | — | Current editor content (HTML string) |
76
- | `onChange` | `(value: string) => void` | Yes | — | Callback fired when content changes |
77
- | `placeholder`| `string` | No | `"Some Text"` | Placeholder text when editor is empty |
78
- | `maxWidth` | `string` | No | "1090px" | Adjust the maximum width accoding to the need ('80%' or '800px') |
79
- | `height` | `string` | No | "500px" | Adjust the height accoding to the need ('50vh' or '500px') |
80
-
81
-
82
-
83
- ## Advanced Usage
84
-
85
- ### With Initial Content
86
-
87
- ```tsx
88
- import React, { useState } from 'react';
89
- import { LexicalTextEditor } from '@innoviatech/lexical-text-editor';
90
- import '@innoviatech/lexical-text-editor/style.css';
91
-
92
- function App() {
93
- const [content, setContent] = useState('<p>Welcome to the editor!</p><ul><li>Feature 1</li><li>Feature 2</li></ul>');
94
-
95
- const handleSave = () => {
96
- console.log('Current content:', content);
97
- };
98
-
99
- return (
100
- <form onSubmit={handleSave}>
101
- <LexicalTextEditor
102
- name="content-editor"
103
- value={content}
104
- onChange={setContent}
105
- placeholder="Write your content..."
106
- maxWidth="600px"
107
- height="400px"
108
- />
109
- <button type="submit">Save Content</button>
110
- </form>
111
- );
112
- }
113
-
114
- export default App;
115
- ```
116
-
117
-
118
- ## Toolbar Features
119
-
120
- - Text Formatting: Bold, Italic, Underline, Strikethrough
121
- - Headings: H1–H6
122
- - Lists: Bulleted and Numbered
123
- - Alignment: Left, Center, Right, Justify
124
- - Text Case: Uppercase, Lowercase, Capitalize
125
- - Colors: Text & background color picker
126
- - Media: Image upload, YouTube embedding, video node
127
- - Links: Insert and edit hyperlinks
128
- - Code: Inline code & code blocks
129
- - Quotes: Blockquote formatting
130
- - Undo/Redo, Clear formatting, Remove link
131
-
132
-
133
- ## Browser Support
134
-
135
- - Chrome 90+
136
- - Firefox 88+
137
- - Safari 14+
138
- - Edge 90+
139
-
140
-
141
- ## Troubleshooting
142
-
143
-
144
- - **CSS not loading:** `import '@innoviatech/lexical-text-editor/style.css'`
145
- - **Editor not rendering:** Check that React 18+ or next.js 14+ is installed
146
- - **TypeScript errors:** Update to TypeScript 5.0+
147
- - **Missing styles:** Verify the CSS import path is correct
148
-
149
-
150
-
151
- ## Version Compatibility
152
-
153
- - React 18+
154
- - Next.js 14+
155
- - Lexical 0.36.0+
156
- - TypeScript 5.0+
157
-
158
-
159
- ## License
160
-
161
- MIT © Innoviatech
162
-
163
- ## Support & Community
164
-
165
- ### Get Help
166
-
167
- We're here to help you succeed with our editor! Here are the best ways to get support:
168
-
169
- ### Report an Issue
170
- Found a bug or experiencing problems?
171
- 👉 [Open a GitHub Issue](https://github.com/technohaattech/Lexical-Text-Editor/issues)
172
-
173
- **Please include:**
174
- - 📱 **Environment** (Browser, OS, React/Next.js version)
175
- - 🔍 **Steps to reproduce**
176
- - 🎯 **Expected vs Actual behavior**
177
- - 📋 **Relevant code snippets**
178
- - 🖼️ **Screenshots** (if applicable)
179
-
180
- ### Request a Feature
181
- Have an idea to make the editor even better?
182
- ✨ [Submit a Feature Request](https://github.com/technohaattech/Lexical-Text-Editor/issues/new?template=feature_request.md)
183
-
184
-
185
-
186
- ### Documentation
187
- [Getting Started Guide](https://github.com/technohaattech/Lexical-Text-Editor)
188
-
189
- ### Video Tutorials
190
- - [Installation & Setup](https://youtube.com/playlist?list=...) *(Coming Soon!)*
191
- - [Advanced Features](https://youtube.com/playlist?list=...) *(Coming Soon!)*
192
- - [Integration Examples](https://youtube.com/playlist?list=...) *(Coming Soon!)*
193
-
194
- ### Community
195
- Join our growing community of developers:
196
-
197
- | Platform | Link | Best For |
198
- |----------|------|----------|
199
- | **GitHub Discussions** | [Join Discussion](https://github.com/technohaattech/Lexical-Text-Editor/discussions) | Questions & ideas |
200
-
201
-
202
- ### Contribute
203
-
204
- Love our editor? Here's how you can contribute:
205
-
206
- ### Ways to Contribute
207
- - 📝 **Improve Documentation** – Help others learn
208
- - 🔧 **Fix Bugs** – Submit pull requests
209
- - ✨ **Add Features** – Extend functionality
210
- - 🧪 **Write Tests** – Improve reliability
211
- - 🌍 **Translate** – Help with localization
212
- - 📣 **Spread the Word** – Star the repo, share with others
213
-
214
-
215
- ### About Innoviatech
216
-
217
-
218
- **Our Mission**
219
-
220
- At Innoviatech, we believe that creating great digital experiences should be accessible to every developer. We build tools that empower teams to focus on what matters most.
221
-
222
-
223
- **Built with Passion**
224
-
225
- > "Great tools shouldn't get in the way of great ideas. That's why we build editors that feel like an extension of your creativity."
226
-
227
-
228
-
229
- **Star Us on GitHub!**
230
-
231
- If you find this project helpful, please consider giving it a star on GitHub. It helps us reach more developers like you!
232
-
233
- [![Star on GitHub](https://img.shields.io/github/stars/technohaattech/Lexical-Text-Editor?style=social)](https://github.com/technohaattech/Lexical-Text-Editor)
234
-
235
- [![npm version](https://img.shields.io/npm/v/@innoviatech/lexical-text-editor)](
236
- https://www.npmjs.com/package/@innoviatech/lexical-text-editor
237
- )
238
-
239
- ---
240
-
241
- *Made with ❤️ by the Innoviatech team*
1
+ # @innoviatech/lexical-text-editor
2
+
3
+ A rich text editor component for React, built on [Lexical](https://lexical.dev/). It ships with a complete toolbar covering text, block, table, code, and media tools, plus theming, a responsive layout engine, and TypeScript support, all in a single package with plain CSS (no Tailwind required).
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@innoviatech/lexical-text-editor)](https://www.npmjs.com/package/@innoviatech/lexical-text-editor)
6
+ [![GitHub stars](https://img.shields.io/github/stars/technohaattech/lexical-text-editor?style=social)](https://github.com/technohaattech/lexical-text-editor)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](#license)
8
+
9
+ ![Editor Preview](./editor_screenshot.png)
10
+
11
+ ## What's New in v3.0
12
+
13
+ Fourteen new features, all implemented and verified end-to-end in the test app:
14
+
15
+ | Feature | Name | Description |
16
+ |---------|------|-------------|
17
+ | Feature 1 | Clear Formatting | Strips all inline formatting from the current selection (bold, italic, underline, colors, case transforms, and more) with one click. Block-level formatting such as headings and lists is preserved. |
18
+ | Feature 2 | Code Blocks | Block-level code with syntax highlighting and a language picker: JavaScript, TypeScript, Python, Java, C#, C++, PHP, Ruby, Go, Rust, Swift, Kotlin, HTML, CSS, SQL, JSON, Bash, Markdown, YAML, XML, and more. |
19
+ | Feature 3 | Horizontal Rule | Inserts `<hr>` dividers between blocks from the toolbar. |
20
+ | Feature 4 | Tables | Insert tables through a dimension grid picker; insert/delete rows and columns, and toggle a header row. Row/column operations detect the current cell automatically. |
21
+ | Feature 5 | Indent / Outdent | Toolbar buttons plus `Tab` / `Shift+Tab` nesting inside lists, including multi-level list support. |
22
+ | Feature 6 | Font Family Dropdown | Apply Inter, System, Serif, Monospace, Cursive, Georgia, Courier, or revert to Default for the current selection. |
23
+ | Feature 7 | Font Size Dropdown | Fixed presets from 12 px to 48 px, applied per selection, with a Default reset. |
24
+ | Feature 8 | Find & Replace | Live match count ("n of m"), next/previous navigation, match-case toggle, and Replace / Replace All. Replace All runs as a single undo step. |
25
+ | Feature 9 | Source Code View | Toggle between WYSIWYG and raw HTML editing. Edits are applied on demand (Update / Done) so typing malformed markup never floods the undo history. |
26
+ | Feature 10 | Fullscreen Mode | Expands the editor to fill the viewport; `Escape` exits. |
27
+ | Feature 11 | Word / Character Count | Live counts in a status bar, independently hideable. |
28
+ | Feature 12 | Light / Dark / System Theme | `theme` prop plus an end-user switcher in the status bar. Dark styling covers every UI surface; `system` tracks the OS `prefers-color-scheme` live and is SSR-safe. |
29
+ | Feature 13 | Toolbar Style Variants | `wrap` (tools flow across lines), `collapse` (single row with a "…" overflow button), and `scrollbar` (single row with a custom slim scrollbar). |
30
+ | Feature 14 | Responsive Overflow Toolbar | Predictive width fitting via `ResizeObserver`: primary tools (undo/redo, headings, text formats, alignment, link) stay inline while the rest collapse into the "…" panel on narrow containers. |
31
+
32
+ ### Previous releases
33
+
34
+ - v2.0.x: Custom image upload handler (`onImageUpload`), image captions, paste-image support, plain-CSS styling (Tailwind removed), and a reduced dependency footprint.
35
+
36
+ ## Features
37
+
38
+ - **Text formatting:** bold, italic, underline, strikethrough, superscript, subscript, inline code, highlight, text case (uppercase / lowercase / capitalize)
39
+ - **Block formatting:** headings (H1 to H6), paragraphs, quotes, ordered & unordered lists, horizontal rules
40
+ - **Tables & code:** table editor with row/column operations and header rows; syntax-highlighted code blocks in 20+ languages
41
+ - **Links & media:** hyperlink insert/edit/remove; images (URL, upload, paste, captions) and YouTube / Google Drive embeds
42
+ - **Editor utilities:** find & replace, source code view, fullscreen, content preview, clear formatting, undo/redo
43
+ - **Typography controls:** font family and font size dropdowns, text & background color pickers
44
+ - **Theming:** light, dark, and system color schemes with full dark-mode styling
45
+ - **Responsive toolbar:** wrap / collapse / scrollbar layouts with automatic overflow handling
46
+ - **Status bar:** live word and character count, user-facing theme and layout switchers
47
+ - **Developer experience:** fully typed TypeScript API, controlled HTML value model, minimal CSS integration
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ npm install @innoviatech/lexical-text-editor
53
+ ```
54
+
55
+ ### Dependencies
56
+
57
+ The package relies on matching Lexical peer packages. npm 7+ installs peer dependencies automatically; with yarn or pnpm, install them explicitly:
58
+
59
+ ```bash
60
+ npm install lexical@^0.36.2 @lexical/react@^0.36.2 @lexical/code@^0.36.2 @lexical/link@^0.36.2 \
61
+ @lexical/list@^0.36.2 @lexical/rich-text@^0.36.2 @lexical/table@^0.36.2 \
62
+ react-color react-icons
63
+ ```
64
+
65
+ No Tailwind CSS is required: just import the stylesheet and use the component directly.
66
+
67
+ ## Quick Start
68
+
69
+ ```tsx
70
+ import React, { useState } from 'react';
71
+ import { LexicalTextEditor } from '@innoviatech/lexical-text-editor';
72
+ import '@innoviatech/lexical-text-editor/style.css';
73
+
74
+ function App() {
75
+ const [content, setContent] = useState('');
76
+
77
+ return (
78
+ <LexicalTextEditor
79
+ name="my-editor"
80
+ value={content}
81
+ onChange={setContent}
82
+ placeholder="Start typing your content here..."
83
+ />
84
+ );
85
+ }
86
+
87
+ export default App;
88
+ ```
89
+
90
+ ## Props
91
+
92
+ | Prop | Type | Required | Default | Description |
93
+ |----------------|-------------------------------------|----------|---------------|----------------------------------------------------------|
94
+ | `name` | `string` | Yes | none | Unique identifier for the editor instance |
95
+ | `value` | `string` | Yes | none | Current editor content (HTML string) |
96
+ | `onChange` | `(value: string) => void` | Yes | none | Callback fired when content changes |
97
+ | `placeholder` | `string` | No | `"Some Text"` | Placeholder text when editor is empty |
98
+ | `maxWidth` | `string` | No | `"1090px"` | Adjust the maximum width (`'80%'` or `'800px'`) |
99
+ | `height` | `string` | No | `"500px"` | Adjust the height (`'50vh'` or `'500px'`) |
100
+ | `onImageUpload`| `(file: File) => Promise<string>` | No | none | Custom handler for uploading images to your server |
101
+ | `theme` | `'light' \| 'dark' \| 'system'` | No | `'system'` | Color scheme; `'system'` follows the OS `prefers-color-scheme` |
102
+ | `toolbarStyle` | `'wrap' \| 'collapse' \| 'scrollbar'` | No | `'collapse'` | Toolbar layout (`'normal'` is a deprecated alias for `'collapse'`) |
103
+ | `showWordCount`| `boolean` | No | `true` | Show live word count in the status bar |
104
+ | `showCharCount`| `boolean` | No | `true` | Show live character count in the status bar |
105
+ | `showDisplayControls` | `boolean` | No | `true` | Show light/dark + toolbar-style switchers in the status bar so end users can change these too |
106
+ | `onThemeChange`| `(theme: 'light' \| 'dark' \| 'system') => void` | No | none | Fires when the end user switches theme from the editor UI (not on prop changes) |
107
+ | `onToolbarStyleChange` | `(style: 'wrap' \| 'collapse' \| 'scrollbar') => void` | No | none | Fires when the end user switches toolbar style from the editor UI (not on prop changes) |
108
+
109
+ ## Advanced Usage
110
+
111
+ ### With Initial Content
112
+
113
+ ```tsx
114
+ import React, { useState } from 'react';
115
+ import { LexicalTextEditor } from '@innoviatech/lexical-text-editor';
116
+ import '@innoviatech/lexical-text-editor/style.css';
117
+
118
+ function App() {
119
+ const [content, setContent] = useState(
120
+ '<p>Welcome to the editor!</p><ul><li>Feature 1</li><li>Feature 2</li></ul>'
121
+ );
122
+
123
+ return (
124
+ <LexicalTextEditor
125
+ name="content-editor"
126
+ value={content}
127
+ onChange={setContent}
128
+ placeholder="Write your content..."
129
+ maxWidth="600px"
130
+ height="400px"
131
+ />
132
+ );
133
+ }
134
+ ```
135
+
136
+ ### Theme Control (Light / Dark / System)
137
+
138
+ Control the color scheme programmatically and persist the end user's choice:
139
+
140
+ ```tsx
141
+ const [theme, setTheme] = useState<'light' | 'dark' | 'system'>('system');
142
+
143
+ <LexicalTextEditor
144
+ name="editor"
145
+ value={content}
146
+ onChange={setContent}
147
+ theme={theme}
148
+ onThemeChange={(t) => {
149
+ setTheme(t);
150
+ localStorage.setItem('editor-theme', t); // persist the user's choice
151
+ }}
152
+ />
153
+ ```
154
+
155
+ `'system'` follows the OS color scheme live (including change events) and is SSR/render-safe because `matchMedia` is only touched inside effects.
156
+
157
+ ### Toolbar Style + Display Controls
158
+
159
+ Choose `wrap` (tools flow to new lines), `collapse` (single row; overflowed tools collapse into a "…" button + modal; this is the default), or `scrollbar` (single scrollable row with a custom slim scrollbar):
160
+
161
+ ```tsx
162
+ <LexicalTextEditor
163
+ name="editor"
164
+ value={content}
165
+ onChange={setContent}
166
+ toolbarStyle="collapse" // 'wrap' | 'collapse' | 'scrollbar'
167
+ onToolbarStyleChange={(style) => persist(style)}
168
+ showDisplayControls // status-bar switchers for end users (default: true)
169
+ />
170
+ ```
171
+
172
+ In `collapse` mode the toolbar measures its width with a `ResizeObserver` and collapses non-primary segments (last in, first out; undo/redo and the heading picker are never collapsed) until everything fits.
173
+
174
+ ### Hiding Status Bar Elements
175
+
176
+ ```tsx
177
+ <LexicalTextEditor
178
+ name="editor"
179
+ value={content}
180
+ onChange={setContent}
181
+ showWordCount={false}
182
+ showCharCount={false}
183
+ showDisplayControls={false}
184
+ />
185
+ ```
186
+
187
+ ### Custom Image Upload
188
+
189
+ Upload images to your own server instead of using temporary blob URLs:
190
+
191
+ ```tsx
192
+ const handleImageUpload = async (file: File): Promise<string> => {
193
+ const formData = new FormData();
194
+ formData.append('image', file);
195
+
196
+ const res = await fetch('/api/upload', { method: 'POST', body: formData });
197
+ const data = await res.json();
198
+ if (!data.url) throw new Error('Upload failed');
199
+ return data.url; // permanent URL stored in editor content
200
+ };
201
+
202
+ <LexicalTextEditor
203
+ name="editor"
204
+ value={content}
205
+ onChange={setContent}
206
+ onImageUpload={handleImageUpload}
207
+ />
208
+ ```
209
+
210
+ When `onImageUpload` is provided, images selected via the dialog, pasted from the clipboard, or drag-dropped are uploaded to your endpoint. The returned URL is stored permanently in the editor content (unlike temporary blob URLs).
211
+
212
+ ### Image Captions
213
+
214
+ Images support captions. Fill in the **Caption** field when inserting an image via the dialog, or click **"+ Add caption"** below an inserted image to edit it inline.
215
+
216
+ ### Find & Replace / Source Code View
217
+
218
+ Both require no configuration; they are toolbar utilities:
219
+
220
+ - **Find & Replace** (magnifier icon): search with a live "n of m" match count, `Enter` / `Shift+Enter` to navigate, `Match case` toggle, Replace / Replace All, `Escape` closes the panel.
221
+ - **Source Code View** (`</>` icon): edit raw HTML in a textarea; **Update** applies edits to the editor, **Done** applies and exits. Toggle the toolbar button again to close without applying.
222
+
223
+ ## Toolbar Reference
224
+
225
+ | Group | Tools |
226
+ |-------|-------|
227
+ | Undo / Redo | History operations (redo disabled when empty) |
228
+ | Headings | Normal, H1 to H6 |
229
+ | Text formats | Bold, Italic, Underline, Quote, Inline Code, Clear Formatting |
230
+ | Case & extras | Uppercase, Lowercase, Capitalize, Strikethrough, Highlight, Superscript, Subscript |
231
+ | Typography | Font family, font size |
232
+ | Colors | Text color, background color (SketchPicker) |
233
+ | Lists & blocks | Ordered list, unordered list, indent, outdent, horizontal rule |
234
+ | Layout | Alignment (left, center, right, justify) |
235
+ | Links & code | Link insert/edit/remove, code block with language picker |
236
+ | Media | Image (URL / upload), YouTube & Google Drive video |
237
+ | Utilities | Find & Replace, Source Code View, Fullscreen, Content Preview |
238
+ | Status bar | Word count, character count, theme switcher, toolbar style switcher |
239
+
240
+ ## Browser Support
241
+
242
+ - Chrome 90+
243
+ - Firefox 88+
244
+ - Safari 14+
245
+ - Edge 90+
246
+
247
+ ## Troubleshooting
248
+
249
+ | Problem | Solution |
250
+ |---------|----------|
251
+ | CSS not loading | Verify the import: `import '@innoviatech/lexical-text-editor/style.css'` |
252
+ | Editor not rendering | Confirm React 18+ (Next.js 14+) is installed |
253
+ | Runtime Lexical errors | Install the Lexical peer packages at `^0.36.2` (see [Dependencies](#dependencies)); mismatched versions across `node_modules` cause errors. Run `npm dedupe` and configure bundler-level dedupe for `lexical`. |
254
+ | TypeScript errors | Update to TypeScript 5.0+ |
255
+ | Missing styles | Confirm the CSS import path is correct |
256
+ | Dropdowns / popovers clipped | Do not add `overflow: hidden` to ancestors of the toolbar; popovers are absolutely positioned and require `overflow: visible` on ancestor elements. |
257
+
258
+ ## Version Compatibility
259
+
260
+ - React 18+
261
+ - Next.js 14+
262
+ - Lexical 0.36.2
263
+ - TypeScript 5.0+
264
+
265
+ ## License
266
+
267
+ [MIT](https://github.com/technohaattech/lexical-text-editor/blob/main/LICENSE) © Innoviatech
268
+
269
+ ## Publishing to npm (Maintainers)
270
+
271
+ Release process for this package:
272
+
273
+ ### Prerequisites
274
+
275
+ 1. An npm account with publish access to the `@innoviatech` scope
276
+ (`npm access ls-packages innoviatech` to verify).
277
+ 2. `npm login` completed locally. If 2FA is enabled, keep the authenticator ready.
278
+ 3. A clean working tree on `main`:
279
+
280
+ ```bash
281
+ git status
282
+ git checkout main
283
+ git pull origin main
284
+ ```
285
+
286
+ ### Step 1: Bump the version
287
+
288
+ ```bash
289
+ npm version 3.0.0 --no-git-tag-version
290
+ # or semantic shortcuts:
291
+ # npm version patch # 3.0.1 bugfix / docs / styles
292
+ # npm version minor # 3.1.0 new feature, backwards-compatible
293
+ # npm version major # 4.0.0 breaking change
294
+ ```
295
+
296
+ Commit and tag:
297
+
298
+ ```bash
299
+ git add package.json package-lock.json
300
+ git commit -m "chore: release v3.0.0"
301
+ git tag v3.0.0
302
+ ```
303
+
304
+ ### Step 2: Build and sanity-check
305
+
306
+ `prepublishOnly` runs the build automatically on publish; verify beforehand:
307
+
308
+ ```bash
309
+ npm run build # dist/index.js, dist/index.esm.js, dist/index.d.ts, dist/lexical-editor.css
310
+ npx tsc --noEmit # typecheck the source
311
+ npm pack --dry-run # review the exact tarball contents (files + sizes)
312
+ ```
313
+
314
+ Checklist for the dry-run output:
315
+ - [ ] `dist/index.js`, `dist/index.esm.js`, `dist/index.d.ts`, `dist/lexical-editor.css` present
316
+ - [ ] `README.md`, `package.json` present
317
+ - [ ] No stray files (`src/`, `rollup.config.js`, test folders); the `files` whitelist in `package.json` enforces this
318
+
319
+ ### Step 3: Smoke-test the tarball locally (recommended)
320
+
321
+ ```bash
322
+ npm pack # innoviatech-lexical-text-editor-3.0.0.tgz
323
+ cd ../test-app
324
+ npm install ../Lexical-Text-Editor/innoviatech-lexical-text-editor-3.0.0.tgz
325
+ npm run build && npm run dev # exercise the editor once
326
+ ```
327
+
328
+ ### Step 4: Publish
329
+
330
+ The package is scoped, so public access must be requested explicitly:
331
+
332
+ ```bash
333
+ npm publish --access public # enter OTP if prompted
334
+ ```
335
+
336
+ If the publish was interrupted, the version metadata may already be reserved.
337
+ Check `npm view @innoviatech/lexical-text-editor` and recover with
338
+ `npm publish --foreground-scripts`, or as a last resort unpublish and republish deliberately.
339
+
340
+ ### Step 5: Verify and tag the release
341
+
342
+ ```bash
343
+ npm view @innoviatech/lexical-text-editor version # should print the new version
344
+ git push origin main --tags
345
+ ```
346
+
347
+ Create a GitHub Release under `technohaattech/lexical-text-editor → Releases`, select the
348
+ `v3.0.0` tag, paste the "What's New" notes, and publish the release.
349
+
350
+ ### Quick reference
351
+
352
+ ```bash
353
+ npm run build && npx tsc --noEmit # 1. build + typecheck
354
+ npm version <x.y.z> --no-git-tag-version # 2. bump
355
+ git add -A && git commit -m "chore: release vX.Y.Z" && git tag vX.Y.Z
356
+ npm pack --dry-run # 3. inspect tarball
357
+ npm publish --access public # 4. publish
358
+ git push origin main --tags # 5. push code + tag
359
+ ```
360
+
361
+ ## Support & Community
362
+
363
+ ### Reporting Issues
364
+
365
+ Open an issue at [GitHub Issues](https://github.com/technohaattech/lexical-text-editor/issues) and include:
366
+
367
+ - Environment details (browser, OS, React / Next.js version)
368
+ - Steps to reproduce
369
+ - Expected vs. actual behavior
370
+ - Relevant code snippets and screenshots, if applicable
371
+
372
+ ### Feature Requests
373
+
374
+ Submit ideas via the
375
+ [feature request template](https://github.com/technohaattech/lexical-text-editor/issues/new?template=feature_request.md).
376
+
377
+ ### Contributing
378
+
379
+ Contributions are welcome:
380
+
381
+ - Improve the documentation
382
+ - Fix bugs or add features via pull requests
383
+ - Write tests
384
+ - Star and share the repository
385
+
386
+ Give the project a ⭐ on GitHub if you find it useful; it helps other developers discover it.
387
+
388
+ ---
389
+
390
+ *Built and maintained by the Innoviatech team.*