@collabchron/notiq 1.1.10 → 1.1.11

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 (412) hide show
  1. package/README.md +281 -259
  2. package/dist/AICommandBarPlugin-TADJ3X2Y.mjs +12 -0
  3. package/dist/AIDialog-2WZUFWSC.mjs +325 -0
  4. package/dist/AudioComponent-CKLMLB5T.mjs +278 -0
  5. package/dist/CodeActionMenuPlugin-MRKY67ED.mjs +14 -0
  6. package/dist/CollaborationPlugin-TIZOQBUT.mjs +405 -0
  7. package/dist/CollaboratorsBar-TMKBOBJI.mjs +20 -0
  8. package/dist/CommentsPlugin-5M4RD6YO.mjs +19 -0
  9. package/dist/DynamicBlockComponent-2LOADZUX.mjs +221 -0
  10. package/dist/{EquationComponent-CB6DFIHV.mjs → EquationComponent-4NFG55NQ.mjs} +82 -46
  11. package/dist/ExcalidrawComponent-SIMURTCA.mjs +662 -0
  12. package/dist/ExcalidrawPlugin-2SGPIQ6U.mjs +14 -0
  13. package/dist/ExportPlugin-OKZOLBGS.mjs +42 -0
  14. package/dist/FileComponent-Y56MX5QD.mjs +200 -0
  15. package/dist/FloatingLinkEditorPlugin-MABB34L7.mjs +12 -0
  16. package/dist/FloatingTextFormatToolbarPlugin-SO5VON7Q.mjs +45 -0
  17. package/dist/HintComponet-ET7M2Q7S.mjs +288 -0
  18. package/dist/InlineCopilotPlugin-PNS5Y6OO.mjs +360 -0
  19. package/dist/{InlineImageComponent-UWIUWBHI.mjs → InlineImageComponent-FVTA4LXZ.mjs} +129 -99
  20. package/dist/MobileToolbar-JKP2MLQJ.mjs +984 -0
  21. package/dist/SlashCommand-2TNOOUBM.mjs +39 -0
  22. package/dist/StoryBuilderComponent-WQSNFPMM.mjs +816 -0
  23. package/dist/{TableCellActionMenuPlugin-PGK2K3VG.mjs → TableCellActionMenuPlugin-YWBA64J7.mjs} +328 -157
  24. package/dist/{TableHoverActionsPlugin-GJVE6VRW.mjs → TableHoverActionsPlugin-2EIXHEXN.mjs} +43 -36
  25. package/dist/{TemplatePlugin-ZD3QEVTI.mjs → TemplatePlugin-HNTPEXBB.mjs} +2 -2
  26. package/dist/ToolbarPlugin-IIAOU4P5.mjs +35 -0
  27. package/dist/VersionHistoryPlugin-23MAZB4G.mjs +371 -0
  28. package/dist/babel-RJXDAKDM.mjs +7287 -0
  29. package/dist/background-color-OZJCBYCT.mjs +425 -0
  30. package/dist/block-format-MTSIXWID.mjs +14 -0
  31. package/dist/chunk-2KESP7OU.mjs +809 -0
  32. package/dist/chunk-3AHNLIME.mjs +1701 -0
  33. package/dist/{chunk-GK35L7UY.mjs → chunk-3IILA3IP.mjs} +1 -1
  34. package/dist/chunk-3JN6QEJR.mjs +31 -0
  35. package/dist/{chunk-5BAKY5KN.mjs → chunk-43Z4Z2KD.mjs} +5 -8
  36. package/dist/{chunk-GXYD4VZM.mjs → chunk-4DVIYZVB.mjs} +1 -1
  37. package/dist/{chunk-7NZAPJ4G.mjs → chunk-4FFTOZGJ.mjs} +4 -3
  38. package/dist/chunk-4UMUPCDK.mjs +68 -0
  39. package/dist/{chunk-POGRR73N.mjs → chunk-5NRAXWYA.mjs} +4 -3
  40. package/dist/{chunk-PZSUSXQG.mjs → chunk-6D6QLRYR.mjs} +2 -2
  41. package/dist/chunk-6SRMKQSD.mjs +682 -0
  42. package/dist/{chunk-3CPBODXA.mjs → chunk-6UVNHT3T.mjs} +7 -27
  43. package/dist/{chunk-G53GLEAY.mjs → chunk-7QRJVZQY.mjs} +47 -22
  44. package/dist/chunk-ACV47ZKE.mjs +201 -0
  45. package/dist/{chunk-FSM26655.mjs → chunk-AMXRQ2TK.mjs} +4 -4
  46. package/dist/chunk-AYNKORDO.mjs +6 -0
  47. package/dist/{chunk-YUDCJRJM.mjs → chunk-BGV62GC2.mjs} +3 -2
  48. package/dist/{chunk-TCYK7DM7.mjs → chunk-CDAMHK63.mjs} +4 -3
  49. package/dist/{chunk-QHIQKMVN.mjs → chunk-D3IOUQFR.mjs} +125 -111
  50. package/dist/chunk-EEBA6OAH.mjs +59 -0
  51. package/dist/{chunk-YKC3SO4Z.mjs → chunk-EIZMKFHF.mjs} +1 -1
  52. package/dist/{chunk-4EXYCTGJ.mjs → chunk-EVPWKNE4.mjs} +3 -3
  53. package/dist/{chunk-K36V4SIW.mjs → chunk-FMJ7DGWP.mjs} +23 -20
  54. package/dist/{chunk-RBWZGXPF.mjs → chunk-FYLRS4BG.mjs} +5 -5
  55. package/dist/{chunk-N3WN46VL.mjs → chunk-GYYLZ3MQ.mjs} +23 -22
  56. package/dist/{chunk-WDG7J2DY.mjs → chunk-H3P47YXJ.mjs} +30 -19
  57. package/dist/chunk-HOZ4QRFV.mjs +536 -0
  58. package/dist/{chunk-5QSNIVIG.mjs → chunk-IAFCQV3Z.mjs} +94 -78
  59. package/dist/{chunk-64Z3FI7T.mjs → chunk-IIVB6JNE.mjs} +5 -4
  60. package/dist/chunk-IU2N42JJ.mjs +1763 -0
  61. package/dist/chunk-IUOUIDEQ.mjs +70 -0
  62. package/dist/chunk-J6ZUY5BY.mjs +202 -0
  63. package/dist/{chunk-YHPNOWFH.mjs → chunk-JHXDLYEV.mjs} +1 -1
  64. package/dist/{chunk-ZB5LZQKC.mjs → chunk-K5OAFEVY.mjs} +1 -1
  65. package/dist/chunk-KDA7ZYMJ.mjs +431 -0
  66. package/dist/{chunk-3JVFG7ER.mjs → chunk-KNW2CGIP.mjs} +7 -64
  67. package/dist/{chunk-4HBCVSE6.mjs → chunk-KXRLARGI.mjs} +1 -1
  68. package/dist/chunk-LAUAYRPC.mjs +944 -0
  69. package/dist/chunk-LLCP7NVE.mjs +449 -0
  70. package/dist/chunk-LU2XWLOE.mjs +219 -0
  71. package/dist/chunk-MPTE332I.mjs +787 -0
  72. package/dist/{chunk-456TN7IM.mjs → chunk-MTQZWJHR.mjs} +17 -16
  73. package/dist/{chunk-LGG4IUIA.mjs → chunk-MW6MAUY3.mjs} +2 -2
  74. package/dist/chunk-N3WTT2U6.mjs +21 -0
  75. package/dist/{chunk-GZPNVR7L.mjs → chunk-N6ILV6NF.mjs} +7 -6
  76. package/dist/{chunk-QEIFVK5M.mjs → chunk-NBE6FF6L.mjs} +4 -4
  77. package/dist/{chunk-BIU7WTLX.mjs → chunk-OE5JRLCN.mjs} +21 -18
  78. package/dist/chunk-OXWTZV3U.mjs +174 -0
  79. package/dist/{chunk-Z4EWP7BI.mjs → chunk-PD5K4AGP.mjs} +22 -23
  80. package/dist/chunk-PFH63ZU4.mjs +33 -0
  81. package/dist/chunk-PHRVYPVM.mjs +808 -0
  82. package/dist/chunk-R7WFRENU.mjs +262 -0
  83. package/dist/{chunk-4VWFVWYP.mjs → chunk-RAVYEEIC.mjs} +1 -1
  84. package/dist/chunk-RJQTA6HG.mjs +358 -0
  85. package/dist/{chunk-7VUMHWWL.mjs → chunk-SAOJHVPE.mjs} +5 -4
  86. package/dist/chunk-TC3IISJZ.mjs +408 -0
  87. package/dist/chunk-VGAX6YEY.mjs +399 -0
  88. package/dist/chunk-W6GAJXUS.mjs +334 -0
  89. package/dist/{chunk-U47ABU5Z.mjs → chunk-W6VQSFE5.mjs} +2 -2
  90. package/dist/chunk-WYCFGRFJ.mjs +118 -0
  91. package/dist/chunk-XAVQAXOJ.mjs +419 -0
  92. package/dist/chunk-XYDBUQ6Z.mjs +1978 -0
  93. package/dist/chunk-XYMXGU4T.mjs +129 -0
  94. package/dist/chunk-XYT6XM5S.mjs +496 -0
  95. package/dist/{chunk-HJPPNHYM.mjs → chunk-XZXGYNTY.mjs} +4 -3
  96. package/dist/{chunk-4GFXER7R.mjs → chunk-YDDBQZ77.mjs} +141 -89
  97. package/dist/{chunk-2FNEAMSP.mjs → chunk-YE7M2VKR.mjs} +52 -47
  98. package/dist/{chunk-3G37YKTV.mjs → chunk-YR2DD74C.mjs} +9 -8
  99. package/dist/{chunk-4MEDW3T6.mjs → chunk-YTLUQJE2.mjs} +5 -4
  100. package/dist/{chunk-DSFQHA7I.mjs → chunk-Z6JAFF55.mjs} +118 -295
  101. package/dist/chunk-ZFV2HGD3.mjs +143 -0
  102. package/dist/{chunk-77UA6HYR.mjs → chunk-ZKZ7MLSS.mjs} +1 -1
  103. package/dist/color-23323E3B.mjs +13 -0
  104. package/dist/components/canvas/CanvasMode.d.ts +18 -0
  105. package/dist/components/editor/Core.d.ts +6 -0
  106. package/dist/components/editor/index.d.ts +27 -0
  107. package/dist/components/editor/lexical-on-change.d.ts +1 -0
  108. package/dist/components/editor/nodes/AudioNode/AudioComponent.d.ts +15 -0
  109. package/dist/components/editor/nodes/AudioNode/index.d.ts +36 -0
  110. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.d.ts +22 -0
  111. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.d.ts +18 -0
  112. package/dist/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.d.ts +19 -0
  113. package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockComponent.d.ts +7 -0
  114. package/dist/components/editor/nodes/DynamicBlockNode/DynamicBlockNode.d.ts +49 -0
  115. package/dist/components/editor/nodes/EquationNode/EquationComponent.d.ts +16 -0
  116. package/dist/components/editor/nodes/EquationNode/EquationNode.d.ts +33 -0
  117. package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.d.ts +15 -0
  118. package/dist/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.d.ts +57 -0
  119. package/dist/components/editor/nodes/ExcalidrawNode/ImageResizer.d.ts +24 -0
  120. package/dist/components/editor/nodes/ExcalidrawNode/index.d.ts +39 -0
  121. package/dist/components/editor/nodes/FigmaNode/FigmaNode.d.ts +27 -0
  122. package/dist/components/editor/nodes/FileNode/FileComponent.d.ts +16 -0
  123. package/dist/components/editor/nodes/FileNode/index.d.ts +39 -0
  124. package/dist/components/editor/nodes/Hint/HintComponet.d.ts +20 -0
  125. package/dist/components/editor/nodes/Hint/index.d.ts +33 -0
  126. package/dist/components/editor/nodes/ImageNode/index.d.ts +62 -0
  127. package/dist/components/editor/nodes/InlineImageNode/InlineImageComponent.d.ts +25 -0
  128. package/dist/components/editor/nodes/InlineImageNode/InlineImageNode.d.ts +66 -0
  129. package/dist/components/editor/nodes/LayoutNode/LayoutContainerNode.d.ts +31 -0
  130. package/dist/components/editor/nodes/LayoutNode/LayoutItemNode.d.ts +21 -0
  131. package/dist/components/editor/nodes/PollNode/index.d.ts +34 -0
  132. package/dist/components/editor/nodes/Stepper/index.d.ts +66 -0
  133. package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderComponent.d.ts +10 -0
  134. package/dist/components/editor/nodes/StoryBuilderNode/StoryBuilderNode.d.ts +59 -0
  135. package/dist/components/editor/nodes/TweetNode/index.d.ts +21 -0
  136. package/dist/components/editor/nodes/index.d.ts +4 -0
  137. package/dist/components/editor/plugins/AICommandBarPlugin/index.d.ts +7 -0
  138. package/dist/components/editor/plugins/AudioPlugin/index.d.ts +1 -0
  139. package/dist/components/editor/plugins/AutoEmbedPlugin/index.d.ts +19 -0
  140. package/dist/components/editor/plugins/AutoLinkPlugin/index.d.ts +1 -0
  141. package/dist/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.d.ts +8 -0
  142. package/dist/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.d.ts +9 -0
  143. package/dist/components/editor/plugins/CodeActionMenuPlugin/index.d.ts +4 -0
  144. package/dist/components/editor/plugins/CodeActionMenuPlugin/utils.d.ts +1 -0
  145. package/dist/components/editor/plugins/CodeHighlightPlugin/index.d.ts +11 -0
  146. package/dist/components/editor/plugins/CollaborationPlugin/CollaboratorsBar.d.ts +9 -0
  147. package/dist/components/editor/plugins/CollaborationPlugin/index.d.ts +8 -0
  148. package/dist/components/editor/plugins/CollapsiblePlugin/index.d.ts +4 -0
  149. package/dist/components/editor/plugins/CommentsPlugin/CommentThreadItem.d.ts +7 -0
  150. package/dist/components/editor/plugins/CommentsPlugin/CommentsSidebar.d.ts +2 -0
  151. package/dist/components/editor/plugins/CommentsPlugin/MentionsAutocomplete.d.ts +22 -0
  152. package/dist/components/editor/plugins/CommentsPlugin/NewCommentDialog.d.ts +2 -0
  153. package/dist/components/editor/plugins/CommentsPlugin/index.d.ts +5 -0
  154. package/dist/components/editor/plugins/ContentAnalyticsPlugin/index.d.ts +1 -0
  155. package/dist/components/editor/plugins/DragDropPastePlugin/index.d.ts +1 -0
  156. package/dist/components/editor/plugins/DraggableBlockPlugin/index.d.ts +5 -0
  157. package/dist/components/editor/plugins/DynamicBlockPlugin/index.d.ts +7 -0
  158. package/dist/components/editor/plugins/EquationsPlugin/index.d.ts +20 -0
  159. package/dist/components/editor/plugins/ExcalidrawPlugin/index.d.ts +5 -0
  160. package/dist/components/editor/plugins/ExportPlugin/ImportExportModal.d.ts +9 -0
  161. package/dist/components/editor/plugins/ExportPlugin/index.d.ts +28 -0
  162. package/dist/components/editor/plugins/FigmaPlugin/index.d.ts +11 -0
  163. package/dist/components/editor/plugins/FilePlugin/index.d.ts +1 -0
  164. package/dist/components/editor/plugins/FloatingLinkEditorPlugin/index.d.ts +6 -0
  165. package/dist/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +6 -0
  166. package/dist/components/editor/plugins/ImagesPlugin/index.d.ts +14 -0
  167. package/dist/components/editor/plugins/InlineCopilotPlugin/index.d.ts +32 -0
  168. package/dist/components/editor/plugins/InlineImagePlugin/index.d.ts +16 -0
  169. package/dist/components/editor/plugins/LayoutPlugin/index.d.ts +14 -0
  170. package/dist/components/editor/plugins/LinkPlugin/index.d.ts +13 -0
  171. package/dist/components/editor/plugins/LinkWithMetaData/index.d.ts +46 -0
  172. package/dist/components/editor/plugins/MarkdownShortcutPlugin/index.d.ts +2 -0
  173. package/dist/components/editor/plugins/MarkdownTransformers/index.d.ts +12 -0
  174. package/dist/components/editor/plugins/PollPlugin/index.d.ts +4 -0
  175. package/dist/components/editor/plugins/ShortcutsPlugin/index.d.ts +13 -0
  176. package/dist/components/editor/plugins/ShortcutsPlugin/shortcuts.d.ts +58 -0
  177. package/dist/components/editor/plugins/SlashCommand/index.d.ts +25 -0
  178. package/dist/components/editor/plugins/SpeechToTextPlugin/index.d.ts +5 -0
  179. package/dist/components/editor/plugins/StoryBuilderPlugin/index.d.ts +7 -0
  180. package/dist/components/editor/plugins/TabFocusPlugin/index.d.ts +1 -0
  181. package/dist/components/editor/plugins/TableCellActionMenuPlugin/index.d.ts +5 -0
  182. package/dist/components/editor/plugins/TableCellResizer/index.d.ts +2 -0
  183. package/dist/components/editor/plugins/TableHoverActionsPlugin/index.d.ts +4 -0
  184. package/dist/components/editor/plugins/TablePlugin/index.d.ts +27 -0
  185. package/dist/components/editor/plugins/TemplatePlugin/TemplateDialog.d.ts +1 -0
  186. package/dist/components/editor/plugins/TemplatePlugin/index.d.ts +3 -0
  187. package/dist/components/editor/plugins/ToolbarPlugin/MobileToolbar.d.ts +10 -0
  188. package/dist/components/editor/plugins/ToolbarPlugin/index.d.ts +11 -0
  189. package/dist/components/editor/plugins/TwitterPlugin/index.d.ts +4 -0
  190. package/dist/components/editor/plugins/VersionHistoryPlugin/NameVersionModal.d.ts +2 -0
  191. package/dist/components/editor/plugins/VersionHistoryPlugin/VersionHistoryDrawer.d.ts +2 -0
  192. package/dist/components/editor/plugins/VersionHistoryPlugin/index.d.ts +2 -0
  193. package/dist/components/editor/plugins/YouTubeNode/index.d.ts +22 -0
  194. package/dist/components/editor/plugins/YouTubePlugin/index.d.ts +11 -0
  195. package/dist/components/editor/templates/data.d.ts +7 -0
  196. package/dist/components/editor/themes/editor-theme.d.ts +3 -0
  197. package/dist/components/editor/utils/ai.d.ts +27 -0
  198. package/dist/components/editor/utils/canUseDOM.d.ts +8 -0
  199. package/dist/components/editor/utils/codeLanguages.d.ts +3 -0
  200. package/dist/components/editor/utils/diffUtils.d.ts +10 -0
  201. package/dist/components/editor/utils/editorFormatting.d.ts +26 -0
  202. package/dist/components/editor/utils/environment.d.ts +17 -0
  203. package/dist/components/editor/utils/extract-data.d.ts +8 -0
  204. package/dist/components/editor/utils/getAllLexicalChildren.d.ts +6 -0
  205. package/dist/components/editor/utils/getDOMRangeRect.d.ts +8 -0
  206. package/dist/components/editor/utils/getSelectedNode.d.ts +2 -0
  207. package/dist/components/editor/utils/gif.d.ts +7 -0
  208. package/dist/components/editor/utils/importUtils.d.ts +27 -0
  209. package/dist/components/editor/utils/invariant.d.ts +1 -0
  210. package/dist/components/editor/utils/markdownTransformers.d.ts +20 -0
  211. package/dist/components/editor/utils/setFloatingElemPosition.d.ts +1 -0
  212. package/dist/components/editor/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  213. package/dist/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.d.ts +2 -0
  214. package/dist/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.d.ts +2 -0
  215. package/dist/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.d.ts +5 -0
  216. package/dist/components/editor/utils/url.d.ts +11 -0
  217. package/dist/components/editor/utils/useLayoutEffect.d.ts +3 -0
  218. package/dist/components/providers/AIContext.d.ts +21 -0
  219. package/dist/components/providers/CollabContext.d.ts +92 -0
  220. package/dist/components/providers/CommentsContext.d.ts +48 -0
  221. package/dist/components/providers/QueryProvider.d.ts +5 -0
  222. package/dist/components/providers/SharedHistoryContext.d.ts +11 -0
  223. package/dist/components/providers/ToolbarContext.d.ts +61 -0
  224. package/dist/components/providers/UploadContext.d.ts +29 -0
  225. package/dist/components/providers/VersionHistoryContext.d.ts +33 -0
  226. package/dist/components/providers/theme-provider.d.ts +3 -0
  227. package/dist/components/theme/ModeToggle.d.ts +2 -0
  228. package/dist/components/ui/ContentEditable.d.ts +15 -0
  229. package/dist/components/ui/FileInput.d.ts +16 -0
  230. package/dist/components/ui/Modal.d.ts +15 -0
  231. package/dist/components/ui/Select.d.ts +14 -0
  232. package/dist/components/ui/TextInput.d.ts +19 -0
  233. package/dist/components/ui/accordion.d.ts +7 -0
  234. package/dist/components/ui/ai/AIDialog.d.ts +9 -0
  235. package/dist/components/ui/ai/ai-button.d.ts +5 -0
  236. package/dist/components/ui/ai/border.d.ts +8 -0
  237. package/dist/components/ui/ai/placeholder-input-vanish.d.ts +6 -0
  238. package/dist/components/ui/badge.d.ts +9 -0
  239. package/dist/components/ui/button.d.ts +12 -0
  240. package/dist/components/ui/card.d.ts +8 -0
  241. package/dist/components/ui/checkbox.d.ts +4 -0
  242. package/dist/components/ui/command.d.ts +80 -0
  243. package/dist/components/ui/dialog/Dialog.d.ts +16 -0
  244. package/dist/components/ui/dialog.d.ts +19 -0
  245. package/dist/components/ui/drop-downs/background-color.d.ts +12 -0
  246. package/dist/components/ui/drop-downs/block-format.d.ts +25 -0
  247. package/dist/components/ui/drop-downs/code.d.ts +6 -0
  248. package/dist/components/ui/drop-downs/codeTheme.d.ts +8 -0
  249. package/dist/components/ui/drop-downs/color.d.ts +12 -0
  250. package/dist/components/ui/drop-downs/font-size.d.ts +10 -0
  251. package/dist/components/ui/drop-downs/font.d.ts +11 -0
  252. package/dist/components/ui/drop-downs/index.d.ts +24 -0
  253. package/dist/components/ui/drop-downs/insert-node.d.ts +6 -0
  254. package/dist/components/ui/drop-downs/table-dropdown.d.ts +10 -0
  255. package/dist/components/ui/drop-downs/text-align.d.ts +8 -0
  256. package/dist/components/ui/drop-downs/text-format.d.ts +11 -0
  257. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  258. package/dist/components/ui/equation/EquationEditor.d.ts +14 -0
  259. package/dist/components/ui/equation/KatexEquationAlterer.d.ts +14 -0
  260. package/dist/components/ui/equation/KatexRenderer.d.ts +13 -0
  261. package/dist/components/ui/excalidraw/ExcalidrawModal.d.ts +48 -0
  262. package/dist/components/ui/excalidraw/Modal.d.ts +16 -0
  263. package/dist/components/ui/hover-card.d.ts +6 -0
  264. package/dist/components/ui/icons/brand-icons.d.ts +5 -0
  265. package/dist/components/ui/image/error-image.d.ts +2 -0
  266. package/dist/components/ui/image/file-upload.d.ts +8 -0
  267. package/dist/components/ui/image/image-resizer.d.ts +10 -0
  268. package/dist/components/ui/image/image-toolbar.d.ts +8 -0
  269. package/dist/components/ui/image/index.d.ts +16 -0
  270. package/dist/components/ui/image/lazy-image.d.ts +10 -0
  271. package/dist/components/ui/image/lazy-video.d.ts +11 -0
  272. package/dist/components/ui/input.d.ts +3 -0
  273. package/dist/components/ui/label.d.ts +5 -0
  274. package/dist/components/ui/models/custom-dialog.d.ts +58 -0
  275. package/dist/components/ui/models/insert-audio.d.ts +7 -0
  276. package/dist/components/ui/models/insert-file.d.ts +7 -0
  277. package/dist/components/ui/models/insert-gif.d.ts +7 -0
  278. package/dist/components/ui/models/insert-image.d.ts +6 -0
  279. package/dist/components/ui/models/insert-poll.d.ts +5 -0
  280. package/dist/components/ui/models/insert-table.d.ts +6 -0
  281. package/dist/components/ui/models/use-model.d.ts +6 -0
  282. package/dist/components/ui/poll/poll-component.d.ts +8 -0
  283. package/dist/components/ui/popover.d.ts +7 -0
  284. package/dist/components/ui/progress.d.ts +4 -0
  285. package/dist/components/ui/scroll-area.d.ts +5 -0
  286. package/dist/components/ui/separator.d.ts +4 -0
  287. package/dist/components/ui/skeleton.d.ts +2 -0
  288. package/dist/components/ui/sonner.d.ts +4 -0
  289. package/dist/components/ui/stepper/step.d.ts +11 -0
  290. package/dist/components/ui/stepper/stepper.d.ts +6 -0
  291. package/dist/components/ui/tabs.d.ts +7 -0
  292. package/dist/components/ui/textarea.d.ts +3 -0
  293. package/dist/components/ui/toggle.d.ts +14 -0
  294. package/dist/components/ui/tooltip.d.ts +7 -0
  295. package/dist/components/ui/write/text-format-floating.d.ts +27 -0
  296. package/dist/components/ui/write/text-format-floting-toolbar.d.ts +26 -0
  297. package/dist/core/chain.d.ts +4 -0
  298. package/dist/core/editor.d.ts +42 -0
  299. package/dist/core/extension.d.ts +20 -0
  300. package/dist/core/extensions/blocks-kit.d.ts +14 -0
  301. package/dist/core/extensions/copilot-and-collab.d.ts +10 -0
  302. package/dist/core/extensions/nodes-and-marks.d.ts +36 -0
  303. package/dist/core/index.d.ts +9 -0
  304. package/dist/core/react/BubbleMenu.d.ts +13 -0
  305. package/dist/core/react/FloatingMenu.d.ts +12 -0
  306. package/dist/core/react/NotiqContent.d.ts +11 -0
  307. package/dist/core/react/NotiqEditor.d.ts +29 -0
  308. package/dist/core/react/context.d.ts +15 -0
  309. package/dist/core/react/index.d.ts +8 -0
  310. package/dist/core/react/useNotiq.d.ts +16 -0
  311. package/dist/core/types.d.ts +88 -0
  312. package/dist/core.d.ts +1 -0
  313. package/dist/core.js +67719 -0
  314. package/dist/core.mjs +132 -0
  315. package/dist/estree-QRALCFII.mjs +5029 -0
  316. package/dist/font-IJKFR4BM.mjs +12 -0
  317. package/dist/font-size-GTL6UVQL.mjs +15 -0
  318. package/dist/hooks/instructions-messages.d.ts +11 -0
  319. package/dist/hooks/use-mobile.d.ts +1 -0
  320. package/dist/hooks/useModal.d.ts +12 -0
  321. package/dist/hooks/useReport.d.ts +8 -0
  322. package/dist/hooks/useResizeObservert.d.ts +1 -0
  323. package/dist/html-CE2S5FIJ.mjs +3185 -0
  324. package/dist/{image-2PJIAYAT.mjs → image-TPW7PZZK.mjs} +360 -325
  325. package/dist/index.d.ts +13 -145
  326. package/dist/index.js +61780 -44629
  327. package/dist/index.mjs +1157 -736
  328. package/dist/insert-audio-C66RZRKY.mjs +180 -0
  329. package/dist/insert-file-3DTGRO7W.mjs +190 -0
  330. package/dist/insert-gif-FIMCCBAI.mjs +112 -0
  331. package/dist/insert-image-CZV6HWQZ.mjs +348 -0
  332. package/dist/insert-node-MA3FXEYN.mjs +245 -0
  333. package/dist/insert-poll-6BCIFY5G.mjs +36 -0
  334. package/dist/insert-table-ZRJP6X52.mjs +70 -0
  335. package/dist/lib/edgestore.d.ts +2 -0
  336. package/dist/lib/index.d.ts +0 -0
  337. package/dist/lib/pinecone-client.d.ts +3 -0
  338. package/dist/lib/utils.d.ts +2 -0
  339. package/dist/markdown-GMCB4RDA.mjs +6753 -0
  340. package/dist/{poll-component-2R4MDLHS.mjs → poll-component-VHMM5KKZ.mjs} +126 -95
  341. package/dist/{postcss-ONF3VDIM.mjs → postcss-GH4QXSB5.mjs} +1879 -1697
  342. package/dist/react.d.ts +1 -0
  343. package/dist/react.js +67651 -0
  344. package/dist/react.mjs +61 -0
  345. package/dist/standalone-A6VDOPCZ.mjs +2506 -0
  346. package/dist/stepper-4AO5XMO7.mjs +356 -0
  347. package/dist/styles/notiq.css +2 -2
  348. package/dist/styles/tailwind-plugin.d.ts +4 -0
  349. package/dist/table-dropdown-4VCRSQB6.mjs +391 -0
  350. package/dist/{text-align-VLECWO4H.mjs → text-align-CSDLJUDA.mjs} +24 -21
  351. package/dist/text-format-6L5N3CHZ.mjs +15 -0
  352. package/dist/typescript-CGC67LRI.mjs +13392 -0
  353. package/dist/utils/docSerialization.d.ts +10 -0
  354. package/dist/utils/emoji-list.d.ts +27 -0
  355. package/dist/utils/getDOMRangeRect.d.ts +8 -0
  356. package/dist/utils/getSelectedNode.d.ts +2 -0
  357. package/dist/utils/getThemeSelector.d.ts +9 -0
  358. package/dist/utils/html.d.ts +9 -0
  359. package/dist/utils/htmlExport.d.ts +9 -0
  360. package/dist/utils/isMobileWidth.d.ts +7 -0
  361. package/dist/utils/joinClasses.d.ts +8 -0
  362. package/dist/utils/setFloatingElemPosition.d.ts +1 -0
  363. package/dist/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  364. package/dist/utils/swipe.d.ts +11 -0
  365. package/dist/utils/url.d.ts +9 -0
  366. package/package.json +128 -105
  367. package/src/styles/notiq.css +1315 -1150
  368. package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +0 -15
  369. package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +0 -161
  370. package/dist/ExcalidrawComponent-LUZJNFWV.mjs +0 -528
  371. package/dist/ExcalidrawPlugin-HC2L43YG.mjs +0 -14
  372. package/dist/ExportPlugin-V2RLM63S.mjs +0 -11
  373. package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +0 -12
  374. package/dist/FloatingTextFormatToolbarPlugin-ENECEZSX.mjs +0 -30
  375. package/dist/HintComponet-BRL6EAMS.mjs +0 -217
  376. package/dist/MobileToolbar-BOOZAMQE.mjs +0 -268
  377. package/dist/SlashCommand-FHEWHFZU.mjs +0 -28
  378. package/dist/StoryBuilderComponent-JGDBM5JU.mjs +0 -562
  379. package/dist/ToolbarPlugin-2VP7FDWD.mjs +0 -1547
  380. package/dist/babel-JZ2EV6AX.mjs +0 -7233
  381. package/dist/background-color-XZTYLGO2.mjs +0 -362
  382. package/dist/block-format-YJCV2DIY.mjs +0 -15
  383. package/dist/chunk-77KXU36M.mjs +0 -64
  384. package/dist/chunk-AMMKBSST.mjs +0 -1256
  385. package/dist/chunk-EGMI62PP.mjs +0 -83
  386. package/dist/chunk-JXDPPUJI.mjs +0 -52
  387. package/dist/chunk-KJ6AJ44Q.mjs +0 -128
  388. package/dist/chunk-NOJDE3CE.mjs +0 -1906
  389. package/dist/chunk-NZXC6FGU.mjs +0 -214
  390. package/dist/chunk-PBD6LMLC.mjs +0 -366
  391. package/dist/chunk-TTHQCW5F.mjs +0 -47
  392. package/dist/chunk-V2NIZOSQ.mjs +0 -538
  393. package/dist/chunk-WAK5JGNJ.mjs +0 -315
  394. package/dist/chunk-YMBXLRW5.mjs +0 -374
  395. package/dist/chunk-YPHOEJ46.mjs +0 -64
  396. package/dist/chunk-ZJRKATOJ.mjs +0 -65
  397. package/dist/color-BPKOPQKN.mjs +0 -12
  398. package/dist/estree-XC56IUFX.mjs +0 -4414
  399. package/dist/font-FEZ3GKSF.mjs +0 -13
  400. package/dist/font-size-EK775WRH.mjs +0 -15
  401. package/dist/html-S3ACX7NI.mjs +0 -2738
  402. package/dist/index.d.mts +0 -145
  403. package/dist/insert-gif-SAIDYURE.mjs +0 -100
  404. package/dist/insert-image-U3RJN3OW.mjs +0 -259
  405. package/dist/insert-node-WXW4ZER4.mjs +0 -201
  406. package/dist/insert-poll-HCPM7MO6.mjs +0 -33
  407. package/dist/insert-table-24XYUS2W.mjs +0 -66
  408. package/dist/markdown-SNVBOSRA.mjs +0 -3487
  409. package/dist/standalone-EOIALU3M.mjs +0 -2373
  410. package/dist/stepper-JDEE26TX.mjs +0 -304
  411. package/dist/text-format-BG5WOOPZ.mjs +0 -16
  412. package/dist/typescript-AMPI6OVS.mjs +0 -13135
