@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,10 +1,11 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { $isCodeNode, getCodeLanguageOptions as getCodeLanguageOptionsPrism, normalizeCodeLanguage as normalizeCodeLanguagePrism, } from "@lexical/code";
3
- import { getCodeLanguageOptions as getCodeLanguageOptionsShiki, getCodeThemeOptions as getCodeThemeOptionsShiki, normalizeCodeLanguage as normalizeCodeLanguageShiki, } from "@lexical/code-shiki";
3
+ import { $isCodeNode } from "../../nodes/CodeNode/CodeNode";
4
+ import { getCodeLanguageOptions as getCodeLanguageOptionsShiki, getCodeThemeOptions as getCodeThemeOptionsShiki, normalizeCodeLanguage as normalizeCodeLanguageShiki, } from "../../nodes/CodeNode/FacadeShiki";
4
5
  import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
5
6
  import { $isListNode, ListNode } from "@lexical/list";
6
7
  import { INSERT_EMBED_COMMAND } from "@lexical/react/LexicalAutoEmbedPlugin";
7
- import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
8
+ import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/extension";
8
9
  import { $isHeadingNode } from "@lexical/rich-text";
9
10
  import { $getSelectionStyleValueForProperty, $isParentElementRTL, $patchStyleText, } from "@lexical/selection";
10
11
  import { $isTableNode, $isTableSelection } from "@lexical/table";
@@ -22,61 +23,26 @@ import { EmbedConfigs } from "../AutoEmbedPlugin";
22
23
  import { INSERT_COLLAPSIBLE_COMMAND } from "../CollapsiblePlugin";
23
24
  import { INSERT_DATETIME_COMMAND } from "../DateTimePlugin";
24
25
  import { InsertEquationDialog } from "../EquationsPlugin";
25
- import { InsertImageDialog, } from "../ImagesPlugin";
26
+ import { InsertImageDialog } from "../ImagesPlugin";
26
27
  import InsertLayoutDialog from "../LayoutPlugin/InsertLayoutDialog";
27
- import { INSERT_PAGE_BREAK } from "../PageBreakPlugin";
28
28
  import { SHORTCUTS } from "../ShortcutsPlugin/shortcuts";
29
29
  import { InsertTableDialog } from "../TablePlugin";
30
30
  import FontSize, { parseFontSizeForToolbar } from "./fontSize";
31
31
  import { clearFormatting, formatBulletList, formatCheckList, formatCode, formatHeading, formatNumberedList, formatParagraph, formatQuote, } from "./utils";
32
+ import { allLanguages, allLanguagesFlat } from "./languages";
32
33
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
34
  const rootTypeToRootName = {
34
35
  root: "Root",
35
36
  table: "Table",
36
37
  };
