@collabchron/notiq 1.1.11 → 1.1.12

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 (66) hide show
  1. package/dist/{AIDialog-2WZUFWSC.mjs → AIDialog-RHRYHSVN.mjs} +5 -5
  2. package/dist/{CodeActionMenuPlugin-MRKY67ED.mjs → CodeActionMenuPlugin-FGH6HZLL.mjs} +2 -2
  3. package/dist/{CollaboratorsBar-TMKBOBJI.mjs → CollaboratorsBar-AMPIAUOY.mjs} +2 -2
  4. package/dist/{CommentsPlugin-5M4RD6YO.mjs → CommentsPlugin-SDJJTUGK.mjs} +2 -2
  5. package/dist/{ExcalidrawComponent-SIMURTCA.mjs → ExcalidrawComponent-BMSYIPP6.mjs} +2 -2
  6. package/dist/{ExcalidrawPlugin-2SGPIQ6U.mjs → ExcalidrawPlugin-QLPGJPSX.mjs} +2 -2
  7. package/dist/{ExportPlugin-OKZOLBGS.mjs → ExportPlugin-MJHYKQZJ.mjs} +7 -6
  8. package/dist/{FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs → FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs} +19 -19
  9. package/dist/{MobileToolbar-JKP2MLQJ.mjs → MobileToolbar-KV5DX4ED.mjs} +15 -17
  10. package/dist/{SlashCommand-2TNOOUBM.mjs → SlashCommand-SPR7G5EI.mjs} +13 -13
  11. package/dist/{StoryBuilderComponent-WQSNFPMM.mjs → StoryBuilderComponent-JN4ZPZOW.mjs} +8 -8
  12. package/dist/{chunk-PHRVYPVM.mjs → ToolbarPlugin-F52PVNXU.mjs} +33 -18
  13. package/dist/{block-format-MTSIXWID.mjs → block-format-TODFREE2.mjs} +2 -2
  14. package/dist/{chunk-FYLRS4BG.mjs → chunk-22ZIL6NH.mjs} +1 -1
  15. package/dist/{chunk-Z6JAFF55.mjs → chunk-2LNT36RL.mjs} +2 -2
  16. package/dist/chunk-37LC44W3.mjs +2677 -0
  17. package/dist/chunk-5D4JF3ZZ.mjs +624 -0
  18. package/dist/{chunk-MPTE332I.mjs → chunk-6FQFPPLG.mjs} +18 -20
  19. package/dist/{chunk-GYYLZ3MQ.mjs → chunk-ELBTVBTS.mjs} +1 -1
  20. package/dist/{chunk-XYDBUQ6Z.mjs → chunk-ENH2IOHI.mjs} +15 -165
  21. package/dist/{chunk-MW6MAUY3.mjs → chunk-FO7M3X2B.mjs} +1 -1
  22. package/dist/{chunk-YDDBQZ77.mjs → chunk-LBGM4VVZ.mjs} +8 -8
  23. package/dist/{chunk-2KESP7OU.mjs → chunk-LLGVCM7M.mjs} +3 -3
  24. package/dist/chunk-LVRJM45C.mjs +171 -0
  25. package/dist/{chunk-XZXGYNTY.mjs → chunk-QNIY45SF.mjs} +1 -1
  26. package/dist/{chunk-YTLUQJE2.mjs → chunk-T2UBAZ66.mjs} +1 -1
  27. package/dist/{chunk-3AHNLIME.mjs → chunk-XNJNT6PC.mjs} +21 -21
  28. package/dist/{chunk-LLCP7NVE.mjs → chunk-XYLTLGY5.mjs} +355 -29
  29. package/dist/{chunk-XAVQAXOJ.mjs → chunk-ZYJ7KABY.mjs} +1 -1
  30. package/dist/{color-23323E3B.mjs → color-S55XFDYQ.mjs} +2 -2
  31. package/dist/components/editor/Core.d.ts +15 -2
  32. package/dist/components/editor/index.d.ts +15 -4
  33. package/dist/core/index.d.ts +2 -1
  34. package/dist/core/react/NotiqEditor.d.ts +8 -8
  35. package/dist/core/types.d.ts +1 -0
  36. package/dist/core.js +8946 -2207
  37. package/dist/core.mjs +32 -26
  38. package/dist/{font-size-GTL6UVQL.mjs → font-size-3HMJHKO2.mjs} +2 -2
  39. package/dist/{image-TPW7PZZK.mjs → image-QPB2CVXP.mjs} +6 -6
  40. package/dist/index.js +4372 -4382
  41. package/dist/index.mjs +87 -1611
  42. package/dist/{insert-image-CZV6HWQZ.mjs → insert-image-PLBZELHK.mjs} +4 -4
  43. package/dist/{insert-node-MA3FXEYN.mjs → insert-node-DGCZBGKG.mjs} +14 -16
  44. package/dist/react.js +10189 -3980
  45. package/dist/react.mjs +21 -16
  46. package/dist/{stepper-4AO5XMO7.mjs → stepper-KNITDVLG.mjs} +31 -31
  47. package/dist/styles/notiq.css +1 -1
  48. package/dist/{text-format-6L5N3CHZ.mjs → text-format-T3IY7FBI.mjs} +3 -3
  49. package/package.json +1 -1
  50. package/dist/ToolbarPlugin-IIAOU4P5.mjs +0 -35
  51. package/dist/chunk-AYNKORDO.mjs +0 -6
  52. package/dist/chunk-IU2N42JJ.mjs +0 -1763
  53. package/dist/chunk-W6GAJXUS.mjs +0 -334
  54. package/dist/{VersionHistoryPlugin-23MAZB4G.mjs → VersionHistoryPlugin-YWGCREKA.mjs} +3 -3
  55. package/dist/{background-color-OZJCBYCT.mjs → background-color-RW5JYLMG.mjs} +3 -3
  56. package/dist/{chunk-YE7M2VKR.mjs → chunk-C4JWLBYN.mjs} +3 -3
  57. package/dist/{chunk-KDA7ZYMJ.mjs → chunk-CLRSETYQ.mjs} +3 -3
  58. package/dist/{chunk-FMJ7DGWP.mjs → chunk-MSAO3YFB.mjs} +3 -3
  59. package/dist/{chunk-XYT6XM5S.mjs → chunk-N3KDPSRI.mjs} +3 -3
  60. package/dist/{chunk-MTQZWJHR.mjs → chunk-SYUCM5G5.mjs} +4 -4
  61. package/dist/{chunk-6SRMKQSD.mjs → chunk-VNDDDXGH.mjs} +3 -3
  62. package/dist/{chunk-LAUAYRPC.mjs → chunk-WUVIQCX7.mjs} +5 -5
  63. package/dist/{insert-audio-C66RZRKY.mjs → insert-audio-I3PD6JFS.mjs} +6 -6
  64. package/dist/{insert-file-3DTGRO7W.mjs → insert-file-PHR7XL4V.mjs} +6 -6
  65. package/dist/{insert-gif-FIMCCBAI.mjs → insert-gif-R5ZO4JHC.mjs} +3 -3
  66. package/dist/{text-align-CSDLJUDA.mjs → text-align-TEB4S52S.mjs} +3 -3
package/dist/index.mjs CHANGED
@@ -1,63 +1,6 @@
1
- import {
2
- AVATAR_PRESETS,
3
- OfflineBanner
4
- } from "./chunk-6SRMKQSD.mjs";
5
- import {
6
- CodeHighlightPlugin,
7
- LexicalAutoLinkPlugin,
8
- LinkWithMetaDataPlugin,
9
- nodes_default
10
- } from "./chunk-YDDBQZ77.mjs";
11
- import {
12
- DynamicBlockPlugin,
13
- EquationsPlugin,
14
- InlineImagePlugin,
15
- StoryBuilderPlugin
16
- } from "./chunk-Z6JAFF55.mjs";
17
- import {
18
- PollPlugin
19
- } from "./chunk-W6VQSFE5.mjs";
20
- import {
21
- CollapsiblePlugin
22
- } from "./chunk-ACV47ZKE.mjs";
23
- import {
24
- AutoEmbedPlugin,
25
- FigmaPlugin,
26
- TwitterPlugin,
27
- YouTubePlugin
28
- } from "./chunk-LLCP7NVE.mjs";
29
- import "./chunk-IAFCQV3Z.mjs";
30
- import {
31
- INSERT_IMAGE_COMMAND,
32
- ImagesPlugin
33
- } from "./chunk-MW6MAUY3.mjs";
34
- import "./chunk-4DVIYZVB.mjs";
35
1
  import {
36
2
  Badge
37
3
  } from "./chunk-AMXRQ2TK.mjs";