@@ -0,0 +1,1978 @@
1
+ import {
2
+ NOTIQ_TRANSFORMERS
3
+ } from "./chunk-2KESP7OU.mjs";
4
+ import {
5
+ Tabs,
6
+ TabsList,
7
+ TabsTrigger
8
+ } from "./chunk-6UVNHT3T.mjs";
9
+ import {
10
+ Button
11
+ } from "./chunk-OE5JRLCN.mjs";
12
+ import {
13
+ cn
14
+ } from "./chunk-JHXDLYEV.mjs";
15
+ import {
16
+ init_react_shim
17
+ } from "./chunk-WYCFGRFJ.mjs";
18
+
19
+ // src/components/editor/plugins/ExportPlugin/index.tsx
20
+ init_react_shim();
21
+ import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
22
+ import { $convertToMarkdownString as $convertToMarkdownString2 } from "@lexical/markdown";
23
+ import { $getRoot as $getRoot4, COMMAND_PRIORITY_LOW, createCommand } from "lexical";
24
+ import { useEffect as useEffect2, useState as useState2 } from "react";
25
+ import { toCanvas } from "html-to-image";
26
+ import jsPDF from "jspdf";
27
+ import { toast as toast2 } from "sonner";
28
+
29
+ // src/utils/htmlExport.tsx
30
+ init_react_shim();
31
+ import { $getRoot } from "lexical";
32
+ function exportEditorToHTML(editor) {
33
+ return editor.getEditorState().read(() => {
34
+ const root = $getRoot();
35
+ const rootElement = editor.getRootElement();
36
+ if (!rootElement) {
37
+ return "<div></div>";
38
+ }
39
+ const clonedElement = rootElement.cloneNode(true);
40
+ const cleanElement = (element) => {
41
+ if (element.classList.contains("no-export") || element.classList.contains("AI-format") || element.getAttribute("role") === "tooltip" || element.classList.contains("image-resizer")) {
42
+ element.remove();
43
+ return;
44
+ }
45
+ element.classList.remove(
46
+ "editor-content",
47
+ "relative",
48
+ "z-20",
49
+ "outline-none",
50
+ "focus:outline-none",
51
+ "focus:ring-0",
52
+ "selection:bg-blue-100",
53
+ "dark:selection:bg-blue-900/30",
54
+ "transition-all",
55
+ "duration-200",
56
+ "ease-in-out"
57
+ );
58
+ element.removeAttribute("contenteditable");
59
+ element.removeAttribute("role");
60
+ element.removeAttribute("spellcheck");
61
+ element.removeAttribute("data-lexical-editor");
62
+ Array.from(element.children).forEach((child) => {
63
+ cleanElement(child);
64
+ });
65
+ };
66
+ cleanElement(clonedElement);
67
+ return clonedElement.innerHTML || "<div></div>";
68
+ });
69
+ }
70
+ function downloadHTML(htmlContent, filename = "document.html") {
71
+ const fullHTML = `<!DOCTYPE html>
72
+ <html lang="en">
73
+ <head>
74
+ <meta charset="UTF-8">
75
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
76
+ <title>Exported Document</title>
77
+ <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
78
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css">
79
+ <script src="https://cdn.tailwindcss.com"></script>
80
+ <script>
81
+ tailwind.config = {
82
+ darkMode: 'class',
83
+ theme: {
84
+ extend: {
85
+ colors: {
86
+ background: 'oklch(1 0 0)',
87
+ foreground: 'oklch(0.145 0 0)',
88
+ card: 'oklch(1 0 0)',
89
+ 'card-foreground': 'oklch(0.145 0 0)',
90
+ popover: 'oklch(1 0 0)',
91
+ 'popover-foreground': 'oklch(0.145 0 0)',
92
+ primary: 'oklch(0.205 0 0)',
93
+ 'primary-foreground': 'oklch(0.985 0 0)',
94
+ secondary: 'oklch(0.97 0 0)',
95
+ 'secondary-foreground': 'oklch(0.205 0 0)',
96
+ muted: 'oklch(0.97 0 0)',
97
+ 'muted-foreground': 'oklch(0.556 0 0)',
98
+ accent: 'oklch(0.97 0 0)',
99
+ 'accent-foreground': 'oklch(0.205 0 0)',
100
+ destructive: 'oklch(0.577 0.245 27.325)',
101
+ 'destructive-foreground': 'oklch(0.577 0.245 27.325)',
102
+ border: 'oklch(0.922 0 0)',
103
+ input: 'oklch(0.922 0 0)',
104
+ ring: 'oklch(0.708 0 0)',
105
+ },
106
+ fontFamily: {
107
+ sans: ['Inter', 'system-ui', 'sans-serif'],
108
+ mono: ['Monaco', 'Consolas', 'monospace'],
109
+ },
110
+ typography: {
111
+ DEFAULT: {
112
+ css: {
113
+ maxWidth: 'none',
114
+ color: 'oklch(0.145 0 0)',
115
+ lineHeight: '1.75',
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ </script>
123
+ <style>
124
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
125
+
126
+ body {
127
+ font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
128
+ line-height: 1.75;
129
+ color: oklch(0.145 0 0);
130
+ background-color: oklch(1 0 0);
131
+ font-weight: 400;
132
+ letter-spacing: 0.025em;
133
+ -webkit-font-smoothing: antialiased;
134
+ -moz-osx-font-smoothing: grayscale;
135
+ }
136
+
137
+ .dark body {
138
+ color: oklch(0.985 0 0);
139
+ background-color: oklch(0.145 0 0);
140
+ }
141
+
142
+ /* Preserve editor content styling */
143
+ .editor-content,
144
+ .prose {
145
+ max-width: none !important;
146
+ font-size: 1.125rem;
147
+ line-height: 1.75;
148
+ letter-spacing: 0.025em;
149
+ }
150
+
151
+ /* Typography styles matching the editor */
152
+ h1, h2, h3, h4, h5, h6 {
153
+ font-weight: 600;
154
+ line-height: 1.25;
155
+ margin-top: 2rem;
156
+ margin-bottom: 1rem;
157
+ letter-spacing: -0.025em;
158
+ }
159
+
160
+ h1 { font-size: 2.25rem; }
161
+ h2 { font-size: 1.875rem; }
162
+ h3 { font-size: 1.5rem; }
163
+ h4 { font-size: 1.25rem; }
164
+ h5 { font-size: 1.125rem; }
165
+ h6 { font-size: 1rem; }
166
+
167
+ p {
168
+ margin-bottom: 1.25rem;
169
+ line-height: 1.75;
170
+ }
171
+
172
+ /* List styles */
173
+ ul, ol {
174
+ margin-bottom: 1.25rem;
175
+ padding-left: 1.75rem;
176
+ }
177
+
178
+ li {
179
+ margin-bottom: 0.5rem;
180
+ line-height: 1.75;
181
+ }
182
+
183
+ /* Blockquote styles */
184
+ blockquote {
185
+ border-left: 4px solid oklch(0.708 0 0);
186
+ margin: 1.5rem 0;
187
+ padding-left: 1.5rem;
188
+ color: oklch(0.556 0 0);
189
+ font-style: italic;
190
+ font-size: 1.125rem;
191
+ }
192
+
193
+ /* Code styles */
194
+ code {
195
+ background-color: oklch(0.97 0 0);
196
+ color: oklch(0.205 0 0);
197
+ padding: 0.25rem 0.5rem;
198
+ border-radius: 0.375rem;
199
+ font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
200
+ font-size: 0.875rem;
201
+ }
202
+
203
+ pre {
204
+ background-color: oklch(0.97 0 0);
205
+ color: oklch(0.205 0 0);
206
+ padding: 1.5rem;
207
+ border-radius: 0.75rem;
208
+ overflow-x: auto;
209
+ margin: 1.5rem 0;
210
+ font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
211
+ line-height: 1.5;
212
+ }
213
+
214
+ pre code {
215
+ background: none;
216
+ padding: 0;
217
+ border-radius: 0;
218
+ color: inherit;
219
+ }
220
+
221
+ /* Table styles */
222
+ table {
223
+ border-collapse: collapse;
224
+ width: 100%;
225
+ margin: 1.5rem 0;
226
+ border-radius: 0.5rem;
227
+ overflow: hidden;
228
+ border: 1px solid oklch(0.922 0 0);
229
+ }
230
+
231
+ th, td {
232
+ border: 1px solid oklch(0.922 0 0);
233
+ padding: 0.75rem 1rem;
234
+ text-align: left;
235
+ line-height: 1.5;
236
+ }
237
+
238
+ th {
239
+ background-color: oklch(0.97 0 0);
240
+ font-weight: 600;
241
+ color: oklch(0.205 0 0);
242
+ }
243
+
244
+ /* Image styles */
245
+ img {
246
+ max-width: 100%;
247
+ height: auto;
248
+ border-radius: 0.5rem;
249
+ margin: 1.5rem 0;
250
+ }
251
+
252
+ /* Link styles */
253
+ a {
254
+ color: oklch(0.488 0.243 264.376);
255
+ text-decoration: underline;
256
+ text-decoration-color: oklch(0.488 0.243 264.376 / 0.3);
257
+ text-underline-offset: 0.25rem;
258
+ transition: all 0.2s ease;
259
+ }
260
+
261
+ a:hover {
262
+ text-decoration-color: oklch(0.488 0.243 264.376);
263
+ }
264
+
265
+ /* Enhanced styles for special components */
266
+ /* Poll component styles */
267
+ .poll-container {
268
+ background: white;
269
+ border: 1px solid #e5e7eb;
270
+ border-radius: 0.5rem;
271
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
272
+ margin: 1.5rem 0;
273
+ }
274
+
275
+ .poll-option {
276
+ position: relative;
277
+ overflow: hidden;
278
+ }
279
+
280
+ .poll-progress {
281
+ position: absolute;
282
+ top: 0;
283
+ left: 0;
284
+ height: 100%;
285
+ background: rgba(59, 130, 246, 0.3);
286
+ border-radius: 0.375rem;
287
+ transition: width 1s ease;
288
+ }
289
+
290
+ /* Story builder styles */
291
+ .story-node {
292
+ transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
293
+ transform: translateY(0);
294
+ }
295
+
296
+ .story-node.hidden {
297
+ display: none;
298
+ opacity: 0;
299
+ transform: translateY(20px);
300
+ }
301
+
302
+ .story-choice {
303
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
304
+ }
305
+
306
+ .story-choice:hover {
307
+ transform: translateY(-2px);
308
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
309
+ }
310
+
311
+ .story-choice:active {
312
+ transform: translateY(-1px);
313
+ transition: all 0.1s ease;
314
+ }
315
+
316
+ .story-choice:disabled {
317
+ cursor: not-allowed;
318
+ opacity: 0.5;
319
+ }
320
+
321
+ .story-choice:disabled:hover {
322
+ transform: none;
323
+ box-shadow: none;
324
+ }
325
+
326
+ /* Dynamic block styles */
327
+ .dynamic-block-container {
328
+ border: 2px dashed #93c5fd;
329
+ background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
330
+ }
331
+
332
+ .block-selector {
333
+ cursor: pointer;
334
+ transition: all 0.2s ease;
335
+ }
336
+
337
+ .block-selector:hover {
338
+ transform: translateY(-1px);
339
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
340
+ }
341
+
342
+ /* Dark mode styles */
343
+ .dark code {
344
+ background-color: oklch(0.269 0 0);
345
+ color: oklch(0.985 0 0);
346
+ }
347
+
348
+ .dark pre {
349
+ background-color: oklch(0.269 0 0);
350
+ color: oklch(0.985 0 0);
351
+ }
352
+
353
+ .dark th {
354
+ background-color: oklch(0.269 0 0);
355
+ color: oklch(0.985 0 0);
356
+ }
357
+
358
+ .dark table,
359
+ .dark th,
360
+ .dark td {
361
+ border-color: oklch(0.269 0 0);
362
+ }
363
+
364
+ .dark blockquote {
365
+ border-left-color: oklch(0.439 0 0);
366
+ color: oklch(0.708 0 0);
367
+ }
368
+
369
+ .dark .poll-container {
370
+ background: #1f2937;
371
+ border-color: #374151;
372
+ }
373
+
374
+ .dark .dynamic-block-container {
375
+ border-color: #3b82f6;
376
+ background: linear-gradient(135deg, #1f2937 0%, #1e3a8a 100%);
377
+ }
378
+
379
+ /* Container styling to match editor */
380
+ .document-container {
381
+ max-width: 80rem;
382
+ margin: 0 auto;
383
+ padding: 2rem 1rem;
384
+ background-color: oklch(1 0 0);
385
+ min-height: 100vh;
386
+ }
387
+
388
+ .dark .document-container {
389
+ background-color: oklch(0.145 0 0);
390
+ }
391
+
392
+ @media (min-width: 768px) {
393
+ .document-container {
394
+ padding: 4rem 3rem;
395
+ border-radius: 1rem;
396
+ margin: 2rem auto;
397
+ min-height: calc(100vh - 4rem);
398
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
399
+ border: 1px solid oklch(0.922 0 0 / 0.5);
400
+ }
401
+
402
+ .dark .document-container {
403
+ border-color: oklch(0.269 0 0 / 0.5);
404
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
405
+ }
406
+ }
407
+
408
+ /* Print styles */
409
+ @media print {
410
+ @page {
411
+ size: A4;
412
+ margin: 1.5cm;
413
+ }
414
+ body {
415
+ background: white !important;
416
+ color: black !important;
417
+ }
418
+ .document-container {
419
+ box-shadow: none !important;
420
+ border: none !important;
421
+ margin: 0 !important;
422
+ padding: 0 !important;
423
+ max-width: 100% !important;
424
+ }
425
+ h1, h2, h3, h4, h5, h6 {
426
+ page-break-after: avoid;
427
+ break-after: avoid;
428
+ }
429
+ blockquote, pre, table, img, figure, .poll-container, .story-node, .dynamic-block-container {
430
+ page-break-inside: avoid;
431
+ break-inside: avoid;
432
+ }
433
+ }
434
+ </style>
435
+ </head>
436
+ <body>
437
+ <div class="document-container">
438
+ ${htmlContent}
439
+ </div>
440
+
441
+ <script>
442
+ // Dark mode detection
443
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
444
+ document.documentElement.classList.add('dark');
445
+ }
446
+
447
+ // Listen for dark mode changes
448
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
449
+ if (e.matches) {
450
+ document.documentElement.classList.add('dark');
451
+ } else {
452
+ document.documentElement.classList.remove('dark');
453
+ }
454
+ });
455
+
456
+ window.showStoryNode = function(nodeId) {
457
+ console.log('[v0] Navigating to story node:', nodeId);
458
+
459
+ // Hide all story nodes with smooth transition
460
+ const allNodes = document.querySelectorAll('.story-node');
461
+ allNodes.forEach(node => {
462
+ node.style.opacity = '0';
463
+ node.style.transform = 'translateY(20px)';
464
+ });
465
+
466
+ // After transition, hide nodes and show target
467
+ setTimeout(() => {
468
+ allNodes.forEach(node => {
469
+ node.classList.add('hidden');
470
+ });
471
+
472
+ const targetNode = document.getElementById('story-node-' + nodeId);
473
+ if (targetNode) {
474
+ console.log('[v0] Found target node:', targetNode);
475
+ targetNode.classList.remove('hidden');
476
+ targetNode.style.opacity = '0';
477
+ targetNode.style.transform = 'translateY(20px)';
478
+
479
+ // Scroll to the story container smoothly
480
+ const storyContainer = document.getElementById('story-container');
481
+ if (storyContainer) {
482
+ storyContainer.scrollIntoView({
483
+ behavior: 'smooth',
484
+ block: 'start',
485
+ inline: 'nearest'
486
+ });
487
+ }
488
+
489
+ // Fade in the new node
490
+ setTimeout(() => {
491
+ targetNode.style.opacity = '1';
492
+ targetNode.style.transform = 'translateY(0)';
493
+ }, 100);
494
+ } else {
495
+ console.error('[v0] Target node not found:', nodeId);
496
+ }
497
+ }, 200);
498
+ };
499
+
500
+ window.restartStory = function() {
501
+ console.log('[v0] Restarting story');
502
+ // Find the first story node (should be the start node)
503
+ const firstNode = document.querySelector('.story-node[data-node-id]');
504
+ if (firstNode) {
505
+ const startNodeId = firstNode.getAttribute('data-node-id');
506
+ console.log('[v0] Found start node:', startNodeId);
507
+ window.showStoryNode(startNodeId);
508
+ } else {
509
+ console.error('[v0] No story nodes found');
510
+ }
511
+ };
512
+
513
+ window.showDynamicBlock = function(containerId, blockId) {
514
+ const container = document.getElementById('dynamic-content-' + containerId);
515
+ if (container) {
516
+ // Update active button styling
517
+ container.parentElement.querySelectorAll('.block-selector').forEach(btn => {
518
+ btn.classList.remove('bg-blue-100', 'border-blue-500');
519
+ btn.classList.add('bg-gray-50', 'border-gray-200');
520
+ });
521
+
522
+ // Find and highlight the clicked button
523
+ const clickedBtn = event.target.closest('.block-selector');
524
+ if (clickedBtn) {
525
+ clickedBtn.classList.remove('bg-gray-50', 'border-gray-200');
526
+ clickedBtn.classList.add('bg-blue-100', 'border-blue-500');
527
+ }
528
+
529
+ // Simple content update (in a real implementation, you'd embed the actual block data)
530
+ container.innerHTML = '<div class="text-center text-gray-500 p-8">Selected block: ' + blockId + '</div>';
531
+ }
532
+ };
533
+
534
+ document.addEventListener('DOMContentLoaded', function() {
535
+ console.log('[v0] DOM loaded, initializing story');
536
+
537
+ // Ensure the first story node is visible and others are hidden
538
+ const storyNodes = document.querySelectorAll('.story-node');
539
+ console.log('[v0] Found story nodes:', storyNodes.length);
540
+
541
+ if (storyNodes.length > 0) {
542
+ storyNodes.forEach((node, index) => {
543
+ if (index === 0) {
544
+ console.log('[v0] Showing first node:', node.id);
545
+ node.classList.remove('hidden');
546
+ node.style.opacity = '1';
547
+ node.style.transform = 'translateY(0)';
548
+ } else {
549
+ console.log('[v0] Hiding node:', node.id);
550
+ node.classList.add('hidden');
551
+ node.style.opacity = '0';
552
+ node.style.transform = 'translateY(20px)';
553
+ }
554
+ });
555
+ }
556
+ });
557
+ </script>
558
+ </body>
559
+ </html>`;
560
+ const blob = new Blob([fullHTML], { type: "text/html" });
561
+ const url = URL.createObjectURL(blob);
562
+ const link = document.createElement("a");
563
+ link.href = url;
564
+ link.download = filename;
565
+ document.body.appendChild(link);
566
+ link.click();
567
+ document.body.removeChild(link);
568
+ URL.revokeObjectURL(url);
569
+ }
570
+
571
+ // src/components/editor/utils/importUtils.ts
572
+ init_react_shim();
573
+ import {
574
+ $getRoot as $getRoot2,
575
+ $getSelection,
576
+ $isRangeSelection,
577
+ $createParagraphNode,
578
+ $createTextNode,
579
+ $createLineBreakNode
580
+ } from "lexical";
581
+ import { $convertFromMarkdownString } from "@lexical/markdown";
582
+ import { $generateNodesFromDOM } from "@lexical/html";
583
+ function detectContentFormat(content, filename) {
584
+ if (filename) {
585
+ const ext = filename.toLowerCase().split(".").pop();
586
+ if (ext === "md" || ext === "markdown") return "markdown";
587
+ if (ext === "json" || ext === "lexical") return "json";
588
+ if (ext === "html" || ext === "htm") return "html";
589
+ if (ext === "txt") return "text";
590
+ }
591
+ const trimmed = content.trim();
592
+ if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) {
593
+ try {
594
+ const parsed = JSON.parse(trimmed);
595
+ if (parsed && (parsed.root || parsed.editorState || Array.isArray(parsed))) {
596
+ return "json";
597
+ }
598
+ } catch (e) {
599
+ }
600
+ }
601
+ if (/<!doctype html>/i.test(trimmed) || /<\/?[a-z][\s\S]*>/i.test(trimmed) && (trimmed.includes("<p>") || trimmed.includes("<div") || trimmed.includes("<h1") || trimmed.includes("<html") || trimmed.includes("<body"))) {
602
+ return "html";
603
+ }
604
+ if (/(^|\n)(#{1,6}\s|>\s|[-*+]\s|\d+\.\s|```|\|.*\|)/.test(trimmed) || /\[.*?\]\(.*?\)/.test(trimmed) || /\*\*.*?\*\*/.test(trimmed) || /_{2}.*?_{2}/.test(trimmed)) {
605
+ return "markdown";
606
+ }
607
+ return "text";
608
+ }
609
+ function importMarkdownToEditor(editor, markdown, mode = "replace") {
610
+ editor.update(
611
+ () => {
612
+ if (mode === "replace") {
613
+ const root = $getRoot2();
614
+ root.clear();
615
+ $convertFromMarkdownString(markdown, NOTIQ_TRANSFORMERS, root, true);
616
+ } else if (mode === "append") {
617
+ const root = $getRoot2();
618
+ $convertFromMarkdownString(markdown, NOTIQ_TRANSFORMERS, root, true);
619
+ } else {
620
+ const selection = $getSelection();
621
+ if ($isRangeSelection(selection)) {
622
+ const tempP = $createParagraphNode();
623
+ $convertFromMarkdownString(markdown, NOTIQ_TRANSFORMERS, tempP, true);
624
+ const children = tempP.getChildren();
625
+ if (children.length > 0) {
626
+ selection.insertNodes(children);
627
+ } else {
628
+ selection.insertText(markdown);
629
+ }
630
+ } else {
631
+ const root = $getRoot2();
632
+ $convertFromMarkdownString(markdown, NOTIQ_TRANSFORMERS, root, true);
633
+ }
634
+ }
635
+ },
636
+ { discrete: true }
637
+ );
638
+ }
639
+ function importJSONToEditor(editor, jsonString) {
640
+ try {
641
+ const parsed = typeof jsonString === "string" ? JSON.parse(jsonString) : jsonString;
642
+ const stateData = parsed.editorState || parsed;
643
+ const editorState = editor.parseEditorState(stateData);
644
+ editor.setEditorState(editorState);
645
+ return true;
646
+ } catch (err) {
647
+ console.error("[Notiq Import JSON Error]:", err);
648
+ throw err;
649
+ }
650
+ }
651
+ function importHTMLToEditor(editor, html, mode = "replace") {
652
+ editor.update(
653
+ () => {
654
+ const parser = new DOMParser();
655
+ const cleanHtml = html.replace(/<!DOCTYPE html>/i, "").trim();
656
+ const dom = parser.parseFromString(cleanHtml, "text/html");
657
+ const nodes = $generateNodesFromDOM(editor, dom);
658
+ if (nodes.length === 0) return;
659
+ if (mode === "replace") {
660
+ const root = $getRoot2();
661
+ root.clear();
662
+ root.append(...nodes);
663
+ } else if (mode === "append") {
664
+ const root = $getRoot2();
665
+ root.append(...nodes);
666
+ } else {
667
+ const selection = $getSelection();
668
+ if ($isRangeSelection(selection)) {
669
+ selection.insertNodes(nodes);
670
+ } else {
671
+ $getRoot2().append(...nodes);
672
+ }
673
+ }
674
+ },
675
+ { discrete: true }
676
+ );
677
+ }
678
+ function importPlainTextToEditor(editor, text, mode = "replace") {
679
+ editor.update(
680
+ () => {
681
+ const blocks = text.split(/\r?\n\r?\n/);
682
+ const nodes = blocks.map((block) => {
683
+ const p = $createParagraphNode();
684
+ const lines = block.split(/\r?\n/);
685
+ lines.forEach((line, idx) => {
686
+ if (idx > 0) p.append($createLineBreakNode());
687
+ p.append($createTextNode(line));
688
+ });
689
+ return p;
690
+ });
691
+ if (mode === "replace") {
692
+ const root = $getRoot2();
693
+ root.clear();
694
+ root.append(...nodes);
695
+ } else if (mode === "append") {
696
+ $getRoot2().append(...nodes);
697
+ } else {
698
+ const selection = $getSelection();
699
+ if ($isRangeSelection(selection)) {
700
+ selection.insertNodes(nodes);
701
+ } else {
702
+ $getRoot2().append(...nodes);
703
+ }
704
+ }
705
+ },
706
+ { discrete: true }
707
+ );
708
+ }
709
+ function importContentToEditor(editor, content, format, mode = "replace") {
710
+ switch (format) {
711
+ case "json":
712
+ importJSONToEditor(editor, content);
713
+ break;
714
+ case "html":
715
+ importHTMLToEditor(editor, content, mode);
716
+ break;
717
+ case "markdown":
718
+ importMarkdownToEditor(editor, content, mode);
719
+ break;
720
+ case "text":
721
+ default:
722
+ importPlainTextToEditor(editor, content, mode);
723
+ break;
724
+ }
725
+ }
726
+
727
+ // src/components/editor/plugins/ExportPlugin/ImportExportModal.tsx
728
+ init_react_shim();
729
+ import { useState, useEffect, useRef } from "react";
730
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
731
+ import { $convertToMarkdownString } from "@lexical/markdown";
732
+ import { $getRoot as $getRoot3 } from "lexical";
733
+ import {
734
+ FileText,
735
+ FileCode2,
736
+ FileJson,
737
+ Code2,
738
+ Download,
739
+ Copy,
740
+ Check,
741
+ Upload,
742
+ X,
743
+ ArrowDownUp,
744
+ Sparkles,
745
+ AlertCircle,
746
+ Eye,
747
+ FileUp,
748
+ FileDown
749
+ } from "lucide-react";
750
+ import { motion, AnimatePresence } from "framer-motion";
751
+ import { toast } from "sonner";
752
+ import { jsx, jsxs } from "react/jsx-runtime";
753
+ function ImportExportModal({
754
+ isOpen,
755
+ onClose,
756
+ defaultTab = "export",
757
+ initialImportFile = null
758
+ }) {
759
+ const [editor] = useLexicalComposerContext();
760
+ const [activeTab, setActiveTab] = useState(defaultTab);
761
+ const [copiedFormat, setCopiedFormat] = useState(null);
762
+ const [previewFormat, setPreviewFormat] = useState(null);
763
+ const [previewContent, setPreviewContent] = useState("");
764
+ const [importSource, setImportSource] = useState("file");
765
+ const [importFile, setImportFile] = useState(initialImportFile);
766
+ const [rawText, setRawText] = useState("");
767
+ const [detectedFormat, setDetectedFormat] = useState("markdown");
768
+ const [importMode, setImportMode] = useState("replace");
769
+ const [isDragging, setIsDragging] = useState(false);
770
+ const fileInputRef = useRef(null);
771
+ const modalBackdropRef = useRef(null);
772
+ useEffect(() => {
773
+ if (isOpen) {
774
+ setActiveTab(defaultTab);
775
+ if (initialImportFile) {
776
+ handleFileSelect(initialImportFile);
777
+ }
778
+ }
779
+ }, [isOpen, defaultTab, initialImportFile]);
780
+ useEffect(() => {
781
+ const handleKeyDown = (e) => {
782
+ if (e.key === "Escape" && isOpen) {
783
+ onClose();
784
+ }
785
+ };
786
+ window.addEventListener("keydown", handleKeyDown);
787
+ return () => window.removeEventListener("keydown", handleKeyDown);
788
+ }, [isOpen, onClose]);
789
+ useEffect(() => {
790
+ if (rawText.trim()) {
791
+ setDetectedFormat(detectContentFormat(rawText));
792
+ }
793
+ }, [rawText]);
794
+ const handleFileSelect = (file) => {
795
+ setImportFile(file);
796
+ const reader = new FileReader();
797
+ reader.onload = (e) => {
798
+ var _a;
799
+ const text = ((_a = e.target) == null ? void 0 : _a.result) || "";
800
+ setRawText(text);
801
+ setDetectedFormat(detectContentFormat(text, file.name));
802
+ };
803
+ reader.readAsText(file);
804
+ };
805
+ const handleDragOver = (e) => {
806
+ e.preventDefault();
807
+ setIsDragging(true);
808
+ };
809
+ const handleDragLeave = (e) => {
810
+ e.preventDefault();
811
+ setIsDragging(false);
812
+ };
813
+ const handleDrop = (e) => {
814
+ e.preventDefault();
815
+ setIsDragging(false);
816
+ if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
817
+ const file = e.dataTransfer.files[0];
818
+ handleFileSelect(file);
819
+ }
820
+ };
821
+ const handleExecuteImport = () => {
822
+ if (!rawText.trim()) {
823
+ toast.error("Please provide a file or text content to import.");
824
+ return;
825
+ }
826
+ try {
827
+ importContentToEditor(editor, rawText, detectedFormat, importMode);
828
+ toast.success(
829
+ `Imported ${detectedFormat.toUpperCase()} document successfully!`
830
+ );
831
+ onClose();
832
+ } catch (err) {
833
+ console.error("[Notiq Import Error]:", err);
834
+ toast.error(`Import failed: ${(err == null ? void 0 : err.message) || "Invalid file structure"}`);
835
+ }
836
+ };
837
+ const getDocumentMarkdown = () => {
838
+ return editor.getEditorState().read(() => {
839
+ return $convertToMarkdownString(NOTIQ_TRANSFORMERS);
840
+ });
841
+ };
842
+ const getDocumentHTML = () => {
843
+ return exportEditorToHTML(editor);
844
+ };
845
+ const getDocumentJSON = () => {
846
+ return editor.getEditorState().read(() => {
847
+ return JSON.stringify(editor.getEditorState().toJSON(), null, 2);
848
+ });
849
+ };
850
+ const getDocumentText = () => {
851
+ return editor.getEditorState().read(() => {
852
+ return $getRoot3().getTextContent();
853
+ });
854
+ };
855
+ const handleCopy = (format, getter) => {
856
+ try {
857
+ const content = getter();
858
+ navigator.clipboard.writeText(content);
859
+ setCopiedFormat(format);
860
+ toast.success(`Copied ${format.toUpperCase()} to clipboard!`);
861
+ setTimeout(() => setCopiedFormat(null), 2e3);
862
+ } catch (e) {
863
+ toast.error("Failed to copy to clipboard.");
864
+ }
865
+ };
866
+ const handleDownload = (filename, mimeType, content) => {
867
+ try {
868
+ const blob = new Blob([content], { type: `${mimeType};charset=utf-8` });
869
+ const url = URL.createObjectURL(blob);
870
+ const link = document.createElement("a");
871
+ link.href = url;
872
+ link.download = filename;
873
+ link.click();
874
+ URL.revokeObjectURL(url);
875
+ toast.success(`Exported ${filename}`);
876
+ } catch (e) {
877
+ toast.error("Failed to download file.");
878
+ }
879
+ };
880
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
881
+ const togglePreview = (format, getter) => {
882
+ if (previewFormat === format) {
883
+ setPreviewFormat(null);
884
+ setPreviewContent("");
885
+ } else {
886
+ setPreviewFormat(format);
887
+ setPreviewContent(getter());
888
+ }
889
+ };
890
+ if (!isOpen) return null;
891
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(
892
+ "div",
893
+ {
894
+ ref: modalBackdropRef,
895
+ onClick: (e) => {
896
+ if (e.target === modalBackdropRef.current) onClose();
897
+ },
898
+ className: "fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-6 bg-background/60 backdrop-blur-sm overflow-y-auto",
899
+ children: /* @__PURE__ */ jsxs(
900
+ motion.div,
901
+ {
902
+ initial: { opacity: 0, scale: 0.95, y: 14 },
903
+ animate: { opacity: 1, scale: 1, y: 0 },
904
+ exit: { opacity: 0, scale: 0.95, y: 14 },
905
+ transition: { duration: 0.18, ease: "easeOut" },
906
+ className: "w-full max-w-2xl bg-card border border-border/80 rounded-2xl shadow-2xl flex flex-col overflow-hidden my-auto max-h-[92vh]",
907
+ children: [
908
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-5 py-3.5 border-b border-border/60 bg-muted/20", children: [
909
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
910
+ /* @__PURE__ */ jsx("div", { className: "h-8 w-8 rounded-lg bg-primary/10 text-primary flex items-center justify-center shadow-2xs", children: /* @__PURE__ */ jsx(ArrowDownUp, { className: "h-4 w-4" }) }),
911
+ /* @__PURE__ */ jsxs("div", { children: [
912
+ /* @__PURE__ */ jsxs("h2", { className: "text-sm font-bold text-foreground flex items-center gap-2", children: [
913
+ /* @__PURE__ */ jsx("span", { children: "Document Power Tools" }),
914
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono px-1.5 py-0.2 rounded bg-primary/10 text-primary font-semibold", children: "Import & Export" })
915
+ ] }),
916
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "Transform, migrate, and backup your document across multiple formats" })
917
+ ] })
918
+ ] }),
919
+ /* @__PURE__ */ jsx(
920
+ Button,
921
+ {
922
+ variant: "ghost",
923
+ size: "sm",
924
+ onClick: onClose,
925
+ className: "h-8 w-8 p-0 rounded-full hover:bg-muted text-muted-foreground hover:text-foreground cursor-pointer",
926
+ "aria-label": "Close modal",
927
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
928
+ }
929
+ )
930
+ ] }),
931
+ /* @__PURE__ */ jsx("div", { className: "px-5 pt-3 pb-2 border-b border-border/40 bg-muted/10", children: /* @__PURE__ */ jsx(
932
+ Tabs,
933
+ {
934
+ value: activeTab,
935
+ onValueChange: (val) => {
936
+ setActiveTab(val);
937
+ setPreviewFormat(null);
938
+ },
939
+ className: "w-full",
940
+ children: /* @__PURE__ */ jsxs(TabsList, { className: "grid grid-cols-2 h-9 p-1", children: [
941
+ /* @__PURE__ */ jsxs(
942
+ TabsTrigger,
943
+ {
944
+ value: "export",
945
+ className: "flex items-center gap-2 text-xs font-semibold cursor-pointer",
946
+ children: [
947
+ /* @__PURE__ */ jsx(FileDown, { className: "h-3.5 w-3.5 text-primary" }),
948
+ /* @__PURE__ */ jsx("span", { children: "Export Document" })
949
+ ]
950
+ }
951
+ ),
952
+ /* @__PURE__ */ jsxs(
953
+ TabsTrigger,
954
+ {
955
+ value: "import",
956
+ className: "flex items-center gap-2 text-xs font-semibold cursor-pointer",
957
+ children: [
958
+ /* @__PURE__ */ jsx(FileUp, { className: "h-3.5 w-3.5 text-blue-500" }),
959
+ /* @__PURE__ */ jsx("span", { children: "Import Document" })
960
+ ]
961
+ }
962
+ )
963
+ ] })
964
+ }
965
+ ) }),
966
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-5 space-y-4", children: activeTab === "export" ? (
967
+ /* --- EXPORT TAB --- */
968
+ /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
969
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground font-medium", children: "Select an export format to download or copy directly to clipboard:" }),
970
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2.5", children: [
971
+ /* @__PURE__ */ jsxs("div", { className: "border border-border/80 hover:border-red-500/40 rounded-xl p-3 bg-card hover:bg-red-500/5 transition-all group flex flex-col justify-between", children: [
972
+ /* @__PURE__ */ jsxs("div", { children: [
973
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1", children: [
974
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
975
+ /* @__PURE__ */ jsx("span", { className: "p-1.5 rounded-md bg-red-500/10 text-red-600 dark:text-red-400", children: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }) }),
976
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-xs text-foreground", children: "PDF Document" })
977
+ ] }),
978
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-muted-foreground uppercase", children: ".pdf" })
979
+ ] }),
980
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground leading-snug mb-3", children: "High-DPI paginated PDF with smart block boundary breaks and footer." })
981
+ ] }),
982
+ /* @__PURE__ */ jsxs(
983
+ Button,
984
+ {
985
+ size: "sm",
986
+ onClick: () => {
987
+ onClose();
988
+ editor.dispatchCommand(EXPORT_PDF_COMMAND, void 0);
989
+ },
990
+ className: "w-full text-xs h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white cursor-pointer",
991
+ children: [
992
+ /* @__PURE__ */ jsx(Download, { className: "h-3 w-3" }),
993
+ "Generate PDF"
994
+ ]
995
+ }
996
+ )
997
+ ] }),
998
+ /* @__PURE__ */ jsxs("div", { className: "border border-border/80 hover:border-blue-500/40 rounded-xl p-3 bg-card hover:bg-blue-500/5 transition-all group flex flex-col justify-between", children: [
999
+ /* @__PURE__ */ jsxs("div", { children: [
1000
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1", children: [
1001
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1002
+ /* @__PURE__ */ jsx("span", { className: "p-1.5 rounded-md bg-blue-500/10 text-blue-600 dark:text-blue-400", children: /* @__PURE__ */ jsx(FileCode2, { className: "h-4 w-4" }) }),
1003
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-xs text-foreground", children: "Markdown (GFM)" })
1004
+ ] }),
1005
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-muted-foreground uppercase", children: ".md" })
1006
+ ] }),
1007
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground leading-snug mb-3", children: "GitHub Flavored Markdown with embeds, math equations, and tables." })
1008
+ ] }),
1009
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
1010
+ /* @__PURE__ */ jsxs(
1011
+ Button,
1012
+ {
1013
+ size: "sm",
1014
+ variant: "outline",
1015
+ onClick: () => handleDownload(
1016
+ `document-${timestamp}.md`,
1017
+ "text/markdown",
1018
+ getDocumentMarkdown()
1019
+ ),
1020
+ className: "flex-1 text-xs h-7 gap-1",
1021
+ children: [
1022
+ /* @__PURE__ */ jsx(Download, { className: "h-3 w-3" }),
1023
+ "Download"
1024
+ ]
1025
+ }
1026
+ ),
1027
+ /* @__PURE__ */ jsx(
1028
+ Button,
1029
+ {
1030
+ size: "sm",
1031
+ variant: "ghost",
1032
+ onClick: () => handleCopy("markdown", getDocumentMarkdown),
1033
+ className: "text-xs h-7 px-2.5",
1034
+ title: "Copy Markdown",
1035
+ children: copiedFormat === "markdown" ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3 text-emerald-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
1036
+ }
1037
+ ),
1038
+ /* @__PURE__ */ jsx(
1039
+ Button,
1040
+ {
1041
+ size: "sm",
1042
+ variant: "ghost",
1043
+ onClick: () => togglePreview("markdown", getDocumentMarkdown),
1044
+ className: cn(
1045
+ "text-xs h-7 px-2",
1046
+ previewFormat === "markdown" && "bg-muted text-primary"
1047
+ ),
1048
+ title: "Inspect preview",
1049
+ children: /* @__PURE__ */ jsx(Eye, { className: "h-3 w-3" })
1050
+ }
1051
+ )
1052
+ ] })
1053
+ ] }),
1054
+ /* @__PURE__ */ jsxs("div", { className: "border border-border/80 hover:border-orange-500/40 rounded-xl p-3 bg-card hover:bg-orange-500/5 transition-all group flex flex-col justify-between", children: [
1055
+ /* @__PURE__ */ jsxs("div", { children: [
1056
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1", children: [
1057
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1058
+ /* @__PURE__ */ jsx("span", { className: "p-1.5 rounded-md bg-orange-500/10 text-orange-600 dark:text-orange-400", children: /* @__PURE__ */ jsx(Code2, { className: "h-4 w-4" }) }),
1059
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-xs text-foreground", children: "Standalone Webpage" })
1060
+ ] }),
1061
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-muted-foreground uppercase", children: ".html" })
1062
+ ] }),
1063
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground leading-snug mb-3", children: "Self-contained offline HTML page with embedded fonts and styling." })
1064
+ ] }),
1065
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
1066
+ /* @__PURE__ */ jsxs(
1067
+ Button,
1068
+ {
1069
+ size: "sm",
1070
+ variant: "outline",
1071
+ onClick: () => {
1072
+ const html = getDocumentHTML();
1073
+ downloadHTML(html, `document-${timestamp}.html`);
1074
+ toast.success("Downloaded standalone HTML");
1075
+ },
1076
+ className: "flex-1 text-xs h-7 gap-1",
1077
+ children: [
1078
+ /* @__PURE__ */ jsx(Download, { className: "h-3 w-3" }),
1079
+ "Download"
1080
+ ]
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ jsx(
1084
+ Button,
1085
+ {
1086
+ size: "sm",
1087
+ variant: "ghost",
1088
+ onClick: () => handleCopy("html", getDocumentHTML),
1089
+ className: "text-xs h-7 px-2.5",
1090
+ title: "Copy HTML",
1091
+ children: copiedFormat === "html" ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3 text-emerald-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
1092
+ }
1093
+ ),
1094
+ /* @__PURE__ */ jsx(
1095
+ Button,
1096
+ {
1097
+ size: "sm",
1098
+ variant: "ghost",
1099
+ onClick: () => togglePreview("html", getDocumentHTML),
1100
+ className: cn(
1101
+ "text-xs h-7 px-2",
1102
+ previewFormat === "html" && "bg-muted text-primary"
1103
+ ),
1104
+ title: "Inspect preview",
1105
+ children: /* @__PURE__ */ jsx(Eye, { className: "h-3 w-3" })
1106
+ }
1107
+ )
1108
+ ] })
1109
+ ] }),
1110
+ /* @__PURE__ */ jsxs("div", { className: "border border-border/80 hover:border-emerald-500/40 rounded-xl p-3 bg-card hover:bg-emerald-500/5 transition-all group flex flex-col justify-between", children: [
1111
+ /* @__PURE__ */ jsxs("div", { children: [
1112
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-1", children: [
1113
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1114
+ /* @__PURE__ */ jsx("span", { className: "p-1.5 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ jsx(FileJson, { className: "h-4 w-4" }) }),
1115
+ /* @__PURE__ */ jsx("span", { className: "font-semibold text-xs text-foreground", children: "Document Backup State" })
1116
+ ] }),
1117
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-muted-foreground uppercase", children: ".json" })
1118
+ ] }),
1119
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground leading-snug mb-3", children: "Full Lexical AST JSON for lossless restoring or version migration." })
1120
+ ] }),
1121
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
1122
+ /* @__PURE__ */ jsxs(
1123
+ Button,
1124
+ {
1125
+ size: "sm",
1126
+ variant: "outline",
1127
+ onClick: () => handleDownload(
1128
+ `document-${timestamp}.json`,
1129
+ "application/json",
1130
+ getDocumentJSON()
1131
+ ),
1132
+ className: "flex-1 text-xs h-7 gap-1",
1133
+ children: [
1134
+ /* @__PURE__ */ jsx(Download, { className: "h-3 w-3" }),
1135
+ "Download"
1136
+ ]
1137
+ }
1138
+ ),
1139
+ /* @__PURE__ */ jsx(
1140
+ Button,
1141
+ {
1142
+ size: "sm",
1143
+ variant: "ghost",
1144
+ onClick: () => handleCopy("json", getDocumentJSON),
1145
+ className: "text-xs h-7 px-2.5",
1146
+ title: "Copy JSON",
1147
+ children: copiedFormat === "json" ? /* @__PURE__ */ jsx(Check, { className: "h-3 w-3 text-emerald-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3 w-3" })
1148
+ }
1149
+ ),
1150
+ /* @__PURE__ */ jsx(
1151
+ Button,
1152
+ {
1153
+ size: "sm",
1154
+ variant: "ghost",
1155
+ onClick: () => togglePreview("json", getDocumentJSON),
1156
+ className: cn(
1157
+ "text-xs h-7 px-2",
1158
+ previewFormat === "json" && "bg-muted text-primary"
1159
+ ),
1160
+ title: "Inspect preview",
1161
+ children: /* @__PURE__ */ jsx(Eye, { className: "h-3 w-3" })
1162
+ }
1163
+ )
1164
+ ] })
1165
+ ] })
1166
+ ] }),
1167
+ previewFormat && /* @__PURE__ */ jsxs("div", { className: "mt-3 p-3 rounded-xl border border-border/80 bg-muted/30 space-y-2 animate-in fade-in-50 duration-150", children: [
1168
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-[11px]", children: [
1169
+ /* @__PURE__ */ jsxs("span", { className: "font-semibold text-foreground flex items-center gap-1.5", children: [
1170
+ /* @__PURE__ */ jsx(Sparkles, { className: "h-3 w-3 text-primary" }),
1171
+ /* @__PURE__ */ jsxs("span", { children: [
1172
+ "Preview: ",
1173
+ previewFormat.toUpperCase()
1174
+ ] })
1175
+ ] }),
1176
+ /* @__PURE__ */ jsx(
1177
+ "button",
1178
+ {
1179
+ type: "button",
1180
+ onClick: () => setPreviewFormat(null),
1181
+ className: "text-muted-foreground hover:text-foreground text-[10px]",
1182
+ children: "Hide"
1183
+ }
1184
+ )
1185
+ ] }),
1186
+ /* @__PURE__ */ jsxs("pre", { className: "text-[11px] font-mono p-2.5 rounded-lg bg-background border border-border/60 max-h-48 overflow-y-auto whitespace-pre-wrap select-all", children: [
1187
+ previewContent.slice(0, 3e3),
1188
+ previewContent.length > 3e3 ? "\n\n... (preview truncated)" : ""
1189
+ ] })
1190
+ ] })
1191
+ ] })
1192
+ ) : (
1193
+ /* --- IMPORT TAB --- */
1194
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1195
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1196
+ /* @__PURE__ */ jsx(
1197
+ "button",
1198
+ {
1199
+ type: "button",
1200
+ onClick: () => setImportSource("file"),
1201
+ className: cn(
1202
+ "px-3 py-1 rounded-lg text-xs font-medium transition-all cursor-pointer",
1203
+ importSource === "file" ? "bg-primary text-primary-foreground shadow-xs" : "bg-muted text-muted-foreground hover:text-foreground"
1204
+ ),
1205
+ children: "Upload File (.md, .json, .html, .txt)"
1206
+ }
1207
+ ),
1208
+ /* @__PURE__ */ jsx(
1209
+ "button",
1210
+ {
1211
+ type: "button",
1212
+ onClick: () => setImportSource("paste"),
1213
+ className: cn(
1214
+ "px-3 py-1 rounded-lg text-xs font-medium transition-all cursor-pointer",
1215
+ importSource === "paste" ? "bg-primary text-primary-foreground shadow-xs" : "bg-muted text-muted-foreground hover:text-foreground"
1216
+ ),
1217
+ children: "Paste Raw Text / Code"
1218
+ }
1219
+ )
1220
+ ] }),
1221
+ importSource === "file" ? (
1222
+ /* Drag & Drop File Zone */
1223
+ /* @__PURE__ */ jsxs(
1224
+ "div",
1225
+ {
1226
+ onDragOver: handleDragOver,
1227
+ onDragLeave: handleDragLeave,
1228
+ onDrop: handleDrop,
1229
+ onClick: () => {
1230
+ var _a;
1231
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
1232
+ },
1233
+ className: cn(
1234
+ "border-2 border-dashed rounded-xl p-6 text-center cursor-pointer transition-all flex flex-col items-center justify-center space-y-2",
1235
+ isDragging ? "border-primary bg-primary/5 scale-[1.01]" : "border-border/80 hover:border-primary/50 hover:bg-muted/30"
1236
+ ),
1237
+ children: [
1238
+ /* @__PURE__ */ jsx(
1239
+ "input",
1240
+ {
1241
+ ref: fileInputRef,
1242
+ type: "file",
1243
+ accept: ".md,.markdown,.html,.htm,.json,.txt,.lexical",
1244
+ onChange: (e) => {
1245
+ if (e.target.files && e.target.files.length > 0) {
1246
+ handleFileSelect(e.target.files[0]);
1247
+ }
1248
+ },
1249
+ className: "hidden"
1250
+ }
1251
+ ),
1252
+ /* @__PURE__ */ jsx("div", { className: "h-10 w-10 rounded-full bg-primary/10 text-primary flex items-center justify-center shadow-xs", children: /* @__PURE__ */ jsx(Upload, { className: "h-5 w-5" }) }),
1253
+ /* @__PURE__ */ jsxs("div", { children: [
1254
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold text-foreground", children: importFile ? importFile.name : "Click to browse or drag & drop file" }),
1255
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: "Supports Markdown (.md), HTML (.html), JSON State (.json), Plain Text (.txt)" })
1256
+ ] }),
1257
+ importFile && /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-muted text-[10px] font-mono text-foreground font-medium mt-1", children: [
1258
+ /* @__PURE__ */ jsxs("span", { children: [
1259
+ "Format: ",
1260
+ detectedFormat.toUpperCase()
1261
+ ] }),
1262
+ /* @__PURE__ */ jsx("span", { children: "\u2022" }),
1263
+ /* @__PURE__ */ jsxs("span", { children: [
1264
+ (importFile.size / 1024).toFixed(1),
1265
+ " KB"
1266
+ ] })
1267
+ ] })
1268
+ ]
1269
+ }
1270
+ )
1271
+ ) : (
1272
+ /* Raw Paste Textarea */
1273
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
1274
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
1275
+ /* @__PURE__ */ jsx("label", { className: "font-semibold text-foreground", children: "Paste Markdown, HTML, JSON, or Text" }),
1276
+ /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-mono px-2 py-0.5 rounded-full bg-muted font-medium text-foreground", children: [
1277
+ "Detected: ",
1278
+ detectedFormat.toUpperCase()
1279
+ ] })
1280
+ ] }),
1281
+ /* @__PURE__ */ jsx(
1282
+ "textarea",
1283
+ {
1284
+ value: rawText,
1285
+ onChange: (e) => setRawText(e.target.value),
1286
+ placeholder: "# Type or paste Markdown or HTML here...",
1287
+ rows: 6,
1288
+ className: "w-full text-xs font-mono p-3 rounded-xl border border-border/80 bg-background focus:ring-1 focus:ring-primary focus:outline-none resize-none leading-relaxed"
1289
+ }
1290
+ )
1291
+ ] })
1292
+ ),
1293
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
1294
+ /* @__PURE__ */ jsx("label", { className: "text-xs font-semibold text-foreground", children: "Import Destination" }),
1295
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
1296
+ /* @__PURE__ */ jsxs(
1297
+ "button",
1298
+ {
1299
+ type: "button",
1300
+ onClick: () => setImportMode("replace"),
1301
+ className: cn(
1302
+ "p-2.5 rounded-xl border text-left transition-all cursor-pointer",
1303
+ importMode === "replace" ? "border-primary bg-primary/5 ring-1 ring-primary/30" : "border-border/70 hover:border-border text-muted-foreground"
1304
+ ),
1305
+ children: [
1306
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-foreground", children: "Replace" }),
1307
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] text-muted-foreground leading-tight", children: "Clear and overwrite document" })
1308
+ ]
1309
+ }
1310
+ ),
1311
+ /* @__PURE__ */ jsxs(
1312
+ "button",
1313
+ {
1314
+ type: "button",
1315
+ onClick: () => setImportMode("append"),
1316
+ className: cn(
1317
+ "p-2.5 rounded-xl border text-left transition-all cursor-pointer",
1318
+ importMode === "append" ? "border-primary bg-primary/5 ring-1 ring-primary/30" : "border-border/70 hover:border-border text-muted-foreground"
1319
+ ),
1320
+ children: [
1321
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-foreground", children: "Append" }),
1322
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] text-muted-foreground leading-tight", children: "Add to end of document" })
1323
+ ]
1324
+ }
1325
+ ),
1326
+ /* @__PURE__ */ jsxs(
1327
+ "button",
1328
+ {
1329
+ type: "button",
1330
+ onClick: () => setImportMode("insert"),
1331
+ className: cn(
1332
+ "p-2.5 rounded-xl border text-left transition-all cursor-pointer",
1333
+ importMode === "insert" ? "border-primary bg-primary/5 ring-1 ring-primary/30" : "border-border/70 hover:border-border text-muted-foreground"
1334
+ ),
1335
+ children: [
1336
+ /* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-foreground", children: "Insert at Cursor" }),
1337
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] text-muted-foreground leading-tight", children: "Insert at caret position" })
1338
+ ]
1339
+ }
1340
+ )
1341
+ ] })
1342
+ ] }),
1343
+ importMode === "replace" && rawText.trim() && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-300 text-[11px]", children: [
1344
+ /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4 shrink-0" }),
1345
+ /* @__PURE__ */ jsx("span", { children: "Replacing will overwrite current editor content. You can always use Undo (Ctrl+Z) or Version History to restore." })
1346
+ ] })
1347
+ ] })
1348
+ ) }),
1349
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-5 py-3 border-t border-border/60 bg-muted/20", children: [
1350
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: activeTab === "export" ? "Notiq exports keep all custom blocks & styling intact." : `${rawText.length} characters ready to import.` }),
1351
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1352
+ /* @__PURE__ */ jsx(
1353
+ Button,
1354
+ {
1355
+ variant: "ghost",
1356
+ size: "sm",
1357
+ onClick: onClose,
1358
+ className: "h-8 px-3 text-xs",
1359
+ children: "Close"
1360
+ }
1361
+ ),
1362
+ activeTab === "import" && /* @__PURE__ */ jsxs(
1363
+ Button,
1364
+ {
1365
+ size: "sm",
1366
+ disabled: !rawText.trim(),
1367
+ onClick: handleExecuteImport,
1368
+ className: "h-8 px-4 text-xs gap-1.5 shadow-xs cursor-pointer",
1369
+ children: [
1370
+ /* @__PURE__ */ jsx(FileUp, { className: "h-3.5 w-3.5" }),
1371
+ "Import into Editor"
1372
+ ]
1373
+ }
1374
+ )
1375
+ ] })
1376
+ ] })
1377
+ ]
1378
+ }
1379
+ )
1380
+ }
1381
+ ) });
1382
+ }
1383
+
1384
+ // src/components/editor/plugins/ExportPlugin/index.tsx
1385
+ import { jsx as jsx2 } from "react/jsx-runtime";
1386
+ var EXPORT_MARKDOWN_COMMAND = createCommand("EXPORT_MARKDOWN_COMMAND");
1387
+ var EXPORT_PDF_COMMAND = createCommand("EXPORT_PDF_COMMAND");
1388
+ var EXPORT_HTML_COMMAND = createCommand("EXPORT_HTML_COMMAND");
1389
+ var EXPORT_JSON_COMMAND = createCommand("EXPORT_JSON_COMMAND");
1390
+ var EXPORT_TEXT_COMMAND = createCommand("EXPORT_TEXT_COMMAND");
1391
+ var OPEN_IMPORT_EXPORT_MODAL_COMMAND = createCommand("OPEN_IMPORT_EXPORT_MODAL_COMMAND");
1392
+ var IMPORT_MARKDOWN_COMMAND = createCommand("IMPORT_MARKDOWN_COMMAND");
1393
+ var IMPORT_HTML_COMMAND = createCommand("IMPORT_HTML_COMMAND");
1394
+ var IMPORT_JSON_COMMAND = createCommand("IMPORT_JSON_COMMAND");
1395
+ var IMPORT_TEXT_COMMAND = createCommand("IMPORT_TEXT_COMMAND");
1396
+ async function prepareDOMForPDF(rootElement, isDark) {
1397
+ const restoredElements = [];
1398
+ const images = Array.from(rootElement.querySelectorAll("img"));
1399
+ images.forEach((img) => {
1400
+ if (!img.crossOrigin) {
1401
+ img.crossOrigin = "anonymous";
1402
+ }
1403
+ });
1404
+ const pendingImages = images.filter((img) => !img.complete && img.src);
1405
+ if (pendingImages.length > 0) {
1406
+ await Promise.all(
1407
+ pendingImages.map(
1408
+ (img) => new Promise((resolve) => {
1409
+ img.onload = resolve;
1410
+ img.onerror = resolve;
1411
+ setTimeout(resolve, 1500);
1412
+ })
1413
+ )
1414
+ );
1415
+ }
1416
+ const iframes = Array.from(rootElement.querySelectorAll("iframe"));
1417
+ iframes.forEach((iframe) => {
1418
+ var _a;
1419
+ const parent = iframe.parentNode;
1420
+ if (!parent) return;
1421
+ const src = iframe.src || iframe.getAttribute("src") || "";
1422
+ let ytId = null;
1423
+ const ytContainer = iframe.closest("[data-lexical-youtube]");
1424
+ if (ytContainer) {
1425
+ ytId = ytContainer.getAttribute("data-lexical-youtube");
1426
+ } else {
1427
+ const match = src.match(/(?:embed\/|watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
1428
+ if (match) ytId = match[1];
1429
+ }
1430
+ if (ytId) {
1431
+ const card = document.createElement("div");
1432
+ card.className = "notiq-pdf-youtube-card";
1433
+ card.style.cssText = "width: 100%; aspect-ratio: 16/9; max-width: 650px; margin: 16px auto; background: #000; border-radius: 12px; overflow: hidden; position: relative; border: 3px solid #eab308; box-shadow: 0 4px 16px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center;";
1434
+ card.innerHTML = `
1435
+ <img src="https://img.youtube.com/vi/${ytId}/hqdefault.jpg" crossorigin="anonymous" style="width: 100%; height: 100%; object-fit: cover; opacity: 0.9;" />
1436
+ <div style="position: absolute; width: 64px; height: 44px; background: #ff0000; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,0.5);">
1437
+ <div style="width: 0; height: 0; border-left: 16px solid #ffffff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 3px;"></div>
1438
+ </div>
1439
+ <div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.85)); padding: 8px 12px; color: #ffffff; font-size: 13px; font-weight: 600; font-family: system-ui, -apple-system, sans-serif; display: flex; justify-content: space-between; align-items: center;">
1440
+ <span>\u25B6 YouTube Video</span>
1441
+ <span style="opacity: 0.85; font-size: 11px;">https://www.youtube.com/watch?v=${ytId}</span>
1442
+ </div>
1443
+ `;
1444
+ const nextSibling = iframe.nextSibling;
1445
+ parent.replaceChild(card, iframe);
1446
+ restoredElements.push({ original: iframe, replacement: card, parent, nextSibling });
1447
+ return;
1448
+ }
1449
+ if (src.includes("figma.com")) {
1450
+ const card = document.createElement("div");
1451
+ card.className = "notiq-pdf-figma-card";
1452
+ card.style.cssText = `width: 100%; max-width: 650px; margin: 16px auto; padding: 18px; background: ${isDark ? "#18181b" : "#fafafa"}; border-radius: 12px; border: 1.5px solid ${isDark ? "#3f3f46" : "#e4e4e7"}; color: ${isDark ? "#f4f4f5" : "#18181b"}; font-family: system-ui, sans-serif;`;
1453
+ card.innerHTML = `
1454
+ <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 6px;">
1455
+ <span style="font-size: 18px;">\u{1F4D0}</span>
1456
+ <span style="font-size: 14px; font-weight: 700; color: #f43f5e;">Figma Design</span>
1457
+ </div>
1458
+ <div style="font-size: 12px; color: #71717a; word-break: break-all;">
1459
+ ${src.replace(/&amp;/g, "&")}
1460
+ </div>
1461
+ `;
1462
+ const nextSibling = iframe.nextSibling;
1463
+ parent.replaceChild(card, iframe);
1464
+ restoredElements.push({ original: iframe, replacement: card, parent, nextSibling });
1465
+ return;
1466
+ }
1467
+ if (src.includes("platform.twitter.com") || iframe.closest("[data-lexical-tweet-id]")) {
1468
+ const tweetId = ((_a = iframe.closest("[data-lexical-tweet-id]")) == null ? void 0 : _a.getAttribute("data-lexical-tweet-id")) || "";
1469
+ const card = document.createElement("div");
1470
+ card.className = "notiq-pdf-tweet-card";
1471
+ card.style.cssText = `width: 100%; max-width: 520px; margin: 16px auto; padding: 18px; background: ${isDark ? "#0f172a" : "#f8fafc"}; border-radius: 12px; border: 1.5px solid ${isDark ? "#334155" : "#e2e8f0"}; color: ${isDark ? "#f8fafc" : "#0f172a"}; font-family: system-ui, sans-serif;`;
1472
+ card.innerHTML = `
1473
+ <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
1474
+ <div style="display: flex; align-items: center; gap: 8px;">
1475
+ <span style="font-size: 18px; font-weight: 900;">\u{1D54F}</span>
1476
+ <span style="font-size: 14px; font-weight: 700;">Post on X</span>
1477
+ </div>
1478
+ <span style="font-size: 11px; color: #64748b;">${tweetId ? `ID: ${tweetId}` : ""}</span>
1479
+ </div>
1480
+ <div style="font-size: 12px; color: #0284c7; word-break: break-all;">
1481
+ ${tweetId ? `https://x.com/i/web/status/${tweetId}` : "Tweet Embed"}
1482
+ </div>
1483
+ `;
1484
+ const nextSibling = iframe.nextSibling;
1485
+ parent.replaceChild(card, iframe);
1486
+ restoredElements.push({ original: iframe, replacement: card, parent, nextSibling });
1487
+ return;
1488
+ }
1489
+ });
1490
+ const tweetContainers = Array.from(rootElement.querySelectorAll("[data-lexical-tweet-id]"));
1491
+ tweetContainers.forEach((container) => {
1492
+ if (container.querySelector(".notiq-pdf-tweet-card")) return;
1493
+ const tweetId = container.getAttribute("data-lexical-tweet-id") || "";
1494
+ const parent = container.parentNode;
1495
+ if (!parent) return;
1496
+ const card = document.createElement("div");
1497
+ card.className = "notiq-pdf-tweet-card";
1498
+ card.style.cssText = `width: 100%; max-width: 520px; margin: 16px auto; padding: 18px; background: ${isDark ? "#0f172a" : "#f8fafc"}; border-radius: 12px; border: 1.5px solid ${isDark ? "#334155" : "#e2e8f0"}; color: ${isDark ? "#f8fafc" : "#0f172a"}; font-family: system-ui, sans-serif;`;
1499
+ card.innerHTML = `
1500
+ <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
1501
+ <div style="display: flex; align-items: center; gap: 8px;">
1502
+ <span style="font-size: 18px; font-weight: 900;">\u{1D54F}</span>
1503
+ <span style="font-size: 14px; font-weight: 700;">Post on X</span>
1504
+ </div>
1505
+ <span style="font-size: 11px; color: #64748b;">${tweetId ? `ID: ${tweetId}` : ""}</span>
1506
+ </div>
1507
+ <div style="font-size: 12px; color: #0284c7; word-break: break-all;">
1508
+ ${tweetId ? `https://x.com/i/web/status/${tweetId}` : "Tweet Embed"}
1509
+ </div>
1510
+ `;
1511
+ const nextSibling = container.nextSibling;
1512
+ parent.replaceChild(card, container);
1513
+ restoredElements.push({ original: container, replacement: card, parent, nextSibling });
1514
+ });
1515
+ return () => {
1516
+ restoredElements.forEach(({ original, replacement, parent }) => {
1517
+ try {
1518
+ if (replacement.parentNode === parent) {
1519
+ parent.replaceChild(original, replacement);
1520
+ }
1521
+ } catch (err) {
1522
+ console.warn("Failed to restore original DOM element after PDF capture:", err);
1523
+ }
1524
+ });
1525
+ };
1526
+ }
1527
+ async function generatePaginatedPDF(rootElement) {
1528
+ const isDark = document.documentElement.classList.contains("dark");
1529
+ const bgColorHex = isDark ? "#0b0f19" : "#ffffff";
1530
+ const bgR = isDark ? 11 : 255;
1531
+ const bgG = isDark ? 15 : 255;
1532
+ const bgB = isDark ? 25 : 255;
1533
+ const restoreDOM = await prepareDOMForPDF(rootElement, isDark);
1534
+ let fullCanvas;
1535
+ try {
1536
+ fullCanvas = await toCanvas(rootElement, {
1537
+ cacheBust: true,
1538
+ pixelRatio: 2,
1539
+ backgroundColor: bgColorHex,
1540
+ imagePlaceholder: "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect width='18' height='18' x='3' y='3' rx='2' ry='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/svg%3E",
1541
+ filter: (node) => {
1542
+ if (node instanceof HTMLElement) {
1543
+ if (node.classList.contains("no-export") || node.classList.contains("AI-format") || node.getAttribute("role") === "tooltip" || node.classList.contains("pointer-events-none")) {
1544
+ return false;
1545
+ }
1546
+ }
1547
+ return true;
1548
+ }
1549
+ });
1550
+ } finally {
1551
+ restoreDOM();
1552
+ }
1553
+ const fullWidth = fullCanvas.width;
1554
+ const fullHeight = fullCanvas.height;
1555
+ const pdf = new jsPDF("p", "mm", "a4");
1556
+ const pageWidth = 210;
1557
+ const pageHeight = 297;
1558
+ const marginTop = 16;
1559
+ const marginBottom = 20;
1560
+ const marginLeft = 14;
1561
+ const marginRight = 14;
1562
+ const printableWidth = pageWidth - marginLeft - marginRight;
1563
+ const printableHeight = pageHeight - marginTop - marginBottom;
1564
+ const mmPerPx = printableWidth / fullWidth;
1565
+ const maxPageHeightPx = Math.floor(printableHeight / mmPerPx);
1566
+ const rootRect = rootElement.getBoundingClientRect();
1567
+ const scale = fullHeight / (rootRect.height || 1);
1568
+ const breakPoints = [];
1569
+ const candidateElements = rootElement.querySelectorAll(
1570
+ "p, h1, h2, h3, h4, h5, h6, blockquote, ul > li, ol > li, table tr, hr, pre, .poll-container, .story-node, .dynamic-block-container"
1571
+ );
1572
+ candidateElements.forEach((el) => {
1573
+ const rect = el.getBoundingClientRect();
1574
+ const topPx = Math.round((rect.top - rootRect.top) * scale);
1575
+ const bottomPx = Math.round((rect.bottom - rootRect.top) * scale);
1576
+ if (topPx > 0 && topPx < fullHeight) breakPoints.push(topPx);
1577
+ if (bottomPx > 0 && bottomPx < fullHeight) breakPoints.push(bottomPx);
1578
+ });
1579
+ const uniqueBreakPoints = Array.from(new Set(breakPoints)).sort((a, b) => a - b);
1580
+ const ctx = fullCanvas.getContext("2d", { willReadFrequently: true });
1581
+ function findBlankRowInRange(minY, maxY) {
1582
+ if (!ctx) return null;
1583
+ const clampedMinY = Math.max(0, Math.floor(minY));
1584
+ const clampedMaxY = Math.min(fullHeight - 1, Math.floor(maxY));
1585
+ if (clampedMaxY <= clampedMinY) return null;
1586
+ const rowHeight = clampedMaxY - clampedMinY + 1;
1587
+ const sampleStartX = Math.floor(fullWidth * 0.2);
1588
+ const sampleWidth = Math.floor(fullWidth * 0.6);
1589
+ try {
1590
+ const imgData = ctx.getImageData(sampleStartX, clampedMinY, sampleWidth, rowHeight);
1591
+ const data = imgData.data;
1592
+ for (let relY = rowHeight - 1; relY >= 0; relY--) {
1593
+ let isBlank = true;
1594
+ for (let x = 0; x < sampleWidth; x += 12) {
1595
+ const idx = (relY * sampleWidth + x) * 4;
1596
+ const r = data[idx];
1597
+ const g = data[idx + 1];
1598
+ const b = data[idx + 2];
1599
+ if (Math.abs(r - bgR) > 12 || Math.abs(g - bgG) > 12 || Math.abs(b - bgB) > 12) {
1600
+ isBlank = false;
1601
+ break;
1602
+ }
1603
+ }
1604
+ if (isBlank) {
1605
+ return clampedMinY + relY;
1606
+ }
1607
+ }
1608
+ } catch (e) {
1609
+ }
1610
+ return null;
1611
+ }
1612
+ const pageCanvases = [];
1613
+ let currentY = 0;
1614
+ while (currentY < fullHeight) {
1615
+ const remainingPx = fullHeight - currentY;
1616
+ if (remainingPx <= maxPageHeightPx) {
1617
+ const sliceHeightPx2 = remainingPx;
1618
+ const sliceCanvas2 = document.createElement("canvas");
1619
+ sliceCanvas2.width = fullWidth;
1620
+ sliceCanvas2.height = sliceHeightPx2;
1621
+ const sCtx2 = sliceCanvas2.getContext("2d");
1622
+ if (sCtx2) {
1623
+ sCtx2.fillStyle = bgColorHex;
1624
+ sCtx2.fillRect(0, 0, fullWidth, sliceHeightPx2);
1625
+ sCtx2.drawImage(fullCanvas, 0, currentY, fullWidth, sliceHeightPx2, 0, 0, fullWidth, sliceHeightPx2);
1626
+ }
1627
+ pageCanvases.push({ canvas: sliceCanvas2, heightMm: sliceHeightPx2 * mmPerPx });
1628
+ break;
1629
+ }
1630
+ const idealEndY = currentY + maxPageHeightPx;
1631
+ const minSearchY = currentY + Math.floor(maxPageHeightPx * 0.75);
1632
+ let chosenBreakY = null;
1633
+ for (let i = uniqueBreakPoints.length - 1; i >= 0; i--) {
1634
+ const bp = uniqueBreakPoints[i];
1635
+ if (bp <= idealEndY && bp >= minSearchY) {
1636
+ chosenBreakY = bp;
1637
+ break;
1638
+ }
1639
+ }
1640
+ if (!chosenBreakY) {
1641
+ chosenBreakY = findBlankRowInRange(idealEndY - 100, idealEndY);
1642
+ }
1643
+ const finalEndY = chosenBreakY && chosenBreakY > currentY + 100 ? chosenBreakY : idealEndY;
1644
+ const sliceHeightPx = finalEndY - currentY;
1645
+ const sliceCanvas = document.createElement("canvas");
1646
+ sliceCanvas.width = fullWidth;
1647
+ sliceCanvas.height = sliceHeightPx;
1648
+ const sCtx = sliceCanvas.getContext("2d");
1649
+ if (sCtx) {
1650
+ sCtx.fillStyle = bgColorHex;
1651
+ sCtx.fillRect(0, 0, fullWidth, sliceHeightPx);
1652
+ sCtx.drawImage(fullCanvas, 0, currentY, fullWidth, sliceHeightPx, 0, 0, fullWidth, sliceHeightPx);
1653
+ }
1654
+ pageCanvases.push({ canvas: sliceCanvas, heightMm: sliceHeightPx * mmPerPx });
1655
+ currentY = finalEndY;
1656
+ }
1657
+ const totalPages = pageCanvases.length;
1658
+ pageCanvases.forEach((pageItem, index) => {
1659
+ if (index > 0) {
1660
+ pdf.addPage();
1661
+ }
1662
+ pdf.setFillColor(bgR, bgG, bgB);
1663
+ pdf.rect(0, 0, pageWidth, pageHeight, "F");
1664
+ const imgData = pageItem.canvas.toDataURL("image/png");
1665
+ pdf.addImage(
1666
+ imgData,
1667
+ "PNG",
1668
+ marginLeft,
1669
+ marginTop,
1670
+ printableWidth,
1671
+ pageItem.heightMm,
1672
+ void 0,
1673
+ "FAST"
1674
+ );
1675
+ pdf.setFontSize(8);
1676
+ pdf.setTextColor(isDark ? 160 : 130, isDark ? 160 : 130, isDark ? 160 : 130);
1677
+ pdf.text(
1678
+ `Page ${index + 1} of ${totalPages} \u2022 Exported from Notiq`,
1679
+ pageWidth / 2,
1680
+ pageHeight - 8,
1681
+ { align: "center" }
1682
+ );
1683
+ });
1684
+ return pdf;
1685
+ }
1686
+ function ExportPlugin() {
1687
+ const [editor] = useLexicalComposerContext2();
1688
+ const [isModalOpen, setIsModalOpen] = useState2(false);
1689
+ const [modalTab, setModalTab] = useState2("export");
1690
+ const [initialFile, setInitialFile] = useState2(null);
1691
+ useEffect2(() => {
1692
+ const handleOpen = (e) => {
1693
+ var _a;
1694
+ const customEvent = e;
1695
+ setModalTab(((_a = customEvent.detail) == null ? void 0 : _a.defaultTab) || "export");
1696
+ setInitialFile(null);
1697
+ setIsModalOpen(true);
1698
+ };
1699
+ window.addEventListener("notiq:open-import-export", handleOpen);
1700
+ const unregister = editor.registerCommand(
1701
+ OPEN_IMPORT_EXPORT_MODAL_COMMAND,
1702
+ (payload) => {
1703
+ setModalTab((payload == null ? void 0 : payload.defaultTab) || "export");
1704
+ setInitialFile((payload == null ? void 0 : payload.initialFile) || null);
1705
+ setIsModalOpen(true);
1706
+ return true;
1707
+ },
1708
+ COMMAND_PRIORITY_LOW
1709
+ );
1710
+ return () => {
1711
+ window.removeEventListener("notiq:open-import-export", handleOpen);
1712
+ unregister();
1713
+ };
1714
+ }, [editor]);
1715
+ useEffect2(() => {
1716
+ const handleKeyDown = (e) => {
1717
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
1718
+ if (e.key === "E" || e.key === "e") {
1719
+ e.preventDefault();
1720
+ setModalTab("export");
1721
+ setInitialFile(null);
1722
+ setIsModalOpen(true);
1723
+ } else if (e.key === "I" || e.key === "i") {
1724
+ e.preventDefault();
1725
+ setModalTab("import");
1726
+ setInitialFile(null);
1727
+ setIsModalOpen(true);
1728
+ }
1729
+ }
1730
+ };
1731
+ window.addEventListener("keydown", handleKeyDown);
1732
+ return () => window.removeEventListener("keydown", handleKeyDown);
1733
+ }, []);
1734
+ useEffect2(() => {
1735
+ const rootElement = editor.getRootElement();
1736
+ if (!rootElement) return;
1737
+ const handleDragOver = (e) => {
1738
+ var _a;
1739
+ if ((_a = e.dataTransfer) == null ? void 0 : _a.types.includes("Files")) {
1740
+ e.preventDefault();
1741
+ }
1742
+ };
1743
+ const handleDrop = (e) => {
1744
+ var _a;
1745
+ const files = (_a = e.dataTransfer) == null ? void 0 : _a.files;
1746
+ if (!files || files.length === 0) return;
1747
+ const file = files[0];
1748
+ const name = file.name.toLowerCase();
1749
+ const isDocumentFile = name.endsWith(".md") || name.endsWith(".markdown") || name.endsWith(".html") || name.endsWith(".htm") || name.endsWith(".json") || name.endsWith(".lexical") || name.endsWith(".txt");
1750
+ if (isDocumentFile) {
1751
+ e.preventDefault();
1752
+ e.stopPropagation();
1753
+ setModalTab("import");
1754
+ setInitialFile(file);
1755
+ setIsModalOpen(true);
1756
+ }
1757
+ };
1758
+ rootElement.addEventListener("dragover", handleDragOver);
1759
+ rootElement.addEventListener("drop", handleDrop);
1760
+ return () => {
1761
+ rootElement.removeEventListener("dragover", handleDragOver);
1762
+ rootElement.removeEventListener("drop", handleDrop);
1763
+ };
1764
+ }, [editor]);
1765
+ useEffect2(() => {
1766
+ return editor.registerCommand(
1767
+ EXPORT_MARKDOWN_COMMAND,
1768
+ () => {
1769
+ try {
1770
+ editor.getEditorState().read(() => {
1771
+ const markdown = $convertToMarkdownString2(NOTIQ_TRANSFORMERS);
1772
+ const blob = new Blob([markdown], { type: "text/markdown;charset=utf-8" });
1773
+ const url = URL.createObjectURL(blob);
1774
+ const link = document.createElement("a");
1775
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1776
+ link.href = url;
1777
+ link.download = `document-${timestamp}.md`;
1778
+ link.click();
1779
+ URL.revokeObjectURL(url);
1780
+ toast2.success("Document exported as Markdown (.md)");
1781
+ });
1782
+ } catch (err) {
1783
+ console.error("[Notiq Export MD Error]:", err);
1784
+ toast2.error("Failed to export Markdown.");
1785
+ }
1786
+ return true;
1787
+ },
1788
+ COMMAND_PRIORITY_LOW
1789
+ );
1790
+ }, [editor]);
1791
+ useEffect2(() => {
1792
+ return editor.registerCommand(
1793
+ EXPORT_PDF_COMMAND,
1794
+ () => {
1795
+ const rootElement = editor.getRootElement();
1796
+ if (!rootElement) {
1797
+ toast2.error("Document content not found for PDF export.");
1798
+ return true;
1799
+ }
1800
+ const toastId = toast2.loading("Generating print-ready PDF...");
1801
+ generatePaginatedPDF(rootElement).then((pdf) => {
1802
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1803
+ pdf.save(`document-${timestamp}.pdf`);
1804
+ toast2.success("PDF document exported successfully!", { id: toastId });
1805
+ }).catch((err) => {
1806
+ console.error("[Notiq Export PDF Error]:", err);
1807
+ toast2.error("Failed to generate PDF. Please try again.", { id: toastId });
1808
+ });
1809
+ return true;
1810
+ },
1811
+ COMMAND_PRIORITY_LOW
1812
+ );
1813
+ }, [editor]);
1814
+ useEffect2(() => {
1815
+ return editor.registerCommand(
1816
+ EXPORT_HTML_COMMAND,
1817
+ () => {
1818
+ try {
1819
+ const htmlContent = exportEditorToHTML(editor);
1820
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1821
+ downloadHTML(htmlContent, `document-${timestamp}.html`);
1822
+ toast2.success("Standalone HTML document exported!");
1823
+ } catch (err) {
1824
+ console.error("[Notiq Export HTML Error]:", err);
1825
+ toast2.error("Failed to export HTML.");
1826
+ }
1827
+ return true;
1828
+ },
1829
+ COMMAND_PRIORITY_LOW
1830
+ );
1831
+ }, [editor]);
1832
+ useEffect2(() => {
1833
+ return editor.registerCommand(
1834
+ EXPORT_JSON_COMMAND,
1835
+ () => {
1836
+ try {
1837
+ editor.getEditorState().read(() => {
1838
+ const jsonStr = JSON.stringify(editor.getEditorState().toJSON(), null, 2);
1839
+ const blob = new Blob([jsonStr], { type: "application/json;charset=utf-8" });
1840
+ const url = URL.createObjectURL(blob);
1841
+ const link = document.createElement("a");
1842
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1843
+ link.href = url;
1844
+ link.download = `document-backup-${timestamp}.json`;
1845
+ link.click();
1846
+ URL.revokeObjectURL(url);
1847
+ toast2.success("Document state exported as JSON (.json)");
1848
+ });
1849
+ } catch (err) {
1850
+ console.error("[Notiq Export JSON Error]:", err);
1851
+ toast2.error("Failed to export JSON state.");
1852
+ }
1853
+ return true;
1854
+ },
1855
+ COMMAND_PRIORITY_LOW
1856
+ );
1857
+ }, [editor]);
1858
+ useEffect2(() => {
1859
+ return editor.registerCommand(
1860
+ EXPORT_TEXT_COMMAND,
1861
+ () => {
1862
+ try {
1863
+ editor.getEditorState().read(() => {
1864
+ const text = $getRoot4().getTextContent();
1865
+ const blob = new Blob([text], { type: "text/plain;charset=utf-8" });
1866
+ const url = URL.createObjectURL(blob);
1867
+ const link = document.createElement("a");
1868
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1869
+ link.href = url;
1870
+ link.download = `document-${timestamp}.txt`;
1871
+ link.click();
1872
+ URL.revokeObjectURL(url);
1873
+ toast2.success("Document exported as Plain Text (.txt)");
1874
+ });
1875
+ } catch (err) {
1876
+ console.error("[Notiq Export Text Error]:", err);
1877
+ toast2.error("Failed to export plain text.");
1878
+ }
1879
+ return true;
1880
+ },
1881
+ COMMAND_PRIORITY_LOW
1882
+ );
1883
+ }, [editor]);
1884
+ useEffect2(() => {
1885
+ return editor.registerCommand(
1886
+ IMPORT_MARKDOWN_COMMAND,
1887
+ ({ content, mode }) => {
1888
+ try {
1889
+ importMarkdownToEditor(editor, content, mode || "replace");
1890
+ toast2.success("Markdown content imported successfully");
1891
+ } catch (err) {
1892
+ console.error("[Notiq Import Markdown Error]:", err);
1893
+ toast2.error("Failed to import Markdown.");
1894
+ }
1895
+ return true;
1896
+ },
1897
+ COMMAND_PRIORITY_LOW
1898
+ );
1899
+ }, [editor]);
1900
+ useEffect2(() => {
1901
+ return editor.registerCommand(
1902
+ IMPORT_HTML_COMMAND,
1903
+ ({ content, mode }) => {
1904
+ try {
1905
+ importHTMLToEditor(editor, content, mode || "replace");
1906
+ toast2.success("HTML content imported successfully");
1907
+ } catch (err) {
1908
+ console.error("[Notiq Import HTML Error]:", err);
1909
+ toast2.error("Failed to import HTML.");
1910
+ }
1911
+ return true;
1912
+ },
1913
+ COMMAND_PRIORITY_LOW
1914
+ );
1915
+ }, [editor]);
1916
+ useEffect2(() => {
1917
+ return editor.registerCommand(
1918
+ IMPORT_JSON_COMMAND,
1919
+ ({ content }) => {
1920
+ try {
1921
+ importJSONToEditor(editor, content);
1922
+ toast2.success("Document JSON state imported successfully");
1923
+ } catch (err) {
1924
+ console.error("[Notiq Import JSON Error]:", err);
1925
+ toast2.error("Failed to import JSON state.");
1926
+ }
1927
+ return true;
1928
+ },
1929
+ COMMAND_PRIORITY_LOW
1930
+ );
1931
+ }, [editor]);
1932
+ useEffect2(() => {
1933
+ return editor.registerCommand(
1934
+ IMPORT_TEXT_COMMAND,
1935
+ ({ content, mode }) => {
1936
+ try {
1937
+ importPlainTextToEditor(editor, content, mode || "replace");
1938
+ toast2.success("Plain text imported successfully");
1939
+ } catch (err) {
1940
+ console.error("[Notiq Import Text Error]:", err);
1941
+ toast2.error("Failed to import plain text.");
1942
+ }
1943
+ return true;
1944
+ },
1945
+ COMMAND_PRIORITY_LOW
1946
+ );
1947
+ }, [editor]);
1948
+ return /* @__PURE__ */ jsx2(
1949
+ ImportExportModal,
1950
+ {
1951
+ isOpen: isModalOpen,
1952
+ onClose: () => {
1953
+ setIsModalOpen(false);
1954
+ setInitialFile(null);
1955
+ },
1956
+ defaultTab: modalTab,
1957
+ initialImportFile: initialFile
1958
+ }
1959
+ );
1960
+ }
1961
+
1962
+ export {
1963
+ exportEditorToHTML,
1964
+ downloadHTML,
1965
+ detectContentFormat,
1966
+ importContentToEditor,
1967
+ EXPORT_MARKDOWN_COMMAND,
1968
+ EXPORT_PDF_COMMAND,
1969
+ EXPORT_HTML_COMMAND,
1970
+ EXPORT_JSON_COMMAND,
1971
+ EXPORT_TEXT_COMMAND,
1972
+ OPEN_IMPORT_EXPORT_MODAL_COMMAND,
1973
+ IMPORT_MARKDOWN_COMMAND,
1974
+ IMPORT_HTML_COMMAND,
1975
+ IMPORT_JSON_COMMAND,
1976
+ IMPORT_TEXT_COMMAND,
1977
+ ExportPlugin
1978
+ };