@collabchron/notiq 1.1.12 → 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 (146) hide show
  1. package/dist/AICommandBarPlugin-ZEC755KY.mjs +27 -0
  2. package/dist/{AIDialog-RHRYHSVN.mjs → AIDialog-HJW6PQPR.mjs} +11 -12
  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-BMSYIPP6.mjs → ExcalidrawComponent-POMYXDSG.mjs} +33 -6
  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-JN4ZPZOW.mjs → StoryBuilderComponent-CBRFPFTR.mjs} +8 -9
  11. package/dist/{chunk-6UVNHT3T.mjs → chunk-4SYRK2NH.mjs} +23 -1
  12. package/dist/chunk-5CJZC5IB.mjs +9086 -0
  13. package/dist/{chunk-FO7M3X2B.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-ZYJ7KABY.mjs → chunk-CQCS5YPS.mjs} +3 -5
  18. package/dist/{chunk-T2UBAZ66.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-ELBTVBTS.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-QNIY45SF.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-5D4JF3ZZ.mjs → chunk-XAJ4GACN.mjs} +171 -49
  35. package/dist/{chunk-7QRJVZQY.mjs → chunk-YVUQRJVV.mjs} +63 -18
  36. package/dist/components/editor/index.d.ts +1 -1
  37. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +1 -0
  38. package/dist/components/editor/nodes/Hint/index.d.ts +2 -1
  39. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +73 -1
  40. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +25 -3
  41. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +16 -3
  42. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +20 -25
  43. package/dist/components/editor/plugins/MarkdownPastePlugin/index.d.ts +5 -0
  44. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +2 -0
  45. package/dist/components/editor/plugins/SlashCommand/index.d.ts +18 -1
  46. package/dist/components/editor/plugins/SmartTypographyPlugin/index.d.ts +26 -0
  47. package/dist/components/editor/utils/aiStream.d.ts +27 -0
  48. package/dist/components/editor/utils/excalidrawDiagramBuilder.d.ts +29 -0
  49. package/dist/components/editor/utils/markdownTransformers.d.ts +4 -1
  50. package/dist/components/editor/utils/url.d.ts +16 -4
  51. package/dist/components/providers/AIContext.d.ts +8 -0
  52. package/dist/components/ui/equation/equationTypography.d.ts +23 -0
  53. package/dist/core/extension.d.ts +3 -1
  54. package/dist/core/extensions/blocks-kit.d.ts +22 -1
  55. package/dist/core/extensions/copilot-and-collab.d.ts +15 -1
  56. package/dist/core/react/NotiqContent.d.ts +4 -1
  57. package/dist/core/react/index.d.ts +1 -0
  58. package/dist/core/react/node-renderers.d.ts +73 -0
  59. package/dist/core.js +15429 -13116
  60. package/dist/core.mjs +47 -39
  61. package/dist/hooks/instructions-messages.d.ts +13 -4
  62. package/dist/{image-QPB2CVXP.mjs → image-AL6PHM2A.mjs} +17 -12
  63. package/dist/index.js +15526 -13194
  64. package/dist/index.mjs +64 -60
  65. package/dist/{insert-audio-I3PD6JFS.mjs → insert-audio-CRWR7EO5.mjs} +4 -6
  66. package/dist/{insert-file-PHR7XL4V.mjs → insert-file-I73AZW3L.mjs} +4 -6
  67. package/dist/{insert-gif-R5ZO4JHC.mjs → insert-gif-KWRC3ACT.mjs} +1 -1
  68. package/dist/{insert-image-PLBZELHK.mjs → insert-image-XIY6BGW5.mjs} +4 -3
  69. package/dist/{insert-poll-6BCIFY5G.mjs → insert-poll-J5YVZNZ4.mjs} +4 -3
  70. package/dist/{insert-table-ZRJP6X52.mjs → insert-table-OIMJRFFK.mjs} +1 -1
  71. package/dist/{poll-component-VHMM5KKZ.mjs → poll-component-TVHXIKGQ.mjs} +3 -2
  72. package/dist/react.js +14747 -12554
  73. package/dist/react.mjs +40 -38
  74. package/dist/{stepper-KNITDVLG.mjs → stepper-ILF7YXTO.mjs} +63 -73
  75. package/dist/styles/notiq.css +1 -1
  76. package/package.json +2 -2
  77. package/src/styles/notiq.css +20 -0
  78. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +0 -12
  79. package/dist/CodeActionMenuPlugin-FGH6HZLL.mjs +0 -14
  80. package/dist/CollaborationPlugin-TIZOQBUT.mjs +0 -405
  81. package/dist/CollaboratorsBar-AMPIAUOY.mjs +0 -20
  82. package/dist/CommentsPlugin-SDJJTUGK.mjs +0 -19
  83. package/dist/ExcalidrawPlugin-QLPGJPSX.mjs +0 -14
  84. package/dist/ExportPlugin-MJHYKQZJ.mjs +0 -43
  85. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +0 -12
  86. package/dist/FloatingTextFormatToolbarPlugin-BXCPN3KD.mjs +0 -45
  87. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +0 -360
  88. package/dist/MobileToolbar-KV5DX4ED.mjs +0 -982
  89. package/dist/SlashCommand-SPR7G5EI.mjs +0 -39
  90. package/dist/TableCellActionMenuPlugin-YWBA64J7.mjs +0 -838
  91. package/dist/TableHoverActionsPlugin-2EIXHEXN.mjs +0 -265
  92. package/dist/TemplatePlugin-HNTPEXBB.mjs +0 -9
  93. package/dist/ToolbarPlugin-F52PVNXU.mjs +0 -823
  94. package/dist/VersionHistoryPlugin-YWGCREKA.mjs +0 -371
  95. package/dist/background-color-RW5JYLMG.mjs +0 -425
  96. package/dist/block-format-TODFREE2.mjs +0 -14
  97. package/dist/chunk-22ZIL6NH.mjs +0 -88
  98. package/dist/chunk-2LNT36RL.mjs +0 -555
  99. package/dist/chunk-37LC44W3.mjs +0 -2677
  100. package/dist/chunk-3IILA3IP.mjs +0 -28
  101. package/dist/chunk-4DVIYZVB.mjs +0 -193
  102. package/dist/chunk-4FFTOZGJ.mjs +0 -103
  103. package/dist/chunk-4UMUPCDK.mjs +0 -68
  104. package/dist/chunk-6D6QLRYR.mjs +0 -238
  105. package/dist/chunk-6FQFPPLG.mjs +0 -785
  106. package/dist/chunk-ACV47ZKE.mjs +0 -201
  107. package/dist/chunk-BGV62GC2.mjs +0 -26
  108. package/dist/chunk-C4JWLBYN.mjs +0 -132
  109. package/dist/chunk-CLRSETYQ.mjs +0 -431
  110. package/dist/chunk-D3IOUQFR.mjs +0 -441
  111. package/dist/chunk-EEBA6OAH.mjs +0 -59
  112. package/dist/chunk-EIZMKFHF.mjs +0 -32
  113. package/dist/chunk-ENH2IOHI.mjs +0 -1828
  114. package/dist/chunk-EVPWKNE4.mjs +0 -27
  115. package/dist/chunk-HOZ4QRFV.mjs +0 -536
  116. package/dist/chunk-IAFCQV3Z.mjs +0 -349
  117. package/dist/chunk-J6ZUY5BY.mjs +0 -202
  118. package/dist/chunk-K5OAFEVY.mjs +0 -191
  119. package/dist/chunk-KXRLARGI.mjs +0 -26
  120. package/dist/chunk-LBGM4VVZ.mjs +0 -409
  121. package/dist/chunk-LLGVCM7M.mjs +0 -809
  122. package/dist/chunk-LU2XWLOE.mjs +0 -219
  123. package/dist/chunk-LVRJM45C.mjs +0 -171
  124. package/dist/chunk-MSAO3YFB.mjs +0 -144
  125. package/dist/chunk-N3KDPSRI.mjs +0 -496
  126. package/dist/chunk-OXWTZV3U.mjs +0 -174
  127. package/dist/chunk-PD5K4AGP.mjs +0 -64
  128. package/dist/chunk-PFH63ZU4.mjs +0 -33
  129. package/dist/chunk-R7WFRENU.mjs +0 -262
  130. package/dist/chunk-RAVYEEIC.mjs +0 -36
  131. package/dist/chunk-RJQTA6HG.mjs +0 -358
  132. package/dist/chunk-SAOJHVPE.mjs +0 -153
  133. package/dist/chunk-SYUCM5G5.mjs +0 -111
  134. package/dist/chunk-VGAX6YEY.mjs +0 -399
  135. package/dist/chunk-VNDDDXGH.mjs +0 -682
  136. package/dist/chunk-WUVIQCX7.mjs +0 -944
  137. package/dist/chunk-XNJNT6PC.mjs +0 -1701
  138. package/dist/chunk-XYLTLGY5.mjs +0 -775
  139. package/dist/chunk-ZKZ7MLSS.mjs +0 -165
  140. package/dist/color-S55XFDYQ.mjs +0 -13
  141. package/dist/font-IJKFR4BM.mjs +0 -12
  142. package/dist/font-size-3HMJHKO2.mjs +0 -15
  143. package/dist/insert-node-DGCZBGKG.mjs +0 -243
  144. package/dist/table-dropdown-4VCRSQB6.mjs +0 -391
  145. package/dist/text-align-TEB4S52S.mjs +0 -121
  146. package/dist/text-format-T3IY7FBI.mjs +0 -15