38
- import {
39
- clearFormatting,
40
- formatBulletList,
41
- formatCheckList,
42
- formatCode,
43
- formatHeading,
44
- formatNumberedList,
45
- formatParagraph,
46
- formatQuote,
47
- updateFontSize
48
- } from "./chunk-6D6QLRYR.mjs";
49
- import {
50
- DropdownMenu,
51
- DropdownMenuContent,
52
- DropdownMenuItem,
53
- DropdownMenuSeparator,
54
- DropdownMenuSub,
55
- DropdownMenuSubContent,
56
- DropdownMenuSubTrigger,
57
- DropdownMenuTrigger
58
- } from "./chunk-OXWTZV3U.mjs";
59
- import "./chunk-PFH63ZU4.mjs";
60
- import "./chunk-AYNKORDO.mjs";
61
4
  import {
62
5
  AICommandBar,
63
6
  AICopilot,
@@ -65,7 +8,6 @@ import {
65
8
  Blockquote,
66
9
  BlocksKit,
67
10
  Bold,
68
- BubbleMenu,
69
11
  BulletList,
70
12
  CheckList,
71
13
  Code,
@@ -74,20 +16,13 @@ import {
74
16
  ColumnsLayout,
75
17
  Equation,
76
18
  Excalidraw,
77
- Extension,
78
19
  Figma,
79
20
  File,
80
- FloatingMenu,
81
21
  Heading,
82
22
  HintBlock,
83
23
  History,
84
24
  Image,
85
25
  Italic,
86
- NotiqContent,
87
- NotiqContext,
88
- NotiqEditor,
89
- NotiqEditorImpl,
90
- NotiqProvider,
91
26
  OrderedList,
92
27
  Paragraph,
93
28
  Poll,
@@ -96,88 +31,60 @@ import {
96
31
  Strike,
97
32
  Tweet,
98
33
  Underline,
99
- YouTube,
34
+ YouTube
35
+ } from "./chunk-5D4JF3ZZ.mjs";
36
+ import {
37
+ BubbleMenu,
38
+ Editor,
39
+ Extension,
40
+ FloatingMenu,
41
+ NotiqContent,
42
+ NotiqContext,
43
+ NotiqEditor,
44
+ NotiqEditorImpl,
45
+ NotiqProvider,
100
46
  createCanCommands,
101
47
  createCommandChain,
102
48
  createNotiqEditor,
103
- editor_theme_default,
104
49
  useNotiq,
105
50
  useNotiqContext
106
- } from "./chunk-IU2N42JJ.mjs";
107
- import "./chunk-PHRVYPVM.mjs";
51
+ } from "./chunk-37LC44W3.mjs";
52
+ import {
53
+ AVATAR_PRESETS,
54
+ OfflineBanner
55
+ } from "./chunk-VNDDDXGH.mjs";
108
56
  import {
109
57
  VersionHistoryProvider,
110
58
  useVersionHistory
111
59
  } from "./chunk-J6ZUY5BY.mjs";
112
- import "./chunk-EIZMKFHF.mjs";
113
- import {
114
- SpeechToTextPlugin_default
115
- } from "./chunk-ZKZ7MLSS.mjs";
116
- import "./chunk-EEBA6OAH.mjs";
117
- import {
118
- OPEN_AI_COMMAND_BAR_COMMAND
119
- } from "./chunk-HOZ4QRFV.mjs";
120
- import {
121
- $createLayoutContainerNode,
122
- $createLayoutItemNode,
123
- LayoutPlugin
124
- } from "./chunk-W6GAJXUS.mjs";
60
+ import "./chunk-ZKZ7MLSS.mjs";
61
+ import "./chunk-LBGM4VVZ.mjs";
62
+ import "./chunk-HOZ4QRFV.mjs";
63
+ import "./chunk-2LNT36RL.mjs";
64
+ import "./chunk-W6VQSFE5.mjs";
65
+ import "./chunk-ACV47ZKE.mjs";
66
+ import "./chunk-XYLTLGY5.mjs";
67
+ import "./chunk-IAFCQV3Z.mjs";
125
68
  import {
126
69
  AIProvider,
127
70
  useAI
128
71
  } from "./chunk-BGV62GC2.mjs";
129
- import "./chunk-PD5K4AGP.mjs";
130
- import "./chunk-KXRLARGI.mjs";
131
- import {
132
- CAN_USE_DOM,
133
- isCapitalize,
134
- isCenterAlign,
135
- isClearFormatting,
136
- isDecreaseFontSize,
137
- isFormatBulletList,
138
- isFormatCheckList,
139
- isFormatCode,
140
- isFormatHeading,
141
- isFormatNumberedList,
142
- isFormatParagraph,
143
- isFormatQuote,
144
- isIncreaseFontSize,
145
- isIndent,
146
- isInsertCodeBlock,
147
- isInsertLink,
148
- isJustifyAlign,
149
- isLeftAlign,
150
- isLowercase,
151
- isOutdent,
152
- isRightAlign,
153
- isStrikeThrough,
154
- isSubscript,
155
- isSuperscript,
156
- isUppercase
157
- } from "./chunk-K5OAFEVY.mjs";
158
- import "./chunk-XYDBUQ6Z.mjs";
72
+ import "./chunk-K5OAFEVY.mjs";
73
+ import "./chunk-LVRJM45C.mjs";
159
74
  import {
160
75
  UploadProvider,
161
76
  useUpload
162
77
  } from "./chunk-N3WTT2U6.mjs";
163
- import {
164
- StepperPlugin
165
- } from "./chunk-2KESP7OU.mjs";
78
+ import "./chunk-FO7M3X2B.mjs";
79
+ import "./chunk-4DVIYZVB.mjs";
80
+ import "./chunk-LLGVCM7M.mjs";
166
81
  import "./chunk-VGAX6YEY.mjs";
167
82
  import "./chunk-N6ILV6NF.mjs";
168
- import "./chunk-YTLUQJE2.mjs";
83
+ import "./chunk-T2UBAZ66.mjs";
169
84
  import "./chunk-43Z4Z2KD.mjs";
170
- import {
171
- $createAudioNode,
172
- AudioNode,
173
- INSERT_AUDIO_COMMAND
174
- } from "./chunk-XYMXGU4T.mjs";
175
- import {
176
- $createFileNode,
177
- FileNode,
178
- INSERT_FILE_COMMAND
179
- } from "./chunk-ZFV2HGD3.mjs";
180
- import "./chunk-LU2XWLOE.mjs";
85
+ import "./chunk-XYMXGU4T.mjs";
86
+ import "./chunk-ZFV2HGD3.mjs";
87
+ import "./chunk-6D6QLRYR.mjs";
181
88
  import {
182
89
  DEFAULT_FONT_SIZE,
183
90
  MAX_ALLOWED_FONT_SIZE,
@@ -186,6 +93,7 @@ import {
186
93
  blockTypeToBlockName,
187
94
  useToolbarState
188
95
  } from "./chunk-4FFTOZGJ.mjs";
96
+ import "./chunk-OXWTZV3U.mjs";
189
97
  import {
190
98
  CommentsProvider,
191
99
  useComments
@@ -199,29 +107,23 @@ import {
199
107
  FALLBACK_SERVER_URL,
200
108
  useCollab
201
109
  } from "./chunk-RJQTA6HG.mjs";
202
- import "./chunk-6UVNHT3T.mjs";
203
- import "./chunk-5NRAXWYA.mjs";
110
+ import "./chunk-PFH63ZU4.mjs";
204
111
  import {
205
112
  SharedHistoryContext,
206
113
  useSharedHistoryContext
207
114
  } from "./chunk-EVPWKNE4.mjs";
208
- import "./chunk-CDAMHK63.mjs";
209
115
  import "./chunk-NBE6FF6L.mjs";
210
- import "./chunk-GYYLZ3MQ.mjs";
116
+ import "./chunk-ELBTVBTS.mjs";
117
+ import "./chunk-5NRAXWYA.mjs";
211
118
  import "./chunk-IUOUIDEQ.mjs";
212
- import {
213
- sanitizeUrl
214
- } from "./chunk-RAVYEEIC.mjs";
215
- import "./chunk-XZXGYNTY.mjs";
216
- import "./chunk-H3P47YXJ.mjs";
119
+ import "./chunk-RAVYEEIC.mjs";
120
+ import "./chunk-QNIY45SF.mjs";
217
121
  import {
218
122
  Button
219
123
  } from "./chunk-OE5JRLCN.mjs";
220
124
  import "./chunk-4UMUPCDK.mjs";
221
125
  import "./chunk-KNW2CGIP.mjs";
222
- import {
223
- HintPlugin
224
- } from "./chunk-7QRJVZQY.mjs";
126
+ import "./chunk-7QRJVZQY.mjs";
225
127
  import "./chunk-IIVB6JNE.mjs";
226
128
  import {
227
129
  cn
@@ -235,1435 +137,9 @@ import {
235
137
  // src/index.ts
236
138
  init_react_shim();
237
139
 
238
- // src/components/editor/index.tsx
239
- init_react_shim();
240
- import { useMemo as useMemo2 } from "react";
241
- import "./themes/theme.css";
242
- import { LexicalComposer } from "@lexical/react/LexicalComposer";
243
- import { LexicalCollaboration } from "@lexical/react/LexicalCollaborationContext";
244
-
245
- // src/components/editor/Core.tsx
246
- init_react_shim();
247
- import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef3, useState as useState3 } from "react";
248
- import { useLexicalEditable as useLexicalEditable2 } from "@lexical/react/useLexicalEditable";
249
- import { useLexicalComposerContext as useLexicalComposerContext8 } from "@lexical/react/LexicalComposerContext";
250
- import dynamic from "next/dynamic.js";
251
- import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
252
- import { ContentEditable } from "@lexical/react/LexicalContentEditable";
253
- import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
254
- import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
255
- import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin";
256
- import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
257
- import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
258
- import { INSERT_TABLE_COMMAND, $createTableNodeWithDimensions } from "@lexical/table";
259
- import { $insertNodeToNearestRoot as $insertNodeToNearestRoot3 } from "@lexical/utils";
260
- import { $isElementNode as $isElementNode2, COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR3 } from "lexical";
261
- import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
262
- import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
263
-
264
- // src/components/editor/plugins/ShortcutsPlugin/index.tsx
265
- init_react_shim();
266
- import { TOGGLE_LINK_COMMAND } from "@lexical/link";
267
- import {
268
- COMMAND_PRIORITY_NORMAL,
269
- FORMAT_ELEMENT_COMMAND,
270
- FORMAT_TEXT_COMMAND,
271
- INDENT_CONTENT_COMMAND,
272
- KEY_MODIFIER_COMMAND,
273
- OUTDENT_CONTENT_COMMAND
274
- } from "lexical";
275
- import { useEffect } from "react";
276
- function ShortcutsPlugin({
277
- editor,
278
- setIsLinkEditMode
279
- }) {
280
- const { toolbarState } = useToolbarState();
281
- useEffect(() => {
282
- const keyboardShortcutsHandler = (payload) => {
283
- const event = payload;
284
- if (isFormatParagraph(event)) {
285
- event.preventDefault();
286
- formatParagraph(editor);
287
- } else if (isFormatHeading(event)) {
288
- event.preventDefault();
289
- const { code } = event;
290
- const headingSize = `h${code[code.length - 1]}`;
291
- formatHeading(editor, toolbarState.blockType, headingSize);
292
- } else if (isFormatBulletList(event)) {
293
- event.preventDefault();
294
- formatBulletList(editor, toolbarState.blockType);
295
- } else if (isFormatNumberedList(event)) {
296
- event.preventDefault();
297
- formatNumberedList(editor, toolbarState.blockType);
298
- } else if (isFormatCheckList(event)) {
299
- event.preventDefault();
300
- formatCheckList(editor, toolbarState.blockType);
301
- } else if (isFormatCode(event)) {
302
- event.preventDefault();
303
- formatCode(editor, toolbarState.blockType);
304
- } else if (isFormatQuote(event)) {
305
- event.preventDefault();
306
- formatQuote(editor, toolbarState.blockType);
307
- } else if (isStrikeThrough(event)) {
308
- event.preventDefault();
309
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
310
- } else if (isLowercase(event)) {
311
- event.preventDefault();
312
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "lowercase");
313
- } else if (isUppercase(event)) {
314
- event.preventDefault();
315
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "uppercase");
316
- } else if (isCapitalize(event)) {
317
- event.preventDefault();
318
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "capitalize");
319
- } else if (isIndent(event)) {
320
- event.preventDefault();
321
- editor.dispatchCommand(INDENT_CONTENT_COMMAND, void 0);
322
- } else if (isOutdent(event)) {
323
- event.preventDefault();
324
- editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, void 0);
325
- } else if (isCenterAlign(event)) {
326
- event.preventDefault();
327
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center");
328
- } else if (isLeftAlign(event)) {
329
- event.preventDefault();
330
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "left");
331
- } else if (isRightAlign(event)) {
332
- event.preventDefault();
333
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "right");
334
- } else if (isJustifyAlign(event)) {
335
- event.preventDefault();
336
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "justify");
337
- } else if (isSubscript(event)) {
338
- event.preventDefault();
339
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript");
340
- } else if (isSuperscript(event)) {
341
- event.preventDefault();
342
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript");
343
- } else if (isInsertCodeBlock(event)) {
344
- event.preventDefault();
345
- editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
346
- } else if (isIncreaseFontSize(event)) {
347
- event.preventDefault();
348
- updateFontSize(
349
- editor,
350
- 1 /* increment */,
351
- toolbarState.fontSizeInputValue
352
- );
353
- } else if (isDecreaseFontSize(event)) {
354
- event.preventDefault();
355
- updateFontSize(
356
- editor,
357
- 2 /* decrement */,
358
- toolbarState.fontSizeInputValue
359
- );
360
- } else if (isClearFormatting(event)) {
361
- event.preventDefault();
362
- clearFormatting(editor);
363
- } else if (isInsertLink(event)) {
364
- event.preventDefault();
365
- const url = toolbarState.isLink ? null : sanitizeUrl("https://");
366
- setIsLinkEditMode(!toolbarState.isLink);
367
- editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
368
- }
369
- return false;
370
- };
371
- return editor.registerCommand(
372
- KEY_MODIFIER_COMMAND,
373
- keyboardShortcutsHandler,
374
- COMMAND_PRIORITY_NORMAL
375
- );
376
- }, [
377
- editor,
378
- toolbarState.isLink,
379
- toolbarState.blockType,
380
- toolbarState.fontSizeInputValue,
381
- setIsLinkEditMode
382
- ]);
383
- return null;
384
- }
385
-
386
- // src/components/editor/plugins/TabFocusPlugin/index.ts
387
- init_react_shim();
388
- import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
389
- import {
390
- $getSelection,
391
- $isRangeSelection,
392
- $setSelection,
393
- FOCUS_COMMAND
394
- } from "lexical";
395
- import { useEffect as useEffect2 } from "react";
396
- var COMMAND_PRIORITY_LOW = 1;
397
- var TAB_TO_FOCUS_INTERVAL = 100;
398
- var lastTabKeyDownTimestamp = 0;
399
- var hasRegisteredKeyDownListener = false;
400
- function registerKeyTimeStampTracker() {
401
- window.addEventListener(
402
- "keydown",
403
- (event) => {
404
- if (event.key === "Tab") {
405
- lastTabKeyDownTimestamp = event.timeStamp;
406
- }
407
- },
408
- true
409
- );
410
- }
411
- function TabFocusPlugin() {
412
- const [editor] = useLexicalComposerContext();
413
- useEffect2(() => {
414
- if (!hasRegisteredKeyDownListener) {
415
- registerKeyTimeStampTracker();
416
- hasRegisteredKeyDownListener = true;
417
- }
418
- return editor.registerCommand(
419
- FOCUS_COMMAND,
420
- (event) => {
421
- const selection = $getSelection();
422
- if ($isRangeSelection(selection)) {
423
- if (lastTabKeyDownTimestamp + TAB_TO_FOCUS_INTERVAL > event.timeStamp) {
424
- $setSelection(selection.clone());
425
- }
426
- }
427
- return false;
428
- },
429
- COMMAND_PRIORITY_LOW
430
- );
431
- }, [editor]);
432
- return null;
433
- }
434
-
435
- // src/components/editor/plugins/TableCellResizer/index.tsx
436
- init_react_shim();
437
- import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
438
- import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
439
- import {
440
- $computeTableMapSkipCellCheck,
441
- $getTableNodeFromLexicalNodeOrThrow,
442
- $getTableRowIndexFromTableCellNode,
443
- $isTableCellNode,
444
- $isTableRowNode,
445
- getDOMCellFromTarget,
446
- getTableElement,
447
- TableNode
448
- } from "@lexical/table";
449
- import { calculateZoomLevel } from "@lexical/utils";
450
- import { $getNearestNodeFromDOMNode, isHTMLElement } from "lexical";
451
- import {
452
- useCallback,
453
- useEffect as useEffect3,
454
- useMemo,
455
- useRef,
456
- useState
457
- } from "react";
458
- import { createPortal } from "react-dom";
459
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
460
- var MIN_ROW_HEIGHT = 33;
461
- var MIN_COLUMN_WIDTH = 92;
462
- function TableCellResizer({ editor }) {
463
- const targetRef = useRef(null);
464
- const resizerRef = useRef(null);
465
- const tableRectRef = useRef(null);
466
- const mouseStartPosRef = useRef(null);
467
- const [mouseCurrentPos, updateMouseCurrentPos] = useState(null);
468
- const [activeCell, updateActiveCell] = useState(null);
469
- const [isMouseDown, updateIsMouseDown] = useState(false);
470
- const [draggingDirection, updateDraggingDirection] = useState(null);
471
- const resetState = useCallback(() => {
472
- updateActiveCell(null);
473
- targetRef.current = null;
474
- updateDraggingDirection(null);
475
- mouseStartPosRef.current = null;
476
- tableRectRef.current = null;
477
- }, []);
478
- const isMouseDownOnEvent = (event) => {
479
- return (event.buttons & 1) === 1;
480
- };
481
- useEffect3(() => {
482
- return editor.registerNodeTransform(TableNode, (tableNode) => {
483
- if (tableNode.getColWidths()) {
484
- return tableNode;
485
- }
486
- const numColumns = tableNode.getColumnCount();
487
- const columnWidth = MIN_COLUMN_WIDTH;
488
- tableNode.setColWidths(Array(numColumns).fill(columnWidth));
489
- return tableNode;
490
- });
491
- }, [editor]);
492
- useEffect3(() => {
493
- const onMouseMove = (event) => {
494
- const target = event.target;
495
- if (!isHTMLElement(target)) {
496
- return;
497
- }
498
- if (draggingDirection) {
499
- updateMouseCurrentPos({
500
- x: event.clientX,
501
- y: event.clientY
502
- });
503
- return;
504
- }
505
- updateIsMouseDown(isMouseDownOnEvent(event));
506
- if (resizerRef.current && resizerRef.current.contains(target)) {
507
- return;
508
- }
509
- if (targetRef.current !== target) {
510
- targetRef.current = target;
511
- const cell = getDOMCellFromTarget(target);
512
- if (cell && activeCell !== cell) {
513
- editor.getEditorState().read(
514
- () => {
515
- const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);
516
- if (!tableCellNode) {
517
- throw new Error("TableCellResizer: Table cell node not found.");
518
- }
519
- const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
520
- const tableElement = getTableElement(
521
- tableNode,
522
- editor.getElementByKey(tableNode.getKey())
523
- );
524
- if (!tableElement) {
525
- throw new Error("TableCellResizer: Table element not found.");
526
- }
527
- targetRef.current = target;
528
- tableRectRef.current = tableElement.getBoundingClientRect();
529
- updateActiveCell(cell);
530
- },
531
- { editor }
532
- );
533
- } else if (cell == null) {
534
- resetState();
535
- }
536
- }
537
- };
538
- const onMouseDown = () => {
539
- updateIsMouseDown(true);
540
- };
541
- const onMouseUp = () => {
542
- updateIsMouseDown(false);
543
- };
544
- const removeRootListener = editor.registerRootListener(
545
- (rootElement, prevRootElement) => {
546
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousemove", onMouseMove);
547
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mousedown", onMouseDown);
548
- prevRootElement == null ? void 0 : prevRootElement.removeEventListener("mouseup", onMouseUp);
549
- rootElement == null ? void 0 : rootElement.addEventListener("mousemove", onMouseMove);
550
- rootElement == null ? void 0 : rootElement.addEventListener("mousedown", onMouseDown);
551
- rootElement == null ? void 0 : rootElement.addEventListener("mouseup", onMouseUp);
552
- }
553
- );
554
- return () => {
555
- removeRootListener();
556
- };
557
- }, [activeCell, draggingDirection, editor, resetState]);
558
- const isHeightChanging = (direction) => {
559
- if (direction === "bottom") {
560
- return true;
561
- }
562
- return false;
563
- };
564
- const updateRowHeight = useCallback(
565
- (heightChange) => {
566
- if (!activeCell) {
567
- throw new Error("TableCellResizer: Expected active cell.");
568
- }
569
- editor.update(
570
- () => {
571
- const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
572
- if (!$isTableCellNode(tableCellNode)) {
573
- throw new Error("TableCellResizer: Table cell node not found.");
574
- }
575
- const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
576
- const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;
577
- const tableRows = tableNode.getChildren();
578
- if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
579
- throw new Error("Expected table cell to be inside of table row.");
580
- }
581
- const tableRow = tableRows[tableRowIndex];
582
- if (!$isTableRowNode(tableRow)) {
583
- throw new Error("Expected table row");
584
- }
585
- let height = tableRow.getHeight();
586
- if (height === void 0) {
587
- const rowCells = tableRow.getChildren();
588
- height = Math.min(
589
- ...rowCells.map(
590
- (cell) => {
591
- var _a;
592
- return (_a = getCellNodeHeight(cell, editor)) != null ? _a : Infinity;
593
- }
594
- )
595
- );
596
- }
597
- const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
598
- tableRow.setHeight(newHeight);
599
- },
600
- { tag: "skip-scroll-into-view" }
601
- );
602
- },
603
- [activeCell, editor]
604
- );
605
- const getCellNodeHeight = (cell, activeEditor) => {
606
- const domCellNode = activeEditor.getElementByKey(cell.getKey());
607
- return domCellNode == null ? void 0 : domCellNode.clientHeight;
608
- };
609
- const getCellColumnIndex = (tableCellNode, tableMap) => {
610
- for (let row = 0; row < tableMap.length; row++) {
611
- for (let column = 0; column < tableMap[row].length; column++) {
612
- if (tableMap[row][column].cell === tableCellNode) {
613
- return column;
614
- }
615
- }
616
- }
617
- };
618
- const updateColumnWidth = useCallback(
619
- (widthChange) => {
620
- if (!activeCell) {
621
- throw new Error("TableCellResizer: Expected active cell.");
622
- }
623
- editor.update(
624
- () => {
625
- const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);
626
- if (!$isTableCellNode(tableCellNode)) {
627
- throw new Error("TableCellResizer: Table cell node not found.");
628
- }
629
- const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
630
- const [tableMap] = $computeTableMapSkipCellCheck(
631
- tableNode,
632
- null,
633
- null
634
- );
635
- const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
636
- if (columnIndex === void 0) {
637
- throw new Error("TableCellResizer: Table column not found.");
638
- }
639
- const colWidths = tableNode.getColWidths();
640
- if (!colWidths) {
641
- return;
642
- }
643
- const width = colWidths[columnIndex];
644
- if (width === void 0) {
645
- return;
646
- }
647
- const newColWidths = [...colWidths];
648
- const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
649
- newColWidths[columnIndex] = newWidth;
650
- tableNode.setColWidths(newColWidths);
651
- },
652
- { tag: "skip-scroll-into-view" }
653
- );
654
- },
655
- [activeCell, editor]
656
- );
657
- const mouseUpHandler = useCallback(
658
- (direction) => {
659
- const handler = (event) => {
660
- event.preventDefault();
661
- event.stopPropagation();
662
- if (!activeCell) {
663
- throw new Error("TableCellResizer: Expected active cell.");
664
- }
665
- if (mouseStartPosRef.current) {
666
- const { x, y } = mouseStartPosRef.current;
667
- if (activeCell === null) {
668
- return;
669
- }
670
- const zoom = calculateZoomLevel(event.target);
671
- if (isHeightChanging(direction)) {
672
- const heightChange = (event.clientY - y) / zoom;
673
- updateRowHeight(heightChange);
674
- } else {
675
- const widthChange = (event.clientX - x) / zoom;
676
- updateColumnWidth(widthChange);
677
- }
678
- resetState();
679
- document.removeEventListener("mouseup", handler);
680
- }
681
- };
682
- return handler;
683
- },
684
- [activeCell, resetState, updateColumnWidth, updateRowHeight]
685
- );
686
- const toggleResize = useCallback(
687
- (direction) => (event) => {
688
- event.preventDefault();
689
- event.stopPropagation();
690
- if (!activeCell) {
691
- throw new Error("TableCellResizer: Expected active cell.");
692
- }
693
- mouseStartPosRef.current = {
694
- x: event.clientX,
695
- y: event.clientY
696
- };
697
- updateMouseCurrentPos(mouseStartPosRef.current);
698
- updateDraggingDirection(direction);
699
- document.addEventListener("mouseup", mouseUpHandler(direction));
700
- },
701
- [activeCell, mouseUpHandler]
702
- );
703
- const getResizers = useCallback(() => {
704
- if (activeCell) {
705
- const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
706
- const zoom = calculateZoomLevel(activeCell.elem);
707
- const zoneWidth = 10;
708
- const styles = {
709
- bottom: {
710
- backgroundColor: "none",
711
- "zIndex": "10",
712
- cursor: "row-resize",
713
- height: `${zoneWidth}px`,
714
- left: `${window.pageXOffset + left}px`,
715
- top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,
716
- width: `${width}px`
717
- },
718
- right: {
719
- backgroundColor: "none",
720
- "zIndex": "10",
721
- cursor: "col-resize",
722
- height: `${height}px`,
723
- left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,
724
- top: `${window.pageYOffset + top}px`,
725
- width: `${zoneWidth}px`
726
- }
727
- };
728
- const tableRect = tableRectRef.current;
729
- if (draggingDirection && mouseCurrentPos && tableRect) {
730
- if (isHeightChanging(draggingDirection)) {
731
- styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;
732
- styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;
733
- styles[draggingDirection].height = "3px";
734
- styles[draggingDirection].width = `${tableRect.width}px`;
735
- } else {
736
- styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;
737
- styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;
738
- styles[draggingDirection].width = "3px";
739
- styles[draggingDirection].height = `${tableRect.height}px`;
740
- }
741
- styles[draggingDirection].backgroundColor = "#10b981";
742
- styles[draggingDirection].boxShadow = "0 0 8px rgba(16, 185, 129, 0.5)";
743
- }
744
- return styles;
745
- }
746
- return {
747
- bottom: null,
748
- left: null,
749
- right: null,
750
- top: null
751
- };
752
- }, [activeCell, draggingDirection, mouseCurrentPos]);
753
- const resizerStyles = getResizers();
754
- return /* @__PURE__ */ jsx("div", { ref: resizerRef, children: activeCell != null && !isMouseDown && /* @__PURE__ */ jsxs(Fragment, { children: [
755
- /* @__PURE__ */ jsx(
756
- "div",
757
- {
758
- className: " absolute TableCellResizer__ui",
759
- style: resizerStyles.right || void 0,
760
- onMouseDown: toggleResize("right")
761
- }
762
- ),
763
- /* @__PURE__ */ jsx(
764
- "div",
765
- {
766
- className: "absolute TableCellResizer__ui",
767
- style: resizerStyles.bottom || void 0,
768
- onMouseDown: toggleResize("bottom")
769
- }
770
- )
771
- ] }) });
772
- }
773
- function TableCellResizerPlugin() {
774
- const [editor] = useLexicalComposerContext2();
775
- const isEditable = useLexicalEditable();
776
- const [mounted, setMounted] = useState(false);
777
- useEffect3(() => {
778
- setMounted(true);
779
- }, []);
780
- const portal = useMemo(() => {
781
- if (!mounted || !isEditable) return null;
782
- return createPortal(/* @__PURE__ */ jsx(TableCellResizer, { editor }), document.body);
783
- }, [mounted, isEditable, editor]);
784
- return portal;
785
- }
786
-
787
- // src/components/editor/Core.tsx
788
- import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin";
789
- import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
790
- import { ListPlugin } from "@lexical/react/LexicalListPlugin";
791
-
792
- // src/components/editor/plugins/DragDropPastePlugin/index.tsx
793
- init_react_shim();
794
- import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
795
- import { DRAG_DROP_PASTE } from "@lexical/rich-text";
796
- import { isMimeType, mediaFileReader } from "@lexical/utils";
797
- import { COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW2 } from "lexical";
798
- import { useEffect as useEffect4 } from "react";
799
- var ACCEPTABLE_IMAGE_TYPES = [
800
- "image/",
801
- "image/heic",
802
- "image/heif",
803
- "image/gif",
804
- "image/webp"
805
- ];
806
- function DragDropPaste() {
807
- const [editor] = useLexicalComposerContext3();
808
- useEffect4(() => {
809
- return editor.registerCommand(
810
- DRAG_DROP_PASTE,
811
- (files) => {
812
- (async () => {
813
- const filesResult = await mediaFileReader(
814
- files,
815
- [ACCEPTABLE_IMAGE_TYPES].flatMap((x) => x)
816
- );
817
- for (const { file, result } of filesResult) {
818
- if (isMimeType(file, ACCEPTABLE_IMAGE_TYPES)) {
819
- editor.dispatchCommand(INSERT_IMAGE_COMMAND, {
820
- altText: file.name,
821
- src: result
822
- });
823
- }
824
- }
825
- })();
826
- return true;
827
- },
828
- COMMAND_PRIORITY_LOW2
829
- );
830
- }, [editor]);
831
- return null;
832
- }
833
-
834
- // src/components/editor/plugins/DraggableBlockPlugin/index.tsx
835
- init_react_shim();
836
- import { useRef as useRef2, useState as useState2, useCallback as useCallback2 } from "react";
837
- import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
838
- import { DraggableBlockPlugin_EXPERIMENTAL } from "@lexical/react/LexicalDraggableBlockPlugin";
839
- import {
840
- $getNearestNodeFromDOMNode as $getNearestNodeFromDOMNode2,
841
- $createParagraphNode,
842
- $createTextNode,
843
- $isElementNode
844
- } from "lexical";
845
- import {
846
- $createHeadingNode,
847
- $createQuoteNode
848
- } from "@lexical/rich-text";
849
- import { $createCodeNode } from "@lexical/code";
850
- import {
851
- $createListNode,
852
- $createListItemNode
853
- } from "@lexical/list";
854
- import {
855
- GripVertical,
856
- Plus,
857
- Heading1,
858
- Heading2,
859
- Heading3,
860
- Quote,
861
- Code as Code2,
862
- List,
863
- ListOrdered,
864
- Columns2,
865
- Columns3,
866
- Copy,
867
- Trash2,
868
- Sparkles
869
- } from "lucide-react";
870
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
871
- var DRAGGABLE_BLOCK_MENU_CLASSNAME = "draggable-block-menu";
872
- function DraggableBlockPlugin({
873
- anchorElem = typeof document !== "undefined" ? document.body : void 0,
874
- className
875
- }) {
876
- const [editor] = useLexicalComposerContext4();
877
- const menuRef = useRef2(null);
878
- const targetLineRef = useRef2(null);
879
- const [isMenuOpen, setIsMenuOpen] = useState2(false);
880
- const getTargetNode = useCallback2(() => {
881
- if (!menuRef.current) return null;
882
- const rect = menuRef.current.getBoundingClientRect();
883
- const targetElem = document.elementFromPoint(
884
- rect.right + 32,
885
- rect.top + rect.height / 2
886
- );
887
- if (!targetElem) return null;
888
- let targetNode = null;
889
- const resolve = () => {
890
- const node = $getNearestNodeFromDOMNode2(targetElem);
891
- if (node) {
892
- targetNode = node.getKey() === "root" ? node : node.getTopLevelElement() || ($isElementNode(node) ? node : null);
893
- }
894
- };
895
- try {
896
- resolve();
897
- } catch (e) {
898
- editor.read(resolve);
899
- }
900
- return targetNode;
901
- }, [editor]);
902
- const handleInsertBelow = () => {
903
- editor.update(
904
- () => {
905
- const targetNode = getTargetNode();
906
- if (targetNode) {
907
- const p = $createParagraphNode();
908
- targetNode.insertAfter(p);
909
- p.select();
910
- }
911
- },
912
- { discrete: true }
913
- );
914
- };
915
- const handleTurnInto = (type) => {
916
- editor.update(
917
- () => {
918
- const targetNode = getTargetNode();
919
- if (!targetNode || targetNode.getKey() === "root") return;
920
- let replacement = null;
921
- switch (type) {
922
- case "h1":
923
- replacement = $createHeadingNode("h1");
924
- break;
925
- case "h2":
926
- replacement = $createHeadingNode("h2");
927
- break;
928
- case "h3":
929
- replacement = $createHeadingNode("h3");
930
- break;
931
- case "quote":
932
- replacement = $createQuoteNode();
933
- break;
934
- case "code":
935
- replacement = $createCodeNode();
936
- break;
937
- case "bullet": {
938
- const list = $createListNode("bullet");
939
- const item = $createListItemNode();
940
- list.append(item);
941
- replacement = list;
942
- break;
943
- }
944
- case "number": {
945
- const list = $createListNode("number");
946
- const item = $createListItemNode();
947
- list.append(item);
948
- replacement = list;
949
- break;
950
- }
951
- }
952
- if (replacement && $isElementNode(targetNode)) {
953
- const children = targetNode.getChildren();
954
- if ($isElementNode(replacement)) {
955
- replacement.append(...children);
956
- }
957
- targetNode.replace(replacement);
958
- }
959
- },
960
- { discrete: true }
961
- );
962
- };
963
- const handleSplitColumns = (columns) => {
964
- editor.update(
965
- () => {
966
- const targetNode = getTargetNode();
967
- if (!targetNode || targetNode.getKey() === "root") return;
968
- const template = columns === 2 ? "1fr 1fr" : "1fr 1fr 1fr";
969
- const container = $createLayoutContainerNode(template);
970
- const col1 = $createLayoutItemNode();
971
- const col2 = $createLayoutItemNode();
972
- const cloned = targetNode;
973
- col1.append(cloned);
974
- col2.append($createParagraphNode());
975
- if (columns === 3) {
976
- const col3 = $createLayoutItemNode();
977
- col3.append($createParagraphNode());
978
- container.append(col1, col2, col3);
979
- } else {
980
- container.append(col1, col2);
981
- }
982
- targetNode.replace(container);
983
- },
984
- { discrete: true }
985
- );
986
- };
987
- const handleDuplicate = () => {
988
- editor.update(
989
- () => {
990
- const targetNode = getTargetNode();
991
- if (targetNode && targetNode.getKey() !== "root") {
992
- const p = $createParagraphNode();
993
- p.append($createTextNode(targetNode.getTextContent()));
994
- targetNode.insertAfter(p);
995
- }
996
- },
997
- { discrete: true }
998
- );
999
- };
1000
- const handleDelete = () => {
1001
- editor.update(
1002
- () => {
1003
- const targetNode = getTargetNode();
1004
- if (targetNode && targetNode.getKey() !== "root") {
1005
- targetNode.remove();
1006
- }
1007
- },
1008
- { discrete: true }
1009
- );
1010
- };
1011
- const handleAskAI = () => {
1012
- editor.dispatchCommand(OPEN_AI_COMMAND_BAR_COMMAND, {
1013
- initialPrompt: "",
1014
- action: "ImproveWriting"
1015
- });
1016
- };
1017
- const isOnMenu = (element) => {
1018
- return !!element.closest(`.${DRAGGABLE_BLOCK_MENU_CLASSNAME}`);
1019
- };
1020
- if (!anchorElem) return null;
1021
- return /* @__PURE__ */ jsx2(
1022
- DraggableBlockPlugin_EXPERIMENTAL,
1023
- {
1024
- anchorElem,
1025
- menuRef,
1026
- targetLineRef,
1027
- menuComponent: /* @__PURE__ */ jsxs2(
1028
- "div",
1029
- {
1030
- ref: menuRef,
1031
- className: cn(
1032
- "draggable-block-menu flex items-center gap-0.5 rounded-md border border-border/40 bg-background/90 text-muted-foreground shadow-sm backdrop-blur transition-all duration-150 group z-40 absolute top-0 left-0",
1033
- className
1034
- ),
1035
- children: [
1036
- /* @__PURE__ */ jsx2(
1037
- "button",
1038
- {
1039
- type: "button",
1040
- onClick: handleInsertBelow,
1041
- className: "flex items-center justify-center w-5 h-5 rounded hover:bg-muted hover:text-foreground transition-colors",
1042
- title: "Insert block below",
1043
- children: /* @__PURE__ */ jsx2(Plus, { className: "w-3.5 h-3.5" })
1044
- }
1045
- ),
1046
- /* @__PURE__ */ jsxs2(DropdownMenu, { open: isMenuOpen, onOpenChange: setIsMenuOpen, children: [
1047
- /* @__PURE__ */ jsx2(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx2(
1048
- "button",
1049
- {
1050
- type: "button",
1051
- className: "flex items-center justify-center w-5 h-5 rounded cursor-grab active:cursor-grabbing hover:bg-muted hover:text-foreground transition-colors",
1052
- title: "Drag to move or click for block actions",
1053
- children: /* @__PURE__ */ jsx2(GripVertical, { className: "w-3.5 h-3.5" })
1054
- }
1055
- ) }),
1056
- /* @__PURE__ */ jsxs2(
1057
- DropdownMenuContent,
1058
- {
1059
- align: "start",
1060
- side: "bottom",
1061
- sideOffset: 4,
1062
- className: "w-52 z-50 text-xs",
1063
- children: [
1064
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: handleAskAI, className: "gap-2 font-medium text-primary", children: [
1065
- /* @__PURE__ */ jsx2(Sparkles, { className: "w-3.5 h-3.5 text-primary" }),
1066
- /* @__PURE__ */ jsx2("span", { children: "Ask AI on block" }),
1067
- /* @__PURE__ */ jsx2("kbd", { className: "ml-auto font-mono text-[10px] opacity-60", children: "\u2318K" })
1068
- ] }),
1069
- /* @__PURE__ */ jsx2(DropdownMenuSeparator, {}),
1070
- /* @__PURE__ */ jsxs2(DropdownMenuSub, { children: [
1071
- /* @__PURE__ */ jsxs2(DropdownMenuSubTrigger, { className: "gap-2", children: [
1072
- /* @__PURE__ */ jsx2(Heading1, { className: "w-3.5 h-3.5 text-muted-foreground" }),
1073
- /* @__PURE__ */ jsx2("span", { children: "Turn into" })
1074
- ] }),
1075
- /* @__PURE__ */ jsxs2(DropdownMenuSubContent, { className: "w-44 text-xs", children: [
1076
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("h1"), className: "gap-2", children: [
1077
- /* @__PURE__ */ jsx2(Heading1, { className: "w-3.5 h-3.5" }),
1078
- /* @__PURE__ */ jsx2("span", { children: "Heading 1" })
1079
- ] }),
1080
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("h2"), className: "gap-2", children: [
1081
- /* @__PURE__ */ jsx2(Heading2, { className: "w-3.5 h-3.5" }),
1082
- /* @__PURE__ */ jsx2("span", { children: "Heading 2" })
1083
- ] }),
1084
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("h3"), className: "gap-2", children: [
1085
- /* @__PURE__ */ jsx2(Heading3, { className: "w-3.5 h-3.5" }),
1086
- /* @__PURE__ */ jsx2("span", { children: "Heading 3" })
1087
- ] }),
1088
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("bullet"), className: "gap-2", children: [
1089
- /* @__PURE__ */ jsx2(List, { className: "w-3.5 h-3.5" }),
1090
- /* @__PURE__ */ jsx2("span", { children: "Bullet List" })
1091
- ] }),
1092
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("number"), className: "gap-2", children: [
1093
- /* @__PURE__ */ jsx2(ListOrdered, { className: "w-3.5 h-3.5" }),
1094
- /* @__PURE__ */ jsx2("span", { children: "Numbered List" })
1095
- ] }),
1096
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("quote"), className: "gap-2", children: [
1097
- /* @__PURE__ */ jsx2(Quote, { className: "w-3.5 h-3.5" }),
1098
- /* @__PURE__ */ jsx2("span", { children: "Quote" })
1099
- ] }),
1100
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleTurnInto("code"), className: "gap-2", children: [
1101
- /* @__PURE__ */ jsx2(Code2, { className: "w-3.5 h-3.5" }),
1102
- /* @__PURE__ */ jsx2("span", { children: "Code Block" })
1103
- ] })
1104
- ] })
1105
- ] }),
1106
- /* @__PURE__ */ jsxs2(DropdownMenuSub, { children: [
1107
- /* @__PURE__ */ jsxs2(DropdownMenuSubTrigger, { className: "gap-2", children: [
1108
- /* @__PURE__ */ jsx2(Columns2, { className: "w-3.5 h-3.5 text-muted-foreground" }),
1109
- /* @__PURE__ */ jsx2("span", { children: "Columns layout" })
1110
- ] }),
1111
- /* @__PURE__ */ jsxs2(DropdownMenuSubContent, { className: "w-40 text-xs", children: [
1112
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleSplitColumns(2), className: "gap-2", children: [
1113
- /* @__PURE__ */ jsx2(Columns2, { className: "w-3.5 h-3.5" }),
1114
- /* @__PURE__ */ jsx2("span", { children: "2 Columns" })
1115
- ] }),
1116
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: () => handleSplitColumns(3), className: "gap-2", children: [
1117
- /* @__PURE__ */ jsx2(Columns3, { className: "w-3.5 h-3.5" }),
1118
- /* @__PURE__ */ jsx2("span", { children: "3 Columns" })
1119
- ] })
1120
- ] })
1121
- ] }),
1122
- /* @__PURE__ */ jsx2(DropdownMenuSeparator, {}),
1123
- /* @__PURE__ */ jsxs2(DropdownMenuItem, { onClick: handleDuplicate, className: "gap-2", children: [
1124
- /* @__PURE__ */ jsx2(Copy, { className: "w-3.5 h-3.5 text-muted-foreground" }),
1125
- /* @__PURE__ */ jsx2("span", { children: "Duplicate" })
1126
- ] }),
1127
- /* @__PURE__ */ jsxs2(
1128
- DropdownMenuItem,
1129
- {
1130
- onClick: handleDelete,
1131
- className: "gap-2 text-destructive focus:text-destructive focus:bg-destructive/10",
1132
- children: [
1133
- /* @__PURE__ */ jsx2(Trash2, { className: "w-3.5 h-3.5 text-destructive" }),
1134
- /* @__PURE__ */ jsx2("span", { children: "Delete" })
1135
- ]
1136
- }
1137
- )
1138
- ]
1139
- }
1140
- )
1141
- ] })
1142
- ]
1143
- }
1144
- ),
1145
- targetLineComponent: /* @__PURE__ */ jsx2(
1146
- "div",
1147
- {
1148
- ref: targetLineRef,
1149
- className: "cursor-none h-[3px] rounded-full bg-gradient-to-r from-blue-500 to-indigo-600 shadow-sm pointer-events-none absolute left-0 top-0 opacity-0 will-change-transform z-40"
1150
- }
1151
- ),
1152
- isOnMenu
1153
- }
1154
- );
1155
- }
1156
-
1157
- // src/components/editor/Core.tsx
1158
- import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
1159
- import { ClickableLinkPlugin } from "@lexical/react/LexicalClickableLinkPlugin";
1160
-
1161
- // src/components/editor/lexical-on-change.tsx
1162
- init_react_shim();
1163
- import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
1164
-
1165
- // src/components/editor/utils/useLayoutEffect.ts
1166
- init_react_shim();
1167
- import { useEffect as useEffect5, useLayoutEffect } from "react";
1168
- var useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect5;
1169
- var useLayoutEffect_default = useLayoutEffectImpl;
1170
-
1171
- // src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts
1172
- init_react_shim();
1173
- import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2 } from "lexical";
1174
-
1175
- // src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts
1176
- init_react_shim();
1177
-
1178
- // src/components/editor/utils/getAllLexicalChildren.ts
1179
- init_react_shim();
1180
- import { $getNodeByKey, $getRoot } from "lexical";
1181
- var getAllLexicalChildren = (editor) => {
1182
- const childrenKeys = editor.getEditorState().read(() => $getRoot().getChildrenKeys());
1183
- return childrenKeys.map((key) => ({
1184
- key,
1185
- node: $getNodeByKey(key),
1186
- htmlElement: editor.getElementByKey(key)
1187
- }));
1188
- };
1189
-
1190
- // src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts
1191
- init_react_shim();
1192
- import { $isParagraphNode } from "lexical";
1193
- import { $isHeadingNode, $isQuoteNode } from "@lexical/rich-text";
1194
- import { $isListItemNode } from "@lexical/list";
1195
- var getNodePlaceholder = (lexicalNode) => {
1196
- let placeholder;
1197
- if ($isHeadingNode(lexicalNode)) {
1198
- const tag = lexicalNode.getTag();
1199
- placeholder = "Heading";
1200
- switch (tag) {
1201
- case "h1": {
1202
- placeholder += " 1";
1203
- break;
1204
- }
1205
- case "h2": {
1206
- placeholder += " 2";
1207
- break;
1208
- }
1209
- case "h3": {
1210
- placeholder += " 3";
1211
- break;
1212
- }
1213
- case "h4": {
1214
- placeholder += " 4";
1215
- break;
1216
- }
1217
- case "h5": {
1218
- placeholder += "5";
1219
- break;
1220
- }
1221
- case "h6": {
1222
- placeholder += "6";
1223
- break;
1224
- }
1225
- }
1226
- }
1227
- if ($isListItemNode(lexicalNode)) {
1228
- placeholder = "list";
1229
- }
1230
- if ($isQuoteNode(lexicalNode)) {
1231
- placeholder = "Quote";
1232
- }
1233
- if ($isParagraphNode(lexicalNode)) {
1234
- placeholder = "Press '/' for command";
1235
- }
1236
- return placeholder;
1237
- };
1238
-
1239
- // src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts
1240
- var PLACEHOLDER_CLASS_NAME = "node-placeholder";
1241
- var isHtmlHeadingElement = (el) => {
1242
- return el instanceof HTMLHeadingElement;
1243
- };
1244
- var setPlaceholderOnSelection = ({
1245
- selection,
1246
- editor
1247
- }) => {
1248
- const children = getAllLexicalChildren(editor);
1249
- const removePlaceholderClass = (element) => {
1250
- if (!element) return;
1251
- if (element.classList.contains(PLACEHOLDER_CLASS_NAME)) {
1252
- element.classList.remove(PLACEHOLDER_CLASS_NAME);
1253
- element.removeAttribute("data-placeholder");
1254
- }
1255
- Array.from(element.children).forEach((child) => {
1256
- if (child instanceof HTMLElement) {
1257
- removePlaceholderClass(child);
1258
- }
1259
- });
1260
- };
1261
- children.forEach(({ htmlElement, node }) => {
1262
- if (!htmlElement) {
1263
- return;
1264
- }
1265
- if (isHtmlHeadingElement(htmlElement)) {
1266
- return;
1267
- }
1268
- const classList = htmlElement.classList;
1269
- if (node.__type === "collapsible-container") {
1270
- removePlaceholderClass(htmlElement);
1271
- return;
1272
- }
1273
- if (node.__type === "table") {
1274
- removePlaceholderClass(htmlElement);
1275
- return;
1276
- }
1277
- if (node.__type === "layout-container") {
1278
- removePlaceholderClass(htmlElement);
1279
- }
1280
- if (classList.length && classList.contains(PLACEHOLDER_CLASS_NAME)) {
1281
- classList.remove(PLACEHOLDER_CLASS_NAME);
1282
- htmlElement.removeAttribute("data-placeholder");
1283
- }
1284
- });
1285
- if (children.length === 1 && children[0].htmlElement && !isHtmlHeadingElement(children[0].htmlElement)) {
1286
- return;
1287
- }
1288
- const anchor = selection.anchor;
1289
- const placeholder = getNodePlaceholder(anchor.getNode());
1290
- if (placeholder) {
1291
- const selectedHtmlElement = editor.getElementByKey(anchor.key);
1292
- selectedHtmlElement == null ? void 0 : selectedHtmlElement.classList.add(PLACEHOLDER_CLASS_NAME);
1293
- selectedHtmlElement == null ? void 0 : selectedHtmlElement.setAttribute("data-placeholder", placeholder);
1294
- }
1295
- };
1296
-
1297
- // src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts
1298
- var setNodePlaceholderFromSelection = (editor) => {
1299
- editor.getEditorState().read(() => {
1300
- const selection = $getSelection2();
1301
- if (!$isRangeSelection2(selection)) {
1302
- return;
1303
- }
1304
- setPlaceholderOnSelection({ selection, editor });
1305
- });
1306
- };
1307
-
1308
- // src/components/editor/lexical-on-change.tsx
1309
- import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
1310
- function LexicalOnChangePlugin() {
1311
- const [editor] = useLexicalComposerContext5();
1312
- useLayoutEffect_default(() => {
1313
- const unregisterListener = editor.registerUpdateListener(
1314
- ({ editorState, dirtyElements, dirtyLeaves, prevEditorState, tags }) => {
1315
- if (dirtyElements.size === 0 && dirtyLeaves.size === 0 || tags.has("history-merge") || prevEditorState.isEmpty()) {
1316
- return;
1317
- }
1318
- setNodePlaceholderFromSelection(editor);
1319
- }
1320
- );
1321
- return () => {
1322
- unregisterListener();
1323
- };
1324
- }, [editor]);
1325
- return /* @__PURE__ */ jsx3(Fragment2, {});
1326
- }
1327
-
1328
- // src/components/editor/plugins/AudioPlugin/index.tsx
1329
- init_react_shim();
1330
- import { useEffect as useEffect6 } from "react";
1331
- import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
1332
- import { $insertNodeToNearestRoot } from "@lexical/utils";
1333
- import { COMMAND_PRIORITY_EDITOR } from "lexical";
1334
- function AudioPlugin() {
1335
- const [editor] = useLexicalComposerContext6();
1336
- useEffect6(() => {
1337
- if (!editor.hasNodes([AudioNode])) {
1338
- throw new Error("AudioPlugin: AudioNode not registered on editor");
1339
- }
1340
- return editor.registerCommand(
1341
- INSERT_AUDIO_COMMAND,
1342
- (payload) => {
1343
- editor.update(() => {
1344
- const audioNode = $createAudioNode(payload);
1345
- $insertNodeToNearestRoot(audioNode);
1346
- });
1347
- return true;
1348
- },
1349
- COMMAND_PRIORITY_EDITOR
1350
- );
1351
- }, [editor]);
1352
- return null;
1353
- }
1354
-
1355
- // src/components/editor/plugins/FilePlugin/index.tsx
1356
- init_react_shim();
1357
- import { useEffect as useEffect7 } from "react";
1358
- import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
1359
- import { $insertNodeToNearestRoot as $insertNodeToNearestRoot2 } from "@lexical/utils";
1360
- import { COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR2 } from "lexical";
1361
- function FilePlugin() {
1362
- const [editor] = useLexicalComposerContext7();
1363
- useEffect7(() => {
1364
- if (!editor.hasNodes([FileNode])) {
1365
- throw new Error("FilePlugin: FileNode not registered on editor");
1366
- }
1367
- return editor.registerCommand(
1368
- INSERT_FILE_COMMAND,
1369
- (payload) => {
1370
- editor.update(() => {
1371
- const fileNode = $createFileNode(payload);
1372
- $insertNodeToNearestRoot2(fileNode);
1373
- });
1374
- return true;
1375
- },
1376
- COMMAND_PRIORITY_EDITOR2
1377
- );
1378
- }, [editor]);
1379
- return null;
1380
- }
1381
-
1382
- // src/components/editor/Core.tsx
1383
- import { motion } from "framer-motion";
1384
- import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1385
- var SlashCommand = dynamic(() => import("./SlashCommand-2TNOOUBM.mjs"), { ssr: false });
1386
- var ToolbarPlugin = dynamic(() => import("./ToolbarPlugin-IIAOU4P5.mjs"), {
1387
- ssr: false,
1388
- loading: () => /* @__PURE__ */ jsx4("div", { className: "hidden md:block w-full flex justify-center p-4" })
1389
- });
1390
- var ExportPlugin = dynamic(() => import("./ExportPlugin-OKZOLBGS.mjs"), { ssr: false });
1391
- var TemplatePlugin = dynamic(() => import("./TemplatePlugin-HNTPEXBB.mjs"), { ssr: false });
1392
- var ExcalidrawPlugin = dynamic(() => import("./ExcalidrawPlugin-2SGPIQ6U.mjs"), {
1393
- ssr: false
1394
- });
1395
- var FloatingLinkEditorPlugin = dynamic(() => import("./FloatingLinkEditorPlugin-MABB34L7.mjs"), {
1396
- ssr: false
1397
- });
1398
- var TableCellActionMenuPlugin = dynamic(() => import("./TableCellActionMenuPlugin-YWBA64J7.mjs"), {
1399
- ssr: false
1400
- });
1401
- var TableHoverActionsPlugin = dynamic(() => import("./TableHoverActionsPlugin-2EIXHEXN.mjs"), {
1402
- ssr: false
1403
- });
1404
- var CodeActionMenuPlugin = dynamic(() => import("./CodeActionMenuPlugin-MRKY67ED.mjs"), { ssr: false });
1405
- var FloatingTextFormatToolbarPlugin = dynamic(
1406
- () => import("./FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs"),
1407
- { ssr: false }
1408
- );
1409
- var CollaborationPlugin = dynamic(
1410
- () => import("./CollaborationPlugin-TIZOQBUT.mjs"),
1411
- { ssr: false }
1412
- );
1413
- var CollaboratorsBar = dynamic(
1414
- () => import("./CollaboratorsBar-TMKBOBJI.mjs"),
1415
- { ssr: false }
1416
- );
1417
- var CommentsPlugin = dynamic(
1418
- () => import("./CommentsPlugin-5M4RD6YO.mjs"),
1419
- { ssr: false }
1420
- );
1421
- var VersionHistoryPlugin = dynamic(
1422
- () => import("./VersionHistoryPlugin-23MAZB4G.mjs"),
1423
- { ssr: false }
1424
- );
1425
- var InlineCopilotPlugin = dynamic(
1426
- () => import("./InlineCopilotPlugin-PNS5Y6OO.mjs"),
1427
- { ssr: false }
1428
- );
1429
- var AICommandBarPlugin = dynamic(
1430
- () => import("./AICommandBarPlugin-TADJ3X2Y.mjs"),
1431
- { ssr: false }
1432
- );
1433
- function EditorPlaceholder() {
1434
- return /* @__PURE__ */ jsxs3("div", { className: "pointer-events-none select-none absolute top-4 md:top-12 left-4 md:left-12 z-10 text-muted-foreground/60 text-sm md:text-base flex items-center gap-1.5 md:gap-2", children: [
1435
- /* @__PURE__ */ jsx4("span", { children: "Type" }),
1436
- /* @__PURE__ */ jsx4("kbd", { className: "px-1.5 py-0.5 text-xs font-mono rounded bg-muted border border-border text-muted-foreground", children: "/" }),
1437
- /* @__PURE__ */ jsx4("span", { className: "truncate max-w-[220px] sm:max-w-none", children: "for commands, or start writing..." })
1438
- ] });
1439
- }
1440
- function Core({
1441
- toolbarConfig,
1442
- content,
1443
- showCollaboratorsBar = true
1444
- }) {
1445
- const { historyState } = useSharedHistoryContext();
1446
- const isEditable = useLexicalEditable2();
1447
- const { enabled: isCollabEnabled } = useCollab();
1448
- const [floatingAnchorElem, setFloatingAnchorElem] = useState3(null);
1449
- const collabCursorsContainerRef = useRef3(null);
1450
- const [editor] = useLexicalComposerContext8();
1451
- const [activeEditor, setActiveEditor] = useState3(editor);
1452
- const [isLinkEditMode, setIsLinkEditMode] = useState3(false);
1453
- const [hasContent, setHasContent] = useState3(false);
1454
- const onRef = useCallback3((_floatingAnchorElem) => {
1455
- if (_floatingAnchorElem !== null) {
1456
- setFloatingAnchorElem(_floatingAnchorElem);
1457
- }
1458
- }, []);
1459
- useEffect8(() => {
1460
- const unregister = editor.registerTextContentListener((textContent) => {
1461
- setHasContent(textContent.trim().length > 0);
1462
- });
1463
- return unregister;
1464
- }, [editor]);
1465
- useEffect8(() => {
1466
- return editor.registerCommand(
1467
- INSERT_TABLE_COMMAND,
1468
- (payload) => {
1469
- const { columns, rows, includeHeaders = true } = payload || {};
1470
- const numRows = Number(rows) || 4;
1471
- const numCols = Number(columns) || 4;
1472
- const tableNode = $createTableNodeWithDimensions(numRows, numCols, includeHeaders);
1473
- $insertNodeToNearestRoot3(tableNode);
1474
- const firstRow = tableNode.getFirstChild();
1475
- const firstCell = $isElementNode2(firstRow) ? firstRow.getFirstChild() : null;
1476
- if (firstCell && $isElementNode2(firstCell)) {
1477
- firstCell.select();
1478
- }
1479
- return true;
1480
- },
1481
- COMMAND_PRIORITY_EDITOR3
1482
- );
1483
- }, [editor]);
1484
- return /* @__PURE__ */ jsxs3(Fragment3, { children: [
1485
- isEditable && /* @__PURE__ */ jsx4(
1486
- ToolbarPlugin,
1487
- {
1488
- editor,
1489
- activeEditor,
1490
- setActiveEditor,
1491
- setIsLinkEditMode,
1492
- toolbarConfig
1493
- }
1494
- ),
1495
- /* @__PURE__ */ jsx4("div", { className: cn(
1496
- "flex justify-center w-full min-h-[calc(100dvh-5rem)] transition-all duration-300",
1497
- "dark:md:from-gray-900/50 dark:md:to-gray-800/30",
1498
- "pt-2 md:pt-4"
1499
- ), children: /* @__PURE__ */ jsxs3(
1500
- motion.div,
1501
- {
1502
- className: cn(
1503
- "relative w-full max-w-5xl transition-all duration-500",
1504
- "prose prose-lg dark:prose-invert lg:prose-xl leading-relaxed",
1505
- "md:rounded-2xl md:shadow-2xl md:shadow-black/5",
1506
- "md:dark:shadow-black/20",
1507
- "bg-white dark:bg-gray-900",
1508
- "md:border md:border-gray-200/50 dark:md:border-gray-800/50"
1509
- ),
1510
- children: [
1511
- /* @__PURE__ */ jsxs3("div", { className: "absolute inset-0 rounded-2xl overflow-hidden pointer-events-none", children: [
1512
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-gradient-to-br from-blue-50/30 via-transparent to-purple-50/30 dark:from-blue-900/10 dark:to-purple-900/10" }),
1513
- /* @__PURE__ */ jsx4("div", { className: "absolute top-0 left-0 w-full h-px bg-gradient-to-r from-transparent via-gray-200 to-transparent dark:via-gray-700" })
1514
- ] }),
1515
- showCollaboratorsBar && /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-4 md:px-12 py-2.5 border-b border-border/40 bg-muted/10 rounded-t-2xl pointer-events-auto", children: [
1516
- /* @__PURE__ */ jsx4("span", { className: "text-xs text-muted-foreground font-medium hidden sm:inline", children: "Collaborative Document" }),
1517
- /* @__PURE__ */ jsx4(CollaboratorsBar, {})
1518
- ] }),
1519
- /* @__PURE__ */ jsx4(
1520
- RichTextPlugin,
1521
- {
1522
- contentEditable: /* @__PURE__ */ jsx4(
1523
- "div",
1524
- {
1525
- ref: (node) => {
1526
- if (node) {
1527
- onRef(node);
1528
- collabCursorsContainerRef.current = node;
1529
- }
1530
- },
1531
- "data-collab-cursor-container": "true",
1532
- className: "relative",
1533
- children: /* @__PURE__ */ jsx4(
1534
- ContentEditable,
1535
- {
1536
- id: "lexical-editor",
1537
- autoFocus: true,
1538
- className: cn(
1539
- "editor-content relative z-20 outline-none",
1540
- "px-4 md:px-12 py-4 md:py-12",
1541
- "min-h-[75dvh] md:min-h-[70vh]",
1542
- "focus:outline-none focus:ring-0",
1543
- "text-foreground selection:bg-blue-100 dark:selection:bg-blue-900/30",
1544
- "font-['Inter',_system-ui,_sans-serif] antialiased",
1545
- "leading-relaxed tracking-wide",
1546
- "transition-all duration-200 ease-in-out",
1547
- "rounded-2xl"
1548
- )
1549
- }
1550
- )
1551
- }
1552
- ),
1553
- placeholder: !hasContent ? /* @__PURE__ */ jsx4(EditorPlaceholder, {}) : null,
1554
- ErrorBoundary: LexicalErrorBoundary
1555
- }
1556
- ),
1557
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 rounded-2xl ring-0 ring-blue-500/0 transition-all duration-300 pointer-events-none focus-within:ring-2 focus-within:ring-blue-500/20 focus-within:ring-offset-2 focus-within:ring-offset-white dark:focus-within:ring-offset-gray-900" }),
1558
- isCollabEnabled ? /* @__PURE__ */ jsx4(
1559
- CollaborationPlugin,
1560
- {
1561
- cursorsContainerRef: collabCursorsContainerRef,
1562
- initialEditorState: content
1563
- }
1564
- ) : /* @__PURE__ */ jsx4(HistoryPlugin, { externalHistoryState: historyState }),
1565
- /* @__PURE__ */ jsx4(AutoFocusPlugin, { defaultSelection: "rootStart" }),
1566
- /* @__PURE__ */ jsx4(ClearEditorPlugin, {}),
1567
- /* @__PURE__ */ jsx4(ShortcutsPlugin, { editor: activeEditor, setIsLinkEditMode }),
1568
- /* @__PURE__ */ jsx4(LexicalOnChangePlugin, {}),
1569
- /* @__PURE__ */ jsx4(LinkPlugin, {}),
1570
- /* @__PURE__ */ jsx4(HorizontalRulePlugin, {}),
1571
- /* @__PURE__ */ jsx4(TabFocusPlugin, {}),
1572
- /* @__PURE__ */ jsx4(PollPlugin, {}),
1573
- /* @__PURE__ */ jsx4(ExcalidrawPlugin, {}),
1574
- /* @__PURE__ */ jsx4(FigmaPlugin, {}),
1575
- /* @__PURE__ */ jsx4(EquationsPlugin, {}),
1576
- /* @__PURE__ */ jsx4(SpeechToTextPlugin_default, {}),
1577
- /* @__PURE__ */ jsx4(TableCellResizerPlugin, {}),
1578
- /* @__PURE__ */ jsx4(LayoutPlugin, {}),
1579
- /* @__PURE__ */ jsx4(CollapsiblePlugin, {}),
1580
- /* @__PURE__ */ jsx4(CodeHighlightPlugin, {}),
1581
- /* @__PURE__ */ jsx4(DragDropPaste, {}),
1582
- /* @__PURE__ */ jsx4(TabIndentationPlugin, { maxIndent: 7 }),
1583
- /* @__PURE__ */ jsx4(LexicalAutoLinkPlugin, {}),
1584
- /* @__PURE__ */ jsx4(LinkWithMetaDataPlugin, {}),
1585
- /* @__PURE__ */ jsx4(ListPlugin, {}),
1586
- /* @__PURE__ */ jsx4(StepperPlugin, {}),
1587
- /* @__PURE__ */ jsx4(TwitterPlugin, {}),
1588
- /* @__PURE__ */ jsx4(CheckListPlugin, {}),
1589
- /* @__PURE__ */ jsx4(ImagesPlugin, {}),
1590
- /* @__PURE__ */ jsx4(InlineImagePlugin, {}),
1591
- /* @__PURE__ */ jsx4(AutoEmbedPlugin, {}),
1592
- /* @__PURE__ */ jsx4(HintPlugin, {}),
1593
- /* @__PURE__ */ jsx4(YouTubePlugin, {}),
1594
- /* @__PURE__ */ jsx4(StoryBuilderPlugin, {}),
1595
- /* @__PURE__ */ jsx4(DynamicBlockPlugin, {}),
1596
- /* @__PURE__ */ jsx4(AudioPlugin, {}),
1597
- /* @__PURE__ */ jsx4(FilePlugin, {}),
1598
- /* @__PURE__ */ jsx4(ExportPlugin, {}),
1599
- /* @__PURE__ */ jsx4(TemplatePlugin, {}),
1600
- /* @__PURE__ */ jsx4(MarkdownShortcutPlugin, {}),
1601
- /* @__PURE__ */ jsx4(ClickableLinkPlugin, { disabled: isEditable }),
1602
- /* @__PURE__ */ jsx4(TablePlugin, { hasCellMerge: true, hasCellBackgroundColor: true, hasHorizontalScroll: true }),
1603
- floatingAnchorElem && isEditable && /* @__PURE__ */ jsxs3(Fragment3, { children: [
1604
- /* @__PURE__ */ jsx4(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }),
1605
- /* @__PURE__ */ jsx4(
1606
- FloatingLinkEditorPlugin,
1607
- {
1608
- anchorElem: floatingAnchorElem,
1609
- isLinkEditMode,
1610
- setIsLinkEditMode
1611
- }
1612
- ),
1613
- /* @__PURE__ */ jsx4(FloatingTextFormatToolbarPlugin, { setIsLinkEditMode, anchorElem: floatingAnchorElem }),
1614
- /* @__PURE__ */ jsx4(TableCellActionMenuPlugin, { anchorElem: floatingAnchorElem, cellMerge: true }),
1615
- /* @__PURE__ */ jsx4(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }),
1616
- /* @__PURE__ */ jsx4(TableHoverActionsPlugin, { anchorElem: floatingAnchorElem })
1617
- ] }),
1618
- isEditable && /* @__PURE__ */ jsx4(SlashCommand, {}),
1619
- isEditable && /* @__PURE__ */ jsx4(InlineCopilotPlugin, {}),
1620
- isEditable && /* @__PURE__ */ jsx4(AICommandBarPlugin, {}),
1621
- /* @__PURE__ */ jsx4(CommentsPlugin, {}),
1622
- /* @__PURE__ */ jsx4(VersionHistoryPlugin, {})
1623
- ]
1624
- }
1625
- ) })
1626
- ] });
1627
- }
1628
-
1629
- // src/components/editor/index.tsx
1630
- import { jsx as jsx5 } from "react/jsx-runtime";
1631
- function Editor({
1632
- isEditable = false,
1633
- content,
1634
- aiConfig,
1635
- uploadConfig,
1636
- toolbarConfig,
1637
- collabConfig,
1638
- showCollaboratorsBar
1639
- }) {
1640
- const isCollabActive = Boolean(collabConfig == null ? void 0 : collabConfig.enabled);
1641
- const initialConfig = useMemo2(
1642
- () => ({
1643
- namespace: "Bloger editor",
1644
- theme: editor_theme_default,
1645
- editorState: isCollabActive ? void 0 : typeof content === "string" ? content : typeof content === "object" && content !== null ? JSON.stringify(content) : void 0,
1646
- nodes: [...nodes_default],
1647
- onError: (error) => {
1648
- throw error;
1649
- },
1650
- editable: isEditable
1651
- }),
1652
- [isCollabActive, content, isEditable]
1653
- );
1654
- return /* @__PURE__ */ jsx5(CollabProvider, { config: collabConfig, children: /* @__PURE__ */ jsx5(LexicalCollaboration, { children: /* @__PURE__ */ jsx5(CommentsProvider, { children: /* @__PURE__ */ jsx5(VersionHistoryProvider, { children: /* @__PURE__ */ jsx5(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx5(AIProvider, { config: aiConfig, children: /* @__PURE__ */ jsx5(UploadProvider, { config: uploadConfig, children: /* @__PURE__ */ jsx5(SharedHistoryContext, { children: /* @__PURE__ */ jsx5(ToolbarContext, { children: /* @__PURE__ */ jsx5(
1655
- Core,
1656
- {
1657
- toolbarConfig,
1658
- content,
1659
- showCollaboratorsBar
1660
- }
1661
- ) }) }) }) }) }) }) }) }) });
1662
- }
1663
-
1664
140
  // src/components/canvas/CanvasMode.tsx
