@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,4 @@
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
- */
1
+ "use client";
8
2
  const elements = new WeakMap();
9
3
  function readTouch(e) {
10
4
  const touch = e.changedTouches[0];
@@ -37,8 +31,8 @@ function addListener(element, cb) {
37
31
  }
38
32
  }
39
33
  };
40
- element.addEventListener('touchstart', handleTouchstart);
41
- element.addEventListener('touchend', handleTouchend);
34
+ element.addEventListener("touchstart", handleTouchstart);
35
+ element.addEventListener("touchend", handleTouchend);
42
36
  elementValues = {
43
37
  handleTouchend,
44
38
  handleTouchstart,
@@ -59,8 +53,8 @@ function deleteListener(element, cb) {
59
53
  listeners.delete(cb);
60
54
  if (listeners.size === 0) {
61
55
  elements.delete(element);
62
- element.removeEventListener('touchstart', elementValues.handleTouchstart);
63
- element.removeEventListener('touchend', elementValues.handleTouchend);
56
+ element.removeEventListener("touchstart", elementValues.handleTouchstart);
57
+ element.removeEventListener("touchend", elementValues.handleTouchend);
64
58
  }
65
59
  }
66
60
  export function addSwipeLeftListener(element, cb) {
@@ -0,0 +1,18 @@
1
+ import { EditorState } from "lexical";
2
+ import React from "react";
3
+ export interface ViewerProps {
4
+ state: EditorState | string;
5
+ sanitize?: boolean;
6
+ }
7
+ /**
8
+ * A viewer component for displaying parsed editor state in the DOM. Returns a div containing dangerouslySetInnerHTML.
9
+ *
10
+ * HTML content is sanitized by stripping tags and running DOMPurify by default. This can be disabled by setting the `sanitize` prop to false - **not recommended for client-facing editors**.
11
+ *
12
+ * Note: DOMPurify is configured to allow iframes. A custom whitelist is applied to only allow iframes from YouTube, Figma, and Twitter.
13
+ * @param {ViewerProps} props
14
+ * @returns {JSX.Element}
15
+ */
16
+ export declare const Viewer: React.FC<ViewerProps>;
17
+ export default Viewer;
18
+ //# sourceMappingURL=Viewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Viewer.d.ts","sourceRoot":"","sources":["../../src/viewer/Viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,KAAuB,MAAM,OAAO,CAAC;AAU5C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AAEH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2GxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,105 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createHeadlessEditor } from "@lexical/headless";
3
+ import PlaygroundNodes from "../nodes/PlaygroundNodes/ServerPlaygroundNodes";
4
+ import { useMemo } from "react";
5
+ import DOMPurify from "dompurify";
6
+ import { $generateHtmlFromNodes } from "@lexical/html";
7
+ import { buildHTMLConfig } from "../buildHTMLConfig";
8
+ import { stripHtmlCode } from "@igorskyflyer/strip-html";
9
+ import { Tweet } from "react-tweet";
10
+ import parse from "html-react-parser";
11
+ import { JSDOM } from "jsdom";
12
+ import theme from "../themes/ViewerTheme";
13
+ /**
14
+ * A viewer component for displaying parsed editor state in the DOM. Returns a div containing dangerouslySetInnerHTML.
15
+ *
16
+ * HTML content is sanitized by stripping tags and running DOMPurify by default. This can be disabled by setting the `sanitize` prop to false - **not recommended for client-facing editors**.
17
+ *
18
+ * Note: DOMPurify is configured to allow iframes. A custom whitelist is applied to only allow iframes from YouTube, Figma, and Twitter.
19
+ * @param {ViewerProps} props
20
+ * @returns {JSX.Element}
21
+ */
22
+ export const Viewer = ({ state, sanitize = true, }) => {
23
+ if (typeof window === "undefined") {
24
+ global.window = new JSDOM("").window;
25
+ global.document = global.window.document;
26
+ }
27
+ // Create editor instance per component to avoid module-level singleton issues
28
+ const editor = useMemo(() => createHeadlessEditor({
29
+ namespace: "ViewerEditor",
30
+ nodes: [...PlaygroundNodes],
31
+ onError(error) {
32
+ throw error;
33
+ },
34
+ html: buildHTMLConfig(),
35
+ theme,
36
+ }), []);
37
+ try {
38
+ if (typeof state === "string") {
39
+ if (sanitize)
40
+ state = stripHtmlCode(state);
41
+ editor.setEditorState(editor.parseEditorState(state));
42
+ }
43
+ else {
44
+ editor.setEditorState(state);
45
+ }
46
+ let clean = "";
47
+ const purify = DOMPurify(window);
48
+ if (sanitize)
49
+ editor.update(() => {
50
+ const html = $generateHtmlFromNodes(editor);
51
+ clean = purify.sanitize(html, {
52
+ ADD_TAGS: ["iframe", "blockquote", "a", "p"],
53
+ ADD_ATTR: [
54
+ "src",
55
+ "width",
56
+ "height",
57
+ "frameborder",
58
+ "allowfullscreen",
59
+ "class",
60
+ "href",
61
+ ],
62
+ FORBID_ATTR: ["on*"],
63
+ });
64
+ const allowedSources = [
65
+ "https://www.youtube.com/embed",
66
+ "https://www.figma.com/embed",
67
+ "https://platform.twitter.com/widgets.js",
68
+ ];
69
+ const parser = new window.DOMParser();
70
+ const doc = parser.parseFromString(clean, "text/html");
71
+ const iframes = doc.querySelectorAll("iframe");
72
+ iframes.forEach((iframe) => {
73
+ const src = iframe.getAttribute("src");
74
+ if (!src ||
75
+ !allowedSources.some((source) => src.startsWith(source))) {
76
+ iframe.remove();
77
+ }
78
+ });
79
+ clean = doc.body.innerHTML;
80
+ });
81
+ else
82
+ editor.update(() => {
83
+ clean = $generateHtmlFromNodes(editor);
84
+ });
85
+ const parsedContent = parse(clean, {
86
+ replace: (domNode) => {
87
+ if (domNode &&
88
+ typeof domNode === "object" &&
89
+ "name" in domNode &&
90
+ "attribs" in domNode &&
91
+ domNode.name === "div" &&
92
+ domNode.attribs["data-lexical-tweet-id"]) {
93
+ const tweetId = domNode.attribs["data-lexical-tweet-id"];
94
+ return _jsx(Tweet, { id: tweetId });
95
+ }
96
+ },
97
+ });
98
+ return _jsx("div", { children: parsedContent });
99
+ }
100
+ catch (error) {
101
+ console.error("Error generating viewer output. There may be an error in the editor state or the HTML generation process.\n", error);
102
+ return (_jsxs("div", { className: "LexicalBlogViewer__Error", children: [_jsx("strong", { children: "Error:" }), " Unable to render content."] }));
103
+ }
104
+ };
105
+ export default Viewer;
@@ -0,0 +1,18 @@
1
+ import { EditorState } from "lexical";
2
+ import React from "react";
3
+ export interface ViewerProps {
4
+ state: EditorState | string;
5
+ sanitize?: boolean;
6
+ }
7
+ /**
8
+ * A viewer component for displaying parsed editor state in the DOM. Returns a div containing dangerouslySetInnerHTML.
9
+ *
10
+ * HTML content is sanitized by stripping tags and running DOMPurify by default. This can be disabled by setting the `sanitize` prop to false - **not recommended for client-facing editors**.
11
+ *
12
+ * Note: DOMPurify is configured to allow iframes. A custom whitelist is applied to only allow iframes from YouTube, Figma, and Twitter.
13
+ * @param {ViewerProps} props
14
+ * @returns {JSX.Element}
15
+ */
16
+ export declare const Viewer: React.FC<ViewerProps>;
17
+ export default Viewer;
18
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/viewer/client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,KAAuB,MAAM,OAAO,CAAC;AAS5C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AAEH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkGxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createEditor } from "lexical";
4
+ import PlaygroundNodes from "../nodes/PlaygroundNodes/ServerPlaygroundNodes";
5
+ import { useMemo } from "react";
6
+ import DOMPurify from "dompurify";
7
+ import { $generateHtmlFromNodes } from "@lexical/html";
8
+ import { buildHTMLConfig } from "../buildHTMLConfig";
9
+ import { stripHtmlCode } from "@igorskyflyer/strip-html";
10
+ import { Tweet } from "react-tweet";
11
+ import parse, { Element } from "html-react-parser";
12
+ import theme from "../themes/ViewerTheme";
13
+ /**
14
+ * A viewer component for displaying parsed editor state in the DOM. Returns a div containing dangerouslySetInnerHTML.
15
+ *
16
+ * HTML content is sanitized by stripping tags and running DOMPurify by default. This can be disabled by setting the `sanitize` prop to false - **not recommended for client-facing editors**.
17
+ *
18
+ * Note: DOMPurify is configured to allow iframes. A custom whitelist is applied to only allow iframes from YouTube, Figma, and Twitter.
19
+ * @param {ViewerProps} props
20
+ * @returns {JSX.Element}
21
+ */
22
+ export const Viewer = ({ state, sanitize = true, }) => {
23
+ // Create editor instance per component to avoid module-level singleton issues
24
+ const editor = useMemo(() => createEditor({
25
+ namespace: "ViewerEditor",
26
+ nodes: [...PlaygroundNodes],
27
+ onError(error) {
28
+ throw error;
29
+ },
30
+ html: buildHTMLConfig(),
31
+ theme,
32
+ }), []);
33
+ try {
34
+ if (typeof state === "string") {
35
+ if (sanitize)
36
+ state = stripHtmlCode(state);
37
+ editor.setEditorState(editor.parseEditorState(state));
38
+ }
39
+ else {
40
+ editor.setEditorState(state);
41
+ }
42
+ let clean = "";
43
+ if (sanitize)
44
+ editor.update(() => {
45
+ const html = $generateHtmlFromNodes(editor);
46
+ clean = DOMPurify.sanitize(html, {
47
+ ADD_TAGS: ["iframe", "blockquote"],
48
+ ADD_ATTR: [
49
+ "src",
50
+ "width",
51
+ "height",
52
+ "frameborder",
53
+ "allowfullscreen",
54
+ "class",
55
+ "href",
56
+ ],
57
+ FORBID_ATTR: ["on*"],
58
+ });
59
+ const allowedSources = [
60
+ "https://www.youtube.com/embed",
61
+ "https://www.figma.com/embed",
62
+ "https://platform.twitter.com/widgets.js",
63
+ ];
64
+ const parser = new DOMParser();
65
+ const doc = parser.parseFromString(clean, "text/html");
66
+ const iframes = doc.querySelectorAll("iframe");
67
+ iframes.forEach((iframe) => {
68
+ const src = iframe.getAttribute("src");
69
+ if (!src ||
70
+ !allowedSources.some((source) => src.startsWith(source))) {
71
+ iframe.remove();
72
+ }
73
+ });
74
+ clean = doc.body.innerHTML;
75
+ });
76
+ else
77
+ editor.update(() => {
78
+ clean = $generateHtmlFromNodes(editor);
79
+ });
80
+ const parsedContent = parse(clean, {
81
+ replace: (domNode) => {
82
+ if (domNode instanceof Element &&
83
+ domNode.name === "div" &&
84
+ domNode.attribs["data-lexical-tweet-id"]) {
85
+ const tweetId = domNode.attribs["data-lexical-tweet-id"];
86
+ return _jsx(Tweet, { id: tweetId });
87
+ }
88
+ },
89
+ });
90
+ return _jsx("div", { children: parsedContent });
91
+ }
92
+ catch (error) {
93
+ console.error("Error generating viewer output. There may be an error in the editor state or the HTML generation process.\n", error);
94
+ return (_jsxs("div", { className: "LexicalBlogViewer__Error", children: [_jsx("strong", { children: "Error:" }), " Unable to render content."] }));
95
+ }
96
+ };
97
+ export default Viewer;
@@ -0,0 +1,4 @@
1
+ export { Viewer } from "./Viewer";
2
+ export type { ViewerProps } from "./Viewer";
3
+ export { Viewer as default } from "./Viewer";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/viewer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Viewer } from "./Viewer";
2
+ export { Viewer as default } from "./Viewer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scottjgilbert/lexical-blog-editor",
3
- "version": "0.1.4",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Prebuilt components for editing and rendering rich blog content with Lexical. Modified wrapper of the Lexical Playground editor.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -13,7 +13,15 @@
13
13
  "types": "./build/index.d.ts",