37
- const CODE_LANGUAGE_OPTIONS_PRISM = getCodeLanguageOptionsPrism().filter((option) => [
38
- "c",
39
- "clike",
40
- "cpp",
41
- "css",
42
- "html",
43
- "java",
44
- "js",
45
- "javascript",
46
- "markdown",
47
- "objc",
48
- "objective-c",
49
- "plain",
50
- "powershell",
51
- "py",
52
- "python",
53
- "rust",
54
- "sql",
55
- "swift",
56
- "typescript",
57
- "xml",
58
- ].includes(option[0]));
59
- const CODE_LANGUAGE_OPTIONS_SHIKI = getCodeLanguageOptionsShiki().filter((option) => [
60
- "c",
61
- "clike",
62
- "cpp",
63
- "css",
64
- "html",
65
- "java",
66
- "js",
67
- "javascript",
68
- "markdown",
69
- "objc",
70
- "objective-c",
71
- "plain",
72
- "powershell",
73
- "py",
74
- "python",
75
- "rust",
76
- "sql",
77
- "typescript",
78
- "xml",
79
- ].includes(option[0]));
38
+ const CODE_CATEGORIES_AND_LANGUAGES_SHIKI = new Map(Array.from(allLanguages.entries()).map(([category, [categoryName, languages]]) => [
39
+ category,
40
+ [
41
+ categoryName,
42
+ getCodeLanguageOptionsShiki().filter((option) => languages.includes(option[0])),
43
+ ],
44
+ ]));
45
+ const CODE_LANGUAGE_OPTIONS_SHIKI = getCodeLanguageOptionsShiki().filter((option) => allLanguagesFlat.includes(option[0]));
80
46
  const CODE_THEME_OPTIONS_SHIKI = getCodeThemeOptionsShiki().filter((option) => [
81
47
  "catppuccin-latte",
82
48
  "everforest-light",
@@ -94,6 +60,14 @@ const CODE_THEME_OPTIONS_SHIKI = getCodeThemeOptionsShiki().filter((option) => [
94
60
  "solarized-light",
95
61
  "vitesse-light",
96
62
  ].includes(option[0]));
63
+ const getCodeCategoryForLanguage = (language) => {
64
+ for (const [category, [, languages]] of CODE_CATEGORIES_AND_LANGUAGES_SHIKI) {
65
+ if (languages.some(([value]) => value === language)) {
66
+ return category;
67
+ }
68
+ }
69
+ return "";
70
+ };
97
71
  const FONT_FAMILY_OPTIONS = [
98
72
  ["Arial", "Arial"],
99
73
  ["Courier New", "Courier New"],
@@ -215,6 +189,7 @@ function $findTopLevelElement(node) {
215
189
  return topLevelElement;
216
190
  }
217
191
  export default function ToolbarPlugin({ editor, activeEditor, setActiveEditor, setIsLinkEditMode, }) {
192
+ var _a, _b;
218
193
  const [selectedElementKey, setSelectedElementKey] = useState(null);
219
194
  const [modal, showModal] = useModal();
220
195
  const [isEditable, setIsEditable] = useState(() => editor.isEditable());
@@ -240,7 +215,13 @@ export default function ToolbarPlugin({ editor, activeEditor, setActiveEditor, s
240
215
  const $handleCodeNode = useCallback((element) => {
241
216
  if ($isCodeNode(element)) {
242
217
  const language = element.getLanguage();
243
- updateToolbarState("codeLanguage", language ? normalizeCodeLanguageShiki(language) || language : "");
218
+ const normalizedLanguage = language
219
+ ? normalizeCodeLanguageShiki(language)
220
+ : "";
221
+ updateToolbarState("codeLanguage", normalizedLanguage);
222
+ updateToolbarState("codeCategory", normalizedLanguage
223
+ ? getCodeCategoryForLanguage(normalizedLanguage)
224
+ : "");
244
225
  const theme = element.getTheme();
245
226
  updateToolbarState("codeTheme", theme || "");
246
227
  return;
@@ -399,40 +380,67 @@ export default function ToolbarPlugin({ editor, activeEditor, setActiveEditor, s
399
380
  activeEditor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
400
381
  }
401
382
  }, [activeEditor, setIsLinkEditMode, toolbarState.isLink]);
383
+ const onCodeCategorySelect = useCallback((value) => {
384
+ var _a, _b;
385
+ const nextLanguage = ((_b = (_a = CODE_CATEGORIES_AND_LANGUAGES_SHIKI.get(value)) === null || _a === void 0 ? void 0 : _a[1][0]) === null || _b === void 0 ? void 0 : _b[0]) || "";
386
+ updateToolbarState("codeCategory", value);
387
+ updateToolbarState("codeLanguage", nextLanguage);
388
+ activeEditor.update(() => {
389
+ $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
390
+ if (selectedElementKey !== null) {
391
+ const node = $getNodeByKey(selectedElementKey);
392
+ if ($isCodeNode(node)) {
393
+ node.setLanguage(nextLanguage);
394
+ }
395
+ }
396
+ });
397
+ }, [activeEditor, selectedElementKey, updateToolbarState]);
402
398
  const onCodeLanguageSelect = useCallback((value) => {
399
+ updateToolbarState("codeLanguage", value);
400
+ updateToolbarState("codeCategory", getCodeCategoryForLanguage(value));
401
+ console.log("oncodeLanguageSelect called ", value);
403
402
  activeEditor.update(() => {
404
403
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
405
404
  if (selectedElementKey !== null) {
405
+ console.log("oncodeLanguageSelect passed selectedElementKey ");
406
406
  const node = $getNodeByKey(selectedElementKey);
407
+ console.log(node);
407
408
  if ($isCodeNode(node)) {
409
+ console.log("setting language", value);
408
410
  node.setLanguage(value);
409
411
  }
410
412
  }
411
413
  });
412
- }, [activeEditor, selectedElementKey]);
414
+ }, [activeEditor, selectedElementKey, updateToolbarState]);
413
415
  const onCodeThemeSelect = useCallback((value) => {
416
+ updateToolbarState("codeTheme", value);
417
+ console.log("oncodeThemeSelect called ", value);
414
418
  activeEditor.update(() => {
415
419
  if (selectedElementKey !== null) {
420
+ console.log("oncodeThemeSelect passed selectedElementKey ");
416
421
  const node = $getNodeByKey(selectedElementKey);
422
+ console.log(node);
417
423
  if ($isCodeNode(node)) {
424
+ console.log("setting theme", value);
418
425
  node.setTheme(value);
419
426
  }
420
427
  }
421
428
  });
422
- }, [activeEditor, selectedElementKey]);
429
+ }, [activeEditor, selectedElementKey, updateToolbarState]);
423
430
  const canViewerSeeInsertDropdown = !toolbarState.isImageCaption;
424
431
  const canViewerSeeInsertCodeButton = !toolbarState.isImageCaption;
425
432
  return (_jsxs("div", { className: "toolbar", children: [_jsx("button", { disabled: !toolbarState.canUndo || !isEditable, onClick: (e) => dispatchToolbarCommand(UNDO_COMMAND, undefined, isKeyboardInput(e)), title: IS_APPLE ? "Undo (⌘Z)" : "Undo (Ctrl+Z)", type: "button", className: "toolbar-item spaced", "aria-label": "Undo", children: _jsx("i", { className: "format undo" }) }), _jsx("button", { disabled: !toolbarState.canRedo || !isEditable, onClick: (e) => dispatchToolbarCommand(REDO_COMMAND, undefined, isKeyboardInput(e)), title: IS_APPLE ? "Redo (⇧⌘Z)" : "Redo (Ctrl+Y)", type: "button", className: "toolbar-item", "aria-label": "Redo", children: _jsx("i", { className: "format redo" }) }), _jsx(Divider, {}), toolbarState.blockType in blockTypeToBlockName &&
426
- activeEditor === editor && (_jsxs(_Fragment, { children: [_jsx(BlockFormatDropDown, { disabled: !isEditable, blockType: toolbarState.blockType, rootType: toolbarState.rootType, editor: activeEditor }), _jsx(Divider, {})] })), toolbarState.blockType === "code" ? (_jsxs(_Fragment, { children: [_jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language", buttonLabel: (CODE_LANGUAGE_OPTIONS_PRISM.find((opt) => opt[0] ===
427
- normalizeCodeLanguagePrism(toolbarState.codeLanguage)) || ["", ""])[1], buttonAriaLabel: "Select language", children: CODE_LANGUAGE_OPTIONS_PRISM.map(([value, name]) => {
433
+ activeEditor === editor && (_jsxs(_Fragment, { children: [_jsx(BlockFormatDropDown, { disabled: !isEditable, blockType: toolbarState.blockType, rootType: toolbarState.rootType, editor: activeEditor }), _jsx(Divider, {})] })), toolbarState.blockType === "code" ? (_jsxs(_Fragment, { children: [_jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language-category", buttonLabel: ((_a = CODE_CATEGORIES_AND_LANGUAGES_SHIKI.get(toolbarState.codeCategory)) === null || _a === void 0 ? void 0 : _a[0]) || "Language Category", buttonAriaLabel: "Select language category", children: Array.from(CODE_CATEGORIES_AND_LANGUAGES_SHIKI.entries()).map(([category, [categoryName]]) => {
434
+ return (_jsx(DropDownItem, { className: `item ${dropDownActiveClass(category === toolbarState.codeCategory)}`, onClick: () => {
435
+ onCodeCategorySelect(category);
436
+ }, children: _jsx("span", { className: "text", children: categoryName }) }, category));
437
+ }) }), _jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language", buttonLabel: (CODE_LANGUAGE_OPTIONS_SHIKI.find((opt) => opt[0] ===
438
+ normalizeCodeLanguageShiki(toolbarState.codeLanguage)) || ["", ""])[1], buttonAriaLabel: "Select language", children: (_b = CODE_CATEGORIES_AND_LANGUAGES_SHIKI.get(toolbarState.codeCategory)) === null || _b === void 0 ? void 0 : _b[1].map(([value, name]) => {
428
439
  return (_jsx(DropDownItem, { className: `item ${dropDownActiveClass(value === toolbarState.codeLanguage)}`, onClick: () => onCodeLanguageSelect(value), children: _jsx("span", { className: "text", children: name }) }, value));
429
- }) }), _jsxs(_Fragment, { children: [_jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language", buttonLabel: (CODE_LANGUAGE_OPTIONS_SHIKI.find((opt) => opt[0] ===
430
- normalizeCodeLanguageShiki(toolbarState.codeLanguage)) || ["", ""])[1], buttonAriaLabel: "Select language", children: CODE_LANGUAGE_OPTIONS_SHIKI.map(([value, name]) => {
431
- return (_jsx(DropDownItem, { className: `item ${dropDownActiveClass(value === toolbarState.codeLanguage)}`, onClick: () => onCodeLanguageSelect(value), children: _jsx("span", { className: "text", children: name }) }, value));
432
- }) }), _jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language", buttonLabel: (CODE_THEME_OPTIONS_SHIKI.find((opt) => opt[0] === toolbarState.codeTheme) || ["", ""])[1], buttonAriaLabel: "Select theme", children: CODE_THEME_OPTIONS_SHIKI.map(([value, name]) => {
433
- return (_jsx(DropDownItem, { className: `item ${dropDownActiveClass(value === toolbarState.codeTheme)}`, onClick: () => onCodeThemeSelect(value), children: _jsx("span", { className: "text", children: name }) }, value));
434
- }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx(FontDropDown, { disabled: !isEditable, style: "font-family", value: toolbarState.fontFamily, editor: activeEditor }), _jsx(Divider, {}), _jsx(FontSize, { selectionFontSize: parseFontSizeForToolbar(toolbarState.fontSize).slice(0, -2), editor: activeEditor, disabled: !isEditable }), _jsx(Divider, {}), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("bold", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isBold ? "active" : ""), title: `Bold (${SHORTCUTS.BOLD})`, type: "button", "aria-label": `Format text as bold. Shortcut: ${SHORTCUTS.BOLD}`, children: _jsx("i", { className: "format bold" }) }), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("italic", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isItalic ? "active" : ""), title: `Italic (${SHORTCUTS.ITALIC})`, type: "button", "aria-label": `Format text as italics. Shortcut: ${SHORTCUTS.ITALIC}`, children: _jsx("i", { className: "format italic" }) }), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("underline", isKeyboardInput(e)), className: "toolbar-item spaced " +
435
- (toolbarState.isUnderline ? "active" : ""), title: `Underline (${SHORTCUTS.UNDERLINE})`, type: "button", "aria-label": `Format text to underlined. Shortcut: ${SHORTCUTS.UNDERLINE}`, children: _jsx("i", { className: "format underline" }) }), canViewerSeeInsertCodeButton && (_jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("code", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isCode ? "active" : ""), title: `Insert code block (${SHORTCUTS.INSERT_CODE_BLOCK})`, type: "button", "aria-label": "Insert code block", children: _jsx("i", { className: "format code" }) })), _jsx("button", { disabled: !isEditable, onClick: insertLink, className: "toolbar-item spaced " + (toolbarState.isLink ? "active" : ""), "aria-label": "Insert link", title: `Insert link (${SHORTCUTS.INSERT_LINK})`, type: "button", children: _jsx("i", { className: "format link" }) }), _jsx(DropdownColorPicker, { disabled: !isEditable, buttonClassName: "toolbar-item color-picker", buttonAriaLabel: "Formatting text color", buttonIconClassName: "icon font-color", color: toolbarState.fontColor, onChange: onFontColorSelect, title: "text color" }), _jsx(DropdownColorPicker, { disabled: !isEditable, buttonClassName: "toolbar-item color-picker", buttonAriaLabel: "Formatting background color", buttonIconClassName: "icon bg-color", color: toolbarState.bgColor, onChange: onBgColorSelect, title: "bg color" }), _jsxs(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item spaced", buttonLabel: "", buttonAriaLabel: "Formatting options for additional text styles", buttonIconClassName: "icon dropdown-more", children: [_jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("lowercase", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isLowercase), title: "Lowercase", "aria-label": "Format text to lowercase", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon lowercase" }), _jsx("span", { className: "text", children: "Lowercase" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.LOWERCASE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("uppercase", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isUppercase), title: "Uppercase", "aria-label": "Format text to uppercase", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon uppercase" }), _jsx("span", { className: "text", children: "Uppercase" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.UPPERCASE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("capitalize", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isCapitalize), title: "Capitalize", "aria-label": "Format text to capitalize", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon capitalize" }), _jsx("span", { className: "text", children: "Capitalize" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.CAPITALIZE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("strikethrough", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isStrikethrough), title: "Strikethrough", "aria-label": "Format text with a strikethrough", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon strikethrough" }), _jsx("span", { className: "text", children: "Strikethrough" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.STRIKETHROUGH })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("subscript", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isSubscript), title: "Subscript", "aria-label": "Format text with a subscript", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon subscript" }), _jsx("span", { className: "text", children: "Subscript" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.SUBSCRIPT })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("superscript", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isSuperscript), title: "Superscript", "aria-label": "Format text with a superscript", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon superscript" }), _jsx("span", { className: "text", children: "Superscript" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.SUPERSCRIPT })] }), _jsx(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("highlight", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isHighlight), title: "Highlight", "aria-label": "Format text with a highlight", children: _jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon highlight" }), _jsx("span", { className: "text", children: "Highlight" })] }) }), _jsxs(DropDownItem, { onClick: (e) => clearFormatting(activeEditor, isKeyboardInput(e)), className: "item wide", title: "Clear text formatting", "aria-label": "Clear all text formatting", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon clear" }), _jsx("span", { className: "text", children: "Clear Formatting" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.CLEAR_FORMATTING })] })] }), canViewerSeeInsertDropdown && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item spaced", buttonLabel: "Insert", buttonAriaLabel: "Insert specialized editor node", buttonIconClassName: "icon plus", children: [_jsxs(DropDownItem, { onClick: () => dispatchToolbarCommand(INSERT_HORIZONTAL_RULE_COMMAND), className: "item", children: [_jsx("i", { className: "icon horizontal-rule" }), _jsx("span", { className: "text", children: "Horizontal Rule" })] }), _jsxs(DropDownItem, { onClick: () => dispatchToolbarCommand(INSERT_PAGE_BREAK), className: "item", children: [_jsx("i", { className: "icon page-break" }), _jsx("span", { className: "text", children: "Page Break" })] }), _jsxs(DropDownItem, { onClick: () => {
440
+ }) }), _jsx(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item code-language", buttonLabel: (CODE_THEME_OPTIONS_SHIKI.find((opt) => opt[0] === toolbarState.codeTheme) || ["", ""])[1], buttonAriaLabel: "Select theme", children: CODE_THEME_OPTIONS_SHIKI.map(([value, name]) => {
441
+ return (_jsx(DropDownItem, { className: `item ${dropDownActiveClass(value === toolbarState.codeTheme)}`, onClick: () => onCodeThemeSelect(value), children: _jsx("span", { className: "text", children: name }) }, value));
442
+ }) })] })) : (_jsxs(_Fragment, { children: [_jsx(FontDropDown, { disabled: !isEditable, style: "font-family", value: toolbarState.fontFamily, editor: activeEditor }), _jsx(Divider, {}), _jsx(FontSize, { selectionFontSize: parseFontSizeForToolbar(toolbarState.fontSize).slice(0, -2), editor: activeEditor, disabled: !isEditable }), _jsx(Divider, {}), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("bold", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isBold ? "active" : ""), title: `Bold (${SHORTCUTS.BOLD})`, type: "button", "aria-label": `Format text as bold. Shortcut: ${SHORTCUTS.BOLD}`, children: _jsx("i", { className: "format bold" }) }), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("italic", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isItalic ? "active" : ""), title: `Italic (${SHORTCUTS.ITALIC})`, type: "button", "aria-label": `Format text as italics. Shortcut: ${SHORTCUTS.ITALIC}`, children: _jsx("i", { className: "format italic" }) }), _jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("underline", isKeyboardInput(e)), className: "toolbar-item spaced " +
443
+ (toolbarState.isUnderline ? "active" : ""), title: `Underline (${SHORTCUTS.UNDERLINE})`, type: "button", "aria-label": `Format text to underlined. Shortcut: ${SHORTCUTS.UNDERLINE}`, children: _jsx("i", { className: "format underline" }) }), canViewerSeeInsertCodeButton && (_jsx("button", { disabled: !isEditable, onClick: (e) => dispatchFormatTextCommand("code", isKeyboardInput(e)), className: "toolbar-item spaced " + (toolbarState.isCode ? "active" : ""), title: `Insert code block (${SHORTCUTS.INSERT_CODE_BLOCK})`, type: "button", "aria-label": "Insert code block", children: _jsx("i", { className: "format code" }) })), _jsx("button", { disabled: !isEditable, onClick: insertLink, className: "toolbar-item spaced " + (toolbarState.isLink ? "active" : ""), "aria-label": "Insert link", title: `Insert link (${SHORTCUTS.INSERT_LINK})`, type: "button", children: _jsx("i", { className: "format link" }) }), _jsx(DropdownColorPicker, { disabled: !isEditable, buttonClassName: "toolbar-item color-picker", buttonAriaLabel: "Formatting text color", buttonIconClassName: "icon font-color", color: toolbarState.fontColor, onChange: onFontColorSelect, title: "text color" }), _jsx(DropdownColorPicker, { disabled: !isEditable, buttonClassName: "toolbar-item color-picker", buttonAriaLabel: "Formatting background color", buttonIconClassName: "icon bg-color", color: toolbarState.bgColor, onChange: onBgColorSelect, title: "bg color" }), _jsxs(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item spaced", buttonLabel: "", buttonAriaLabel: "Formatting options for additional text styles", buttonIconClassName: "icon dropdown-more", children: [_jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("lowercase", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isLowercase), title: "Lowercase", "aria-label": "Format text to lowercase", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon lowercase" }), _jsx("span", { className: "text", children: "Lowercase" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.LOWERCASE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("uppercase", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isUppercase), title: "Uppercase", "aria-label": "Format text to uppercase", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon uppercase" }), _jsx("span", { className: "text", children: "Uppercase" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.UPPERCASE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("capitalize", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isCapitalize), title: "Capitalize", "aria-label": "Format text to capitalize", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon capitalize" }), _jsx("span", { className: "text", children: "Capitalize" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.CAPITALIZE })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("strikethrough", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isStrikethrough), title: "Strikethrough", "aria-label": "Format text with a strikethrough", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon strikethrough" }), _jsx("span", { className: "text", children: "Strikethrough" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.STRIKETHROUGH })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("subscript", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isSubscript), title: "Subscript", "aria-label": "Format text with a subscript", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon subscript" }), _jsx("span", { className: "text", children: "Subscript" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.SUBSCRIPT })] }), _jsxs(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("superscript", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isSuperscript), title: "Superscript", "aria-label": "Format text with a superscript", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon superscript" }), _jsx("span", { className: "text", children: "Superscript" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.SUPERSCRIPT })] }), _jsx(DropDownItem, { onClick: (e) => dispatchFormatTextCommand("highlight", isKeyboardInput(e)), className: "item wide " + dropDownActiveClass(toolbarState.isHighlight), title: "Highlight", "aria-label": "Format text with a highlight", children: _jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon highlight" }), _jsx("span", { className: "text", children: "Highlight" })] }) }), _jsxs(DropDownItem, { onClick: (e) => clearFormatting(activeEditor, isKeyboardInput(e)), className: "item wide", title: "Clear text formatting", "aria-label": "Clear all text formatting", children: [_jsxs("div", { className: "icon-text-container", children: [_jsx("i", { className: "icon clear" }), _jsx("span", { className: "text", children: "Clear Formatting" })] }), _jsx("span", { className: "shortcut", children: SHORTCUTS.CLEAR_FORMATTING })] })] }), canViewerSeeInsertDropdown && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs(DropDown, { disabled: !isEditable, buttonClassName: "toolbar-item spaced", buttonLabel: "Insert", buttonAriaLabel: "Insert specialized editor node", buttonIconClassName: "icon plus", children: [_jsxs(DropDownItem, { onClick: () => dispatchToolbarCommand(INSERT_HORIZONTAL_RULE_COMMAND), className: "item", children: [_jsx("i", { className: "icon horizontal-rule" }), _jsx("span", { className: "text", children: "Horizontal Rule" })] }), _jsxs(DropDownItem, { onClick: () => {
436
444
  showModal("Insert Image", (onClose) => (_jsx(InsertImageDialog, { activeEditor: activeEditor, onClose: onClose })));
437
445
  }, className: "item", children: [_jsx("i", { className: "icon image" }), _jsx("span", { className: "text", children: "Image" })] }), _jsxs(DropDownItem, { onClick: () => {
438
446
  showModal("Insert Table", (onClose) => (_jsx(InsertTableDialog, { activeEditor: activeEditor, onClose: onClose })));
@@ -0,0 +1,14 @@
1
+ export declare const webFrontend: string[];
2
+ export declare const backendGeneral: string[];
3
+ export declare const systemsLowLevel: string[];
4
+ export declare const mobileDevelopment: string[];
5
+ export declare const dataScienceMath: string[];
6
+ export declare const functionalProgramming: string[];
7
+ export declare const databaseQuery: string[];
8
+ export declare const devOpsConfig: string[];
9
+ export declare const shellAutomation: string[];
10
+ export declare const markupDocs: string[];
11
+ export declare const miscellaneous: string[];
12
+ export declare const allLanguages: Map<string, [string, string[]]>;
13
+ export declare const allLanguagesFlat: string[];
14
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../src/plugins/ToolbarPlugin/languages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UA4BvB,CAAC;AAEF,eAAO,MAAM,cAAc,UA6B1B,CAAC;AAEF,eAAO,MAAM,eAAe,UAc3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAO7B,CAAC;AAEF,eAAO,MAAM,eAAe,UAW3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,UAcjC,CAAC;AAEF,eAAO,MAAM,aAAa,UAA6B,CAAC;AAExD,eAAO,MAAM,YAAY,UAgBxB,CAAC;AAEF,eAAO,MAAM,eAAe,UAS3B,CAAC;AAEF,eAAO,MAAM,UAAU,UAUtB,CAAC;AAEF,eAAO,MAAM,aAAa,UAqBzB,CAAC;AAGF,eAAO,MAAM,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYvD,CAAC;AAEH,eAAO,MAAM,gBAAgB,UAE5B,CAAC"}
@@ -0,0 +1,185 @@
1
+ export const webFrontend = [
2
+ "coffeescript",
3
+ "csp",
4
+ "css",
5
+ "css-extras",
6
+ "flow",
7
+ "graphql",
8
+ "haml",
9
+ "handlebars",
10
+ "javascript",
11
+ "json",
12
+ "jsx",
13
+ "less",
14
+ "liquid",
15
+ "livescript",
16
+ "markup",
17
+ "markup-templating",
18
+ "n4js",
19
+ "pug",
20
+ "sass",
21
+ "scss",
22
+ "smarty",
23
+ "soy",
24
+ "stylus",
25
+ "tsx",
26
+ "twig",
27
+ "typescript",
28
+ "velocity",
29
+ ];
30
+ export const backendGeneral = [
31
+ "abap",
32
+ "aspnet",
33
+ "basic",
34
+ "crystal",
35
+ "csharp",
36
+ "d",
37
+ "django",
38
+ "eiffel",
39
+ "erb",
40
+ "go",
41
+ "groovy",
42
+ "haxe",
43
+ "java",
44
+ "lua",
45
+ "nim",
46
+ "pascal",
47
+ "perl",
48
+ "php",
49
+ "php-extras",
50
+ "python",
51
+ "ruby",
52
+ "rust",
53
+ "scala",
54
+ "smalltalk",
55
+ "tcl",
56
+ "vbnet",
57
+ "visual-basic",
58
+ "xojo",
59
+ ];
60
+ export const systemsLowLevel = [
61
+ "ada",
62
+ "arduino",
63
+ "asm6502",
64
+ "c",
65
+ "clike",
66
+ "cpp",
67
+ "fortran",
68
+ "glsl",
69
+ "nasm",
70
+ "opencl",
71
+ "verilog",
72
+ "vhdl",
73
+ "wasm",
74
+ ];
75
+ export const mobileDevelopment = [
76
+ "actionscript",
77
+ "dart",
78
+ "kotlin",
79
+ "monkey",
80
+ "objectivec",
81
+ "swift",
82
+ ];
83
+ export const dataScienceMath = [
84
+ "apl",
85
+ "arff",
86
+ "julia",
87
+ "matlab",
88
+ "mizar",
89
+ "parigp",
90
+ "prolog",
91
+ "q",
92
+ "r",
93
+ "sas",
94
+ ];
95
+ export const functionalProgramming = [
96
+ "clojure",
97
+ "elixir",
98
+ "elm",
99
+ "erlang",
100
+ "fsharp",
101
+ "haskell",
102
+ "io",
103
+ "lisp",
104
+ "ocaml",
105
+ "oz",
106
+ "pure",
107
+ "reason",
108
+ "scheme",
109
+ ];
110
+ export const databaseQuery = ["plsql", "sql", "xquery"];
111
+ export const devOpsConfig = [
112
+ "apacheconf",
113
+ "docker",
114
+ "git",
115
+ "hpkp",
116
+ "hsts",
117
+ "http",
118
+ "ini",
119
+ "makefile",
120
+ "nginx",
121
+ "nix",
122
+ "properties",
123
+ "protobuf",
124
+ "puppet",
125
+ "roboconf",
126
+ "yaml",
127
+ ];
128
+ export const shellAutomation = [
129
+ "applescript",
130
+ "autohotkey",
131
+ "autoit",
132
+ "bash",
133
+ "batch",
134
+ "nsis",
135
+ "powershell",
136
+ "vim",
137
+ ];
138
+ export const markupDocs = [
139
+ "asciidoc",
140
+ "diff",
141
+ "gedcom",
142
+ "gherkin",
143
+ "latex",
144
+ "markdown",
145
+ "rest",
146
+ "textile",
147
+ "wiki",
148
+ ];
149
+ export const miscellaneous = [
150
+ "bison",
151
+ "brainfuck",
152
+ "bro",
153
+ "gml",
154
+ "ichigojam",
155
+ "icon",
156
+ "inform7",
157
+ "j",
158
+ "jolie",
159
+ "keyman",
160
+ "lolcode",
161
+ "mel",
162
+ "parser",
163
+ "processing",
164
+ "qore",
165
+ "renpy",
166
+ "rip",
167
+ "tap",
168
+ "tt2",
169
+ "xeora",
170
+ ];
171
+ //! The important one, but exported
172
+ export const allLanguages = new Map([
173
+ ["backendGeneral", ["Backend", backendGeneral]],
174
+ ["databaseQuery", ["Database", databaseQuery]],
175
+ ["dataScienceMath", ["Data Science & Math", dataScienceMath]],
176
+ ["devOpsConfig", ["DevOps/Config", devOpsConfig]],
177
+ ["functionalProgramming", ["Functional Programming", functionalProgramming]],
178
+ ["markupDocs", ["Markup & Docs", markupDocs]],
179
+ ["mobileDevelopment", ["Mobile Development", mobileDevelopment]],
180
+ ["shellAutomation", ["Shell & Automation", shellAutomation]],
181
+ ["systemsLowLevel", ["Systems & Low Level", systemsLowLevel]],
182
+ ["webFrontend", ["Web Development", webFrontend]],
183
+ ["miscellaneous", ["Miscellaneous", miscellaneous]],
184
+ ]);
185
+ export const allLanguagesFlat = Array.from(allLanguages.values()).flatMap(([, languages]) => languages);
@@ -1,5 +1,5 @@
1
- import { HeadingTagType } from '@lexical/rich-text';
2
- import { LexicalEditor } from 'lexical';
1
+ import { HeadingTagType } from "@lexical/rich-text";
2
+ import { LexicalEditor } from "lexical";
3
3
  export declare enum UpdateFontSizeType {
4
4
  increment = 1,
5
5
  decrement = 2
@@ -5,15 +5,15 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { $createCodeNode } from '@lexical/code';
9
- import { INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, } from '@lexical/list';
10
- import { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
11
- import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, } from '@lexical/rich-text';
12
- import { $patchStyleText, $setBlocksType } from '@lexical/selection';
13
- import { $isTableSelection } from '@lexical/table';
14
- import { $getNearestBlockElementAncestorOrThrow } from '@lexical/utils';
15
- import { $addUpdateTag, $createParagraphNode, $getSelection, $isRangeSelection, $isTextNode, SKIP_DOM_SELECTION_TAG, SKIP_SELECTION_FOCUS_TAG, } from 'lexical';
16
- import { DEFAULT_FONT_SIZE, MAX_ALLOWED_FONT_SIZE, MIN_ALLOWED_FONT_SIZE, } from '../../context/ToolbarContext';
8
+ import { $createCodeNode } from "../../nodes/CodeNode/CodeNode";
9
+ import { INSERT_CHECK_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, } from "@lexical/list";
10
+ import { $isDecoratorBlockNode } from "@lexical/react/LexicalDecoratorBlockNode";
11
+ import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, } from "@lexical/rich-text";
12
+ import { $patchStyleText, $setBlocksType } from "@lexical/selection";
13
+ import { $isTableSelection } from "@lexical/table";
14
+ import { $getNearestBlockElementAncestorOrThrow } from "@lexical/utils";
15
+ import { $addUpdateTag, $createParagraphNode, $getSelection, $isRangeSelection, $isTextNode, SKIP_DOM_SELECTION_TAG, SKIP_SELECTION_FOCUS_TAG, } from "lexical";
16
+ import { DEFAULT_FONT_SIZE, MAX_ALLOWED_FONT_SIZE, MIN_ALLOWED_FONT_SIZE, } from "../../context/ToolbarContext";
17
17
  // eslint-disable-next-line no-shadow
18
18
  export var UpdateFontSizeType;
19
19
  (function (UpdateFontSizeType) {
@@ -101,16 +101,16 @@ export const updateFontSizeInSelection = (editor, newFontSize, updateType, skipR
101
101
  const selection = $getSelection();
102
102
  if (selection !== null) {
103
103
  $patchStyleText(selection, {
104
- 'font-size': newFontSize || getNextFontSize,
104
+ "font-size": newFontSize || getNextFontSize,
105
105
  });
106
106
  }
107
107
  }
108
108
  });
109
109
  };
110
110
  export const updateFontSize = (editor, updateType, inputValue, skipRefocus = false) => {
111
- if (inputValue !== '') {
111
+ if (inputValue !== "") {
112
112
  const nextFontSize = calculateNextFontSize(Number(inputValue), updateType);
113
- updateFontSizeInSelection(editor, String(nextFontSize) + 'px', null, skipRefocus);
113
+ updateFontSizeInSelection(editor, String(nextFontSize) + "px", null, skipRefocus);
114
114
  }
115
115
  else {
116
116
  updateFontSizeInSelection(editor, null, updateType, skipRefocus);
@@ -133,7 +133,7 @@ export const formatHeading = (editor, blockType, headingSize) => {
133
133
  }
134
134
  };
135
135
  export const formatBulletList = (editor, blockType) => {
136
- if (blockType !== 'bullet') {
136
+ if (blockType !== "bullet") {
137
137
  editor.update(() => {
138
138
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
139
139
  editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined);
@@ -144,7 +144,7 @@ export const formatBulletList = (editor, blockType) => {
144
144
  }
145
145
  };
146
146
  export const formatCheckList = (editor, blockType) => {
147
- if (blockType !== 'check') {
147
+ if (blockType !== "check") {
148
148
  editor.update(() => {
149
149
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
150
150
  editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined);
@@ -155,7 +155,7 @@ export const formatCheckList = (editor, blockType) => {
155
155
  }
156
156
  };
157
157
  export const formatNumberedList = (editor, blockType) => {
158
- if (blockType !== 'number') {
158
+ if (blockType !== "number") {
159
159
  editor.update(() => {
160
160
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
161
161
  editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined);
@@ -166,7 +166,7 @@ export const formatNumberedList = (editor, blockType) => {
166
166
  }
167
167
  };
168
168
  export const formatQuote = (editor, blockType) => {
169
- if (blockType !== 'quote') {
169
+ if (blockType !== "quote") {
170
170
  editor.update(() => {
171
171
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
172
172
  const selection = $getSelection();
@@ -175,7 +175,7 @@ export const formatQuote = (editor, blockType) => {
175
175
  }
176
176
  };
177
177
  export const formatCode = (editor, blockType) => {
178
- if (blockType !== 'code') {
178
+ if (blockType !== "code") {
179
179
  editor.update(() => {
180
180
  $addUpdateTag(SKIP_SELECTION_FOCUS_TAG);
181
181
  let selection = $getSelection();
@@ -235,15 +235,15 @@ export const clearFormatting = (editor, skipRefocus = false) => {
235
235
  if (nodes.length === 1 && $isTextNode(extractedTextNode)) {
236
236
  textNode = extractedTextNode;
237
237
  }
238
- if (textNode.__style !== '') {
239
- textNode.setStyle('');
238
+ if (textNode.__style !== "") {
239
+ textNode.setStyle("");
240
240
  }
241
241
  if (textNode.__format !== 0) {
242
242
  textNode.setFormat(0);
243
243
  }
244
244
  const nearestBlockElement = $getNearestBlockElementAncestorOrThrow(textNode);
245
245
  if (nearestBlockElement.__format !== 0) {
246
- nearestBlockElement.setFormat('');
246
+ nearestBlockElement.setFormat("");
247
247
  }
248
248
  if (nearestBlockElement.__indent !== 0) {
249
249
  nearestBlockElement.setIndent(0);
@@ -254,7 +254,7 @@ export const clearFormatting = (editor, skipRefocus = false) => {
254
254
  node.replace($createParagraphNode(), true);
255
255
  }
256
256
  else if ($isDecoratorBlockNode(node)) {
257
- node.setFormat('');
257
+ node.setFormat("");
258
258
  }
259
259
  });
260
260
  }
@@ -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
  export declare const INSERT_TWEET_COMMAND: LexicalCommand<string>;
11
11
  export default function TwitterPlugin(): JSX.Element | null;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TwitterPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAyC,cAAc,EAAC,MAAM,SAAS,CAAC;AAK/E,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,MAAM,CAEvD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAqB1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TwitterPlugin/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAGL,cAAc,EACf,MAAM,SAAS,CAAC;AAKjB,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,MAAM,CAEvD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAqB1D"}
@@ -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 { $insertNodeToNearestRoot } from '@lexical/utils';
10
- import { COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
11
- import { useEffect } from 'react';
12
- import { $createTweetNode, TweetNode } from '../../nodes/TweetNode';
13
- export const INSERT_TWEET_COMMAND = createCommand('INSERT_TWEET_COMMAND');
1
+ "use client";
2
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
3
+ import { $insertNodeToNearestRoot } from "@lexical/utils";
4
+ import { COMMAND_PRIORITY_EDITOR, createCommand, } from "lexical";
5
+ import { useEffect } from "react";
6
+ import { $createTweetNode, TweetNode } from "../../nodes/TweetNode/TweetNode";
7
+ export const INSERT_TWEET_COMMAND = createCommand("INSERT_TWEET_COMMAND");
14
8
  export default function TwitterPlugin() {
15
9
  const [editor] = useLexicalComposerContext();
16
10
  useEffect(() => {
17
11
  if (!editor.hasNodes([TweetNode])) {
18
- throw new Error('TwitterPlugin: TweetNode not registered on editor');
12
+ throw new Error("TwitterPlugin: TweetNode not registered on editor");
19
13
  }
20
14
  return editor.registerCommand(INSERT_TWEET_COMMAND, (payload) => {
21
15
  const tweetNode = $createTweetNode(payload);
@@ -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
  export declare const INSERT_YOUTUBE_COMMAND: LexicalCommand<string>;
11
11
  export default function YouTubePlugin(): JSX.Element | null;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/YouTubePlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAyC,cAAc,EAAC,MAAM,SAAS,CAAC;AAK/E,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAEzD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAqB1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/YouTubePlugin/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAGL,cAAc,EACf,MAAM,SAAS,CAAC;AAQjB,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAEzD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAqB1D"}