1665
141
  init_react_shim();
1666
- import { useState as useState4, useRef as useRef4, useEffect as useEffect9, useCallback as useCallback4 } from "react";
142
+ import { useState, useRef, useEffect, useCallback } from "react";
1667
143
  import {
1668
144
  ZoomIn,
1669
145
  ZoomOut,
@@ -1671,9 +147,9 @@ import {
1671
147
  StickyNote,
1672
148
  FileText,
1673
149
  Shapes,
1674
- Trash2 as Trash22
150
+ Trash2
1675
151
  } from "lucide-react";
1676
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
152
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1677
153
  var NOTE_COLORS = [
1678
154
  { name: "Yellow", bg: "bg-amber-100 dark:bg-amber-950/70 border-amber-300 dark:border-amber-800 text-amber-900 dark:text-amber-100" },
1679
155
  { name: "Blue", bg: "bg-sky-100 dark:bg-sky-950/70 border-sky-300 dark:border-sky-800 text-sky-900 dark:text-sky-100" },
@@ -1686,11 +162,11 @@ function CanvasMode({
1686
162
  onClose,
1687
163
  className
1688
164
  }) {
1689
- const [scale, setScale] = useState4(1);
1690
- const [pan, setPan] = useState4({ x: 80, y: 80 });
1691
- const [isPanning, setIsPanning] = useState4(false);
1692
- const startPanRef = useRef4({ x: 0, y: 0 });
1693
- const [cards, setCards] = useState4([
165
+ const [scale, setScale] = useState(1);
166
+ const [pan, setPan] = useState({ x: 80, y: 80 });
167
+ const [isPanning, setIsPanning] = useState(false);
168
+ const startPanRef = useRef({ x: 0, y: 0 });
169
+ const [cards, setCards] = useState([
1694
170
  {
1695
171
  id: "primary-doc",
1696
172
  x: 100,
@@ -1742,14 +218,14 @@ function CanvasMode({
1742
218
  color: "bg-card border-border"
1743
219
  }
1744
220
  ]);
1745
- const [activeDragId, setActiveDragId] = useState4(null);
1746
- const dragOffsetRef = useRef4({ x: 0, y: 0 });
221
+ const [activeDragId, setActiveDragId] = useState(null);
222
+ const dragOffsetRef = useRef({ x: 0, y: 0 });
1747
223
  const handleMouseDownCanvas = (e) => {
1748
224
  if (e.target.closest(".canvas-card")) return;
1749
225
  setIsPanning(true);
1750
226
  startPanRef.current = { x: e.clientX - pan.x, y: e.clientY - pan.y };
1751
227
  };
1752
- const handleMouseMove = useCallback4(
228
+ const handleMouseMove = useCallback(
1753
229
  (e) => {
1754
230
  if (isPanning) {
1755
231
  setPan({
@@ -1771,11 +247,11 @@ function CanvasMode({
1771
247
  },
1772
248
  [isPanning, activeDragId, pan, scale]
1773
249
  );
1774
- const handleMouseUp = useCallback4(() => {
250
+ const handleMouseUp = useCallback(() => {
1775
251
  setIsPanning(false);
1776
252
  setActiveDragId(null);
1777
253
  }, []);
1778
- useEffect9(() => {
254
+ useEffect(() => {
1779
255
  window.addEventListener("mousemove", handleMouseMove);
1780
256
  window.addEventListener("mouseup", handleMouseUp);
1781
257
  return () => {
@@ -1827,7 +303,7 @@ function CanvasMode({
1827
303
  setScale(1);
1828
304
  setPan({ x: 80, y: 80 });
1829
305
  };
1830
- return /* @__PURE__ */ jsxs4(
306
+ return /* @__PURE__ */ jsxs(
1831
307
  "div",
1832
308
  {
1833
309
  className: cn(
@@ -1837,10 +313,10 @@ function CanvasMode({
1837
313
  ),
1838
314
  onMouseDown: handleMouseDownCanvas,
1839
315
  children: [
1840
- /* @__PURE__ */ jsxs4("div", { className: "absolute top-4 left-6 z-30 flex items-center gap-2 p-1.5 rounded-xl border border-border/80 bg-background/90 text-foreground shadow-lg backdrop-blur-md", children: [
1841
- /* @__PURE__ */ jsx6(Badge, { variant: "outline", className: "bg-primary/10 text-primary border-primary/20 px-2.5 py-1", children: "Canvas View" }),
1842
- /* @__PURE__ */ jsx6("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
1843
- /* @__PURE__ */ jsxs4(
316
+ /* @__PURE__ */ jsxs("div", { className: "absolute top-4 left-6 z-30 flex items-center gap-2 p-1.5 rounded-xl border border-border/80 bg-background/90 text-foreground shadow-lg backdrop-blur-md", children: [
317
+ /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "bg-primary/10 text-primary border-primary/20 px-2.5 py-1", children: "Canvas View" }),
318
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
319
+ /* @__PURE__ */ jsxs(
1844
320
  Button,
1845
321
  {
1846
322
  size: "sm",
@@ -1848,13 +324,13 @@ function CanvasMode({
1848
324
  onClick: handleAddNote,
1849
325
  className: "h-8 gap-1.5 text-xs font-medium",
1850
326
  children: [
1851
- /* @__PURE__ */ jsx6(StickyNote, { className: "w-3.5 h-3.5 text-amber-500" }),
1852
- /* @__PURE__ */ jsx6("span", { children: "Add Sticky Note" })
327
+ /* @__PURE__ */ jsx(StickyNote, { className: "w-3.5 h-3.5 text-amber-500" }),
328
+ /* @__PURE__ */ jsx("span", { children: "Add Sticky Note" })
1853
329
  ]
1854
330
  }
1855
331
  ),
1856
- /* @__PURE__ */ jsx6("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
1857
- /* @__PURE__ */ jsx6(
332
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
333
+ /* @__PURE__ */ jsx(
1858
334
  Button,
1859
335
  {
1860
336
  size: "sm",
@@ -1862,14 +338,14 @@ function CanvasMode({
1862
338
  onClick: zoomOut,
1863
339
  className: "h-8 w-8 p-0",
1864
340
  title: "Zoom Out",
1865
- children: /* @__PURE__ */ jsx6(ZoomOut, { className: "w-4 h-4" })
341
+ children: /* @__PURE__ */ jsx(ZoomOut, { className: "w-4 h-4" })
1866
342
  }
1867
343
  ),
1868
- /* @__PURE__ */ jsxs4("span", { className: "text-xs font-mono font-medium px-1", children: [
344
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-mono font-medium px-1", children: [
1869
345
  Math.round(scale * 100),
1870
346
  "%"
1871
347
  ] }),
1872
- /* @__PURE__ */ jsx6(
348
+ /* @__PURE__ */ jsx(
1873
349
  Button,
1874
350
  {
1875
351
  size: "sm",
@@ -1877,10 +353,10 @@ function CanvasMode({
1877
353
  onClick: zoomIn,
1878
354
  className: "h-8 w-8 p-0",
1879
355
  title: "Zoom In",
1880
- children: /* @__PURE__ */ jsx6(ZoomIn, { className: "w-4 h-4" })
356
+ children: /* @__PURE__ */ jsx(ZoomIn, { className: "w-4 h-4" })
1881
357
  }
1882
358
  ),
1883
- /* @__PURE__ */ jsx6(
359
+ /* @__PURE__ */ jsx(
1884
360
  Button,
1885
361
  {
1886
362
  size: "sm",
@@ -1888,12 +364,12 @@ function CanvasMode({
1888
364
  onClick: resetZoom,
1889
365
  className: "h-8 w-8 p-0",
1890
366
  title: "Reset View",
1891
- children: /* @__PURE__ */ jsx6(Maximize2, { className: "w-3.5 h-3.5" })
367
+ children: /* @__PURE__ */ jsx(Maximize2, { className: "w-3.5 h-3.5" })
1892
368
  }
1893
369
  ),
1894
- onClose && /* @__PURE__ */ jsxs4(Fragment4, { children: [
1895
- /* @__PURE__ */ jsx6("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
1896
- /* @__PURE__ */ jsx6(
370
+ onClose && /* @__PURE__ */ jsxs(Fragment, { children: [
371
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
372
+ /* @__PURE__ */ jsx(
1897
373
  Button,
1898
374
  {
1899
375
  size: "sm",
@@ -1905,7 +381,7 @@ function CanvasMode({
1905
381
  )
1906
382
  ] })
1907
383
  ] }),
1908
- /* @__PURE__ */ jsx6(
384
+ /* @__PURE__ */ jsx(
1909
385
  "div",
1910
386
  {
1911
387
  style: {
@@ -1913,7 +389,7 @@ function CanvasMode({
1913
389
  transformOrigin: "0 0"
1914
390
  },
1915
391
  className: "absolute inset-0 pointer-events-none",
1916
- children: cards.map((card) => /* @__PURE__ */ jsxs4(
392
+ children: cards.map((card) => /* @__PURE__ */ jsxs(
1917
393
  "div",
1918
394
  {
1919
395
  style: {
@@ -1929,17 +405,17 @@ function CanvasMode({
1929
405
  activeDragId === card.id ? "ring-2 ring-primary shadow-2xl z-20 cursor-grabbing" : "hover:shadow-2xl z-10"
1930
406
  ),
1931
407
  children: [
1932
- /* @__PURE__ */ jsxs4(
408
+ /* @__PURE__ */ jsxs(
1933
409
  "div",
1934
410
  {
1935
411
  onMouseDown: (e) => handleStartCardDrag(e, card),
1936
412
  className: "flex items-center justify-between px-3 py-2 border-b border-border/30 bg-black/5 dark:bg-white/5 cursor-grab active:cursor-grabbing",
1937
413
  children: [
1938
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1.5 flex-1 mr-2", children: [
1939
- card.type === "doc" && /* @__PURE__ */ jsx6(FileText, { className: "w-3.5 h-3.5 text-primary shrink-0" }),
1940
- card.type === "note" && /* @__PURE__ */ jsx6(StickyNote, { className: "w-3.5 h-3.5 text-amber-500 shrink-0" }),
1941
- card.type === "board" && /* @__PURE__ */ jsx6(Shapes, { className: "w-3.5 h-3.5 text-indigo-500 shrink-0" }),
1942
- /* @__PURE__ */ jsx6(
414
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-1 mr-2", children: [
415
+ card.type === "doc" && /* @__PURE__ */ jsx(FileText, { className: "w-3.5 h-3.5 text-primary shrink-0" }),
416
+ card.type === "note" && /* @__PURE__ */ jsx(StickyNote, { className: "w-3.5 h-3.5 text-amber-500 shrink-0" }),
417
+ card.type === "board" && /* @__PURE__ */ jsx(Shapes, { className: "w-3.5 h-3.5 text-indigo-500 shrink-0" }),
418
+ /* @__PURE__ */ jsx(
1943
419
  "input",
1944
420
  {
1945
421
  type: "text",
@@ -1949,23 +425,23 @@ function CanvasMode({
1949
425
  }
1950
426
  )
1951
427
  ] }),
1952
- /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-1", children: card.id !== "primary-doc" && /* @__PURE__ */ jsx6(
428
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: card.id !== "primary-doc" && /* @__PURE__ */ jsx(
1953
429
  "button",
1954
430
  {
1955
431
  onClick: () => handleDeleteCard(card.id),
1956
432
  className: "p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 opacity-60 hover:opacity-100 transition-opacity",
1957
433
  title: "Delete card",
1958
- children: /* @__PURE__ */ jsx6(Trash22, { className: "w-3 h-3 text-destructive" })
434
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3 h-3 text-destructive" })
1959
435
  }
1960
436
  ) })
1961
437
  ]
1962
438
  }
1963
439
  ),
1964
- /* @__PURE__ */ jsx6("div", { className: "p-3 flex-1 flex flex-col", children: card.type === "board" ? /* @__PURE__ */ jsxs4("div", { className: "flex-1 flex flex-col items-center justify-center border-2 border-dashed border-border/50 rounded-lg p-6 text-center text-muted-foreground text-xs gap-2", children: [
1965
- /* @__PURE__ */ jsx6(Shapes, { className: "w-8 h-8 text-indigo-500/70" }),
1966
- /* @__PURE__ */ jsx6("span", { className: "font-medium text-foreground", children: "Interactive Whiteboard" }),
1967
- /* @__PURE__ */ jsx6("p", { className: "text-[11px] max-w-[200px]", children: "Integrated with Excalidraw vector sketches and visual wireframes." })
1968
- ] }) : /* @__PURE__ */ jsx6(
440
+ /* @__PURE__ */ jsx("div", { className: "p-3 flex-1 flex flex-col", children: card.type === "board" ? /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col items-center justify-center border-2 border-dashed border-border/50 rounded-lg p-6 text-center text-muted-foreground text-xs gap-2", children: [
441
+ /* @__PURE__ */ jsx(Shapes, { className: "w-8 h-8 text-indigo-500/70" }),
442
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: "Interactive Whiteboard" }),
443
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] max-w-[200px]", children: "Integrated with Excalidraw vector sketches and visual wireframes." })
444
+ ] }) : /* @__PURE__ */ jsx(
1969
445
  "textarea",
1970
446
  {
1971
447
  value: card.content,