@scottjgilbert/lexical-blog-editor 0.1.4 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/README.md +73 -67
  2. package/build/Editor.d.ts +8 -3
  3. package/build/Editor.d.ts.map +1 -1
  4. package/build/Editor.js +13 -8
  5. package/build/EditorExport.d.ts +4 -0
  6. package/build/EditorExport.d.ts.map +1 -0
  7. package/build/EditorExport.js +13 -0
  8. package/build/appSettings.d.ts +1 -1
  9. package/build/appSettings.js +1 -1
  10. package/build/buildHTMLConfig.d.ts +1 -1
  11. package/build/buildHTMLConfig.d.ts.map +1 -1
  12. package/build/buildHTMLConfig.js +35 -11
  13. package/build/context/FlashMessageContext.d.ts +2 -2
  14. package/build/context/FlashMessageContext.d.ts.map +1 -1
  15. package/build/context/FlashMessageContext.js +4 -3
  16. package/build/context/SharedHistoryContext.d.ts +3 -3
  17. package/build/context/SharedHistoryContext.d.ts.map +1 -1
  18. package/build/context/SharedHistoryContext.js +3 -2
  19. package/build/context/ToolbarContext.d.ts +1 -0
  20. package/build/context/ToolbarContext.d.ts.map +1 -1
  21. package/build/context/ToolbarContext.js +2 -0
  22. package/build/hooks/useModal.d.ts.map +1 -1
  23. package/build/hooks/useModal.js +1 -0
  24. package/build/hooks/useReport.d.ts +0 -7
  25. package/build/hooks/useReport.d.ts.map +1 -1
  26. package/build/hooks/useReport.js +1 -0
  27. package/build/index.css +283 -246
  28. package/build/index.d.ts +3 -3
  29. package/build/index.d.ts.map +1 -1
  30. package/build/index.js +2 -2
  31. package/build/nodes/CodeNode/CodeHighlightNode.d.ts +35 -0
  32. package/build/nodes/CodeNode/CodeHighlightNode.d.ts.map +1 -0
  33. package/build/nodes/CodeNode/CodeHighlightNode.js +88 -0
  34. package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts +22 -0
  35. package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts.map +1 -0
  36. package/build/nodes/CodeNode/CodeHighlighterShiki.js +644 -0
  37. package/build/nodes/CodeNode/CodeNode.d.ts +48 -0
  38. package/build/nodes/CodeNode/CodeNode.d.ts.map +1 -0
  39. package/build/nodes/CodeNode/CodeNode.js +367 -0
  40. package/build/nodes/CodeNode/FacadeShiki.d.ts +18 -0
  41. package/build/nodes/CodeNode/FacadeShiki.d.ts.map +1 -0
  42. package/build/nodes/CodeNode/FacadeShiki.js +159 -0
  43. package/build/nodes/CodeNode/FlatStructureUtils.d.ts +21 -0
  44. package/build/nodes/CodeNode/FlatStructureUtils.d.ts.map +1 -0
  45. package/build/nodes/CodeNode/FlatStructureUtils.js +85 -0
  46. package/build/nodes/CodeNode/invariant.d.ts +2 -0
  47. package/build/nodes/CodeNode/invariant.d.ts.map +1 -0
  48. package/build/nodes/CodeNode/invariant.js +6 -0
  49. package/build/nodes/DateTimeNode/DateTimeComponent.d.ts.map +1 -1
  50. package/build/nodes/DateTimeNode/DateTimeComponent.js +1 -0
  51. package/build/nodes/DateTimeNode/DateTimeNode.css +21 -0
  52. package/build/nodes/FigmaNode/FigmaNode.d.ts.map +1 -0
  53. package/build/nodes/FigmaNode/ServerFigmaNode.d.ts +21 -0
  54. package/build/nodes/FigmaNode/ServerFigmaNode.d.ts.map +1 -0
  55. package/build/nodes/FigmaNode/ServerFigmaNode.js +48 -0
  56. package/build/nodes/ImageComponent.d.ts.map +1 -1
  57. package/build/nodes/ImageComponent.js +1 -2
  58. package/build/nodes/ImageNode.d.ts +7 -7
  59. package/build/nodes/ImageNode.d.ts.map +1 -1
  60. package/build/nodes/ImageNode.js +30 -30
  61. package/build/nodes/LayoutContainerNode.d.ts +2 -2
  62. package/build/nodes/LayoutContainerNode.d.ts.map +1 -1
  63. package/build/nodes/LayoutContainerNode.js +10 -10
  64. package/build/nodes/PlaygroundNodes/PlaygroundNodes.d.ts.map +1 -0
  65. package/build/nodes/{PlaygroundNodes.js → PlaygroundNodes/PlaygroundNodes.js} +19 -21
  66. package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts +11 -0
  67. package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts.map +1 -0
  68. package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.js +65 -0
  69. package/build/nodes/TweetNode/ServerTweetNode.d.ts +20 -0
  70. package/build/nodes/TweetNode/ServerTweetNode.d.ts.map +1 -0
  71. package/build/nodes/TweetNode/ServerTweetNode.js +59 -0
  72. package/build/nodes/TweetNode/TweetNode.d.ts.map +1 -0
  73. package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts +21 -0
  74. package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts.map +1 -0
  75. package/build/nodes/YouTubeNode/ServerYouTubeNode.js +67 -0
  76. package/build/nodes/YouTubeNode/YouTubeNode.d.ts.map +1 -0
  77. package/build/plugins/ActionsPlugin/index.d.ts +0 -7
  78. package/build/plugins/ActionsPlugin/index.d.ts.map +1 -1
  79. package/build/plugins/ActionsPlugin/index.js +2 -1
  80. package/build/plugins/AutoEmbedPlugin/index.d.ts +2 -9
  81. package/build/plugins/AutoEmbedPlugin/index.d.ts.map +1 -1
  82. package/build/plugins/AutoEmbedPlugin/index.js +30 -29
  83. package/build/plugins/AutoLinkPlugin/index.d.ts +1 -1
  84. package/build/plugins/AutoLinkPlugin/index.d.ts.map +1 -1
  85. package/build/plugins/AutoLinkPlugin/index.js +3 -2
  86. package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +1 -1
  87. package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts.map +1 -1
  88. package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +7 -6
  89. package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +2 -2
  90. package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts.map +1 -1
  91. package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +25 -24
  92. package/build/plugins/CodeActionMenuPlugin/index.d.ts +2 -9
  93. package/build/plugins/CodeActionMenuPlugin/index.d.ts.map +1 -1
  94. package/build/plugins/CodeActionMenuPlugin/index.js +22 -20
  95. package/build/plugins/CodeActionMenuPlugin/utils.d.ts.map +1 -1
  96. package/build/plugins/CodeActionMenuPlugin/utils.js +3 -2
  97. package/build/plugins/CodeHighlightPrismPlugin/index.d.ts +1 -1
  98. package/build/plugins/CodeHighlightPrismPlugin/index.d.ts.map +1 -1
  99. package/build/plugins/CodeHighlightPrismPlugin/index.js +4 -10
  100. package/build/plugins/CodeHighlightShikiPlugin/index.d.ts +1 -1
  101. package/build/plugins/CodeHighlightShikiPlugin/index.d.ts.map +1 -1
  102. package/build/plugins/CodeHighlightShikiPlugin/index.js +3 -3
  103. package/build/plugins/CollapsiblePlugin/Collapsible.css +17 -1
  104. package/build/plugins/CollapsiblePlugin/index.d.ts +1 -1
  105. package/build/plugins/CollapsiblePlugin/index.d.ts.map +1 -1
  106. package/build/plugins/CollapsiblePlugin/index.js +11 -10
  107. package/build/plugins/ComponentPickerPlugin/index.d.ts.map +1 -1
  108. package/build/plugins/ComponentPickerPlugin/index.js +3 -8
  109. package/build/plugins/ContextMenuPlugin/index.d.ts +1 -1
  110. package/build/plugins/ContextMenuPlugin/index.d.ts.map +1 -1
  111. package/build/plugins/ContextMenuPlugin/index.js +15 -14
  112. package/build/plugins/DateTimePlugin/index.d.ts +2 -2
  113. package/build/plugins/DateTimePlugin/index.d.ts.map +1 -1
  114. package/build/plugins/DateTimePlugin/index.js +8 -14
  115. package/build/plugins/DragDropPastePlugin/index.d.ts +0 -7
  116. package/build/plugins/DragDropPastePlugin/index.d.ts.map +1 -1
  117. package/build/plugins/DragDropPastePlugin/index.js +12 -11
  118. package/build/plugins/DraggableBlockPlugin/index.css +6 -0
  119. package/build/plugins/DraggableBlockPlugin/index.d.ts +2 -2
  120. package/build/plugins/DraggableBlockPlugin/index.d.ts.map +1 -1
  121. package/build/plugins/DraggableBlockPlugin/index.js +23 -22
  122. package/build/plugins/EmojiPickerPlugin/index.d.ts +0 -7
  123. package/build/plugins/EmojiPickerPlugin/index.d.ts.map +1 -1
  124. package/build/plugins/EmojiPickerPlugin/index.js +1 -0
  125. package/build/plugins/EmojisPlugin/index.d.ts +1 -8
  126. package/build/plugins/EmojisPlugin/index.d.ts.map +1 -1
  127. package/build/plugins/EmojisPlugin/index.js +10 -16
  128. package/build/plugins/EquationsPlugin/index.d.ts +3 -3
  129. package/build/plugins/EquationsPlugin/index.d.ts.map +1 -1
  130. package/build/plugins/EquationsPlugin/index.js +14 -10
  131. package/build/plugins/FigmaPlugin/index.d.ts +2 -2
  132. package/build/plugins/FigmaPlugin/index.d.ts.map +1 -1
  133. package/build/plugins/FigmaPlugin/index.js +8 -14
  134. package/build/plugins/FloatingLinkEditorPlugin/index.css +11 -0
  135. package/build/plugins/FloatingLinkEditorPlugin/index.d.ts +3 -3
  136. package/build/plugins/FloatingLinkEditorPlugin/index.d.ts.map +1 -1
  137. package/build/plugins/FloatingLinkEditorPlugin/index.js +28 -27
  138. package/build/plugins/FloatingTextFormatToolbarPlugin/index.css +15 -0
  139. package/build/plugins/FloatingTextFormatToolbarPlugin/index.d.ts.map +1 -1
  140. package/build/plugins/FloatingTextFormatToolbarPlugin/index.js +2 -1
  141. package/build/plugins/ImagesPlugin/index.d.ts +3 -3
  142. package/build/plugins/ImagesPlugin/index.d.ts.map +1 -1
  143. package/build/plugins/ImagesPlugin/index.js +38 -37
  144. package/build/plugins/KeywordsPlugin/index.d.ts +1 -8
  145. package/build/plugins/KeywordsPlugin/index.d.ts.map +1 -1
  146. package/build/plugins/KeywordsPlugin/index.js +6 -12
  147. package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +2 -2
  148. package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts.map +1 -1
  149. package/build/plugins/LayoutPlugin/InsertLayoutDialog.js +10 -9
  150. package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts +1 -1
  151. package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts.map +1 -1
  152. package/build/plugins/LayoutPlugin/LayoutPlugin.js +8 -14
  153. package/build/plugins/LinkPlugin/index.d.ts.map +1 -1
  154. package/build/plugins/LinkPlugin/index.js +1 -0
  155. package/build/plugins/MarkdownShortcutPlugin/index.d.ts.map +1 -1
  156. package/build/plugins/MarkdownShortcutPlugin/index.js +1 -0
  157. package/build/plugins/MarkdownTransformers/index.d.ts +1 -1
  158. package/build/plugins/MarkdownTransformers/index.d.ts.map +1 -1
  159. package/build/plugins/MarkdownTransformers/index.js +25 -25
  160. package/build/plugins/PasteLogPlugin/index.d.ts.map +1 -1
  161. package/build/plugins/PasteLogPlugin/index.js +1 -0
  162. package/build/plugins/ShortcutsPlugin/index.d.ts +0 -7
  163. package/build/plugins/ShortcutsPlugin/index.d.ts.map +1 -1
  164. package/build/plugins/ShortcutsPlugin/index.js +1 -0
  165. package/build/plugins/SpeechToTextPlugin/index.d.ts +2 -2
  166. package/build/plugins/SpeechToTextPlugin/index.d.ts.map +1 -1
  167. package/build/plugins/SpeechToTextPlugin/index.js +7 -11
  168. package/build/plugins/TabFocusPlugin/index.d.ts +0 -7
  169. package/build/plugins/TabFocusPlugin/index.d.ts.map +1 -1
  170. package/build/plugins/TabFocusPlugin/index.js +6 -5
  171. package/build/plugins/TableActionMenuPlugin/index.d.ts +1 -8
  172. package/build/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  173. package/build/plugins/TableActionMenuPlugin/index.js +41 -40
  174. package/build/plugins/TableCellResizer/index.d.ts +2 -2
  175. package/build/plugins/TableCellResizer/index.d.ts.map +1 -1
  176. package/build/plugins/TableCellResizer/index.js +43 -42
  177. package/build/plugins/TableHoverActionsPlugin/index.d.ts +1 -8
  178. package/build/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  179. package/build/plugins/TableHoverActionsPlugin/index.js +19 -18
  180. package/build/plugins/TableHoverActionsV2Plugin/index.d.ts.map +1 -1
  181. package/build/plugins/TableHoverActionsV2Plugin/index.js +1 -0
  182. package/build/plugins/TablePlugin.d.ts +2 -2
  183. package/build/plugins/TablePlugin.d.ts.map +1 -1
  184. package/build/plugins/TablePlugin.js +11 -10
  185. package/build/plugins/TableScrollShadowPlugin/index.d.ts +0 -7
  186. package/build/plugins/TableScrollShadowPlugin/index.d.ts.map +1 -1
  187. package/build/plugins/TableScrollShadowPlugin/index.js +9 -8
  188. package/build/plugins/TestRecorderPlugin/index.d.ts +1 -8
  189. package/build/plugins/TestRecorderPlugin/index.d.ts.map +1 -1
  190. package/build/plugins/TestRecorderPlugin/index.js +45 -44
  191. package/build/plugins/ToolbarPlugin/fontSize.d.ts +2 -2
  192. package/build/plugins/ToolbarPlugin/fontSize.d.ts.map +1 -1
  193. package/build/plugins/ToolbarPlugin/fontSize.js +19 -18
  194. package/build/plugins/ToolbarPlugin/index.d.ts.map +1 -1
  195. package/build/plugins/ToolbarPlugin/index.js +68 -60
  196. package/build/plugins/ToolbarPlugin/languages.d.ts +14 -0
  197. package/build/plugins/ToolbarPlugin/languages.d.ts.map +1 -0
  198. package/build/plugins/ToolbarPlugin/languages.js +185 -0
  199. package/build/plugins/ToolbarPlugin/utils.d.ts +2 -2
  200. package/build/plugins/ToolbarPlugin/utils.js +21 -21
  201. package/build/plugins/TwitterPlugin/index.d.ts +2 -2
  202. package/build/plugins/TwitterPlugin/index.d.ts.map +1 -1
  203. package/build/plugins/TwitterPlugin/index.js +8 -14
  204. package/build/plugins/YouTubePlugin/index.d.ts +2 -2
  205. package/build/plugins/YouTubePlugin/index.d.ts.map +1 -1
  206. package/build/plugins/YouTubePlugin/index.js +8 -14
  207. package/build/themes/PlaygroundEditorTheme.css +301 -33
  208. package/build/themes/ViewerTheme.css +899 -0
  209. package/build/{plugins/MentionsPlugin/index.d.ts → themes/ViewerTheme.d.ts} +5 -3
  210. package/build/themes/ViewerTheme.d.ts.map +1 -0
  211. package/build/themes/ViewerTheme.js +124 -0
  212. package/build/themes/ViewerThemeComplete.css +1043 -0
  213. package/build/ui/ColorPicker.d.ts +2 -2
  214. package/build/ui/ColorPicker.d.ts.map +1 -1
  215. package/build/ui/ColorPicker.js +47 -46
  216. package/build/ui/DropDown.d.ts.map +1 -1
  217. package/build/ui/DropDown.js +1 -0
  218. package/build/ui/FlashMessage.d.ts +3 -3
  219. package/build/ui/FlashMessage.d.ts.map +1 -1
  220. package/build/ui/FlashMessage.js +3 -2
  221. package/build/ui/ImageResizer.d.ts +3 -3
  222. package/build/ui/ImageResizer.d.ts.map +1 -1
  223. package/build/ui/ImageResizer.js +20 -19
  224. package/build/ui/KatexEquationAlterer.css +3 -1
  225. package/build/ui/KatexEquationAlterer.d.ts.map +1 -1
  226. package/build/ui/KatexEquationAlterer.js +1 -0
  227. package/build/ui/KatexRenderer.d.ts.map +1 -1
  228. package/build/ui/KatexRenderer.js +1 -0
  229. package/build/ui/Modal.d.ts.map +1 -1
  230. package/build/ui/Modal.js +1 -0
  231. package/build/ui/Switch.d.ts +2 -2
  232. package/build/ui/Switch.d.ts.map +1 -1
  233. package/build/ui/Switch.js +3 -2
  234. package/build/ui/TextInput.d.ts.map +1 -1
  235. package/build/ui/TextInput.js +1 -0
  236. package/build/utils/ServerBlockWithAlignableContents.d.ts +22 -0
  237. package/build/utils/ServerBlockWithAlignableContents.d.ts.map +1 -0
  238. package/build/utils/ServerBlockWithAlignableContents.js +6 -0
  239. package/build/utils/focusUtils.d.ts.map +1 -1
  240. package/build/utils/focusUtils.js +4 -3
  241. package/build/utils/getDOMRangeRect.d.ts.map +1 -1
  242. package/build/utils/getDOMRangeRect.js +1 -0
  243. package/build/utils/setFloatingElemPosition.d.ts.map +1 -1
  244. package/build/utils/setFloatingElemPosition.js +5 -4
  245. package/build/utils/swipe.d.ts +0 -7
  246. package/build/utils/swipe.d.ts.map +1 -1
  247. package/build/utils/swipe.js +5 -11
  248. package/build/viewer/Viewer.d.ts +18 -0
  249. package/build/viewer/Viewer.d.ts.map +1 -0
  250. package/build/viewer/Viewer.js +105 -0
  251. package/build/viewer/client.d.ts +18 -0
  252. package/build/viewer/client.d.ts.map +1 -0
  253. package/build/viewer/client.js +97 -0
  254. package/build/viewer/index.d.ts +4 -0
  255. package/build/viewer/index.d.ts.map +1 -0
  256. package/build/viewer/index.js +2 -0
  257. package/package.json +58 -36
  258. package/build/collaboration.d.ts +0 -12
  259. package/build/collaboration.d.ts.map +0 -1
  260. package/build/collaboration.js +0 -32
  261. package/build/nodes/FigmaNode.d.ts.map +0 -1
  262. package/build/nodes/PageBreakNode/index.css +0 -64
  263. package/build/nodes/PageBreakNode/index.d.ts +0 -25
  264. package/build/nodes/PageBreakNode/index.d.ts.map +0 -1
  265. package/build/nodes/PageBreakNode/index.js +0 -83
  266. package/build/nodes/PlaygroundNodes.d.ts.map +0 -1
  267. package/build/nodes/PollComponent.d.ts +0 -17
  268. package/build/nodes/PollComponent.d.ts.map +0 -1
  269. package/build/nodes/PollComponent.js +0 -85
  270. package/build/nodes/PollNode.css +0 -165
  271. package/build/nodes/PollNode.d.ts +0 -51
  272. package/build/nodes/PollNode.d.ts.map +0 -1
  273. package/build/nodes/PollNode.js +0 -153
  274. package/build/nodes/StickyComponent.d.ts +0 -18
  275. package/build/nodes/StickyComponent.d.ts.map +0 -1
  276. package/build/nodes/StickyComponent.js +0 -155
  277. package/build/nodes/StickyNode.css +0 -37
  278. package/build/nodes/StickyNode.d.ts +0 -39
  279. package/build/nodes/StickyNode.d.ts.map +0 -1
  280. package/build/nodes/StickyNode.js +0 -66
  281. package/build/nodes/TweetNode.d.ts.map +0 -1
  282. package/build/nodes/YouTubeNode.d.ts.map +0 -1
  283. package/build/plugins/DocsPlugin/index.d.ts +0 -10
  284. package/build/plugins/DocsPlugin/index.d.ts.map +0 -1
  285. package/build/plugins/DocsPlugin/index.js +0 -4
  286. package/build/plugins/MaxLengthPlugin/index.d.ts +0 -11
  287. package/build/plugins/MaxLengthPlugin/index.d.ts.map +0 -1
  288. package/build/plugins/MaxLengthPlugin/index.js +0 -44
  289. package/build/plugins/MentionsPlugin/index.d.ts.map +0 -1
  290. package/build/plugins/MentionsPlugin/index.js +0 -562
  291. package/build/plugins/PageBreakPlugin/index.d.ts +0 -12
  292. package/build/plugins/PageBreakPlugin/index.d.ts.map +0 -1
  293. package/build/plugins/PageBreakPlugin/index.js +0 -34
  294. package/build/plugins/StickyPlugin/index.d.ts +0 -10
  295. package/build/plugins/StickyPlugin/index.d.ts.map +0 -1
  296. package/build/plugins/StickyPlugin/index.js +0 -19
  297. package/build/plugins/TreeViewPlugin/index.d.ts +0 -10
  298. package/build/plugins/TreeViewPlugin/index.d.ts.map +0 -1
  299. package/build/plugins/TreeViewPlugin/index.js +0 -7
  300. package/build/plugins/TypingPerfPlugin/index.d.ts +0 -10
  301. package/build/plugins/TypingPerfPlugin/index.d.ts.map +0 -1
  302. package/build/plugins/TypingPerfPlugin/index.js +0 -100
  303. package/build/plugins/VersionsPlugin/index.css +0 -57
  304. package/build/plugins/VersionsPlugin/index.d.ts +0 -14
  305. package/build/plugins/VersionsPlugin/index.d.ts.map +0 -1
  306. package/build/plugins/VersionsPlugin/index.js +0 -147
  307. /package/build/nodes/{FigmaNode.d.ts → FigmaNode/FigmaNode.d.ts} +0 -0
  308. /package/build/nodes/{FigmaNode.js → FigmaNode/FigmaNode.js} +0 -0
  309. /package/build/nodes/{PlaygroundNodes.d.ts → PlaygroundNodes/PlaygroundNodes.d.ts} +0 -0
  310. /package/build/nodes/{TweetNode.d.ts → TweetNode/TweetNode.d.ts} +0 -0
  311. /package/build/nodes/{TweetNode.js → TweetNode/TweetNode.js} +0 -0
  312. /package/build/nodes/{YouTubeNode.d.ts → YouTubeNode/YouTubeNode.d.ts} +0 -0
  313. /package/build/nodes/{YouTubeNode.js → YouTubeNode/YouTubeNode.js} +0 -0
