@innoviatech/lexical-text-editor 2.0.7 → 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.
- package/README.md +390 -288
- package/dist/components/AlignmentSelectionList.js +19 -0
- package/dist/components/ColorPicker.js +30 -0
- package/dist/components/ContentPreview.js +11 -0
- package/dist/components/DisplayControls.d.ts +16 -0
- package/dist/components/DropdownList.js +18 -0
- package/dist/components/FindReplaceModal.d.ts +11 -0
- package/dist/components/FindReplaceModal.js +120 -0
- package/dist/components/FontSelectionList.d.ts +17 -0
- package/dist/components/FontSelectionList.js +17 -0
- package/dist/components/HeadingSelectionList.js +19 -0
- package/dist/components/ImageComponent.js +111 -0
- package/dist/components/InsertDropdownList.js +17 -0
- package/dist/components/LexicalTextEditor.d.ts +10 -0
- package/dist/components/LexicalTextEditor.js +128 -0
- package/dist/components/LinkModal.js +47 -0
- package/dist/components/Separator.js +4 -0
- package/dist/components/SourceView.d.ts +13 -0
- package/dist/components/SourceView.js +50 -0
- package/dist/components/StatusBar.d.ts +14 -0
- package/dist/components/StatusBar.js +30 -0
- package/dist/components/ToolbarOverflowModal.d.ts +15 -0
- package/dist/components/common/Dialog.js +27 -0
- package/dist/components/common/Popover.d.ts +10 -1
- package/dist/components/common/Popover.js +37 -0
- package/dist/components/common/Tooltip.d.ts +7 -0
- package/dist/components/common/Tooltip.js +20 -0
- package/dist/components/ui/button.js +35 -0
- package/dist/components/ui/command.js +33 -0
- package/dist/components/ui/dialog.js +35 -0
- package/dist/components/ui/input.js +6 -0
- package/dist/components/ui/popover.js +16 -0
- package/dist/components/ui/scroll-area.js +12 -0
- package/dist/components/ui/tooltip.js +16 -0
- package/dist/constants/index.d.ts +23 -1
- package/dist/constants/index.js +224 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical-editor.css +1 -1
- package/dist/lib/utils.js +5 -0
- package/dist/nodes/ExtendedTextNode.js +140 -0
- package/dist/nodes/ImageNode.js +149 -0
- package/dist/nodes/VideoNode.js +80 -0
- package/dist/nodes/YoutubeNode.js +64 -0
- package/dist/plugins/CodeBlockPlugin.d.ts +1 -0
- package/dist/plugins/CodeBlockPlugin.js +88 -0
- package/dist/plugins/ColorPlugin.js +47 -0
- package/dist/plugins/CustomOnChangePlugin.js +33 -0
- package/dist/plugins/FontFamilyPlugin.d.ts +1 -0
- package/dist/plugins/FontFamilyPlugin.js +53 -0
- package/dist/plugins/FontSizePlugin.d.ts +1 -0
- package/dist/plugins/FontSizePlugin.js +48 -0
- package/dist/plugins/ImagePlugin.js +91 -0
- package/dist/plugins/ListPlugin.js +44 -0
- package/dist/plugins/TablePlugin.d.ts +1 -0
- package/dist/plugins/TablePlugin.js +92 -0
- package/dist/plugins/ToolbarPlugin.d.ts +13 -1
- package/dist/plugins/ToolbarPlugin.js +381 -0
- package/dist/plugins/VideoPlugin.js +49 -0
- package/dist/plugins/YoutubePlugin.js +30 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/editor_screenshot.png +0 -0
- package/package.json +11 -4
- package/googlebd703883f12c69e4.html +0 -1
- package/rollup.config.js +0 -55
- package/src/components/AlignmentSelectionList.tsx +0 -61
- package/src/components/ColorPicker.tsx +0 -66
- package/src/components/ContentPreview.tsx +0 -51
- package/src/components/DropdownList.tsx +0 -57
- package/src/components/HeadingSelectionList.tsx +0 -61
- package/src/components/ImageComponent.tsx +0 -206
- package/src/components/InsertDropdownList.tsx +0 -36
- package/src/components/LexicalTextEditor.tsx +0 -119
- package/src/components/LinkModal.tsx +0 -127
- package/src/components/Separator.tsx +0 -7
- package/src/components/common/Dialog.tsx +0 -47
- package/src/components/common/Popover.tsx +0 -87
- package/src/components/common/Tooltip.tsx +0 -43
- package/src/components/ui/button.tsx +0 -58
- package/src/components/ui/command.tsx +0 -183
- package/src/components/ui/dialog.tsx +0 -142
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/popover.tsx +0 -46
- package/src/components/ui/scroll-area.tsx +0 -56
- package/src/components/ui/tooltip.tsx +0 -59
- package/src/constants/index.tsx +0 -177
- package/src/index.ts +0 -6
- package/src/lib/utils.ts +0 -6
- package/src/nodes/ExtendedTextNode.tsx +0 -174
- package/src/nodes/ImageNode.tsx +0 -232
- package/src/nodes/VideoNode.tsx +0 -134
- package/src/nodes/YoutubeNode.tsx +0 -101
- package/src/plugins/ColorPlugin.tsx +0 -85
- package/src/plugins/CustomOnChangePlugin.tsx +0 -50
- package/src/plugins/ImagePlugin.tsx +0 -189
- package/src/plugins/ListPlugin.tsx +0 -58
- package/src/plugins/ToolbarPlugin.tsx +0 -500
- package/src/plugins/VideoPlugin.tsx +0 -100
- package/src/plugins/YoutubePlugin.tsx +0 -83
- package/src/styles/lexical-editor.css +0 -1053
- package/src/types/global.d.ts +0 -34
- package/src/types/other.d.ts +0 -11
- package/src/types/react-icons.d.ts +0 -11
- package/tailwind.config.js +0 -10
- package/tsconfig.json +0 -32
package/README.md
CHANGED
|
@@ -1,288 +1,390 @@
|
|
|
1
|
-
# @innoviatech/lexical-text-editor
|
|
2
|
-
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
. 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
|
+
[](https://www.npmjs.com/package/@innoviatech/lexical-text-editor)
|
|
6
|
+
[](https://github.com/technohaattech/lexical-text-editor)
|
|
7
|
+
[](#license)
|
|
8
|
+
|
|
9
|
+

|
|
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.*
|