@baasix/lexical 0.0.2

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 (57) hide show
  1. package/README.md +281 -0
  2. package/dist/DateTimeComponent-4MX2IKXK.css +45 -0
  3. package/dist/DateTimeComponent-4MX2IKXK.css.map +1 -0
  4. package/dist/DateTimeComponent-7V5RW3AE.js +2928 -0
  5. package/dist/DateTimeComponent-7V5RW3AE.js.map +1 -0
  6. package/dist/EquationComponent-3IW3ONJD.js +159 -0
  7. package/dist/EquationComponent-3IW3ONJD.js.map +1 -0
  8. package/dist/EquationComponent-C2C6477P.css +28 -0
  9. package/dist/EquationComponent-C2C6477P.css.map +1 -0
  10. package/dist/ExcalidrawComponent-GZYLHNOY.js +267 -0
  11. package/dist/ExcalidrawComponent-GZYLHNOY.js.map +1 -0
  12. package/dist/ExcalidrawComponent-U6BD7DUB.css +152 -0
  13. package/dist/ExcalidrawComponent-U6BD7DUB.css.map +1 -0
  14. package/dist/ImageComponent-IYUGOT6O.css +73 -0
  15. package/dist/ImageComponent-IYUGOT6O.css.map +1 -0
  16. package/dist/ImageComponent-TTUYUG3M.js +429 -0
  17. package/dist/ImageComponent-TTUYUG3M.js.map +1 -0
  18. package/dist/PollComponent-CWI5UJF5.css +187 -0
  19. package/dist/PollComponent-CWI5UJF5.css.map +1 -0
  20. package/dist/PollComponent-KLJZSW5O.js +199 -0
  21. package/dist/PollComponent-KLJZSW5O.js.map +1 -0
  22. package/dist/StickyComponent-MZSTQF47.css +774 -0
  23. package/dist/StickyComponent-MZSTQF47.css.map +1 -0
  24. package/dist/StickyComponent-ZED6LNTX.js +233 -0
  25. package/dist/StickyComponent-ZED6LNTX.js.map +1 -0
  26. package/dist/chunk-35UCX4ZT.js +168 -0
  27. package/dist/chunk-35UCX4ZT.js.map +1 -0
  28. package/dist/chunk-44LUNGL3.js +16608 -0
  29. package/dist/chunk-44LUNGL3.js.map +1 -0
  30. package/dist/chunk-BHROZTZU.js +42 -0
  31. package/dist/chunk-BHROZTZU.js.map +1 -0
  32. package/dist/chunk-FJ6COZ4H.js +275 -0
  33. package/dist/chunk-FJ6COZ4H.js.map +1 -0
  34. package/dist/chunk-GSFNU3JE.js +211 -0
  35. package/dist/chunk-GSFNU3JE.js.map +1 -0
  36. package/dist/chunk-I43VQAHW.js +918 -0
  37. package/dist/chunk-I43VQAHW.js.map +1 -0
  38. package/dist/chunk-N22RKA5D.js +402 -0
  39. package/dist/chunk-N22RKA5D.js.map +1 -0
  40. package/dist/chunk-OIMMC5C3.js +134 -0
  41. package/dist/chunk-OIMMC5C3.js.map +1 -0
  42. package/dist/chunk-PZ5AY32C.js +10 -0
  43. package/dist/chunk-PZ5AY32C.js.map +1 -0
  44. package/dist/chunk-TVF6V3BJ.js +41 -0
  45. package/dist/chunk-TVF6V3BJ.js.map +1 -0
  46. package/dist/chunk-XTKVR2JI.js +225 -0
  47. package/dist/chunk-XTKVR2JI.js.map +1 -0
  48. package/dist/emoji-list-MUV74SND.js +8 -0
  49. package/dist/emoji-list-MUV74SND.js.map +1 -0
  50. package/dist/index.css +4234 -0
  51. package/dist/index.css.map +1 -0
  52. package/dist/index.d.ts +17 -0
  53. package/dist/index.js +16050 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/landscape-RJWVK6ET.jpg +0 -0
  56. package/dist/yellow-flower-R72KOP74.jpg +0 -0
  57. package/package.json +76 -0
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ # @baasix/lexical
2
+
3
+ A feature-rich Lexical-based rich text editor component for Baasix applications. Forked from the [Lexical Playground](https://github.com/facebook/lexical) (v0.41.0) and adapted for seamless integration with the Baasix SDK.
4
+
5
+ ## Features
6
+
7
+ - **Rich Text Editing** — Full WYSIWYG editor with a comprehensive toolbar
8
+ - **Markdown Shortcuts** — Type markdown syntax and it auto-converts
9
+ - **Tables** — Insert and edit tables with cell resizing, hover actions, and scroll shadows
10
+ - **Images** — Drag-and-drop image uploads via Baasix file storage
11
+ - **Embeds** — YouTube, Twitter/X, and Figma embeds
12
+ - **Code Blocks** — Syntax-highlighted code blocks with Prism.js and Shiki support
13
+ - **Equations** — KaTeX-powered math equations (inline and block)
14
+ - **Excalidraw** — Embedded whiteboard/drawing canvas
15
+ - **Collapsible Sections** — Toggle sections for long content
16
+ - **Mentions** — @mention support for users/entities
17
+ - **Comments & Threads** — Inline commenting system
18
+ - **Polls** — Embeddable poll components
19
+ - **Sticky Notes** — Floating sticky notes
20
+ - **Emoji Picker** — Built-in emoji picker and shortcodes
21
+ - **Drag & Drop** — Draggable blocks for reordering content
22
+ - **Fullscreen Mode** — Toggle fullscreen editing with Escape to exit
23
+ - **Keyboard Shortcuts** — Extensive keyboard shortcut support
24
+ - **Read-Only Mode** — Controlled read-only state
25
+ - **HTML Bidirectional Sync** — External HTML value ↔ Lexical editor state with debounced onChange
26
+ - **Versioning** — Built-in version/revision tracking plugin
27
+ - **Terminology** — Custom terminology highlighting
28
+ - **Page Breaks** — Insert page break markers
29
+ - **Layouts** — Multi-column layout support
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install @baasix/lexical
35
+ ```
36
+
37
+ ### Peer Dependencies
38
+
39
+ ```bash
40
+ npm install react react-dom @baasix/sdk
41
+ ```
42
+
43
+ ## Quick Start
44
+
45
+ ```tsx
46
+ import { LexicalEditor } from '@baasix/lexical';
47
+ import '@baasix/lexical/style.css';
48
+
49
+ function MyForm() {
50
+ const [content, setContent] = useState('<p>Hello world</p>');
51
+
52
+ return (
53
+ <LexicalEditor
54
+ baasixClient={baasixClient}
55
+ value={content}
56
+ onChange={setContent}
57
+ height={500}
58
+ placeholder="Start writing..."
59
+ />
60
+ );
61
+ }
62
+ ```
63
+
64
+ ## Props
65
+
66
+ | Prop | Type | Required | Default | Description |
67
+ |------|------|----------|---------|-------------|
68
+ | `baasixClient` | `Baasix` | Yes | — | Baasix SDK client instance (used for file uploads, etc.) |
69
+ | `value` | `string` | Yes | — | HTML string to render in the editor |
70
+ | `onChange` | `(html: string) => void` | Yes | — | Callback fired when editor content changes |
71
+ | `folder` | `string` | No | — | Baasix file storage folder for uploaded assets |
72
+ | `height` | `number \| string` | No | `500` | Editor height (px or CSS value) |
73
+ | `debounceMs` | `number` | No | `300` | Debounce delay (ms) for the `onChange` callback |
74
+ | `placeholder` | `string` | No | — | Placeholder text shown in an empty editor |
75
+ | `readOnly` | `boolean` | No | `false` | When `true`, the editor is non-editable |
76
+ | `maxLength` | `number` | No | — | Maximum character limit |
77
+
78
+ ## Usage Examples
79
+
80
+ ### Basic Rich Text Field
81
+
82
+ ```tsx
83
+ import { LexicalEditor } from '@baasix/lexical';
84
+ import '@baasix/lexical/style.css';
85
+ import { useBaasix } from '@baasix/sdk';
86
+
87
+ function ArticleEditor() {
88
+ const { client } = useBaasix();
89
+ const [body, setBody] = useState('');
90
+
91
+ return (
92
+ <LexicalEditor
93
+ baasixClient={client}
94
+ value={body}
95
+ onChange={setBody}
96
+ folder="articles"
97
+ height={600}
98
+ placeholder="Write your article..."
99
+ />
100
+ );
101
+ }
102
+ ```
103
+
104
+ ### Read-Only Viewer
105
+
106
+ ```tsx
107
+ <LexicalEditor
108
+ baasixClient={client}
109
+ value={savedHtml}
110
+ onChange={() => {}}
111
+ readOnly
112
+ height="auto"
113
+ />
114
+ ```
115
+
116
+ ### With Character Limit
117
+
118
+ ```tsx
119
+ <LexicalEditor
120
+ baasixClient={client}
121
+ value={comment}
122
+ onChange={setComment}
123
+ maxLength={500}
124
+ height={200}
125
+ placeholder="Add a comment (max 500 characters)..."
126
+ />
127
+ ```
128
+
129
+ ### Custom Debounce
130
+
131
+ ```tsx
132
+ <LexicalEditor
133
+ baasixClient={client}
134
+ value={content}
135
+ onChange={handleSave}
136
+ debounceMs={1000} // 1 second debounce for expensive save operations
137
+ />
138
+ ```
139
+
140
+ ## Styling
141
+
142
+ The editor ships its own CSS. Import it once at the top of your app or component:
143
+
144
+ ```tsx
145
+ import '@baasix/lexical/style.css';
146
+ ```
147
+
148
+ The editor uses the `.editor-shell` class as its root container. You can override styles as needed.
149
+
150
+ ## Architecture
151
+
152
+ The editor is wrapped in several React context providers:
153
+
154
+ - **`FullscreenContext`** — Manages fullscreen toggle state
155
+ - **`EditorConfigProvider`** — Provides the Baasix client and folder config to all plugins
156
+ - **`SettingsContext`** — Editor feature toggles (rich text, autocomplete, etc.)
157
+ - **`SharedHistoryContext`** — Shared undo/redo history
158
+ - **`LexicalComposer`** — Core Lexical editor initialization
159
+ - **`CollaborationContext`** — Collaboration awareness (Yjs ready)
160
+ - **`ToolbarContext`** — Toolbar state management
161
+
162
+ ### Custom Nodes
163
+
164
+ The editor includes many custom Lexical nodes beyond the defaults:
165
+
166
+ | Node | Description |
167
+ |------|-------------|
168
+ | `ImageNode` | Images with resize and caption |
169
+ | `EquationNode` | KaTeX math equations |
170
+ | `ExcalidrawNode` | Excalidraw whiteboard drawings |
171
+ | `FigmaNode` | Figma embed |
172
+ | `TweetNode` | Twitter/X embed |
173
+ | `YouTubeNode` | YouTube embed |
174
+ | `PollNode` | Interactive polls |
175
+ | `StickyNode` | Floating sticky notes |
176
+ | `MentionNode` | @mention references |
177
+ | `EmojiNode` | Custom emoji rendering |
178
+ | `DateTimeNode` | Date/time picker |
179
+ | `PageBreakNode` | Page break markers |
180
+ | `LayoutContainerNode` | Multi-column layouts |
181
+ | `CollapsibleContainerNode` | Toggle/collapsible sections |
182
+ | `AutocompleteNode` | Typeahead autocomplete |
183
+ | `KeywordNode` | Keyword highlighting |
184
+ | `SpecialTextNode` | Special text formatting |
185
+ | `TerminologyNode` | Terminology highlighting |
186
+ | `NotesNode` | Inline notes |
187
+ | `RevisionNode` | Revision tracking |
188
+ | `HtmlBlockNode` | Raw HTML blocks |
189
+
190
+ ### Plugins
191
+
192
+ Over 40 editor plugins are included:
193
+
194
+ - **Toolbar** — Rich formatting toolbar with font size, color, alignment, and more
195
+ - **Drag & Drop** — Draggable block reordering via `@atlaskit/pragmatic-drag-and-drop`
196
+ - **Code Actions** — Copy, format (Prettier), and wrap code blocks
197
+ - **Floating Link Editor** — Inline link editing popover
198
+ - **Floating Text Format** — Selection-based floating toolbar
199
+ - **Component Picker** — Slash-command menu for inserting components
200
+ - **Context Menu** — Right-click context menu actions
201
+ - **Auto Embed** — Automatic URL-to-embed conversion
202
+ - **Markdown Shortcuts** — Markdown-to-rich-text transformers
203
+ - **Comments** — Inline comment threads
204
+ - **Versions** — Content version history
205
+ - **And many more…**
206
+
207
+ ## Plugin Directory Structure
208
+
209
+ ```
210
+ src/
211
+ ├── index.tsx # Entry point, CSS imports, exports
212
+ ├── LexicalEditor.tsx # Public API component & HtmlPlugin
213
+ ├── Editor.tsx # Main editor composition with all plugins
214
+ ├── FORK_SOURCE.md # Fork provenance info
215
+ ├── declarations.d.ts # Module declarations
216
+ ├── context/ # React context providers
217
+ │ ├── EditorConfigContext.tsx
218
+ │ ├── FullscreenContext.tsx
219
+ │ ├── SettingsContext.tsx
220
+ │ ├── SharedHistoryContext.tsx
221
+ │ ├── ToolbarContext.tsx
222
+ │ └── FlashMessageContext.tsx
223
+ ├── hooks/ # Custom React hooks
224
+ │ ├── useFlashMessage.tsx
225
+ │ ├── useModal.tsx
226
+ │ └── useReport.ts
227
+ ├── nodes/ # Custom Lexical nodes
228
+ │ ├── PlaygroundNodes.ts # Node registration
229
+ │ ├── ImageNode.tsx
230
+ │ ├── EquationNode.tsx
231
+ │ ├── ExcalidrawNode/
232
+ │ └── ... (20+ nodes)
233
+ ├── plugins/ # Editor plugins
234
+ │ ├── ToolbarPlugin/
235
+ │ ├── DraggableBlockPlugin/
236
+ │ ├── ImagesPlugin/
237
+ │ ├── CommentPlugin/
238
+ │ ├── VersionsPlugin/
239
+ │ └── ... (40+ plugins)
240
+ ├── themes/ # Editor CSS themes
241
+ │ ├── PlaygroundEditorTheme.ts
242
+ │ ├── CommentEditorTheme.ts
243
+ │ └── StickyEditorTheme.ts
244
+ ├── ui/ # Reusable UI components
245
+ │ ├── Button.tsx
246
+ │ ├── ColorPicker.tsx
247
+ │ ├── Modal.tsx
248
+ │ ├── Dialog.tsx
249
+ │ └── ... (15+ components)
250
+ ├── utils/ # Utility functions
251
+ ├── images/ # Static image assets
252
+ └── styles/ # Additional CSS
253
+ ```
254
+
255
+ ## Key Dependencies
256
+
257
+ | Package | Version | Purpose |
258
+ |---------|---------|---------|
259
+ | `lexical` | 0.41.0 | Core editor framework |
260
+ | `@lexical/react` | 0.41.0 | React bindings for Lexical |
261
+ | `@lexical/rich-text` | 0.41.0 | Rich text support |
262
+ | `@lexical/table` | 0.41.0 | Table support |
263
+ | `@lexical/code` | 0.41.0 | Code block support |
264
+ | `@lexical/list` | 0.41.0 | List support |
265
+ | `@lexical/link` | 0.41.0 | Link support |
266
+ | `@lexical/markdown` | 0.41.0 | Markdown transformers |
267
+ | `@excalidraw/excalidraw` | 0.18.0 | Whiteboard drawings |
268
+ | `katex` | 0.16.x | Math equation rendering |
269
+ | `prismjs` | 1.30.x | Syntax highlighting |
270
+ | `yjs` | 13.6.x | Real-time collaboration (CRDT) |
271
+ | `@baasix/sdk` | * | Baasix SDK (peer dependency) |
272
+
273
+ ## Fork Information
274
+
275
+ This package is forked from [facebook/lexical](https://github.com/facebook/lexical) `packages/lexical-playground/src` at tag **v0.41.0** (forked on 2026-03-16). The following files from the original playground were removed: `App.tsx`, `index.tsx`, `index.css`, `appSettings.ts`, `Settings.tsx`, `setupEnv.ts`, `buildHTMLConfig.tsx`, `collaboration.ts`, and the `server/` directory.
276
+
277
+ The editor has been adapted to work as a standalone component that integrates with the Baasix SDK for file uploads and asset management.
278
+
279
+ ## License
280
+
281
+ MIT
@@ -0,0 +1,45 @@
1
+ /* src/nodes/DateTimeNode/DateTimeNode.css */
2
+ .dateTimePill {
3
+ cursor: pointer;
4
+ width: fit-content;
5
+ background: #ddd;
6
+ border: 1px solid #ddd;
7
+ border-radius: 8px;
8
+ padding: 0px 4px 0px 4px;
9
+ }
10
+ .dateTimePill.selected {
11
+ outline: 2px solid rgb(60, 132, 244);
12
+ }
13
+ .dateTimePill.bold {
14
+ font-weight: bold;
15
+ }
16
+ .dateTimePill.italic {
17
+ font-style: italic;
18
+ }
19
+ .dateTimePill.underline {
20
+ text-decoration: underline;
21
+ }
22
+ .dateTimePill.strikethrough {
23
+ text-decoration: line-through;
24
+ }
25
+ .dateTimePill.underline.strikethrough {
26
+ text-decoration: underline line-through;
27
+ }
28
+ .dateTimePill.highlight {
29
+ background: rgba(255, 212, 0, 0.14);
30
+ }
31
+ .dateTimePill:hover {
32
+ background: #f2f2f2;
33
+ }
34
+ .dateTimePicker {
35
+ background: #fff;
36
+ border: 1px solid #ddd;
37
+ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);
38
+ border-radius: 8px;
39
+ padding: 0px 6px 0px 10px;
40
+ }
41
+ .rdp-root {
42
+ --rdp-accent-color: #76b6ff;
43
+ --rdp-accent-background-color: #f0f0f0;
44
+ }
45
+ /*# sourceMappingURL=DateTimeComponent-4MX2IKXK.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/nodes/DateTimeNode/DateTimeNode.css"],"sourcesContent":["/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\r\n\r\n.dateTimePill {\r\n cursor: pointer;\r\n width: fit-content;\r\n background: #ddd;\r\n border: 1px solid #ddd;\r\n border-radius: 8px;\r\n padding: 0px 4px 0px 4px;\r\n}\r\n.dateTimePill.selected {\r\n outline: 2px solid rgb(60, 132, 244);\r\n}\r\n.dateTimePill.bold {\r\n font-weight: bold;\r\n}\r\n.dateTimePill.italic {\r\n font-style: italic;\r\n}\r\n.dateTimePill.underline {\r\n text-decoration: underline;\r\n}\r\n.dateTimePill.strikethrough {\r\n text-decoration: line-through;\r\n}\r\n.dateTimePill.underline.strikethrough {\r\n text-decoration: underline line-through;\r\n}\r\n.dateTimePill.highlight {\r\n background: rgba(255, 212, 0, 0.14);\r\n}\r\n.dateTimePill:hover {\r\n background: #f2f2f2;\r\n}\r\n.dateTimePicker {\r\n background: #fff;\r\n border: 1px solid #ddd;\r\n box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.3);\r\n border-radius: 8px;\r\n padding: 0px 6px 0px 10px;\r\n}\r\n/* https://daypicker.dev/docs/styling#css-variables */\r\n.rdp-root {\r\n --rdp-accent-color: #76b6ff;\r\n --rdp-accent-background-color: #f0f0f0;\r\n}\r\n"],"mappings":";AASA,CAAC;AACC,UAAQ;AACR,SAAO;AACP,cAAY;AACZ,UAAQ,IAAI,MAAM;AAClB,iBAAe;AACf,WAAS,IAAI,IAAI,IAAI;AACvB;AACA,CARC,YAQY,CAAC;AACZ,WAAS,IAAI,MAAM,IAAI,EAAE,EAAE,GAAG,EAAE;AAClC;AACA,CAXC,YAWY,CAAC;AACZ,eAAa;AACf;AACA,CAdC,YAcY,CAAC;AACZ,cAAY;AACd;AACA,CAjBC,YAiBY,CAAC;AACZ,mBAAiB;AACnB;AACA,CApBC,YAoBY,CAAC;AACZ,mBAAiB;AACnB;AACA,CAvBC,YAuBY,CANC,SAMS,CAHT;AAIZ,mBAAiB,UAAU;AAC7B;AACA,CA1BC,YA0BY,CAAC;AACZ,cAAY,KAAK,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE;AAChC;AACA,CA7BC,YA6BY;AACX,cAAY;AACd;AACA,CAAC;AACC,cAAY;AACZ,UAAQ,IAAI,MAAM;AAClB,cAAY,IAAI,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AACvC,iBAAe;AACf,WAAS,IAAI,IAAI,IAAI;AACvB;AAEA,CAAC;AACC,sBAAoB;AACpB,iCAA+B;AACjC;","names":[]}