@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.
- package/README.md +73 -67
- package/build/Editor.d.ts +8 -3
- package/build/Editor.d.ts.map +1 -1
- package/build/Editor.js +13 -8
- package/build/EditorExport.d.ts +4 -0
- package/build/EditorExport.d.ts.map +1 -0
- package/build/EditorExport.js +13 -0
- package/build/appSettings.d.ts +1 -1
- package/build/appSettings.js +1 -1
- package/build/buildHTMLConfig.d.ts +1 -1
- package/build/buildHTMLConfig.d.ts.map +1 -1
- package/build/buildHTMLConfig.js +35 -11
- package/build/context/FlashMessageContext.d.ts +2 -2
- package/build/context/FlashMessageContext.d.ts.map +1 -1
- package/build/context/FlashMessageContext.js +4 -3
- package/build/context/SharedHistoryContext.d.ts +3 -3
- package/build/context/SharedHistoryContext.d.ts.map +1 -1
- package/build/context/SharedHistoryContext.js +3 -2
- package/build/context/ToolbarContext.d.ts +1 -0
- package/build/context/ToolbarContext.d.ts.map +1 -1
- package/build/context/ToolbarContext.js +2 -0
- package/build/hooks/useModal.d.ts.map +1 -1
- package/build/hooks/useModal.js +1 -0
- package/build/hooks/useReport.d.ts +0 -7
- package/build/hooks/useReport.d.ts.map +1 -1
- package/build/hooks/useReport.js +1 -0
- package/build/index.css +283 -246
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/nodes/CodeNode/CodeHighlightNode.d.ts +35 -0
- package/build/nodes/CodeNode/CodeHighlightNode.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeHighlightNode.js +88 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts +22 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.js +644 -0
- package/build/nodes/CodeNode/CodeNode.d.ts +48 -0
- package/build/nodes/CodeNode/CodeNode.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeNode.js +367 -0
- package/build/nodes/CodeNode/FacadeShiki.d.ts +18 -0
- package/build/nodes/CodeNode/FacadeShiki.d.ts.map +1 -0
- package/build/nodes/CodeNode/FacadeShiki.js +159 -0
- package/build/nodes/CodeNode/FlatStructureUtils.d.ts +21 -0
- package/build/nodes/CodeNode/FlatStructureUtils.d.ts.map +1 -0
- package/build/nodes/CodeNode/FlatStructureUtils.js +85 -0
- package/build/nodes/CodeNode/invariant.d.ts +2 -0
- package/build/nodes/CodeNode/invariant.d.ts.map +1 -0
- package/build/nodes/CodeNode/invariant.js +6 -0
- package/build/nodes/DateTimeNode/DateTimeComponent.d.ts.map +1 -1
- package/build/nodes/DateTimeNode/DateTimeComponent.js +1 -0
- package/build/nodes/DateTimeNode/DateTimeNode.css +21 -0
- package/build/nodes/FigmaNode/FigmaNode.d.ts.map +1 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.d.ts +21 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.d.ts.map +1 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.js +48 -0
- package/build/nodes/ImageComponent.d.ts.map +1 -1
- package/build/nodes/ImageComponent.js +1 -2
- package/build/nodes/ImageNode.d.ts +7 -7
- package/build/nodes/ImageNode.d.ts.map +1 -1
- package/build/nodes/ImageNode.js +30 -30
- package/build/nodes/LayoutContainerNode.d.ts +2 -2
- package/build/nodes/LayoutContainerNode.d.ts.map +1 -1
- package/build/nodes/LayoutContainerNode.js +10 -10
- package/build/nodes/PlaygroundNodes/PlaygroundNodes.d.ts.map +1 -0
- package/build/nodes/{PlaygroundNodes.js → PlaygroundNodes/PlaygroundNodes.js} +19 -21
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts +11 -0
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts.map +1 -0
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.js +65 -0
- package/build/nodes/TweetNode/ServerTweetNode.d.ts +20 -0
- package/build/nodes/TweetNode/ServerTweetNode.d.ts.map +1 -0
- package/build/nodes/TweetNode/ServerTweetNode.js +59 -0
- package/build/nodes/TweetNode/TweetNode.d.ts.map +1 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts +21 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts.map +1 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.js +67 -0
- package/build/nodes/YouTubeNode/YouTubeNode.d.ts.map +1 -0
- package/build/plugins/ActionsPlugin/index.d.ts +0 -7
- package/build/plugins/ActionsPlugin/index.d.ts.map +1 -1
- package/build/plugins/ActionsPlugin/index.js +2 -1
- package/build/plugins/AutoEmbedPlugin/index.d.ts +2 -9
- package/build/plugins/AutoEmbedPlugin/index.d.ts.map +1 -1
- package/build/plugins/AutoEmbedPlugin/index.js +30 -29
- package/build/plugins/AutoLinkPlugin/index.d.ts +1 -1
- package/build/plugins/AutoLinkPlugin/index.d.ts.map +1 -1
- package/build/plugins/AutoLinkPlugin/index.js +3 -2
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +7 -6
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +2 -2
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +25 -24
- package/build/plugins/CodeActionMenuPlugin/index.d.ts +2 -9
- package/build/plugins/CodeActionMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/index.js +22 -20
- package/build/plugins/CodeActionMenuPlugin/utils.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/utils.js +3 -2
- package/build/plugins/CodeHighlightPrismPlugin/index.d.ts +1 -1
- package/build/plugins/CodeHighlightPrismPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeHighlightPrismPlugin/index.js +4 -10
- package/build/plugins/CodeHighlightShikiPlugin/index.d.ts +1 -1
- package/build/plugins/CodeHighlightShikiPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeHighlightShikiPlugin/index.js +3 -3
- package/build/plugins/CollapsiblePlugin/Collapsible.css +17 -1
- package/build/plugins/CollapsiblePlugin/index.d.ts +1 -1
- package/build/plugins/CollapsiblePlugin/index.d.ts.map +1 -1
- package/build/plugins/CollapsiblePlugin/index.js +11 -10
- package/build/plugins/ComponentPickerPlugin/index.d.ts.map +1 -1
- package/build/plugins/ComponentPickerPlugin/index.js +3 -8
- package/build/plugins/ContextMenuPlugin/index.d.ts +1 -1
- package/build/plugins/ContextMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/ContextMenuPlugin/index.js +15 -14
- package/build/plugins/DateTimePlugin/index.d.ts +2 -2
- package/build/plugins/DateTimePlugin/index.d.ts.map +1 -1
- package/build/plugins/DateTimePlugin/index.js +8 -14
- package/build/plugins/DragDropPastePlugin/index.d.ts +0 -7
- package/build/plugins/DragDropPastePlugin/index.d.ts.map +1 -1
- package/build/plugins/DragDropPastePlugin/index.js +12 -11
- package/build/plugins/DraggableBlockPlugin/index.css +6 -0
- package/build/plugins/DraggableBlockPlugin/index.d.ts +2 -2
- package/build/plugins/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/build/plugins/DraggableBlockPlugin/index.js +23 -22
- package/build/plugins/EmojiPickerPlugin/index.d.ts +0 -7
- package/build/plugins/EmojiPickerPlugin/index.d.ts.map +1 -1
- package/build/plugins/EmojiPickerPlugin/index.js +1 -0
- package/build/plugins/EmojisPlugin/index.d.ts +1 -8
- package/build/plugins/EmojisPlugin/index.d.ts.map +1 -1
- package/build/plugins/EmojisPlugin/index.js +10 -16
- package/build/plugins/EquationsPlugin/index.d.ts +3 -3
- package/build/plugins/EquationsPlugin/index.d.ts.map +1 -1
- package/build/plugins/EquationsPlugin/index.js +14 -10
- package/build/plugins/FigmaPlugin/index.d.ts +2 -2
- package/build/plugins/FigmaPlugin/index.d.ts.map +1 -1
- package/build/plugins/FigmaPlugin/index.js +8 -14
- package/build/plugins/FloatingLinkEditorPlugin/index.css +11 -0
- package/build/plugins/FloatingLinkEditorPlugin/index.d.ts +3 -3
- package/build/plugins/FloatingLinkEditorPlugin/index.d.ts.map +1 -1
- package/build/plugins/FloatingLinkEditorPlugin/index.js +28 -27
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.css +15 -0
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.d.ts.map +1 -1
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.js +2 -1
- package/build/plugins/ImagesPlugin/index.d.ts +3 -3
- package/build/plugins/ImagesPlugin/index.d.ts.map +1 -1
- package/build/plugins/ImagesPlugin/index.js +38 -37
- package/build/plugins/KeywordsPlugin/index.d.ts +1 -8
- package/build/plugins/KeywordsPlugin/index.d.ts.map +1 -1
- package/build/plugins/KeywordsPlugin/index.js +6 -12
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +2 -2
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts.map +1 -1
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.js +10 -9
- package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts +1 -1
- package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts.map +1 -1
- package/build/plugins/LayoutPlugin/LayoutPlugin.js +8 -14
- package/build/plugins/LinkPlugin/index.d.ts.map +1 -1
- package/build/plugins/LinkPlugin/index.js +1 -0
- package/build/plugins/MarkdownShortcutPlugin/index.d.ts.map +1 -1
- package/build/plugins/MarkdownShortcutPlugin/index.js +1 -0
- package/build/plugins/MarkdownTransformers/index.d.ts +1 -1
- package/build/plugins/MarkdownTransformers/index.d.ts.map +1 -1
- package/build/plugins/MarkdownTransformers/index.js +25 -25
- package/build/plugins/PasteLogPlugin/index.d.ts.map +1 -1
- package/build/plugins/PasteLogPlugin/index.js +1 -0
- package/build/plugins/ShortcutsPlugin/index.d.ts +0 -7
- package/build/plugins/ShortcutsPlugin/index.d.ts.map +1 -1
- package/build/plugins/ShortcutsPlugin/index.js +1 -0
- package/build/plugins/SpeechToTextPlugin/index.d.ts +2 -2
- package/build/plugins/SpeechToTextPlugin/index.d.ts.map +1 -1
- package/build/plugins/SpeechToTextPlugin/index.js +7 -11
- package/build/plugins/TabFocusPlugin/index.d.ts +0 -7
- package/build/plugins/TabFocusPlugin/index.d.ts.map +1 -1
- package/build/plugins/TabFocusPlugin/index.js +6 -5
- package/build/plugins/TableActionMenuPlugin/index.d.ts +1 -8
- package/build/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableActionMenuPlugin/index.js +41 -40
- package/build/plugins/TableCellResizer/index.d.ts +2 -2
- package/build/plugins/TableCellResizer/index.d.ts.map +1 -1
- package/build/plugins/TableCellResizer/index.js +43 -42
- package/build/plugins/TableHoverActionsPlugin/index.d.ts +1 -8
- package/build/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableHoverActionsPlugin/index.js +19 -18
- package/build/plugins/TableHoverActionsV2Plugin/index.d.ts.map +1 -1
- package/build/plugins/TableHoverActionsV2Plugin/index.js +1 -0
- package/build/plugins/TablePlugin.d.ts +2 -2
- package/build/plugins/TablePlugin.d.ts.map +1 -1
- package/build/plugins/TablePlugin.js +11 -10
- package/build/plugins/TableScrollShadowPlugin/index.d.ts +0 -7
- package/build/plugins/TableScrollShadowPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableScrollShadowPlugin/index.js +9 -8
- package/build/plugins/TestRecorderPlugin/index.d.ts +1 -8
- package/build/plugins/TestRecorderPlugin/index.d.ts.map +1 -1
- package/build/plugins/TestRecorderPlugin/index.js +45 -44
- package/build/plugins/ToolbarPlugin/fontSize.d.ts +2 -2
- package/build/plugins/ToolbarPlugin/fontSize.d.ts.map +1 -1
- package/build/plugins/ToolbarPlugin/fontSize.js +19 -18
- package/build/plugins/ToolbarPlugin/index.d.ts.map +1 -1
- package/build/plugins/ToolbarPlugin/index.js +68 -60
- package/build/plugins/ToolbarPlugin/languages.d.ts +14 -0
- package/build/plugins/ToolbarPlugin/languages.d.ts.map +1 -0
- package/build/plugins/ToolbarPlugin/languages.js +185 -0
- package/build/plugins/ToolbarPlugin/utils.d.ts +2 -2
- package/build/plugins/ToolbarPlugin/utils.js +21 -21
- package/build/plugins/TwitterPlugin/index.d.ts +2 -2
- package/build/plugins/TwitterPlugin/index.d.ts.map +1 -1
- package/build/plugins/TwitterPlugin/index.js +8 -14
- package/build/plugins/YouTubePlugin/index.d.ts +2 -2
- package/build/plugins/YouTubePlugin/index.d.ts.map +1 -1
- package/build/plugins/YouTubePlugin/index.js +8 -14
- package/build/themes/PlaygroundEditorTheme.css +301 -33
- package/build/themes/ViewerTheme.css +899 -0
- package/build/{plugins/MentionsPlugin/index.d.ts → themes/ViewerTheme.d.ts} +5 -3
- package/build/themes/ViewerTheme.d.ts.map +1 -0
- package/build/themes/ViewerTheme.js +124 -0
- package/build/themes/ViewerThemeComplete.css +1043 -0
- package/build/ui/ColorPicker.d.ts +2 -2
- package/build/ui/ColorPicker.d.ts.map +1 -1
- package/build/ui/ColorPicker.js +47 -46
- package/build/ui/DropDown.d.ts.map +1 -1
- package/build/ui/DropDown.js +1 -0
- package/build/ui/FlashMessage.d.ts +3 -3
- package/build/ui/FlashMessage.d.ts.map +1 -1
- package/build/ui/FlashMessage.js +3 -2
- package/build/ui/ImageResizer.d.ts +3 -3
- package/build/ui/ImageResizer.d.ts.map +1 -1
- package/build/ui/ImageResizer.js +20 -19
- package/build/ui/KatexEquationAlterer.css +3 -1
- package/build/ui/KatexEquationAlterer.d.ts.map +1 -1
- package/build/ui/KatexEquationAlterer.js +1 -0
- package/build/ui/KatexRenderer.d.ts.map +1 -1
- package/build/ui/KatexRenderer.js +1 -0
- package/build/ui/Modal.d.ts.map +1 -1
- package/build/ui/Modal.js +1 -0
- package/build/ui/Switch.d.ts +2 -2
- package/build/ui/Switch.d.ts.map +1 -1
- package/build/ui/Switch.js +3 -2
- package/build/ui/TextInput.d.ts.map +1 -1
- package/build/ui/TextInput.js +1 -0
- package/build/utils/ServerBlockWithAlignableContents.d.ts +22 -0
- package/build/utils/ServerBlockWithAlignableContents.d.ts.map +1 -0
- package/build/utils/ServerBlockWithAlignableContents.js +6 -0
- package/build/utils/focusUtils.d.ts.map +1 -1
- package/build/utils/focusUtils.js +4 -3
- package/build/utils/getDOMRangeRect.d.ts.map +1 -1
- package/build/utils/getDOMRangeRect.js +1 -0
- package/build/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/build/utils/setFloatingElemPosition.js +5 -4
- package/build/utils/swipe.d.ts +0 -7
- package/build/utils/swipe.d.ts.map +1 -1
- package/build/utils/swipe.js +5 -11
- package/build/viewer/Viewer.d.ts +18 -0
- package/build/viewer/Viewer.d.ts.map +1 -0
- package/build/viewer/Viewer.js +105 -0
- package/build/viewer/client.d.ts +18 -0
- package/build/viewer/client.d.ts.map +1 -0
- package/build/viewer/client.js +97 -0
- package/build/viewer/index.d.ts +4 -0
- package/build/viewer/index.d.ts.map +1 -0
- package/build/viewer/index.js +2 -0
- package/package.json +58 -36
- package/build/collaboration.d.ts +0 -12
- package/build/collaboration.d.ts.map +0 -1
- package/build/collaboration.js +0 -32
- package/build/nodes/FigmaNode.d.ts.map +0 -1
- package/build/nodes/PageBreakNode/index.css +0 -64
- package/build/nodes/PageBreakNode/index.d.ts +0 -25
- package/build/nodes/PageBreakNode/index.d.ts.map +0 -1
- package/build/nodes/PageBreakNode/index.js +0 -83
- package/build/nodes/PlaygroundNodes.d.ts.map +0 -1
- package/build/nodes/PollComponent.d.ts +0 -17
- package/build/nodes/PollComponent.d.ts.map +0 -1
- package/build/nodes/PollComponent.js +0 -85
- package/build/nodes/PollNode.css +0 -165
- package/build/nodes/PollNode.d.ts +0 -51
- package/build/nodes/PollNode.d.ts.map +0 -1
- package/build/nodes/PollNode.js +0 -153
- package/build/nodes/StickyComponent.d.ts +0 -18
- package/build/nodes/StickyComponent.d.ts.map +0 -1
- package/build/nodes/StickyComponent.js +0 -155
- package/build/nodes/StickyNode.css +0 -37
- package/build/nodes/StickyNode.d.ts +0 -39
- package/build/nodes/StickyNode.d.ts.map +0 -1
- package/build/nodes/StickyNode.js +0 -66
- package/build/nodes/TweetNode.d.ts.map +0 -1
- package/build/nodes/YouTubeNode.d.ts.map +0 -1
- package/build/plugins/DocsPlugin/index.d.ts +0 -10
- package/build/plugins/DocsPlugin/index.d.ts.map +0 -1
- package/build/plugins/DocsPlugin/index.js +0 -4
- package/build/plugins/MaxLengthPlugin/index.d.ts +0 -11
- package/build/plugins/MaxLengthPlugin/index.d.ts.map +0 -1
- package/build/plugins/MaxLengthPlugin/index.js +0 -44
- package/build/plugins/MentionsPlugin/index.d.ts.map +0 -1
- package/build/plugins/MentionsPlugin/index.js +0 -562
- package/build/plugins/PageBreakPlugin/index.d.ts +0 -12
- package/build/plugins/PageBreakPlugin/index.d.ts.map +0 -1
- package/build/plugins/PageBreakPlugin/index.js +0 -34
- package/build/plugins/StickyPlugin/index.d.ts +0 -10
- package/build/plugins/StickyPlugin/index.d.ts.map +0 -1
- package/build/plugins/StickyPlugin/index.js +0 -19
- package/build/plugins/TreeViewPlugin/index.d.ts +0 -10
- package/build/plugins/TreeViewPlugin/index.d.ts.map +0 -1
- package/build/plugins/TreeViewPlugin/index.js +0 -7
- package/build/plugins/TypingPerfPlugin/index.d.ts +0 -10
- package/build/plugins/TypingPerfPlugin/index.d.ts.map +0 -1
- package/build/plugins/TypingPerfPlugin/index.js +0 -100
- package/build/plugins/VersionsPlugin/index.css +0 -57
- package/build/plugins/VersionsPlugin/index.d.ts +0 -14
- package/build/plugins/VersionsPlugin/index.d.ts.map +0 -1
- package/build/plugins/VersionsPlugin/index.js +0 -147
- /package/build/nodes/{FigmaNode.d.ts → FigmaNode/FigmaNode.d.ts} +0 -0
- /package/build/nodes/{FigmaNode.js → FigmaNode/FigmaNode.js} +0 -0
- /package/build/nodes/{PlaygroundNodes.d.ts → PlaygroundNodes/PlaygroundNodes.d.ts} +0 -0
- /package/build/nodes/{TweetNode.d.ts → TweetNode/TweetNode.d.ts} +0 -0
- /package/build/nodes/{TweetNode.js → TweetNode/TweetNode.js} +0 -0
- /package/build/nodes/{YouTubeNode.d.ts → YouTubeNode/YouTubeNode.d.ts} +0 -0
- /package/build/nodes/{YouTubeNode.js → YouTubeNode/YouTubeNode.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
# @scottjgilbert/lexical-blog-editor
|
|
2
2
|
|
|
3
|
+
<p float="left">
|
|
3
4
|
<img alt="NPM version" src="https://img.shields.io/npm/v/@scottjgilbert/lexical-blog-editor.svg?style=for-the-badge&labelColor=000000">
|
|
4
5
|
<img alt="License" src="https://img.shields.io/npm/l/@scottjgilbert/lexical-blog-editor.svg?style=for-the-badge&labelColor=000000">
|
|
6
|
+
</p>
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
# Lexical Blog Editor Documentation
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
A feature-rich, production-ready rich text editor designed for blog content management. Built on Meta's [Lexical](https://lexical.dev/) framework.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
A feature-rich, production-ready rich text editor and viewer for blog content, built on Meta's [Lexical](https://lexical.dev/) framework. This package provides a comprehensive editing experience with extensive plugin support, custom nodes, and a full-featured toolbar.
|
|
15
|
+
|
|
16
|
+
This editor is designed to be plug-and-play and is not customizable or designed for extensive configuration. It is intended to be used as a complete solution for blog content creation, with a focus on providing a wide range of features out of the box.
|
|
9
17
|
|
|
10
18
|
## Installation
|
|
11
19
|
|
|
@@ -21,33 +29,47 @@ yarn add @scottjgilbert/lexical-blog-editor
|
|
|
21
29
|
|
|
22
30
|
This package requires the following peer dependencies:
|
|
23
31
|
|
|
24
|
-
-
|
|
25
|
-
- React
|
|
26
|
-
-
|
|
32
|
+
- Lexical 0.40.0 or higher
|
|
33
|
+
- React 18.0.0 or 19.0.0
|
|
34
|
+
- React DOM 18.0.0 or 19.0.0
|
|
35
|
+
|
|
36
|
+
## Supported Browsers
|
|
37
|
+
|
|
38
|
+
| Browser | Version |
|
|
39
|
+
| ------- | ------- |
|
|
40
|
+
| Chrome | 49+ |
|
|
41
|
+
| Firefox | 52+ |
|
|
42
|
+
| Safari | 11+ |
|
|
43
|
+
| Edge | 79+ |
|
|
27
44
|
|
|
28
45
|
## Usage
|
|
29
46
|
|
|
30
47
|
### Basic Implementation
|
|
31
48
|
|
|
32
49
|
```tsx
|
|
50
|
+
import { useState } from "react";
|
|
33
51
|
import { Editor } from "@scottjgilbert/lexical-blog-editor";
|
|
34
|
-
import
|
|
52
|
+
import { Viewer } from "@scottjgilbert/lexical-blog-editor/viewer";
|
|
53
|
+
import type { EditorState } from "@scottjgilbert/lexical-blog-editor";
|
|
54
|
+
|
|
55
|
+
import "@scottjgilbert/lexical-blog-editor/styles/ViewerTheme.css";
|
|
35
56
|
|
|
36
57
|
function MyBlogEditor() {
|
|
58
|
+
const [savedState, setSavedState] = useState<string | null>(null);
|
|
59
|
+
|
|
37
60
|
const handleChange = (editorState: EditorState) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const json = JSON.stringify(editorState.toJSON());
|
|
41
|
-
console.log("Editor content:", json);
|
|
42
|
-
// Save to your database, state management, etc.
|
|
43
|
-
});
|
|
61
|
+
const json = JSON.stringify(editorState.toJSON());
|
|
62
|
+
setSavedState(json);
|
|
44
63
|
};
|
|
45
64
|
|
|
46
65
|
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
<>
|
|
67
|
+
<Editor
|
|
68
|
+
onChange={handleChange}
|
|
69
|
+
placeholder="Start writing your blog post..."
|
|
70
|
+
/>
|
|
71
|
+
{savedState && <Viewer state={savedState} />}
|
|
72
|
+
</>
|
|
51
73
|
);
|
|
52
74
|
}
|
|
53
75
|
```
|
|
@@ -56,10 +78,10 @@ function MyBlogEditor() {
|
|
|
56
78
|
|
|
57
79
|
```tsx
|
|
58
80
|
import { Editor } from "@scottjgilbert/lexical-blog-editor";
|
|
59
|
-
import type { EditorState } from "lexical";
|
|
81
|
+
import type { EditorState } from "@scottjgilbert/lexical-blog-editor";
|
|
60
82
|
|
|
61
83
|
function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
62
|
-
const handleChange = (editorState: EditorState) => {
|
|
84
|
+
const handleChange = (editorState: EditorState, html: string) => {
|
|
63
85
|
// Handle changes
|
|
64
86
|
};
|
|
65
87
|
|
|
@@ -79,11 +101,26 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
79
101
|
|
|
80
102
|
#### Props
|
|
81
103
|
|
|
82
|
-
| Prop | Type
|
|
83
|
-
| -------------- |
|
|
84
|
-
| `onChange` | `(editorState: EditorState) => void` | **Required** | Callback fired whenever the editor content changes |
|
|
85
|
-
| `placeholder` | `string`
|
|
86
|
-
| `initialState` | `EditorState`
|
|
104
|
+
| Prop | Type | Default | Description |
|
|
105
|
+
| -------------- | -------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------- |
|
|
106
|
+
| `onChange` | `(editorState: EditorState, html: string) => void` | **Required** | Callback fired whenever the editor content changes |
|
|
107
|
+
| `placeholder` | `string` | `"Enter some text..."` | Placeholder text displayed when the editor is empty |
|
|
108
|
+
| `initialState` | `EditorState` | `undefined` | Initial editor content state. If not provided, displays a default welcome message |
|
|
109
|
+
|
|
110
|
+
### Viewer Component
|
|
111
|
+
|
|
112
|
+
Import from:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Viewer } from "@scottjgilbert/lexical-blog-editor/viewer";
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Props
|
|
119
|
+
|
|
120
|
+
| Prop | Type | Default | Description |
|
|
121
|
+
| ---------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `state` | `EditorState \| string` | **Required** | Serialized editor state string (from `JSON.stringify(editorState.toJSON())`) or an `EditorState` instance |
|
|
123
|
+
| `sanitize` | `boolean` | `true` | Sanitizes generated HTML with DOMPurify and an iframe allowlist for YouTube, Figma, and Twitter embeds |
|
|
87
124
|
|
|
88
125
|
## Features
|
|
89
126
|
|
|
@@ -105,7 +142,6 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
105
142
|
- **Embeds**: YouTube videos, Twitter/X posts, Figma designs
|
|
106
143
|
- **Equations**: LaTeX/KaTeX mathematical equation support
|
|
107
144
|
- **Horizontal Rules**: Visual section dividers
|
|
108
|
-
- **Page Breaks**: Print-friendly page break markers
|
|
109
145
|
- **Layouts**: Multi-column layouts with customizable containers
|
|
110
146
|
- **Collapsible Sections**: Expandable/collapsible content blocks
|
|
111
147
|
- **Date/Time**: Insert formatted date and time stamps
|
|
@@ -113,11 +149,9 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
113
149
|
### Interactive Elements
|
|
114
150
|
|
|
115
151
|
- **Links**: Auto-detection, manual insertion, and inline editing
|
|
116
|
-
- **Mentions**: @mention support with autocomplete
|
|
117
152
|
- **Hashtags**: Automatic #hashtag detection
|
|
118
153
|
- **Keywords**: Special keyword highlighting
|
|
119
154
|
- **Emojis**: Emoji picker with search and categories
|
|
120
|
-
- **Polls**: Interactive poll creation (visual component)
|
|
121
155
|
|
|
122
156
|
### Advanced Features
|
|
123
157
|
|
|
@@ -127,15 +161,16 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
127
161
|
- **Component Picker**: Slash commands (`/`) to quickly insert components
|
|
128
162
|
- **Floating Toolbars**: Context-aware formatting toolbars
|
|
129
163
|
- **Auto-linking**: Automatically converts URLs to clickable links
|
|
130
|
-
- **Syntax Highlighting**: Code blocks with Shiki-powered syntax highlighting
|
|
164
|
+
- **Syntax Highlighting**: Code blocks with Shiki-powered syntax highlighting for almost 200 languages
|
|
131
165
|
- **Undo/Redo**: Full history support with keyboard shortcuts
|
|
132
166
|
- **Keyboard Shortcuts**: Comprehensive keyboard shortcut system
|
|
133
167
|
- **Copy/Paste**: Smart paste handling with format preservation
|
|
168
|
+
- **Viewer**: Read-only rendering component with sanitization and embed handling
|
|
134
169
|
|
|
135
|
-
### Included Plugins
|
|
170
|
+
### Included Plugins/Extensions
|
|
136
171
|
|
|
137
172
|
<details>
|
|
138
|
-
<summary>View all
|
|
173
|
+
<summary>View all (30+)</summary>
|
|
139
174
|
|
|
140
175
|
- ActionsPlugin
|
|
141
176
|
- AutoEmbedPlugin
|
|
@@ -145,7 +180,6 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
145
180
|
- ClearEditorPlugin
|
|
146
181
|
- ClickableLinkPlugin
|
|
147
182
|
- CodeActionMenuPlugin
|
|
148
|
-
- CodeHighlightShikiPlugin
|
|
149
183
|
- CollapsiblePlugin
|
|
150
184
|
- ComponentPickerPlugin
|
|
151
185
|
- DateTimePlugin
|
|
@@ -159,15 +193,13 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
159
193
|
- FloatingTextFormatToolbarPlugin
|
|
160
194
|
- HashtagPlugin
|
|
161
195
|
- HistoryPlugin
|
|
162
|
-
-
|
|
196
|
+
- HorizontalRule**Extension**
|
|
163
197
|
- ImagesPlugin
|
|
164
198
|
- KeywordsPlugin
|
|
165
199
|
- LayoutPlugin
|
|
166
200
|
- LinkPlugin
|
|
167
201
|
- ListPlugin
|
|
168
202
|
- MarkdownShortcutPlugin
|
|
169
|
-
- MentionsPlugin
|
|
170
|
-
- PageBreakPlugin
|
|
171
203
|
- RichTextPlugin
|
|
172
204
|
- ShortcutsPlugin
|
|
173
205
|
- SpeechToTextPlugin
|
|
@@ -182,7 +214,8 @@ function MyBlogEditor({ savedContent }: { savedContent?: EditorState }) {
|
|
|
182
214
|
|
|
183
215
|
### Custom Nodes
|
|
184
216
|
|
|
185
|
-
|
|
217
|
+
<details>
|
|
218
|
+
<summary>The editor includes 20 custom node types:</summary>
|
|
186
219
|
|
|
187
220
|
- AutoLinkNode, LinkNode
|
|
188
221
|
- CodeNode, CodeHighlightNode
|
|
@@ -199,34 +232,20 @@ The editor includes over 25 custom node types:
|
|
|
199
232
|
- LayoutContainerNode, LayoutItemNode
|
|
200
233
|
- ListNode, ListItemNode
|
|
201
234
|
- MarkNode
|
|
202
|
-
- MentionNode
|
|
203
235
|
- OverflowNode
|
|
204
|
-
- PageBreakNode
|
|
205
|
-
- PollNode
|
|
206
236
|
- SpecialTextNode
|
|
207
237
|
- TableNode, TableCellNode, TableRowNode
|
|
208
238
|
- TweetNode
|
|
209
239
|
- YouTubeNode
|
|
210
240
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
The package includes built-in CSS that will be automatically imported. The editor uses CSS classes that can be customized:
|
|
214
|
-
|
|
215
|
-
```tsx
|
|
216
|
-
// The editor includes its own styles
|
|
217
|
-
import { Editor } from "@scottjgilbert/lexical-blog-editor";
|
|
218
|
-
// Styles are automatically applied
|
|
219
|
-
```
|
|
241
|
+
</details>
|
|
220
242
|
|
|
221
|
-
|
|
243
|
+
## Styling
|
|
222
244
|
|
|
223
|
-
|
|
224
|
-
- `.editor-container` - Main editor container
|
|
225
|
-
- `.editor-scroller` - Scrollable editor area
|
|
226
|
-
- `.editor` - ContentEditable wrapper
|
|
227
|
-
- Various node-specific classes for custom styling
|
|
245
|
+
See the [Styling Guide](./docs/styling.md) for details on editor and viewer styling. The viewer ships with two style bundles:
|
|
228
246
|
|
|
229
|
-
|
|
247
|
+
- `@scottjgilbert/lexical-blog-editor/styles/ViewerTheme.css`
|
|
248
|
+
- `@scottjgilbert/lexical-blog-editor/styles/ViewerThemeComplete.css`
|
|
230
249
|
|
|
231
250
|
## TypeScript Support
|
|
232
251
|
|
|
@@ -237,26 +256,13 @@ import type { EditorProps } from "@scottjgilbert/lexical-blog-editor";
|
|
|
237
256
|
import type { EditorState } from "@scottjgilbert/lexical-blog-editor";
|
|
238
257
|
```
|
|
239
258
|
|
|
240
|
-
## Roadmap
|
|
241
|
-
|
|
242
|
-
- [ ] **Viewer Component**: Dedicated component for rendering saved EditorState as read-only DOM content
|
|
243
|
-
- [ ] **Server-Side Rendering**: Enhanced SSR support
|
|
244
|
-
|
|
245
|
-
## Browser Support
|
|
246
|
-
|
|
247
|
-
The editor supports all modern browsers:
|
|
248
|
-
|
|
249
|
-
- Chrome/Edge (latest)
|
|
250
|
-
- Firefox (latest)
|
|
251
|
-
- Safari (latest)
|
|
252
|
-
|
|
253
259
|
## Contributing
|
|
254
260
|
|
|
255
261
|
This is an open-source project. Contributions, issues, and feature requests are welcome!
|
|
256
262
|
|
|
257
263
|
## Acknowledgments
|
|
258
264
|
|
|
259
|
-
Built on top of Meta's [Lexical](https://lexical.dev/) framework. This package is a
|
|
265
|
+
Built on top of Meta's [Lexical](https://lexical.dev/) framework. This package is a modified wrapper of the Lexical Playground editor, tailored specifically for blog content creation.
|
|
260
266
|
|
|
261
267
|
## License
|
|
262
268
|
|
package/build/Editor.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { EditorState } from "lexical";
|
|
1
|
+
import type { EditorState } from "lexical";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import "./index.css";
|
|
4
|
-
export
|
|
4
|
+
export interface EditorProps {
|
|
5
5
|
placeholder?: string;
|
|
6
6
|
initialState?: EditorState;
|
|
7
7
|
onChange: (state: EditorState) => void;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
export declare const EditorComponent: ({ placeholder, onChange, }: {
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
onChange: (state: EditorState) => void;
|
|
12
12
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* A full Rich Text Editor component.
|
|
15
|
+
* @param {EditorProps} props
|
|
16
|
+
* @returns {JSX.Element}
|
|
17
|
+
*/
|
|
13
18
|
export declare const Editor: React.FC<EditorProps>;
|
|
14
19
|
//# sourceMappingURL=Editor.d.ts.map
|
package/build/Editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,aAAa,CAAC;AAcrB,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,GAAI,4BAG7B;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC,4CAwIA,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8BxC,CAAC"}
|
package/build/Editor.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
|
|
|
7
7
|
import { ClearEditorPlugin } from "@lexical/react/LexicalClearEditorPlugin";
|
|
8
8
|
import { ClickableLinkPlugin } from "@lexical/react/LexicalClickableLinkPlugin";
|
|
9
9
|
import { HashtagPlugin } from "@lexical/react/LexicalHashtagPlugin";
|
|
10
|
-
import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
10
|
+
// import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
11
11
|
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
12
12
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
13
|
import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
@@ -38,8 +38,6 @@ import KeywordsPlugin from "./plugins/KeywordsPlugin";
|
|
|
38
38
|
import { LayoutPlugin } from "./plugins/LayoutPlugin/LayoutPlugin";
|
|
39
39
|
import LinkPlugin from "./plugins/LinkPlugin";
|
|
40
40
|
import MarkdownShortcutPlugin from "./plugins/MarkdownShortcutPlugin";
|
|
41
|
-
import MentionsPlugin from "./plugins/MentionsPlugin";
|
|
42
|
-
import PageBreakPlugin from "./plugins/PageBreakPlugin";
|
|
43
41
|
import ShortcutsPlugin from "./plugins/ShortcutsPlugin";
|
|
44
42
|
import SpeechToTextPlugin from "./plugins/SpeechToTextPlugin";
|
|
45
43
|
import TabFocusPlugin from "./plugins/TabFocusPlugin";
|
|
@@ -58,17 +56,18 @@ import { TableContext } from "./plugins/TablePlugin";
|
|
|
58
56
|
import { ToolbarContext } from "./context/ToolbarContext";
|
|
59
57
|
import { useMemo } from "react";
|
|
60
58
|
import PlaygroundEditorTheme from "./themes/PlaygroundEditorTheme";
|
|
61
|
-
import PlaygroundNodes from "./nodes/PlaygroundNodes";
|
|
59
|
+
import PlaygroundNodes from "./nodes/PlaygroundNodes/PlaygroundNodes";
|
|
62
60
|
import { buildHTMLConfig } from "./buildHTMLConfig";
|
|
63
61
|
import "./index.css";
|
|
64
62
|
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
63
|
+
import { HorizontalRuleExtension } from "@lexical/extension";
|
|
65
64
|
function $prepopulatedRichText() {
|
|
66
65
|
const root = $getRoot();
|
|
67
66
|
const heading = $createHeadingNode("h1");
|
|
68
|
-
heading.append($createTextNode("
|
|
67
|
+
heading.append($createTextNode("Rich Blog Editor"));
|
|
69
68
|
root.append(heading);
|
|
70
69
|
const paragraph = $createParagraphNode();
|
|
71
|
-
paragraph.append($createTextNode("Welcome to the
|
|
70
|
+
paragraph.append($createTextNode("Welcome to the rich blog editor!"));
|
|
72
71
|
root.append(paragraph);
|
|
73
72
|
}
|
|
74
73
|
export const EditorComponent = ({ placeholder = "Enter some text...", onChange, }) => {
|
|
@@ -107,8 +106,13 @@ export const EditorComponent = ({ placeholder = "Enter some text...", onChange,
|
|
|
107
106
|
window.removeEventListener("resize", updateViewPortWidth);
|
|
108
107
|
};
|
|
109
108
|
}, [isSmallWidthViewport]);
|
|
110
|
-
return (_jsxs(_Fragment, { children: [_jsx(ToolbarPlugin, { editor: editor, activeEditor: activeEditor, setActiveEditor: setActiveEditor, setIsLinkEditMode: setIsLinkEditMode }), _jsx(ShortcutsPlugin, { editor: activeEditor, setIsLinkEditMode: setIsLinkEditMode }), _jsxs("div", { className: `editor-container`, children: [_jsx(DragDropPaste, {}), _jsx(AutoFocusPlugin, {}), _jsx(ClearEditorPlugin, {}), _jsx(ComponentPickerPlugin, {}), _jsx(EmojiPickerPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(
|
|
109
|
+
return (_jsxs(_Fragment, { children: [_jsx(ToolbarPlugin, { editor: editor, activeEditor: activeEditor, setActiveEditor: setActiveEditor, setIsLinkEditMode: setIsLinkEditMode }), _jsx(ShortcutsPlugin, { editor: activeEditor, setIsLinkEditMode: setIsLinkEditMode }), _jsxs("div", { className: `editor-container`, children: [_jsx(DragDropPaste, {}), _jsx(AutoFocusPlugin, {}), _jsx(ClearEditorPlugin, {}), _jsx(ComponentPickerPlugin, {}), _jsx(EmojiPickerPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(EmojisPlugin, {}), _jsx(HashtagPlugin, {}), _jsx(KeywordsPlugin, {}), _jsx(SpeechToTextPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(DateTimePlugin, {}), _jsx(HistoryPlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx("div", { className: "editor-scroller", children: _jsx("div", { className: "editor", ref: onRef, children: _jsx(ContentEditable, { placeholder: placeholder }) }) }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: onChange }), _jsx(MarkdownShortcutPlugin, {}), _jsx(CodeHighlightShikiPlugin, {}), _jsx(ListPlugin, { hasStrictIndent: true }), _jsx(CheckListPlugin, {}), _jsx(TablePlugin, {}), _jsx(TableCellResizer, {}), _jsx(TableScrollShadowPlugin, {}), _jsx(ImagesPlugin, {}), _jsx(LinkPlugin, { hasLinkAttributes: true }), _jsx(TwitterPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(FigmaPlugin, {}), _jsx(ClickableLinkPlugin, { disabled: isEditable }), _jsx(EquationsPlugin, {}), _jsx(TabFocusPlugin, {}), _jsx(TabIndentationPlugin, { maxIndent: 7 }), _jsx(CollapsiblePlugin, {}), _jsx(LayoutPlugin, {}), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode }), _jsx(TableCellActionMenuPlugin, { anchorElem: floatingAnchorElem, cellMerge: true })] })), floatingAnchorElem && !isSmallWidthViewport && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }), _jsx(TableHoverActionsV2Plugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode })] })), _jsx(ActionsPlugin, { shouldPreserveNewLinesInMarkdown: true, useCollabV2: false })] }), " "] }));
|
|
111
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* A full Rich Text Editor component.
|
|
113
|
+
* @param {EditorProps} props
|
|
114
|
+
* @returns {JSX.Element}
|
|
115
|
+
*/
|
|
112
116
|
export const Editor = ({ placeholder = "Enter some text...", initialState, onChange, }) => {
|
|
113
117
|
const app = useMemo(() => defineExtension({
|
|
114
118
|
$initialEditorState: initialState !== null && initialState !== void 0 ? initialState : $prepopulatedRichText,
|
|
@@ -117,6 +121,7 @@ export const Editor = ({ placeholder = "Enter some text...", initialState, onCha
|
|
|
117
121
|
namespace: "BlogEditor",
|
|
118
122
|
nodes: PlaygroundNodes,
|
|
119
123
|
theme: PlaygroundEditorTheme,
|
|
124
|
+
dependencies: [HorizontalRuleExtension],
|
|
120
125
|
}), [initialState]);
|
|
121
|
-
return (_jsx("div", { className: "
|
|
126
|
+
return (_jsx("div", { className: "editor-shell", children: _jsx(LexicalExtensionComposer, { extension: app, contentEditable: null, children: _jsx(TableContext, { children: _jsx(ToolbarContext, { children: _jsx(EditorComponent, { placeholder: placeholder, onChange: onChange }) }) }) }) }));
|
|
122
127
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorExport.d.ts","sourceRoot":"","sources":["../src/EditorExport.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAM5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAuBxC;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/Editor.tsx
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import React, { Suspense, useEffect, useState } from "react";
|
|
5
|
+
const ClientEditor = React.lazy(() => import("./Editor").then((mod) => ({ default: mod.Editor })));
|
|
6
|
+
export function Editor(props) {
|
|
7
|
+
const [mounted, setMounted] = useState(false);
|
|
8
|
+
useEffect(() => setMounted(true), []);
|
|
9
|
+
if (typeof window === "undefined" || !mounted) {
|
|
10
|
+
return (_jsxs("div", { className: "space-y-4 p-4", children: [_jsx("p", { className: "text-gray-600", children: "Loading editor..." }), _jsx("div", { className: "h-10 bg-gray-200 rounded animate-pulse" }), _jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "h-4 bg-gray-200 rounded animate-pulse w-5/6" }), _jsx("div", { className: "h-4 bg-gray-200 rounded animate-pulse w-4/6" })] })] }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(ClientEditor, Object.assign({}, props)) }));
|
|
13
|
+
}
|
package/build/appSettings.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const DEFAULT_SETTINGS: {
|
|
|
15
15
|
readonly isCharLimit: false;
|
|
16
16
|
readonly isCharLimitUtf8: false;
|
|
17
17
|
readonly isCodeHighlighted: true;
|
|
18
|
-
readonly isCodeShiki:
|
|
18
|
+
readonly isCodeShiki: true;
|
|
19
19
|
readonly isCollab: false;
|
|
20
20
|
readonly isMaxLength: false;
|
|
21
21
|
readonly isRichText: true;
|
package/build/appSettings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHTMLConfig.d.ts","sourceRoot":"","sources":["../src/buildHTMLConfig.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAIL,UAAU,EAKX,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"buildHTMLConfig.d.ts","sourceRoot":"","sources":["../src/buildHTMLConfig.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAIL,UAAU,EAKX,MAAM,SAAS,CAAC;AA+IjB,wBAAgB,eAAe,IAAI,UAAU,CAE5C"}
|
package/build/buildHTMLConfig.js
CHANGED
|
@@ -5,23 +5,24 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import { $isTextNode, isBlockDomNode, isHTMLElement, ParagraphNode, TextNode, } from
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { $isTextNode, isBlockDomNode, isHTMLElement, ParagraphNode, TextNode, } from "lexical";
|
|
9
|
+
import { CodeNode } from "./nodes/CodeNode/CodeNode";
|
|
10
|
+
import { parseAllowedFontSize } from "./plugins/ToolbarPlugin/fontSize";
|
|
11
|
+
import { parseAllowedColor } from "./ui/ColorPicker";
|
|
11
12
|
function getExtraStyles(element) {
|
|
12
13
|
// Parse styles from pasted input, but only if they match exactly the
|
|
13
14
|
// sort of styles that would be produced by exportDOM
|
|
14
|
-
let extraStyles =
|
|
15
|
+
let extraStyles = "";
|
|
15
16
|
const fontSize = parseAllowedFontSize(element.style.fontSize);
|
|
16
17
|
const backgroundColor = parseAllowedColor(element.style.backgroundColor);
|
|
17
18
|
const color = parseAllowedColor(element.style.color);
|
|
18
|
-
if (fontSize !==
|
|
19
|
+
if (fontSize !== "" && fontSize !== "15px") {
|
|
19
20
|
extraStyles += `font-size: ${fontSize};`;
|
|
20
21
|
}
|
|
21
|
-
if (backgroundColor !==
|
|
22
|
+
if (backgroundColor !== "" && backgroundColor !== "rgb(255, 255, 255)") {
|
|
22
23
|
extraStyles += `background-color: ${backgroundColor};`;
|
|
23
24
|
}
|
|
24
|
-
if (color !==
|
|
25
|
+
if (color !== "" && color !== "rgb(0, 0, 0)") {
|
|
25
26
|
extraStyles += `color: ${color};`;
|
|
26
27
|
}
|
|
27
28
|
return extraStyles;
|
|
@@ -67,18 +68,18 @@ function buildExportMap() {
|
|
|
67
68
|
ParagraphNode,
|
|
68
69
|
(editor, target) => {
|
|
69
70
|
const output = target.exportDOM(editor);
|
|
70
|
-
if (isHTMLElement(output.element) && output.element.tagName ===
|
|
71
|
+
if (isHTMLElement(output.element) && output.element.tagName === "P") {
|
|
71
72
|
const after = output.after;
|
|
72
73
|
return Object.assign(Object.assign({}, output), { after: (generatedElement) => {
|
|
73
74
|
if (after) {
|
|
74
75
|
generatedElement = after(generatedElement);
|
|
75
76
|
}
|
|
76
77
|
if (isHTMLElement(generatedElement) &&
|
|
77
|
-
generatedElement.tagName ===
|
|
78
|
+
generatedElement.tagName === "P") {
|
|
78
79
|
for (const childNode of generatedElement.childNodes) {
|
|
79
80
|
if (isBlockDomNode(childNode)) {
|
|
80
|
-
const div = document.createElement(
|
|
81
|
-
div.setAttribute(
|
|
81
|
+
const div = document.createElement("div");
|
|
82
|
+
div.setAttribute("role", "paragraph");
|
|
82
83
|
for (const attr of generatedElement.attributes) {
|
|
83
84
|
div.setAttribute(attr.name, attr.value);
|
|
84
85
|
}
|
|
@@ -94,6 +95,29 @@ function buildExportMap() {
|
|
|
94
95
|
return output;
|
|
95
96
|
},
|
|
96
97
|
],
|
|
98
|
+
[
|
|
99
|
+
CodeNode,
|
|
100
|
+
(editor, target) => {
|
|
101
|
+
const output = target.exportDOM(editor);
|
|
102
|
+
if (isHTMLElement(output.element) && output.element.tagName === "PRE") {
|
|
103
|
+
const after = output.after;
|
|
104
|
+
return Object.assign(Object.assign({}, output), { after: (generatedElement) => {
|
|
105
|
+
if (after) {
|
|
106
|
+
generatedElement = after(generatedElement);
|
|
107
|
+
}
|
|
108
|
+
if (isHTMLElement(generatedElement) &&
|
|
109
|
+
generatedElement.tagName === "PRE") {
|
|
110
|
+
// Count line breaks after the element is fully constructed
|
|
111
|
+
const lineCount = generatedElement.getElementsByTagName("br").length + 1;
|
|
112
|
+
const lineNumbers = Array.from({ length: lineCount }, (_, i) => i + 1).join("\n");
|
|
113
|
+
generatedElement.setAttribute("data-gutter", lineNumbers);
|
|
114
|
+
}
|
|
115
|
+
return generatedElement;
|
|
116
|
+
} });
|
|
117
|
+
}
|
|
118
|
+
return output;
|
|
119
|
+
},
|
|
120
|
+
],
|
|
97
121
|
]);
|
|
98
122
|
}
|
|
99
123
|
export function buildHTMLConfig() {
|
|
@@ -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
|
|
9
|
-
import { ReactNode } from
|
|
8
|
+
import type { JSX } from "react";
|
|
9
|
+
import { ReactNode } from "react";
|
|
10
10
|
export type ShowFlashMessage = (message?: React.ReactNode, duration?: number) => void;
|
|
11
11
|
export declare const FlashMessageContext: ({ children, }: {
|
|
12
12
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlashMessageContext.d.ts","sourceRoot":"","sources":["../../src/context/FlashMessageContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlashMessageContext.d.ts","sourceRoot":"","sources":["../../src/context/FlashMessageContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAEL,SAAS,EAKV,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,EACzB,QAAQ,CAAC,EAAE,MAAM,KACd,IAAI,CAAC;AAWV,eAAO,MAAM,mBAAmB,GAAI,eAEjC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAG,GAAG,CAAC,OAsBP,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,gBAMzC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useEffect, useState, } from
|
|
3
|
-
import FlashMessage from
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useState, } from "react";
|
|
4
|
+
import FlashMessage from "../ui/FlashMessage";
|
|
4
5
|
const Context = createContext(undefined);
|
|
5
6
|
const INITIAL_STATE = {};
|
|
6
7
|
const DEFAULT_DURATION = 1000;
|
|
@@ -19,7 +20,7 @@ export const FlashMessageContext = ({ children, }) => {
|
|
|
19
20
|
export const useFlashMessageContext = () => {
|
|
20
21
|
const ctx = useContext(Context);
|
|
21
22
|
if (!ctx) {
|
|
22
|
-
throw new Error(
|
|
23
|
+
throw new Error("Missing FlashMessageContext");
|
|
23
24
|
}
|
|
24
25
|
return ctx;
|
|
25
26
|
};
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type { HistoryState } from
|
|
9
|
-
import type { JSX } from
|
|
10
|
-
import { ReactNode } from
|
|
8
|
+
import type { HistoryState } from "@lexical/react/LexicalHistoryPlugin";
|
|
9
|
+
import type { JSX } from "react";
|
|
10
|
+
import { ReactNode } from "react";
|
|
11
11
|
type ContextShape = {
|
|
12
12
|
historyState?: HistoryState;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedHistoryContext.d.ts","sourceRoot":"","sources":["../../src/context/SharedHistoryContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SharedHistoryContext.d.ts","sourceRoot":"","sources":["../../src/context/SharedHistoryContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAEtE,KAAK,YAAY,GAAG;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAIF,eAAO,MAAM,oBAAoB,GAAI,eAElC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAG,GAAG,CAAC,OAMP,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,YAE1C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createEmptyHistoryState } from
|
|
3
|
-
import { createContext, useContext, useMemo } from
|
|
3
|
+
import { createEmptyHistoryState } from "@lexical/react/LexicalHistoryPlugin";
|
|
4
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
5
|
const Context = createContext({});
|
|
5
6
|
export const SharedHistoryContext = ({ children, }) => {
|
|
6
7
|
const historyContext = useMemo(() => ({ historyState: createEmptyHistoryState() }), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarContext.d.ts","sourceRoot":"","sources":["../../src/context/ToolbarContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToolbarContext.d.ts","sourceRoot":"","sources":["../../src/context/ToolbarContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAc,EAEZ,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAGpC,QAAA,MAAM,kBAAkB;;;CAGvB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;CAahC,CAAC;AAGF,QAAA,MAAM,qBAAqB;;eAEC,MAAM,OAAO,oBAAoB;;;;;;mBAMlC,iBAAiB;;;;;;;;;;;;;;;;;;;cAqBtB,MAAM,OAAO,kBAAkB;qBAC1B,MAAM,GAAG,IAAI;CACvC,CAAC;AAEF,KAAK,YAAY,GAAG,OAAO,qBAAqB,CAAC;AAGjD,KAAK,eAAe,GAAG,MAAM,YAAY,CAAC;AAC1C,KAAK,iBAAiB,CAAC,GAAG,SAAS,eAAe,IAAI,YAAY,CAAC,GAAG,CAAC,CAAC;AAExE,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,CAAC,GAAG,SAAS,eAAe,EAC5C,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAC5B,IAAI,CAAC;CACT,CAAC;AAIF,eAAO,MAAM,cAAc,GAAI,eAE5B;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAG,GAAG,CAAC,OA0BP,CAAC;AAEF,eAAO,MAAM,eAAe,oBAQ3B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
3
4
|
export const MIN_ALLOWED_FONT_SIZE = 8;
|
|
@@ -28,6 +29,7 @@ const INITIAL_TOOLBAR_STATE = {
|
|
|
28
29
|
blockType: "paragraph",
|
|
29
30
|
canRedo: false,
|
|
30
31
|
canUndo: false,
|
|
32
|
+
codeCategory: "",
|
|
31
33
|
codeLanguage: "",
|
|
32
34
|
codeTheme: "",
|
|
33
35
|
elementFormat: "left",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../src/hooks/useModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../src/hooks/useModal.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjC,MAAM,CAAC,OAAO,UAAU,QAAQ,IAAI;IAClC,GAAG,CAAC,OAAO,GAAG,IAAI;IAClB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,GAAG,CAAC,OAAO,KAAK,IAAI;CACzE,CA2CA"}
|
package/build/hooks/useModal.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
1
|
export default function useReport(): (arg0: string) => ReturnType<typeof setTimeout>;
|
|
9
2
|
//# sourceMappingURL=useReport.d.ts.map
|