14
14
  "import": "./build/index.js",
15
15
  "require": "./build/index.js"
16
- }
16
+ },
17
+ "./viewer": {
18
+ "types": "./build/viewer/index.d.ts",
19
+ "browser": "./build/viewer/client.js",
20
+ "import": "./build/viewer/index.js",
21
+ "require": "./build/viewer/index.js"
22
+ },
23
+ "./styles/ViewerTheme.css": "./build/themes/ViewerTheme.css",
24
+ "./styles/ViewerThemeComplete.css": "./build/themes/ViewerThemeComplete.css"
17
25
  },
18
26
  "files": [
19
27
  "build"
@@ -26,50 +34,64 @@
26
34
  "rich-text"
27
35
  ],
28
36
  "author": "Scott Gilbert",
29
- "license": "ISC",
37
+ "license": "MIT",
38
+ "peerDependencies": {
39
+ "lexical": "^0.40.0",
40
+ "react": "^18.0.0 || ^19.0.0",
41
+ "react-dom": "^18.0.0 || ^19.0.0"
42
+ },
30
43
  "dependencies": {
31
- "@floating-ui/react": "^0.27.16",
32
- "@lexical/clipboard": "^0.39.0",
33
- "@lexical/code": "^0.39.0",
34
- "@lexical/code-shiki": "^0.39.0",
35
- "@lexical/file": "^0.39.0",
36
- "@lexical/hashtag": "^0.39.0",
37
- "@lexical/html": "^0.39.0",
38
- "@lexical/link": "^0.39.0",
39
- "@lexical/list": "^0.39.0",
40
- "@lexical/mark": "^0.39.0",
41
- "@lexical/markdown": "^0.39.0",
42
- "@lexical/overflow": "^0.39.0",
43
- "@lexical/react": "^0.39.0",
44
- "@lexical/rich-text": "^0.39.0",
45
- "@lexical/selection": "^0.39.0",
46
- "@lexical/table": "^0.39.0",
47
- "@lexical/utils": "^0.39.0",
48
- "@lexical/yjs": "^0.39.0",
44
+ "@floating-ui/react": "^0.27.17",
45
+ "@igorskyflyer/strip-html": "^2.1.0",
46
+ "@lexical/clipboard": "^0.40.0",
47
+ "@lexical/code": "^0.40.0",
48
+ "@lexical/code-shiki": "^0.40.0",
49
+ "@lexical/extension": "^0.40.0",
50
+ "@lexical/file": "^0.40.0",
51
+ "@lexical/hashtag": "^0.40.0",
52
+ "@lexical/headless": "^0.40.0",
53
+ "@lexical/html": "^0.40.0",
54
+ "@lexical/link": "^0.40.0",
55
+ "@lexical/list": "^0.40.0",
56
+ "@lexical/mark": "^0.40.0",
57
+ "@lexical/markdown": "^0.40.0",
58
+ "@lexical/overflow": "^0.40.0",
59
+ "@lexical/react": "^0.40.0",
60
+ "@lexical/rich-text": "^0.40.0",
61
+ "@lexical/selection": "^0.40.0",
62
+ "@lexical/table": "^0.40.0",
63
+ "@lexical/utils": "^0.40.0",
64
+ "@lexical/yjs": "^0.40.0",
65
+ "@shikijs/core": "^3.22.0",
66
+ "@shikijs/engine-javascript": "^3.22.0",
67
+ "@shikijs/types": "^3.22.0",
49
68
  "date-fns": "^4.1.0",
50
- "katex": "^0.16.27",
51
- "lexical": "^0.39.0",
52
- "lodash": "^4.17.21",
53
- "lodash-es": "^4.17.22",
54
- "prettier": "^3.7.4",
55
- "react": "19.2.3",
69
+ "dompurify": "^3.0.6",
70
+ "html-react-parser": "^5.2.16",
71
+ "jsdom": "^28.0.0",
72
+ "katex": "^0.16.28",
73
+ "lodash": "^4.17.23",
74
+ "lodash-es": "^4.17.23",
75
+ "prettier": "^3.8.1",
56
76
  "react-day-picker": "^9.13.0",
57
- "react-dom": "19.2.3",
58
- "react-error-boundary": "^6.0.3",
77
+ "react-error-boundary": "^6.1.0",
78
+ "react-tweet": "^3.3.0",
79
+ "shiki": "^3.22.0",
59
80
  "y-websocket": "^3.0.0",
60
81
  "yjs": "^13.6.29"
61
82
  },