@@ -1,555 +0,0 @@
1
- import {
2
- $createInlineImageNode,
3
- $isInlineImageNode,
4
- InlineImageNode
5
- } from "./chunk-LLGVCM7M.mjs";
6
- import {
7
- $createStoryBuilderNode,
8
- StoryBuilderNode
9
- } from "./chunk-T2UBAZ66.mjs";
10
- import {
11
- $createDynamicBlockNode,
12
- DynamicBlockNode
13
- } from "./chunk-43Z4Z2KD.mjs";
14
- import {
15
- DialogActions,
16
- Select,
17
- TextInput
18
- } from "./chunk-IUOUIDEQ.mjs";
19
- import {
20
- Button
21
- } from "./chunk-OE5JRLCN.mjs";
22
- import {
23
- KatexRenderer
24
- } from "./chunk-4UMUPCDK.mjs";
25
- import {
26
- $createEquationNode,
27
- EquationNode
28
- } from "./chunk-KNW2CGIP.mjs";
29
- import {
30
- init_react_shim
31
- } from "./chunk-WYCFGRFJ.mjs";
32
-
33
- // src/components/editor/plugins/StoryBuilderPlugin/index.tsx
34
- init_react_shim();
35
- import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
36
- import { $wrapNodeInElement } from "@lexical/utils";
37
- import {
38
- $createParagraphNode,
39
- $insertNodes,
40
- $isRootOrShadowRoot,
41
- COMMAND_PRIORITY_EDITOR,
42
- createCommand
43
- } from "lexical";
44
- import { useEffect } from "react";
45
- var INSERT_STORY_BUILDER_COMMAND = createCommand("INSERT_STORY_BUILDER_COMMAND");
46
- function StoryBuilderPlugin() {
47
- const [editor] = useLexicalComposerContext();
48
- useEffect(() => {
49
- if (!editor.hasNodes([StoryBuilderNode])) {
50
- throw new Error("StoryBuilderPlugin: StoryBuilderNode not registered on editor");
51
- }
52
- return editor.registerCommand(
53
- INSERT_STORY_BUILDER_COMMAND,
54
- (payload) => {
55
- const storyBuilderNode = $createStoryBuilderNode(payload);
56
- $insertNodes([storyBuilderNode]);
57
- if ($isRootOrShadowRoot(storyBuilderNode.getParentOrThrow())) {
58
- $wrapNodeInElement(storyBuilderNode, $createParagraphNode).selectEnd();
59
- }
60
- return true;
61
- },
62
- COMMAND_PRIORITY_EDITOR
63
- );
64
- }, [editor]);
65
- return null;
66
- }
67
-
68
- // src/components/editor/plugins/InlineImagePlugin/index.tsx
69
- init_react_shim();
70
- import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
71
- import { $wrapNodeInElement as $wrapNodeInElement2, mergeRegister } from "@lexical/utils";
72
- import {
73
- $createParagraphNode as $createParagraphNode2,
74
- $createRangeSelection,
75
- $getSelection,
76
- $insertNodes as $insertNodes2,
77
- $isNodeSelection,
78
- $isRootOrShadowRoot as $isRootOrShadowRoot2,
79
- $setSelection,
80
- COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR2,
81
- COMMAND_PRIORITY_HIGH,
82
- COMMAND_PRIORITY_LOW,
83
- createCommand as createCommand2,
84
- DRAGOVER_COMMAND,
85
- DRAGSTART_COMMAND,
86
- DROP_COMMAND,
87
- getDOMSelectionFromTarget,
88
- isHTMLElement
89
- } from "lexical";
90
- import { useEffect as useEffect2, useRef, useState } from "react";
91
-
92
- // src/components/ui/FileInput.tsx
93
- init_react_shim();
94
- import { jsx, jsxs } from "react/jsx-runtime";
95
- function FileInput({
96
- accept,
97
- label,
98
- onChange,
99
- "data-test-id": dataTestId
100
- }) {
101
- return /* @__PURE__ */ jsxs("div", { className: "Input__wrapper", children: [
102
- /* @__PURE__ */ jsx("label", { className: "Input__label", children: label }),
103
- /* @__PURE__ */ jsx(
104
- "input",
105
- {
106
- type: "file",
107
- accept,
108
- className: "Input__input",
109
- onChange: (e) => onChange(e.target.files),
110
- "data-test-id": dataTestId
111
- }
112
- )
113
- ] });
114
- }
115
-
116
- // src/components/editor/plugins/InlineImagePlugin/index.tsx
117
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
118
- var INSERT_INLINE_IMAGE_COMMAND = createCommand2("INSERT_INLINE_IMAGE_COMMAND");
119
- function InsertInlineImageDialog({
120
- activeEditor,
121
- onClose
122
- }) {
123
- const hasModifier = useRef(false);
124
- const [src, setSrc] = useState("");
125
- const [altText, setAltText] = useState("");
126
- const [showCaption, setShowCaption] = useState(false);
127
- const [position, setPosition] = useState("left");
128
- const isDisabled = src === "";
129
- const handleShowCaptionChange = (e) => {
130
- setShowCaption(e.target.checked);
131
- };
132
- const handlePositionChange = (e) => {
133
- setPosition(e.target.value);
134
- };
135
- const loadImage = (files) => {
136
- const reader = new FileReader();
137
- reader.onload = () => {
138
- if (typeof reader.result === "string") {
139
- setSrc(reader.result);
140
- }
141
- return "";
142
- };
143
- reader.onerror = () => {
144
- console.error("Error reading file");
145
- setSrc("");
146
- };
147
- if (files !== null && files.length > 0) {
148
- reader.readAsDataURL(files[0]);
149
- }
150
- };
151
- useEffect2(() => {
152
- hasModifier.current = false;
153
- const handler = (e) => {
154
- hasModifier.current = e.altKey;
155
- };
156
- document.addEventListener("keydown", handler);
157
- return () => {
158
- document.removeEventListener("keydown", handler);
159
- };
160
- }, [activeEditor]);
161
- const handleOnClick = () => {
162
- const payload = { altText, position, showCaption, src };
163
- activeEditor.dispatchCommand(INSERT_INLINE_IMAGE_COMMAND, payload);
164
- onClose();
165
- };
166
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
167
- /* @__PURE__ */ jsx2("div", { className: "mb-4", children: /* @__PURE__ */ jsx2(FileInput, { label: "Image Upload", onChange: loadImage, accept: "image/*", "data-test-id": "image-modal-file-upload" }) }),
168
- /* @__PURE__ */ jsx2("div", { className: "mb-4", children: /* @__PURE__ */ jsx2(
169
- TextInput,
170
- {
171
- label: "Alt Text",
172
- placeholder: "Descriptive alternative text",
173
- onChange: setAltText,
174
- value: altText,
175
- "data-test-id": "image-modal-alt-text-input"
176
- }
177
- ) }),
178
- /* @__PURE__ */ jsxs2(
179
- Select,
180
- {
181
- className: "mb-4 w-72",
182
- label: "Position",
183
- name: "position",
184
- id: "position-select",
185
- onChange: handlePositionChange,
186
- children: [
187
- /* @__PURE__ */ jsx2("option", { value: "left", children: "Left" }),
188
- /* @__PURE__ */ jsx2("option", { value: "right", children: "Right" }),
189
- /* @__PURE__ */ jsx2("option", { value: "full", children: "Full Width" })
190
- ]
191
- }
192
- ),
193
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center space-x-2 mb-4", children: [
194
- /* @__PURE__ */ jsx2(
195
- "input",
196
- {
197
- id: "caption",
198
- type: "checkbox",
199
- checked: showCaption,
200
- onChange: handleShowCaptionChange,
201
- className: "w-4 h-4 text-primary bg-background border-border rounded focus:ring-ring focus:ring-2"
202
- }
203
- ),
204
- /* @__PURE__ */ jsx2("label", { htmlFor: "caption", className: "text-sm font-medium text-foreground cursor-pointer", children: "Show Caption" })
205
- ] }),
206
- /* @__PURE__ */ jsx2(DialogActions, { children: /* @__PURE__ */ jsx2(Button, { "data-test-id": "image-modal-file-upload-btn", disabled: isDisabled, onClick: () => handleOnClick(), children: "Confirm" }) })
207
- ] });
208
- }
209
- function InlineImagePlugin() {
210
- const [editor] = useLexicalComposerContext2();
211
- useEffect2(() => {
212
- if (!editor.hasNodes([InlineImageNode])) {
213
- throw new Error("ImagesPlugin: ImageNode not registered on editor");
214
- }
215
- return mergeRegister(
216
- editor.registerCommand(
217
- INSERT_INLINE_IMAGE_COMMAND,
218
- (payload) => {
219
- const imageNode = $createInlineImageNode(payload);
220
- $insertNodes2([imageNode]);
221
- if ($isRootOrShadowRoot2(imageNode.getParentOrThrow())) {
222
- $wrapNodeInElement2(imageNode, $createParagraphNode2).selectEnd();
223
- }
224
- return true;
225
- },
226
- COMMAND_PRIORITY_EDITOR2
227
- ),
228
- editor.registerCommand(
229
- DRAGSTART_COMMAND,
230
- (event) => {
231
- return $onDragStart(event);
232
- },
233
- COMMAND_PRIORITY_HIGH
234
- ),
235
- editor.registerCommand(
236
- DRAGOVER_COMMAND,
237
- (event) => {
238
- return $onDragover(event);
239
- },
240
- COMMAND_PRIORITY_LOW
241
- ),
242
- editor.registerCommand(
243
- DROP_COMMAND,
244
- (event) => {
245
- return $onDrop(event, editor);
246
- },
247
- COMMAND_PRIORITY_HIGH
248
- )
249
- );
250
- }, [editor]);
251
- return null;
252
- }
253
- var TRANSPARENT_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
254
- var img = null;
255
- if (typeof document !== "undefined") {
256
- img = document.createElement("img");
257
- img.src = TRANSPARENT_IMAGE;
258
- }
259
- function $onDragStart(event) {
260
- const node = $getImageNodeInSelection();
261
- if (!node) {
262
- return false;
263
- }
264
- const dataTransfer = event.dataTransfer;
265
- if (!dataTransfer) {
266
- return false;
267
- }
268
- dataTransfer.setData("text/plain", "_");
269
- if (img) {
270
- dataTransfer.setDragImage(img, 0, 0);
271
- }
272
- dataTransfer.setData(
273
- "application/x-lexical-drag",
274
- JSON.stringify({
275
- data: {
276
- altText: node.__altText,
277
- caption: node.__caption,
278
- height: node.__height,
279
- key: node.getKey(),
280
- showCaption: node.__showCaption,
281
- src: node.__src,
282
- width: node.__width
283
- },
284
- type: "image"
285
- })
286
- );
287
- return true;
288
- }
289
- function $onDragover(event) {
290
- const node = $getImageNodeInSelection();
291
- if (!node) {
292
- return false;
293
- }
294
- if (!canDropImage(event)) {
295
- event.preventDefault();
296
- }
297
- return true;
298
- }
299
- function $onDrop(event, editor) {
300
- const node = $getImageNodeInSelection();
301
- if (!node) {
302
- return false;
303
- }
304
- const data = getDragImageData(event);
305
- if (!data) {
306
- return false;
307
- }
308
- event.preventDefault();
309
- if (canDropImage(event)) {
310
- const range = getDragSelection(event);
311
- node.remove();
312
- const rangeSelection = $createRangeSelection();
313
- if (range !== null && range !== void 0) {
314
- rangeSelection.applyDOMRange(range);
315
- }
316
- $setSelection(rangeSelection);
317
- editor.dispatchCommand(INSERT_INLINE_IMAGE_COMMAND, data);
318
- }
319
- return true;
320
- }
321
- function $getImageNodeInSelection() {
322
- const selection = $getSelection();
323
- if (!$isNodeSelection(selection)) {
324
- return null;
325
- }
326
- const nodes = selection.getNodes();
327
- const node = nodes[0];
328
- return $isInlineImageNode(node) ? node : null;
329
- }
330
- function getDragImageData(event) {
331
- var _a;
332
- const dragData = (_a = event.dataTransfer) == null ? void 0 : _a.getData("application/x-lexical-drag");
333
- if (!dragData) {
334
- return null;
335
- }
336
- const { type, data } = JSON.parse(dragData);
337
- if (type !== "image") {
338
- return null;
339
- }
340
- return data;
341
- }
342
- function canDropImage(event) {
343
- const target = event.target;
344
- return !!(isHTMLElement(target) && !target.closest("code, span.editor-image") && isHTMLElement(target.parentElement) && target.parentElement.closest("div.ContentEditable__root"));
345
- }
346
- function getDragSelection(event) {
347
- let range;
348
- const domSelection = getDOMSelectionFromTarget(event.target);
349
- if (document.caretRangeFromPoint) {
350
- range = document.caretRangeFromPoint(event.clientX, event.clientY);
351
- } else if (event.rangeParent && domSelection !== null) {
352
- domSelection.collapse(event.rangeParent, event.rangeOffset || 0);
353
- range = domSelection.getRangeAt(0);
354
- } else {
355
- throw Error("Cannot get the selection when dragging");
356
- }
357
- return range;
358
- }
359
-
360
- // src/components/editor/plugins/EquationsPlugin/index.tsx
361
- init_react_shim();
362
- import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
363
- import { $wrapNodeInElement as $wrapNodeInElement3 } from "@lexical/utils";
364
- import {
365
- $createParagraphNode as $createParagraphNode3,
366
- $insertNodes as $insertNodes3,
367
- $isRootOrShadowRoot as $isRootOrShadowRoot3,
368
- COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR3,
369
- createCommand as createCommand3
370
- } from "lexical";
371
- import { useCallback as useCallback2, useEffect as useEffect3 } from "react";
372
-
373
- // src/components/ui/equation/KatexEquationAlterer.tsx
374
- init_react_shim();
375
- import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
376
- import { useCallback, useState as useState2 } from "react";
377
- import { ErrorBoundary } from "react-error-boundary";
378
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
379
- function KatexEquationAlterer({
380
- onConfirm,
381
- initialEquation = ""
382
- }) {
383
- const [editor] = useLexicalComposerContext3();
384
- const [equation, setEquation] = useState2(initialEquation);
385
- const [inline, setInline] = useState2(true);
386
- const onClick = useCallback(() => {
387
- onConfirm(equation, inline);
388
- }, [onConfirm, equation, inline]);
389
- const onCheckboxChange = useCallback(() => {
390
- setInline(!inline);
391
- }, [setInline, inline]);
392
- return /* @__PURE__ */ jsxs3(Fragment2, { children: [
393
- /* @__PURE__ */ jsxs3("div", { className: "KatexEquationAlterer_defaultRow", children: [
394
- "Inline",
395
- /* @__PURE__ */ jsx3("input", { type: "checkbox", checked: inline, onChange: onCheckboxChange })
396
- ] }),
397
- /* @__PURE__ */ jsx3("div", { className: "KatexEquationAlterer_defaultRow", children: "Equation " }),
398
- /* @__PURE__ */ jsx3("div", { className: "KatexEquationAlterer_centerRow", children: inline ? /* @__PURE__ */ jsx3(
399
- "input",
400
- {
401
- onChange: (event) => {
402
- setEquation(event.target.value);
403
- },
404
- value: equation,
405
- className: "KatexEquationAlterer_textArea"
406
- }
407
- ) : /* @__PURE__ */ jsx3(
408
- "textarea",
409
- {
410
- onChange: (event) => {
411
- setEquation(event.target.value);
412
- },
413
- value: equation,
414
- className: "KatexEquationAlterer_textArea"
415
- }
416
- ) }),
417
- /* @__PURE__ */ jsx3("div", { className: "KatexEquationAlterer_defaultRow", children: "Visualization " }),
418
- /* @__PURE__ */ jsx3("div", { className: "KatexEquationAlterer_centerRow", children: /* @__PURE__ */ jsx3(ErrorBoundary, { onError: (e) => editor._onError(e), fallback: null, children: /* @__PURE__ */ jsx3(
419
- KatexRenderer,
420
- {
421
- equation,
422
- inline: false,
423
- onDoubleClick: () => null
424
- }
425
- ) }) }),
426
- /* @__PURE__ */ jsx3("div", { className: "KatexEquationAlterer_dialogActions", children: /* @__PURE__ */ jsx3(Button, { onClick, children: "Confirm" }) })
427
- ] });
428
- }
429
-
430
- // src/components/editor/plugins/EquationsPlugin/index.tsx
431
- import { jsx as jsx4 } from "react/jsx-runtime";
432
- var INSERT_EQUATION_COMMAND = createCommand3("INSERT_EQUATION_COMMAND");
433
- function InsertEquationDialog({
434
- activeEditor,
435
- onClose
436
- }) {
437
- const onEquationConfirm = useCallback2(
438
- (equation, inline) => {
439
- activeEditor.dispatchCommand(INSERT_EQUATION_COMMAND, { equation, inline });
440
- onClose();
441
- },
442
- [activeEditor, onClose]
443
- );
444
- return /* @__PURE__ */ jsx4(KatexEquationAlterer, { onConfirm: onEquationConfirm });
445
- }
446
- function EquationsPlugin() {
447
- const [editor] = useLexicalComposerContext4();
448
- useEffect3(() => {
449
- if (!editor.hasNodes([EquationNode])) {
450
- throw new Error(
451
- "EquationsPlugins: EquationsNode not registered on editor"
452
- );
453
- }
454
- return editor.registerCommand(
455
- INSERT_EQUATION_COMMAND,
456
- (payload) => {
457
- const { equation, inline } = payload;
458
- const equationNode = $createEquationNode(equation, inline);
459
- $insertNodes3([equationNode]);
460
- if ($isRootOrShadowRoot3(equationNode.getParentOrThrow())) {
461
- $wrapNodeInElement3(equationNode, $createParagraphNode3).selectEnd();
462
- }
463
- return true;
464
- },
465
- COMMAND_PRIORITY_EDITOR3
466
- );
467
- }, [editor]);
468
- return null;
469
- }
470
-
471
- // src/components/editor/plugins/DynamicBlockPlugin/index.tsx
472
- init_react_shim();
473
- import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
474
- import { $insertNodeToNearestRoot } from "@lexical/utils";
475
- import { COMMAND_PRIORITY_EDITOR as COMMAND_PRIORITY_EDITOR4, createCommand as createCommand4 } from "lexical";
476
- import { useEffect as useEffect4 } from "react";
477
- var INSERT_DYNAMIC_BLOCK_COMMAND = createCommand4("INSERT_DYNAMIC_BLOCK_COMMAND");
478
- function DynamicBlockPlugin() {
479
- const [editor] = useLexicalComposerContext5();
480
- useEffect4(() => {
481
- if (!editor.hasNodes([DynamicBlockNode])) {
482
- throw new Error("DynamicBlockPlugin: DynamicBlockNode not registered on editor");
483
- }
484
- return editor.registerCommand(
485
- INSERT_DYNAMIC_BLOCK_COMMAND,
486
- (payload) => {
487
- const dynamicBlockNode = $createDynamicBlockNode(payload);
488
- $insertNodeToNearestRoot(dynamicBlockNode);
489
- return true;
490
- },
491
- COMMAND_PRIORITY_EDITOR4
492
- );
493
- }, [editor]);
494
- return null;
495
- }
496
- var createDefaultDynamicBlock = () => ({
497
- id: `dynamic-block-${Date.now()}`,
498
- title: "Interactive Content Block",
499
- currentBlockId: "block-1",
500
- blocks: [
501
- {
502
- id: "block-1",
503
- type: "text",
504
- content: "<h3>Welcome!</h3><p>This is your first dynamic content block. Click to see the magic happen!</p>",
505
- animation: "fade"
506
- },
507
- {
508
- id: "block-2",
509
- type: "text",
510
- content: "<h3>Amazing!</h3><p>You triggered the interaction! This content appeared because you clicked. Try hovering for more surprises.</p>",
511
- animation: "slide"
512
- },
513
- {
514
- id: "block-3",
515
- type: "text",
516
- content: "<h3>Incredible!</h3><p>Hover interactions work too! You can create time-based triggers, scroll triggers, and much more.</p>",
517
- animation: "bounce"
518
- }
519
- ],
520
- triggers: [
521
- {
522
- id: "trigger-1",
523
- type: "click",
524
- condition: "",
525
- targetBlockId: "block-2",
526
- action: "replace"
527
- },
528
- {
529
- id: "trigger-2",
530
- type: "hover",
531
- condition: "",
532
- targetBlockId: "block-3",
533
- action: "replace"
534
- },
535
- {
536
- id: "trigger-3",
537
- type: "time",
538
- condition: 3,
539
- targetBlockId: "block-2",
540
- action: "replace"
541
- }
542
- ]
543
- });
544
-
545
- export {
546
- INSERT_STORY_BUILDER_COMMAND,
547
- StoryBuilderPlugin,
548
- InsertInlineImageDialog,
549
- InlineImagePlugin,
550
- InsertEquationDialog,
551
- EquationsPlugin,
552
- INSERT_DYNAMIC_BLOCK_COMMAND,
553
- DynamicBlockPlugin,
554
- createDefaultDynamicBlock
555
- };