@collabchron/notiq 1.1.11 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/AICommandBarPlugin-ZEC755KY.mjs +27 -0
  2. package/dist/{AIDialog-2WZUFWSC.mjs → AIDialog-HJW6PQPR.mjs} +12 -13
  3. package/dist/{AudioComponent-CKLMLB5T.mjs → AudioComponent-W5XMZPQB.mjs} +10 -6
  4. package/dist/{DynamicBlockComponent-2LOADZUX.mjs → DynamicBlockComponent-CHRL2GAQ.mjs} +7 -6
  5. package/dist/{EquationComponent-4NFG55NQ.mjs → EquationComponent-GNQHG53L.mjs} +26 -7
  6. package/dist/{ExcalidrawComponent-SIMURTCA.mjs → ExcalidrawComponent-POMYXDSG.mjs} +34 -7
  7. package/dist/{FileComponent-Y56MX5QD.mjs → FileComponent-EOVCH4V5.mjs} +9 -5
  8. package/dist/{HintComponet-ET7M2Q7S.mjs → HintComponet-QXL5ESND.mjs} +32 -8
  9. package/dist/{InlineImageComponent-FVTA4LXZ.mjs → InlineImageComponent-KDN3VGZC.mjs} +8 -3
  10. package/dist/{StoryBuilderComponent-WQSNFPMM.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +9 -10
  11. package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
  12. package/dist/chunk-5CJZC5IB.mjs +9086 -0
  13. package/dist/{chunk-MW6MAUY3.mjs → chunk-6NK5DONB.mjs} +1 -1
  14. package/dist/{chunk-N6ILV6NF.mjs → chunk-ACW4DLVO.mjs} +21 -7
  15. package/dist/chunk-BCGD2YXP.mjs +574 -0
  16. package/dist/{chunk-TC3IISJZ.mjs → chunk-BTR3TPIN.mjs} +18 -5
  17. package/dist/{chunk-XAVQAXOJ.mjs → chunk-CQCS5YPS.mjs} +3 -5
  18. package/dist/{chunk-YTLUQJE2.mjs → chunk-D4UBNSUW.mjs} +1 -1
  19. package/dist/{chunk-KNW2CGIP.mjs → chunk-DBRZIA43.mjs} +4 -1
  20. package/dist/{chunk-CDAMHK63.mjs → chunk-GJK2L7ZM.mjs} +23 -2
  21. package/dist/{chunk-GYYLZ3MQ.mjs → chunk-IKYVBTCJ.mjs} +43 -20
  22. package/dist/chunk-IXRA5D53.mjs +10447 -0
  23. package/dist/{chunk-W6VQSFE5.mjs → chunk-J2CEQXG4.mjs} +1 -1
  24. package/dist/{chunk-43Z4Z2KD.mjs → chunk-JTNLN4JI.mjs} +1 -1
  25. package/dist/{chunk-OE5JRLCN.mjs → chunk-ONOHG5NB.mjs} +6 -4
  26. package/dist/{chunk-XZXGYNTY.mjs → chunk-OO42URWA.mjs} +27 -6
  27. package/dist/chunk-PBVRSNGU.mjs +129 -0
  28. package/dist/chunk-QCS57TIF.mjs +1794 -0
  29. package/dist/chunk-RNEIJRUS.mjs +60 -0
  30. package/dist/chunk-TJPTGECP.mjs +1556 -0
  31. package/dist/{chunk-XYMXGU4T.mjs → chunk-TMYRA2W4.mjs} +1 -1
  32. package/dist/{chunk-ZFV2HGD3.mjs → chunk-UNEFOZTS.mjs} +1 -1
  33. package/dist/chunk-X4NI7EQS.mjs +282 -0
  34. package/dist/chunk-XAJ4GACN.mjs +746 -0
  35. package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
  36. package/dist/components/editor/Core.d.ts +15 -2
  37. package/dist/components/editor/index.d.ts +16 -5
  38. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
  39. package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
  40. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
  41. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
  42. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
  43. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
  44. package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
  45. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
  46. package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
  47. package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
  48. package/dist/components/editor/utils/aiStream.d.ts +27 -0
  49. package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
  50. package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
  51. package/dist/components/editor/utils/url.d.ts +16 -4
  52. package/dist/components/providers/AIContext.d.ts +8 -0
  53. package/dist/components/ui/equation/equationTypography.d.ts +23 -0
  54. package/dist/core/extension.d.ts +3 -1
  55. package/dist/core/extensions/blocks-kit.d.ts +22 -1
  56. package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
  57. package/dist/core/index.d.ts +2 -1
  58. package/dist/core/react/NotiqContent.d.ts +4 -1
  59. package/dist/core/react/NotiqEditor.d.ts +8 -8
  60. package/dist/core/react/index.d.ts +1 -0
  61. package/dist/core/react/node-renderers.d.ts +73 -0
  62. package/dist/core/types.d.ts +1 -0
  63. package/dist/core.js +18136 -9084
  64. package/dist/core.mjs +58 -44
  65. package/dist/hooks/instructions-messages.d.ts +13 -4
  66. package/dist/{image-TPW7PZZK.mjs → image-AL6PHM2A.mjs} +18 -13
  67. package/dist/index.js +15180 -12858
  68. package/dist/index.mjs +121 -1641
  69. package/dist/{insert-audio-C66RZRKY.mjs → insert-audio-CRWR7EO5.mjs} +6 -8
  70. package/dist/{insert-file-3DTGRO7W.mjs → insert-file-I73AZW3L.mjs} +6 -8
  71. package/dist/{insert-gif-FIMCCBAI.mjs → insert-gif-KWRC3ACT.mjs} +4 -4
  72. package/dist/{insert-image-CZV6HWQZ.mjs → insert-image-XIY6BGW5.mjs} +6 -5
  73. package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
  74. package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
  75. package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
  76. package/dist/react.js +17933 -9531
  77. package/dist/react.mjs +41 -34
  78. package/dist/{stepper-4AO5XMO7.mjs → stepper-ILF7YXTO.mjs} +64 -74
  79. package/dist/styles/notiq.css +1 -1
  80. package/package.json +2 -2
  81. package/src/styles/notiq.css +20 -0
  82. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
  83. package/dist/CodeActionMenuPlugin-MRKY67ED.mjs +0 -14
  84. package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
  85. package/dist/CollaboratorsBar-TMKBOBJI.mjs +0 -20
  86. package/dist/CommentsPlugin-5M4RD6YO.mjs +0 -19
  87. package/dist/ExcalidrawPlugin-2SGPIQ6U.mjs +0 -14
  88. package/dist/ExportPlugin-OKZOLBGS.mjs +0 -42
  89. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
  90. package/dist/FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs +0 -45
  91. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
  92. package/dist/MobileToolbar-JKP2MLQJ.mjs +0 -984
  93. package/dist/SlashCommand-2TNOOUBM.mjs +0 -39
  94. package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
  95. package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
  96. package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
  97. package/dist/ToolbarPlugin-IIAOU4P5.mjs +0 -35
  98. package/dist/VersionHistoryPlugin-23MAZB4G.mjs +0 -371
  99. package/dist/background-color-OZJCBYCT.mjs +0 -425
  100. package/dist/block-format-MTSIXWID.mjs +0 -14
  101. package/dist/chunk-2KESP7OU.mjs +0 -809
  102. package/dist/chunk-3AHNLIME.mjs +0 -1701
  103. package/dist/chunk-3IILA3IP.mjs +0 -28
  104. package/dist/chunk-4DVIYZVB.mjs +0 -193
  105. package/dist/chunk-4FFTOZGJ.mjs +0 -103
  106. package/dist/chunk-4UMUPCDK.mjs +0 -68
  107. package/dist/chunk-6D6QLRYR.mjs +0 -238
  108. package/dist/chunk-6SRMKQSD.mjs +0 -682
  109. package/dist/chunk-ACV47ZKE.mjs +0 -201
  110. package/dist/chunk-AYNKORDO.mjs +0 -6
  111. package/dist/chunk-BGV62GC2.mjs +0 -26
  112. package/dist/chunk-D3IOUQFR.mjs +0 -441
  113. package/dist/chunk-EEBA6OAH.mjs +0 -59
  114. package/dist/chunk-EIZMKFHF.mjs +0 -32
  115. package/dist/chunk-EVPWKNE4.mjs +0 -27
  116. package/dist/chunk-FMJ7DGWP.mjs +0 -144
  117. package/dist/chunk-FYLRS4BG.mjs +0 -88
  118. package/dist/chunk-HOZ4QRFV.mjs +0 -536
  119. package/dist/chunk-IAFCQV3Z.mjs +0 -349
  120. package/dist/chunk-IU2N42JJ.mjs +0 -1763
  121. package/dist/chunk-J6ZUY5BY.mjs +0 -202
  122. package/dist/chunk-K5OAFEVY.mjs +0 -191
  123. package/dist/chunk-KDA7ZYMJ.mjs +0 -431
  124. package/dist/chunk-KXRLARGI.mjs +0 -26
  125. package/dist/chunk-LAUAYRPC.mjs +0 -944
  126. package/dist/chunk-LLCP7NVE.mjs +0 -449
  127. package/dist/chunk-LU2XWLOE.mjs +0 -219
  128. package/dist/chunk-MPTE332I.mjs +0 -787
  129. package/dist/chunk-MTQZWJHR.mjs +0 -111
  130. package/dist/chunk-OXWTZV3U.mjs +0 -174
  131. package/dist/chunk-PD5K4AGP.mjs +0 -64
  132. package/dist/chunk-PFH63ZU4.mjs +0 -33
  133. package/dist/chunk-PHRVYPVM.mjs +0 -808
  134. package/dist/chunk-R7WFRENU.mjs +0 -262
  135. package/dist/chunk-RAVYEEIC.mjs +0 -36
  136. package/dist/chunk-RJQTA6HG.mjs +0 -358
  137. package/dist/chunk-SAOJHVPE.mjs +0 -153
  138. package/dist/chunk-VGAX6YEY.mjs +0 -399
  139. package/dist/chunk-W6GAJXUS.mjs +0 -334
  140. package/dist/chunk-XYDBUQ6Z.mjs +0 -1978
  141. package/dist/chunk-XYT6XM5S.mjs +0 -496
  142. package/dist/chunk-YDDBQZ77.mjs +0 -409
  143. package/dist/chunk-YE7M2VKR.mjs +0 -132
  144. package/dist/chunk-Z6JAFF55.mjs +0 -555
  145. package/dist/chunk-ZKZ7MLSS.mjs +0 -165
  146. package/dist/color-23323E3B.mjs +0 -13
  147. package/dist/font-IJKFR4BM.mjs +0 -12
  148. package/dist/font-size-GTL6UVQL.mjs +0 -15
  149. package/dist/insert-node-MA3FXEYN.mjs +0 -245
  150. package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
  151. package/dist/text-align-CSDLJUDA.mjs +0 -121
  152. package/dist/text-format-6L5N3CHZ.mjs +0 -15
package/dist/index.mjs CHANGED
@@ -1,71 +1,14 @@
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,
64
7
  Audio,
8
+ BlockHandle,
65
9
  Blockquote,
66
10
  BlocksKit,
67
11
  Bold,
68
- BubbleMenu,
69
12
  BulletList,
70
13
  CheckList,
71
14
  Code,
@@ -74,155 +17,109 @@ import {
74
17
  ColumnsLayout,
75
18
  Equation,
76
19
  Excalidraw,
77
- Extension,
78
20
  Figma,
79
21
  File,
80
- FloatingMenu,
81
22
  Heading,
82
23
  HintBlock,
83
24
  History,
84
25
  Image,
85
26
  Italic,
86
- NotiqContent,
87
- NotiqContext,
88
- NotiqEditor,
89
- NotiqEditorImpl,
90
- NotiqProvider,
27
+ NodeRenderers,
91
28
  OrderedList,
92
29
  Paragraph,
93
30
  Poll,
31
+ SlashMenu,
94
32
  StarterKit,
95
33
  Stepper,
96
34
  Strike,
97
35
  Tweet,
98
36
  Underline,
99
- YouTube,
37
+ YouTube
38
+ } from "./chunk-XAJ4GACN.mjs";
39
+ import {
40
+ AVATAR_PRESETS,
41
+ BubbleMenu,
42
+ Editor,
43
+ Extension,
44
+ FloatingMenu,
45
+ NotiqContent,
46
+ NotiqContext,
47
+ NotiqEditor,
48
+ NotiqEditorImpl,
49
+ NotiqProvider,
50
+ OfflineBanner,
51
+ VersionHistoryProvider,
100
52
  createCanCommands,
101
53
  createCommandChain,
102
54
  createNotiqEditor,
103
- editor_theme_default,
104
55
  useNotiq,
105
- useNotiqContext
106
- } from "./chunk-IU2N42JJ.mjs";
107
- import "./chunk-PHRVYPVM.mjs";
108
- import {
109
- VersionHistoryProvider,
56
+ useNotiqContext,
110
57
  useVersionHistory
111
- } 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";
125
- import {
126
- AIProvider,
127
- useAI
128
- } 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";
159
- import {
160
- UploadProvider,
161
- useUpload
162
- } from "./chunk-N3WTT2U6.mjs";
163
- import {
164
- StepperPlugin
165
- } from "./chunk-2KESP7OU.mjs";
166
- import "./chunk-VGAX6YEY.mjs";
167
- import "./chunk-N6ILV6NF.mjs";
168
- import "./chunk-YTLUQJE2.mjs";
169
- 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";
58
+ } from "./chunk-5CJZC5IB.mjs";
181
59
  import {
60
+ COLLAB_COLORS,
61
+ COLLAB_SERVER_PRESETS,
62
+ CollabProvider,
63
+ CommentsProvider,
64
+ DEFAULT_DOC_ID,
182
65
  DEFAULT_FONT_SIZE,
66
+ DEFAULT_SERVER_URL,
67
+ FALLBACK_SERVER_URL,
183
68
  MAX_ALLOWED_FONT_SIZE,
184
69
  MIN_ALLOWED_FONT_SIZE,
185
70
  ToolbarContext,
186
71
  blockTypeToBlockName,
72
+ useCollab,
73
+ useComments,
187
74
  useToolbarState
188
- } from "./chunk-4FFTOZGJ.mjs";
75
+ } from "./chunk-IXRA5D53.mjs";
76
+ import "./chunk-J2CEQXG4.mjs";
77
+ import "./chunk-TJPTGECP.mjs";
189
78
  import {
190
- CommentsProvider,
191
- useComments
192
- } from "./chunk-R7WFRENU.mjs";
79
+ AIProvider,
80
+ useAI
81
+ } from "./chunk-BCGD2YXP.mjs";
82
+ import "./chunk-3JN6QEJR.mjs";
83
+ import "./chunk-4SYRK2NH.mjs";
84
+ import "./chunk-D4UBNSUW.mjs";
85
+ import "./chunk-JTNLN4JI.mjs";
193
86
  import {
194
- COLLAB_COLORS,
195
- COLLAB_SERVER_PRESETS,
196
- CollabProvider,
197
- DEFAULT_DOC_ID,
198
- DEFAULT_SERVER_URL,
199
- FALLBACK_SERVER_URL,
200
- useCollab
201
- } from "./chunk-RJQTA6HG.mjs";
202
- import "./chunk-6UVNHT3T.mjs";
203
- import "./chunk-5NRAXWYA.mjs";
87
+ UploadProvider,
88
+ useUpload
89
+ } from "./chunk-N3WTT2U6.mjs";
90
+ import "./chunk-6NK5DONB.mjs";
91
+ import "./chunk-CQCS5YPS.mjs";
92
+ import "./chunk-QCS57TIF.mjs";
93
+ import "./chunk-ACW4DLVO.mjs";
94
+ import "./chunk-TMYRA2W4.mjs";
95
+ import "./chunk-UNEFOZTS.mjs";
204
96
  import {
205
97
  SharedHistoryContext,
206
98
  useSharedHistoryContext
207
- } from "./chunk-EVPWKNE4.mjs";
208
- import "./chunk-CDAMHK63.mjs";
99
+ } from "./chunk-GJK2L7ZM.mjs";
209
100
  import "./chunk-NBE6FF6L.mjs";