@@ -1,22 +1,24 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import './index.css';
3
- import { $isCodeNode, CodeNode, getLanguageFriendlyName, normalizeCodeLang, } from '@lexical/code';
4
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
- import { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';
6
- import { useEffect, useRef, useState } from 'react';
7
- import { createPortal } from 'react-dom';
8
- import { CopyButton } from './components/CopyButton';
9
- import { canBePrettier, PrettierButton } from './components/PrettierButton';
10
- import { useDebounce } from './utils';
3
+ import "./index.css";
4
+ import { $isCodeNode, CodeNode } from "../../nodes/CodeNode/CodeNode";
5
+ import { getLanguageFriendlyName, normalizeCodeLang } from "@lexical/code";
6
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
7
+ import { $getNearestNodeFromDOMNode, isHTMLElement } from "lexical";
8
+ import { useEffect, useRef, useState } from "react";
9
+ import { createPortal } from "react-dom";
10
+ import { CopyButton } from "./components/CopyButton";
11
+ import { canBePrettier, PrettierButton } from "./components/PrettierButton";
12
+ import { useDebounce } from "./utils";
11
13
  const CODE_PADDING = 8;
12
14
  function CodeActionMenuContainer({ anchorElem, }) {
13
15
  const [editor] = useLexicalComposerContext();
14
- const [lang, setLang] = useState('');
16
+ const [lang, setLang] = useState("");
15
17
  const [isShown, setShown] = useState(false);
16
18
  const [shouldListenMouseMove, setShouldListenMouseMove] = useState(false);
17
19
  const [position, setPosition] = useState({
18
- right: '0',
19
- top: '0',
20
+ right: "0",
21
+ top: "0",
20
22
  });
21
23
  const codeSetRef = useRef(new Set());
22
24
  const codeDOMNodeRef = useRef(null);
@@ -34,12 +36,12 @@ function CodeActionMenuContainer({ anchorElem, }) {
34
36
  }
35
37
  codeDOMNodeRef.current = codeDOMNode;
36
38
  let codeNode = null;
37
- let _lang = '';
39
+ let _lang = "";
38
40
  editor.update(() => {
39
41
  const maybeCodeNode = $getNearestNodeFromDOMNode(codeDOMNode);
40
42
  if ($isCodeNode(maybeCodeNode)) {
41
43
  codeNode = maybeCodeNode;
42
- _lang = codeNode.getLanguage() || '';
44
+ _lang = codeNode.getLanguage() || "";
43
45
  }
44
46
  });
45
47
  if (codeNode) {
@@ -57,11 +59,11 @@ function CodeActionMenuContainer({ anchorElem, }) {
57
59
  if (!shouldListenMouseMove) {
58
60
  return;
59
61
  }
60
- document.addEventListener('mousemove', debouncedOnMouseMove);
62
+ document.addEventListener("mousemove", debouncedOnMouseMove);
61
63
  return () => {
62
64
  setShown(false);
63
65
  debouncedOnMouseMove.cancel();
64
- document.removeEventListener('mousemove', debouncedOnMouseMove);
66
+ document.removeEventListener("mousemove", debouncedOnMouseMove);
65
67
  };
66
68
  }, [shouldListenMouseMove, debouncedOnMouseMove]);
67
69
  useEffect(() => {
@@ -69,10 +71,10 @@ function CodeActionMenuContainer({ anchorElem, }) {
69
71
  editor.getEditorState().read(() => {
70
72
  for (const [key, type] of mutations) {
71
73
  switch (type) {
72
- case 'created':
74
+ case "created":
73
75
  codeSetRef.current.add(key);
74
76
  break;
75
- case 'destroyed':
77
+ case "destroyed":
76
78
  codeSetRef.current.delete(key);
77
79
  break;
78
80
  default:
@@ -90,9 +92,9 @@ function CodeActionMenuContainer({ anchorElem, }) {
90
92
  function getMouseInfo(event) {
91
93
  const target = event.target;
92
94
  if (isHTMLElement(target)) {
93
- const codeDOMNode = target.closest('code.PlaygroundEditorTheme__code');
95
+ const codeDOMNode = target.closest("code.PlaygroundEditorTheme__code");
94
96
  const isOutside = !(codeDOMNode ||
95
- target.closest('div.code-action-menu-container'));
97
+ target.closest("div.code-action-menu-container"));
96
98
  return { codeDOMNode, isOutside };
97
99
  }
98
100
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeActionMenuPlugin/utils.ts"],"names":[],"mappings":"AAUA,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAC9D,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,4CAQA,UAAU,CAAC,CAAC,CAAC,WAU9B"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeActionMenuPlugin/utils.ts"],"names":[],"mappings":"AAYA,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAC9D,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,MAAM,4CAQA,UAAU,CAAC,CAAC,CAAC,WAU9B"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /**
2
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
4
  *
@@ -5,8 +6,8 @@
5
6
  * LICENSE file in the root directory of this source tree.
6
7
  *
7
8
  */
8
- import { debounce } from 'lodash-es';
9
- import { useMemo, useRef } from 'react';
9
+ import { debounce } from "lodash-es";
10
+ import { useMemo, useRef } from "react";
10
11
  export function useDebounce(fn, ms, maxWait) {
11
12
  const funcRef = useRef(null);
12
13
  funcRef.current = fn;
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { JSX } from 'react';
8
+ import type { JSX } from "react";
9
9
  export default function CodeHighlightPrismPlugin(): JSX.Element | null;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeHighlightPrismPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAM/B,MAAM,CAAC,OAAO,UAAU,wBAAwB,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAQrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeHighlightPrismPlugin/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjC,MAAM,CAAC,OAAO,UAAU,wBAAwB,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAQrE"}
@@ -1,13 +1,7 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { registerCodeHighlighting } from '@lexical/code';
9
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { useEffect } from 'react';
1
+ "use client";
2
+ import { registerCodeHighlighting } from "@lexical/code";
3
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
4
+ import { useEffect } from "react";
11
5
  export default function CodeHighlightPrismPlugin() {
12
6
  const [editor] = useLexicalComposerContext();
13
7
  useEffect(() => {
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { JSX } from 'react';
8
+ import type { JSX } from "react";
9
9
  export default function CodeHighlightShikiPlugin(): JSX.Element | null;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeHighlightShikiPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAM/B,MAAM,CAAC,OAAO,UAAU,wBAAwB,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAQrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CodeHighlightShikiPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjC,MAAM,CAAC,OAAO,UAAU,wBAAwB,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAQrE"}
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { registerCodeHighlighting } from '@lexical/code-shiki';
9
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { useEffect } from 'react';
8
+ import { registerCodeHighlighting } from "../../nodes/CodeNode/CodeHighlighterShiki";
9
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
10
+ import { useEffect } from "react";
11
11
  export default function CodeHighlightShikiPlugin() {
12
12
  const [editor] = useLexicalComposerContext();
13
13
  useEffect(() => {
@@ -34,7 +34,7 @@
34
34
  border-width: 4px 6px 4px 6px;
35
35
  border-left-color: #000;
36
36
  display: block;
37
- content: '';
37
+ content: "";
38
38
  position: absolute;
39
39
  left: 7px;
40
40
  top: 50%;
@@ -55,3 +55,19 @@
55
55
  display: none;
56
56
  user-select: none;
57
57
  }
58
+
59
+ @media (prefers-color-scheme: dark) {
60
+ .Collapsible__container {
61
+ background: #2a2a2a;
62
+ border: 1px solid #444;
63
+ }
64
+ .Collapsible__title {
65
+ color: #ddd;
66
+ }
67
+ .Collapsible__title:before {
68
+ border-left-color: #ddd;
69
+ }
70
+ .Collapsible__container[open] > .Collapsible__title:before {
71
+ border-top-color: #ddd;
72
+ }
73
+ }
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import './Collapsible.css';
8
+ import "./Collapsible.css";
9
9
  export declare const INSERT_COLLAPSIBLE_COMMAND: import("lexical").LexicalCommand<void>;
10
10
  export default function CollapsiblePlugin(): null;
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CollapsiblePlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,mBAAmB,CAAC;AAsC3B,eAAO,MAAM,0BAA0B,wCAEtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,IAAI,CAiMhD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/CollapsiblePlugin/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,mBAAmB,CAAC;AAsC3B,eAAO,MAAM,0BAA0B,wCAEtC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,IAAI,CAiMhD"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /**
2
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
4
  *
@@ -5,15 +6,15 @@
5
6
  * LICENSE file in the root directory of this source tree.
6
7
  *
7
8
  */
8
- import './Collapsible.css';
9
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { $findMatchingParent, $insertNodeToNearestRoot, mergeRegister, } from '@lexical/utils';
11
- import { $createParagraphNode, $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, createCommand, INSERT_PARAGRAPH_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, } from 'lexical';
12
- import { useEffect } from 'react';
13
- import { $createCollapsibleContainerNode, $isCollapsibleContainerNode, CollapsibleContainerNode, } from './CollapsibleContainerNode';
14
- import { $createCollapsibleContentNode, $isCollapsibleContentNode, CollapsibleContentNode, } from './CollapsibleContentNode';
15
- import { $createCollapsibleTitleNode, $isCollapsibleTitleNode, CollapsibleTitleNode, } from './CollapsibleTitleNode';
16
- export const INSERT_COLLAPSIBLE_COMMAND = createCommand('INSERT_COLLAPSIBLE_COMMAND');
9
+ import "./Collapsible.css";
10
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
11
+ import { $findMatchingParent, $insertNodeToNearestRoot, mergeRegister, } from "@lexical/utils";
12
+ import { $createParagraphNode, $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, createCommand, INSERT_PARAGRAPH_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, } from "lexical";
13
+ import { useEffect } from "react";
14
+ import { $createCollapsibleContainerNode, $isCollapsibleContainerNode, CollapsibleContainerNode, } from "./CollapsibleContainerNode";
15
+ import { $createCollapsibleContentNode, $isCollapsibleContentNode, CollapsibleContentNode, } from "./CollapsibleContentNode";
16
+ import { $createCollapsibleTitleNode, $isCollapsibleTitleNode, CollapsibleTitleNode, } from "./CollapsibleTitleNode";
17
+ export const INSERT_COLLAPSIBLE_COMMAND = createCommand("INSERT_COLLAPSIBLE_COMMAND");
17
18
  export default function CollapsiblePlugin() {
18
19
  const [editor] = useLexicalComposerContext();
19
20
  useEffect(() => {
@@ -22,7 +23,7 @@ export default function CollapsiblePlugin() {
22
23
  CollapsibleTitleNode,
23
24
  CollapsibleContentNode,
24
25
  ])) {
25
- throw new Error('CollapsiblePlugin: CollapsibleContainerNode, CollapsibleTitleNode, or CollapsibleContentNode not registered on editor');
26
+ throw new Error("CollapsiblePlugin: CollapsibleContainerNode, CollapsibleTitleNode, or CollapsibleContentNode not registered on editor");
26
27
  }
27
28
  const $onEscapeUp = () => {
28
29
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ComponentPickerPlugin/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAWjC,OAAO,EAEL,UAAU,EAEX,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAKL,aAAa,EAEd,MAAM,SAAS,CAAC;AAIjB,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAU5C,qBAAa,qBAAsB,SAAQ,UAAU;IAEnD,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;gBAGtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KACzC;CASJ;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,UAAU,EACV,OAAO,EACP,YAAY,EACZ,MAAM,GACP,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,EAAE,qBAAqB,CAAC;CAC/B,2CAqBA;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BA6B3E;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,2BAsLzE;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,IAAI,GAAG,CAAC,OAAO,CAqF/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ComponentPickerPlugin/index.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAWjC,OAAO,EAEL,UAAU,EAEX,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAKL,aAAa,EAEd,MAAM,SAAS,CAAC;AAIjB,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAS5C,qBAAa,qBAAsB,SAAQ,UAAU;IAEnD,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAEnB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;gBAGtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KACzC;CASJ;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,UAAU,EACV,OAAO,EACP,YAAY,EACZ,MAAM,GACP,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,EAAE,qBAAqB,CAAC;CAC/B,2CAqBA;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BA6B3E;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,2BAiLzE;AAED,MAAM,CAAC,OAAO,UAAU,yBAAyB,IAAI,GAAG,CAAC,OAAO,CAqF/D"}
@@ -1,9 +1,10 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { $createCodeNode } from "@lexical/code";
3
+ import { $createCodeNode } from "../../nodes/CodeNode/CodeNode";
3
4
  import { INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, } from "@lexical/list";
4
5
  import { INSERT_EMBED_COMMAND } from "@lexical/react/LexicalAutoEmbedPlugin";
5
6
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
- import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
7
+ import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/extension";
7
8
  import { LexicalTypeaheadMenuPlugin, MenuOption, useBasicTypeaheadTriggerMatch, } from "@lexical/react/LexicalTypeaheadMenuPlugin";
8
9
  import { $createHeadingNode, $createQuoteNode } from "@lexical/rich-text";
9
10
  import { $setBlocksType } from "@lexical/selection";
@@ -18,7 +19,6 @@ import { INSERT_DATETIME_COMMAND } from "../DateTimePlugin";
18
19
  import { InsertEquationDialog } from "../EquationsPlugin";
19
20
  import { InsertImageDialog } from "../ImagesPlugin";
20
21
  import InsertLayoutDialog from "../LayoutPlugin/InsertLayoutDialog";
21
- import { INSERT_PAGE_BREAK } from "../PageBreakPlugin";
22
22
  import { InsertTableDialog } from "../TablePlugin";
23
23
  export class ComponentPickerOption extends MenuOption {
24
24
  constructor(title, options) {
@@ -132,11 +132,6 @@ export function getBaseOptions(editor, showModal) {
132
132
  keywords: ["horizontal rule", "divider", "hr"],
133
133
  onSelect: () => editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, undefined),
134
134
  }),
135
- new ComponentPickerOption("Page Break", {
136
- icon: _jsx("i", { className: "icon page-break" }),
137
- keywords: ["page break", "divider"],
138
- onSelect: () => editor.dispatchCommand(INSERT_PAGE_BREAK, undefined),
139
- }),
140
135
  ...EmbedConfigs.map((embedConfig) => new ComponentPickerOption(`Embed ${embedConfig.contentName}`, {
141
136
  icon: embedConfig.icon,
142
137
  keywords: [...embedConfig.keywords, "embed"],
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { JSX } from 'react';
8
+ import type { JSX } from "react";
9
9
  export default function ContextMenuPlugin(): JSX.Element;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ContextMenuPlugin/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAqB/B,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,GAAG,CAAC,OAAO,CAgIvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ContextMenuPlugin/index.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAqBjC,MAAM,CAAC,OAAO,UAAU,iBAAiB,IAAI,GAAG,CAAC,OAAO,CAgIvD"}
@@ -1,9 +1,10 @@
1
+ "use client";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link';
3
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
- import { NodeContextMenuOption, NodeContextMenuPlugin, NodeContextMenuSeparator, } from '@lexical/react/LexicalNodeContextMenuPlugin';
5
- import { $getSelection, $isDecoratorNode, $isNodeSelection, $isRangeSelection, COPY_COMMAND, CUT_COMMAND, PASTE_COMMAND, } from 'lexical';
6
- import { useMemo } from 'react';
3
+ import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
4
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
5
+ import { NodeContextMenuOption, NodeContextMenuPlugin, NodeContextMenuSeparator, } from "@lexical/react/LexicalNodeContextMenuPlugin";
6
+ import { $getSelection, $isDecoratorNode, $isNodeSelection, $isRangeSelection, COPY_COMMAND, CUT_COMMAND, PASTE_COMMAND, } from "lexical";
7
+ import { useMemo } from "react";
7
8
  export default function ContextMenuPlugin() {
8
9
  const [editor] = useLexicalComposerContext();
9
10
  const items = useMemo(() => {
@@ -41,17 +42,17 @@ export default function ContextMenuPlugin() {
41
42
  const item = readClipboardItems[0];
42
43
  const permission = await navigator.permissions.query({
43
44
  // @ts-expect-error These types are incorrect.
44
- name: 'clipboard-read',
45
+ name: "clipboard-read",
45
46
  });
46
- if (permission.state === 'denied') {
47
- alert('Not allowed to paste from clipboard.');
47
+ if (permission.state === "denied") {
48
+ alert("Not allowed to paste from clipboard.");
48
49
  return;
49
50
  }
50
51
  for (const type of item.types) {
51
52
  const dataString = await (await item.getType(type)).text();
52
53
  data.setData(type, dataString);
53
54
  }
54
- const event = new ClipboardEvent('paste', {
55
+ const event = new ClipboardEvent("paste", {
55
56
  clipboardData: data,
56
57
  });
57
58
  editor.dispatchCommand(PASTE_COMMAND, event);
@@ -65,16 +66,16 @@ export default function ContextMenuPlugin() {
65
66
  navigator.clipboard.read().then(async function (...args) {
66
67
  const permission = await navigator.permissions.query({
67
68
  // @ts-expect-error These types are incorrect.
68
- name: 'clipboard-read',
69
+ name: "clipboard-read",
69
70
  });
70
- if (permission.state === 'denied') {
71
- alert('Not allowed to paste from clipboard.');
71
+ if (permission.state === "denied") {
72
+ alert("Not allowed to paste from clipboard.");
72
73
  return;
73
74
  }
74
75
  const data = new DataTransfer();
75
76
  const clipboardText = await navigator.clipboard.readText();
76
- data.setData('text/plain', clipboardText);
77
- const event = new ClipboardEvent('paste', {
77
+ data.setData("text/plain", clipboardText);
78
+ const event = new ClipboardEvent("paste", {
78
79
  clipboardData: data,
79
80
  });
80
81
  editor.dispatchCommand(PASTE_COMMAND, event);
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { JSX } from 'react';
9
- import { LexicalCommand } from 'lexical';
8
+ import type { JSX } from "react";
9
+ import { LexicalCommand } from "lexical";
10
10
  type CommandPayload = {
11
11
  dateTime: Date;
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DateTimePlugin/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAI/B,OAAO,EAML,cAAc,EACf,MAAM,SAAS,CAAC;AAQjB,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,cAAc,CACzB,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CA4B3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DateTimePlugin/index.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAML,cAAc,EACf,MAAM,SAAS,CAAC;AAQjB,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAAc,CAAC,cAAc,CACzB,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CA4B3D"}
@@ -1,21 +1,15 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
- import { $wrapNodeInElement, mergeRegister } from '@lexical/utils';
10
- import { $createParagraphNode, $insertNodes, $isRootOrShadowRoot, COMMAND_PRIORITY_EDITOR, createCommand, } from 'lexical';
11
- import { useEffect } from 'react';
12
- import { $createDateTimeNode, DateTimeNode, } from '../../nodes/DateTimeNode/DateTimeNode';
13
- export const INSERT_DATETIME_COMMAND = createCommand('INSERT_DATETIME_COMMAND');
1
+ "use client";
2
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
3
+ import { $wrapNodeInElement, mergeRegister } from "@lexical/utils";
4
+ import { $createParagraphNode, $insertNodes, $isRootOrShadowRoot, COMMAND_PRIORITY_EDITOR, createCommand, } from "lexical";
5
+ import { useEffect } from "react";
6
+ import { $createDateTimeNode, DateTimeNode, } from "../../nodes/DateTimeNode/DateTimeNode";
7
+ export const INSERT_DATETIME_COMMAND = createCommand("INSERT_DATETIME_COMMAND");
14
8
  export default function DateTimePlugin() {
15
9
  const [editor] = useLexicalComposerContext();
16
10
  useEffect(() => {
17
11
  if (!editor.hasNodes([DateTimeNode])) {
18
- throw new Error('DateTimePlugin: DateTimeNode not registered on editor');
12
+ throw new Error("DateTimePlugin: DateTimeNode not registered on editor");
19
13
  }
20
14
  return mergeRegister(editor.registerCommand(INSERT_DATETIME_COMMAND, (payload) => {
21
15
  const { dateTime } = payload;
@@ -1,9 +1,2 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
1
  export default function DragDropPaste(): null;
9
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DragDropPastePlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,IAAI,CA0B5C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DragDropPastePlugin/index.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,IAAI,CA0B5C"}
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  /**
2
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
4
  *
@@ -5,18 +6,18 @@
5
6
  * LICENSE file in the root directory of this source tree.
6
7
  *
7
8
  */
8
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
- import { DRAG_DROP_PASTE } from '@lexical/rich-text';
10
- import { isMimeType, mediaFileReader } from '@lexical/utils';
11
- import { COMMAND_PRIORITY_LOW } from 'lexical';
12
- import { useEffect } from 'react';
13
- import { INSERT_IMAGE_COMMAND } from '../ImagesPlugin';
9
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
10
+ import { DRAG_DROP_PASTE } from "@lexical/rich-text";
11
+ import { isMimeType, mediaFileReader } from "@lexical/utils";
12
+ import { COMMAND_PRIORITY_LOW } from "lexical";
13
+ import { useEffect } from "react";
14
+ import { INSERT_IMAGE_COMMAND } from "../ImagesPlugin";
14
15
  const ACCEPTABLE_IMAGE_TYPES = [
15
- 'image/',
16
- 'image/heic',
17
- 'image/heif',
18
- 'image/gif',
19
- 'image/webp',
16
+ "image/",
17
+ "image/heic",
18
+ "image/heif",
19
+ "image/gif",
20
+ "image/webp",
20
21
  ];
21
22
  export default function DragDropPaste() {
22
23
  const [editor] = useLexicalComposerContext();
@@ -61,3 +61,9 @@
61
61
  font-size: 14px;
62
62
  border-radius: 8px 8px 0 0;
63
63
  }
64
+
65
+ @media (prefers-color-scheme: dark) {
66
+ .draggable-block-menu .icon {
67
+ filter: invert(1);
68
+ }
69
+ }
@@ -1,5 +1,5 @@
1
- import type { JSX } from 'react';
2
- import './index.css';
1
+ import type { JSX } from "react";
2
+ import "./index.css";
3
3
  export default function DraggableBlockPlugin({ anchorElem, }: {
4
4
  anchorElem?: HTMLElement;
5
5
  }): JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DraggableBlockPlugin/index.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE/B,OAAO,aAAa,CAAC;AAkCrB,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,GAAG,GAAG,CAAC,OAAO,CAkPd"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/DraggableBlockPlugin/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,aAAa,CAAC;AAkCrB,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,GAAG,GAAG,CAAC,OAAO,CAmPd"}
@@ -1,13 +1,14 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import './index.css';
3
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
- import { DraggableBlockPlugin_EXPERIMENTAL } from '@lexical/react/LexicalDraggableBlockPlugin';
5
- import { $createParagraphNode, $createTextNode, $getNearestNodeFromDOMNode, $getNodeByKey, $isParagraphNode, $isTextNode, } from 'lexical';
6
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
- import * as ReactDOM from 'react-dom';
8
- import useModal from '../../hooks/useModal';
9
- import { ComponentPickerMenuItem, getBaseOptions, getDynamicOptions, } from '../ComponentPickerPlugin';
10
- const DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu';
3
+ import "./index.css";
4
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
5
+ import { DraggableBlockPlugin_EXPERIMENTAL } from "@lexical/react/LexicalDraggableBlockPlugin";
6
+ import { $createParagraphNode, $createTextNode, $getNearestNodeFromDOMNode, $getNodeByKey, $isParagraphNode, $isTextNode, } from "lexical";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import * as ReactDOM from "react-dom";
9
+ import useModal from "../../hooks/useModal";
10
+ import { ComponentPickerMenuItem, getBaseOptions, getDynamicOptions, } from "../ComponentPickerPlugin";
11
+ const DRAGGABLE_BLOCK_MENU_CLASSNAME = "draggable-block-menu";
11
12
  function isOnMenu(element) {
12
13
  return !!element.closest(`.${DRAGGABLE_BLOCK_MENU_CLASSNAME}`);
13
14
  }
@@ -21,7 +22,7 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
21
22
  const [draggableElement, setDraggableElement] = useState(null);
22
23
  const [pickerState, setPickerState] = useState(null);
23
24
  const [isPickerOpen, setIsPickerOpen] = useState(false);
24
- const [queryString, setQueryString] = useState('');
25
+ const [queryString, setQueryString] = useState("");
25
26
  const [highlightedIndex, setHighlightedIndex] = useState(0);
26
27
  const [pickerPosition, setPickerPosition] = useState(null);
27
28
  const options = useMemo(() => {
@@ -29,7 +30,7 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
29
30
  if (!queryString) {
30
31
  return baseOptions;
31
32
  }
32
- const regex = new RegExp(queryString, 'i');
33
+ const regex = new RegExp(queryString, "i");
33
34
  return [
34
35
  ...getDynamicOptions(editor, queryString),
35
36
  ...baseOptions.filter((option) => regex.test(option.title) ||
@@ -60,9 +61,9 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
60
61
  setIsPickerOpen(false);
61
62
  setPickerState(null);
62
63
  };
63
- document.addEventListener('mousedown', handleClickOutside);
64
+ document.addEventListener("mousedown", handleClickOutside);
64
65
  return () => {
65
- document.removeEventListener('mousedown', handleClickOutside);
66
+ document.removeEventListener("mousedown", handleClickOutside);
66
67
  };
67
68
  }, [isPickerOpen]);
68
69
  const selectOption = useCallback((option) => {
@@ -77,7 +78,7 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
77
78
  return;
78
79
  }
79
80
  const placeholder = $createParagraphNode();
80
- const textNode = $createTextNode('');
81
+ const textNode = $createTextNode("");
81
82
  placeholder.append(textNode);
82
83
  if (pickerState.insertBefore) {
83
84
  node.insertBefore(placeholder);
@@ -106,30 +107,30 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
106
107
  if (!isPickerOpen || !options.length) {
107
108
  return;
108
109
  }
109
- if (event.key === 'ArrowDown') {
110
+ if (event.key === "ArrowDown") {
110
111
  event.preventDefault();
111
112
  setHighlightedIndex((index) => index + 1 >= options.length ? 0 : index + 1);
112
113
  }
113
- else if (event.key === 'ArrowUp') {
114
+ else if (event.key === "ArrowUp") {
114
115
  event.preventDefault();
115
116
  setHighlightedIndex((index) => index - 1 < 0 ? options.length - 1 : index - 1);
116
117
  }
117
- else if (event.key === 'Enter') {
118
+ else if (event.key === "Enter") {
118
119
  event.preventDefault();
119
120
  const option = options[highlightedIndex];
120
121
  if (option) {
121
122
  selectOption(option);
122
123
  }
123
124
  }
124
- else if (event.key === 'Escape') {
125
+ else if (event.key === "Escape") {
125
126
  event.preventDefault();
126
127
  setIsPickerOpen(false);
127
128
  setPickerState(null);
128
129
  }
129
130
  };
130
- window.addEventListener('keydown', handleKeyDown);
131
+ window.addEventListener("keydown", handleKeyDown);
131
132
  return () => {
132
- window.removeEventListener('keydown', handleKeyDown);
133
+ window.removeEventListener("keydown", handleKeyDown);
133
134
  };
134
135
  }, [highlightedIndex, isPickerOpen, options, selectOption]);
135
136
  function openComponentPicker(e) {
@@ -156,14 +157,14 @@ export default function DraggableBlockPlugin({ anchorElem = document.body, }) {
156
157
  }
157
158
  : null);
158
159
  setPickerState({ insertBefore, targetNodeKey });
159
- setQueryString('');
160
+ setQueryString("");
160
161
  setHighlightedIndex(0);
161
162
  setIsPickerOpen(true);
162
163
  }
163
164
  return (_jsxs(_Fragment, { children: [modal, isPickerOpen && pickerPosition
164
165
  ? ReactDOM.createPortal(_jsxs("div", { className: "typeahead-popover component-picker-menu draggable-block-component-picker", ref: pickerRef, style: {
165
166
  left: pickerPosition.left,
166
- position: 'absolute',
167
+ position: "absolute",
167
168
  top: pickerPosition.top,
168
169
  zIndex: 10,
169
170
  }, children: [_jsx("input", { className: "component-picker-search", placeholder: "Filter blocks...", value: queryString, ref: searchInputRef, onChange: (event) => setQueryString(event.target.value) }), _jsx("ul", { children: options.map((option, i) => (_jsx(ComponentPickerMenuItem, { index: i, isSelected: highlightedIndex === i, onClick: () => {