62
83
  "devDependencies": {
63
- "@tailwindcss/postcss": "^4",
84
+ "@tailwindcss/postcss": "^4.1.18",
85
+ "@types/jsdom": "^27.0.0",
64
86
  "@types/lodash": "^4.17.23",
65
87
  "@types/lodash-es": "^4.17.12",
66
- "@types/node": "^20",
67
- "@types/react": "^19",
68
- "@types/react-dom": "^19",
88
+ "@types/node": "^20.19.32",
89
+ "@types/react": "^19.2.13",
90
+ "@types/react-dom": "^19.2.3",
69
91
  "copyfiles": "^2.4.1",
70
- "eslint": "^9",
71
- "tailwindcss": "^4",
72
- "typescript": "^5"
92
+ "eslint": "^9.39.2",
93
+ "tailwindcss": "^4.1.18",
94
+ "typescript": "^5.9.3"
73
95
  },
74
96
  "scripts": {
75
97
  "build": "tsc && pnpm run copy-assets",
@@ -1,12 +0,0 @@
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 { Provider } from "@lexical/yjs";
9
- import { Doc } from "yjs";
10
- export declare function createWebsocketProvider(id: string, yjsDocMap: Map<string, Doc>): Provider;
11
- export declare function createWebsocketProviderWithDoc(id: string, doc: Doc): Provider;
12
- //# sourceMappingURL=collaboration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../src/collaboration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAU1B,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,QAAQ,CAWV;AAED,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,QAAQ,CAU7E"}
@@ -1,32 +0,0 @@
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 { WebsocketProvider } from "y-websocket";
9
- import { Doc } from "yjs";
10
- const url = new URL(window.location.href);
11
- const params = new URLSearchParams(url.search);
12
- const WEBSOCKET_ENDPOINT = params.get("collabEndpoint") || "ws://localhost:1234";
13
- const WEBSOCKET_SLUG = "playground";
14
- const WEBSOCKET_ID = params.get("collabId") || "0";
15
- // parent dom -> child doc
16
- export function createWebsocketProvider(id, yjsDocMap) {
17
- let doc = yjsDocMap.get(id);
18
- if (doc === undefined) {
19
- doc = new Doc();
20
- yjsDocMap.set(id, doc);
21
- }
22
- else {
23
- doc.load();
24
- }
25
- return createWebsocketProviderWithDoc(id, doc);
26
- }
27
- export function createWebsocketProviderWithDoc(id, doc) {
28
- // @ts-expect-error I have no idea why this is needed
29
- return new WebsocketProvider(WEBSOCKET_ENDPOINT, WEBSOCKET_SLUG + "/" + WEBSOCKET_ID + "/" + id, doc, {
30
- connect: false,
31
- });
32
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"FigmaNode.d.ts","sourceRoot":"","sources":["../../src/nodes/FigmaNode.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,0CAA0C,CAAC;AAmClD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC;IACE,UAAU,EAAE,MAAM,CAAC;CACpB,EACD,4BAA4B,CAC7B,CAAC;AAEF,qBAAa,SAAU,SAAQ,kBAAkB;IAC/C,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS;IAIxC,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS;IAMjE,UAAU,IAAI,mBAAmB;gBAOrB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,OAAO;IAKjE,SAAS,IAAI,KAAK;IAIlB,KAAK,IAAI,MAAM;IAIf,cAAc,CACZ,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,EACnC,qBAAqB,CAAC,EAAE,KAAK,GAAG,SAAS,GACxC,MAAM;IAIT,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;CAepE;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAE9D;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GAC/C,IAAI,IAAI,SAAS,CAEnB"}
@@ -1,64 +0,0 @@
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
-
9
- /* @import url('assets/styles/variables.css'); */
10
-
11
- [type='page-break'] {
12
- position: relative;
13
- display: block;
14
- width: calc(100% + var(--editor-input-padding, 28px) * 2);
15
- overflow: unset;
16
- margin-left: calc(var(--editor-input-padding, 28px) * -1);
17
- margin-top: var(--editor-input-padding, 28px);
18
- margin-bottom: var(--editor-input-padding, 28px);
19
-
20
- border: none;
21
- border-top: 1px dashed var(--editor-color-secondary, #eeeeee);
22
- border-bottom: 1px dashed var(--editor-color-secondary, #eeeeee);
23
- background-color: var(--editor-color-secondary, #eeeeee);
24
- }
25
-
26
- [type='page-break']::before {
27
- content: '';
28
-
29
- position: absolute;
30
- top: 50%;
31
- left: calc(var(--editor-input-padding, 28px) + 12px);
32
- transform: translateY(-50%);
33
- opacity: 0.5;
34
-
35
- background-size: cover;
36
- background-image: url(/src/images/icons/scissors.svg);
37
- width: 16px;
38
- height: 16px;
39
- }
40
-
41
- [type='page-break']::after {
42
- position: absolute;
43
- top: 50%;
44
- left: 50%;
45
- transform: translate(-50%, -50%);
46
-
47
- display: block;
48
- padding: 2px 6px;
49
- border: 1px solid #ccc;
50
- background-color: #fff;
51
-
52
- content: 'PAGE BREAK';
53
- font-size: 12px;
54
- color: #000;
55
- font-weight: 600;
56
- }
57
-
58
- .selected[type='page-break'] {
59
- border-color: var(--editor-color-primary, #4766cb);
60
- }
61
-
62
- .selected[type='page-break']::before {
63
- opacity: 1;
64
- }
@@ -1,25 +0,0 @@
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 type { JSX } from "react";
9
- import "./index.css";
10
- import { DecoratorNode, DOMConversionMap, LexicalNode, SerializedLexicalNode } from "lexical";
11
- export type SerializedPageBreakNode = SerializedLexicalNode;
12
- export declare class PageBreakNode extends DecoratorNode<JSX.Element> {
13
- static getType(): string;
14
- static clone(node: PageBreakNode): PageBreakNode;
15
- static importJSON(serializedNode: SerializedPageBreakNode): PageBreakNode;
16
- static importDOM(): DOMConversionMap | null;
17
- createDOM(): HTMLElement;
18
- getTextContent(): string;
19
- isInline(): false;
20
- updateDOM(): boolean;
21
- decorate(): JSX.Element;
22
- }
23
- export declare function $createPageBreakNode(): PageBreakNode;
24
- export declare function $isPageBreakNode(node: LexicalNode | null | undefined): node is PageBreakNode;
25
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nodes/PageBreakNode/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,aAAa,CAAC;AAKrB,OAAO,EAIL,aAAa,EACb,gBAAgB,EAEhB,WAAW,EAEX,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAuC5D,qBAAa,aAAc,SAAQ,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;IAC3D,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa;IAIhD,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,uBAAuB,GAAG,aAAa;IAIzE,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAgB3C,SAAS,IAAI,WAAW;IAOxB,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,KAAK;IAIjB,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,GAAG,CAAC,OAAO;CAGxB;AAMD,wBAAgB,oBAAoB,IAAI,aAAa,CAEpD;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,aAAa,CAEvB"}
@@ -1,83 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import "./index.css";
3
- import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
4
- import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
5
- import { mergeRegister } from "@lexical/utils";
6
- import { CLICK_COMMAND, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, DecoratorNode, } from "lexical";
7
- import { useEffect } from "react";
8
- function PageBreakComponent({ nodeKey }) {
9
- const [editor] = useLexicalComposerContext();
10
- const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
11
- useEffect(() => {
12
- return mergeRegister(editor.registerCommand(CLICK_COMMAND, (event) => {
13
- const pbElem = editor.getElementByKey(nodeKey);
14
- if (event.target === pbElem) {
15
- if (!event.shiftKey) {
16
- clearSelection();
17
- }
18
- setSelected(!isSelected);
19
- return true;
20
- }
21
- return false;
22
- }, COMMAND_PRIORITY_LOW));
23
- }, [clearSelection, editor, isSelected, nodeKey, setSelected]);
24
- useEffect(() => {
25
- const pbElem = editor.getElementByKey(nodeKey);
26
- if (pbElem !== null) {
27
- pbElem.className = isSelected ? "selected" : "";
28
- }
29
- }, [editor, isSelected, nodeKey]);
30
- return null;
31
- }
32
- export class PageBreakNode extends DecoratorNode {
33
- static getType() {
34
- return "page-break";
35
- }
36
- static clone(node) {
37
- return new PageBreakNode(node.__key);
38
- }
39
- static importJSON(serializedNode) {
40
- return $createPageBreakNode().updateFromJSON(serializedNode);
41
- }
42
- static importDOM() {
43
- return {
44
- figure: (domNode) => {
45
- const tp = domNode.getAttribute("type");
46
- if (tp !== this.getType()) {
47
- return null;
48
- }
49
- return {
50
- conversion: $convertPageBreakElement,
51
- priority: COMMAND_PRIORITY_HIGH,
52
- };
53
- },
54
- };
55
- }
56
- createDOM() {
57
- const el = document.createElement("figure");
58
- el.style.pageBreakAfter = "always";
59
- el.setAttribute("type", this.getType());
60
- return el;
61
- }
62
- getTextContent() {
63
- return "\n";
64
- }
65
- isInline() {
66
- return false;
67
- }
68
- updateDOM() {
69
- return false;
70
- }
71
- decorate() {
72
- return _jsx(PageBreakComponent, { nodeKey: this.__key });
73
- }
74
- }
75
- function $convertPageBreakElement() {
76
- return { node: $createPageBreakNode() };
77
- }
78
- export function $createPageBreakNode() {
79
- return new PageBreakNode();
80
- }
81
- export function $isPageBreakNode(node) {
82
- return node instanceof PageBreakNode;
83
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlaygroundNodes.d.ts","sourceRoot":"","sources":["../../src/nodes/PlaygroundNodes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA8BlD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAiC9C,CAAC;AAEF,eAAe,eAAe,CAAC"}