210
- import "./chunk-GYYLZ3MQ.mjs";
101
+ import "./chunk-5NRAXWYA.mjs";
102
+ import "./chunk-IKYVBTCJ.mjs";
211
103
  import "./chunk-IUOUIDEQ.mjs";
212
- import {
213
- sanitizeUrl
214
- } from "./chunk-RAVYEEIC.mjs";
215
- import "./chunk-XZXGYNTY.mjs";
104
+ import "./chunk-X4NI7EQS.mjs";
105
+ import "./chunk-BTR3TPIN.mjs";
216
106
  import "./chunk-H3P47YXJ.mjs";
107
+ import "./chunk-OO42URWA.mjs";
217
108
  import {
218
109
  Button
219
- } from "./chunk-OE5JRLCN.mjs";
220
- import "./chunk-4UMUPCDK.mjs";
221
- import "./chunk-KNW2CGIP.mjs";
222
- import {
223
- HintPlugin
224
- } from "./chunk-7QRJVZQY.mjs";
110
+ } from "./chunk-ONOHG5NB.mjs";
111
+ import "./chunk-PBVRSNGU.mjs";
112
+ import "./chunk-DBRZIA43.mjs";
225
113
  import "./chunk-IIVB6JNE.mjs";
114
+ import "./chunk-YVUQRJVV.mjs";
115
+ import {
116
+ NodeRendererSlot,
117
+ NotiqNodeRendererProvider,
118
+ clearEditorNodeRenderers,
119
+ getEditorNodeRenderers,
120
+ setEditorNodeRenderers,
121
+ useNotiqNodeRenderers
122
+ } from "./chunk-RNEIJRUS.mjs";
226
123
  import {
227
124
  cn
228
125
  } from "./chunk-JHXDLYEV.mjs";
@@ -235,1435 +132,9 @@ import {
235
132
  // src/index.ts
236
133
  init_react_shim();
237
134
 
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
135
  // src/components/canvas/CanvasMode.tsx
1665
136
  init_react_shim();
1666
- import { useState as useState4, useRef as useRef4, useEffect as useEffect9, useCallback as useCallback4 } from "react";
137
+ import { useState, useRef, useEffect, useCallback } from "react";
1667
138
  import {
1668
139
  ZoomIn,
1669
140
  ZoomOut,
@@ -1671,9 +142,9 @@ import {
1671
142
  StickyNote,
1672
143
  FileText,
1673
144
  Shapes,
1674
- Trash2 as Trash22
145
+ Trash2
1675
146
  } from "lucide-react";
1676
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
147
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1677
148
  var NOTE_COLORS = [
1678
149
  { 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
150
  { 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 +157,11 @@ function CanvasMode({
1686
157
  onClose,
1687
158
  className
1688
159
  }) {
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([
160
+ const [scale, setScale] = useState(1);
161
+ const [pan, setPan] = useState({ x: 80, y: 80 });
162
+ const [isPanning, setIsPanning] = useState(false);
163
+ const startPanRef = useRef({ x: 0, y: 0 });
164
+ const [cards, setCards] = useState([
1694
165
  {
1695
166
  id: "primary-doc",
1696
167
  x: 100,
@@ -1742,14 +213,14 @@ function CanvasMode({
1742
213
  color: "bg-card border-border"
1743
214
  }
1744
215
  ]);
1745
- const [activeDragId, setActiveDragId] = useState4(null);
1746
- const dragOffsetRef = useRef4({ x: 0, y: 0 });
216
+ const [activeDragId, setActiveDragId] = useState(null);
217
+ const dragOffsetRef = useRef({ x: 0, y: 0 });
1747
218
  const handleMouseDownCanvas = (e) => {
1748
219
  if (e.target.closest(".canvas-card")) return;
1749
220
  setIsPanning(true);
1750
221
  startPanRef.current = { x: e.clientX - pan.x, y: e.clientY - pan.y };
1751
222
  };
1752
- const handleMouseMove = useCallback4(
223
+ const handleMouseMove = useCallback(
1753
224
  (e) => {
1754
225
  if (isPanning) {
1755
226
  setPan({
@@ -1771,11 +242,11 @@ function CanvasMode({
1771
242
  },
1772
243
  [isPanning, activeDragId, pan, scale]
1773
244
  );
1774
- const handleMouseUp = useCallback4(() => {
245
+ const handleMouseUp = useCallback(() => {
1775
246
  setIsPanning(false);
1776
247
  setActiveDragId(null);
1777
248
  }, []);
1778
- useEffect9(() => {
249
+ useEffect(() => {
1779
250
  window.addEventListener("mousemove", handleMouseMove);
1780
251
  window.addEventListener("mouseup", handleMouseUp);
1781
252
  return () => {
@@ -1827,7 +298,7 @@ function CanvasMode({
1827
298
  setScale(1);
1828
299
  setPan({ x: 80, y: 80 });
1829
300
  };
1830
- return /* @__PURE__ */ jsxs4(
301
+ return /* @__PURE__ */ jsxs(
1831
302
  "div",
1832
303
  {
1833
304
  className: cn(
@@ -1837,10 +308,10 @@ function CanvasMode({
1837
308
  ),
1838
309
  onMouseDown: handleMouseDownCanvas,
1839
310
  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(
311
+ /* @__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: [
312
+ /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "bg-primary/10 text-primary border-primary/20 px-2.5 py-1", children: "Canvas View" }),
313
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
314
+ /* @__PURE__ */ jsxs(
1844
315
  Button,
1845
316
  {
1846
317
  size: "sm",
@@ -1848,13 +319,13 @@ function CanvasMode({
1848
319
  onClick: handleAddNote,
1849
320
  className: "h-8 gap-1.5 text-xs font-medium",
1850
321
  children: [
1851
- /* @__PURE__ */ jsx6(StickyNote, { className: "w-3.5 h-3.5 text-amber-500" }),
1852
- /* @__PURE__ */ jsx6("span", { children: "Add Sticky Note" })
322
+ /* @__PURE__ */ jsx(StickyNote, { className: "w-3.5 h-3.5 text-amber-500" }),
323
+ /* @__PURE__ */ jsx("span", { children: "Add Sticky Note" })
1853
324
  ]
1854
325
  }
1855
326
  ),
1856
- /* @__PURE__ */ jsx6("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
1857
- /* @__PURE__ */ jsx6(
327
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
328
+ /* @__PURE__ */ jsx(
1858
329
  Button,
1859
330
  {
1860
331
  size: "sm",
@@ -1862,14 +333,14 @@ function CanvasMode({
1862
333
  onClick: zoomOut,
1863
334
  className: "h-8 w-8 p-0",
1864
335
  title: "Zoom Out",
1865
- children: /* @__PURE__ */ jsx6(ZoomOut, { className: "w-4 h-4" })
336
+ children: /* @__PURE__ */ jsx(ZoomOut, { className: "w-4 h-4" })
1866
337
  }
1867
338
  ),
1868
- /* @__PURE__ */ jsxs4("span", { className: "text-xs font-mono font-medium px-1", children: [
339
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-mono font-medium px-1", children: [
1869
340
  Math.round(scale * 100),
1870
341
  "%"
1871
342
  ] }),
1872
- /* @__PURE__ */ jsx6(
343
+ /* @__PURE__ */ jsx(
1873
344
  Button,
1874
345
  {
1875
346
  size: "sm",
@@ -1877,10 +348,10 @@ function CanvasMode({
1877
348
  onClick: zoomIn,
1878
349
  className: "h-8 w-8 p-0",
1879
350
  title: "Zoom In",
1880
- children: /* @__PURE__ */ jsx6(ZoomIn, { className: "w-4 h-4" })
351
+ children: /* @__PURE__ */ jsx(ZoomIn, { className: "w-4 h-4" })
1881
352
  }
1882
353
  ),
1883
- /* @__PURE__ */ jsx6(
354
+ /* @__PURE__ */ jsx(
1884
355
  Button,
1885
356
  {
1886
357
  size: "sm",
@@ -1888,12 +359,12 @@ function CanvasMode({
1888
359
  onClick: resetZoom,
1889
360
  className: "h-8 w-8 p-0",
1890
361
  title: "Reset View",
1891
- children: /* @__PURE__ */ jsx6(Maximize2, { className: "w-3.5 h-3.5" })
362
+ children: /* @__PURE__ */ jsx(Maximize2, { className: "w-3.5 h-3.5" })
1892
363
  }
1893
364
  ),
1894
- onClose && /* @__PURE__ */ jsxs4(Fragment4, { children: [
1895
- /* @__PURE__ */ jsx6("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
1896
- /* @__PURE__ */ jsx6(
365
+ onClose && /* @__PURE__ */ jsxs(Fragment, { children: [
366
+ /* @__PURE__ */ jsx("div", { className: "w-[1px] h-5 bg-border/60 mx-1" }),
367
+ /* @__PURE__ */ jsx(
1897
368
  Button,
1898
369
  {
1899
370
  size: "sm",
@@ -1905,7 +376,7 @@ function CanvasMode({
1905
376
  )
1906
377
  ] })
1907
378
  ] }),
1908
- /* @__PURE__ */ jsx6(
379
+ /* @__PURE__ */ jsx(
1909
380
  "div",
1910
381
  {
1911
382
  style: {
@@ -1913,7 +384,7 @@ function CanvasMode({
1913
384
  transformOrigin: "0 0"
1914
385
  },
1915
386
  className: "absolute inset-0 pointer-events-none",
1916
- children: cards.map((card) => /* @__PURE__ */ jsxs4(
387
+ children: cards.map((card) => /* @__PURE__ */ jsxs(
1917
388
  "div",
1918
389
  {
1919
390
  style: {
@@ -1929,17 +400,17 @@ function CanvasMode({
1929
400
  activeDragId === card.id ? "ring-2 ring-primary shadow-2xl z-20 cursor-grabbing" : "hover:shadow-2xl z-10"
1930
401
  ),
1931
402
  children: [
1932
- /* @__PURE__ */ jsxs4(
403
+ /* @__PURE__ */ jsxs(
1933
404
  "div",
1934
405
  {
1935
406
  onMouseDown: (e) => handleStartCardDrag(e, card),
1936
407
  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
408
  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(
409
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-1 mr-2", children: [
410
+ card.type === "doc" && /* @__PURE__ */ jsx(FileText, { className: "w-3.5 h-3.5 text-primary shrink-0" }),
411
+ card.type === "note" && /* @__PURE__ */ jsx(StickyNote, { className: "w-3.5 h-3.5 text-amber-500 shrink-0" }),
412
+ card.type === "board" && /* @__PURE__ */ jsx(Shapes, { className: "w-3.5 h-3.5 text-indigo-500 shrink-0" }),
413
+ /* @__PURE__ */ jsx(
1943
414
  "input",
1944
415
  {
1945
416
  type: "text",
@@ -1949,23 +420,23 @@ function CanvasMode({
1949
420
  }
1950
421
  )
1951
422
  ] }),
1952
- /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-1", children: card.id !== "primary-doc" && /* @__PURE__ */ jsx6(
423
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: card.id !== "primary-doc" && /* @__PURE__ */ jsx(
1953
424
  "button",
1954
425
  {
1955
426
  onClick: () => handleDeleteCard(card.id),
1956
427
  className: "p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 opacity-60 hover:opacity-100 transition-opacity",
1957
428
  title: "Delete card",
1958
- children: /* @__PURE__ */ jsx6(Trash22, { className: "w-3 h-3 text-destructive" })
429
+ children: /* @__PURE__ */ jsx(Trash2, { className: "w-3 h-3 text-destructive" })
1959
430
  }
1960
431
  ) })
1961
432
  ]
1962
433
  }
1963
434
  ),
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(
435
+ /* @__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: [
436
+ /* @__PURE__ */ jsx(Shapes, { className: "w-8 h-8 text-indigo-500/70" }),
437
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: "Interactive Whiteboard" }),
438
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] max-w-[200px]", children: "Integrated with Excalidraw vector sketches and visual wireframes." })
439
+ ] }) : /* @__PURE__ */ jsx(
1969
440
  "textarea",
1970
441
  {
1971
442
  value: card.content,
@@ -2137,6 +608,7 @@ export {
2137
608
  AIProvider,
2138
609
  AVATAR_PRESETS,
2139
610
  Audio,
611
+ BlockHandle,
2140
612
  Blockquote,
2141
613
  BlocksKit,
2142
614
  Bold,
@@ -2171,16 +643,20 @@ export {
2171
643
  Italic,
2172
644
  MAX_ALLOWED_FONT_SIZE,
2173
645
  MIN_ALLOWED_FONT_SIZE,
646
+ NodeRendererSlot,
647
+ NodeRenderers,
2174
648
  NotiqContent,
2175
649
  NotiqContext,
2176
650
  NotiqEditor,
2177
651
  NotiqEditorImpl,
652
+ NotiqNodeRendererProvider,
2178
653
  NotiqProvider,
2179
654
  OfflineBanner,
2180
655
  OrderedList,
2181
656
  Paragraph,
2182
657
  Poll,
2183
658
  SharedHistoryContext,
659
+ SlashMenu,
2184
660
  StarterKit,
2185
661
  Stepper,
2186
662
  Strike,
@@ -2191,16 +667,20 @@ export {
2191
667
  VersionHistoryProvider,
2192
668
  YouTube,
2193
669
  blockTypeToBlockName,
670
+ clearEditorNodeRenderers,
2194
671
  createCanCommands,
2195
672
  createCommandChain,
2196
673
  createNotiqEditor,
674
+ getEditorNodeRenderers,
2197
675
  notiqPlugin,
676
+ setEditorNodeRenderers,
2198
677
  useAI,
2199
678
  useCollab,
2200
679
  useComments,
2201
680
  useNotiq as useEditor,
2202
681
  useNotiq,
2203
682
  useNotiqContext,
683
+ useNotiqNodeRenderers,
2204
684
  useSharedHistoryContext,
2205
685
  useToolbarState,
2206
686
  useUpload,