phx-react 1.3.1718 → 1.3.1719
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/dist/cjs/components/TextEditorV2/constants.d.ts +1 -1
- package/dist/cjs/components/TextEditorV2/constants.js +15 -0
- package/dist/cjs/components/TextEditorV2/constants.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/editor.js +10 -58
- package/dist/cjs/components/TextEditorV2/editor.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/nodes/ImageComponent.js +2 -8
- package/dist/cjs/components/TextEditorV2/nodes/ImageComponent.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/nodes/InlineImageComponent.js +2 -2
- package/dist/cjs/components/TextEditorV2/nodes/InlineImageComponent.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/nodes/PlaygroundNodes.js +0 -19
- package/dist/cjs/components/TextEditorV2/nodes/PlaygroundNodes.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/FloatingTextFormatToolbarPlugin/index.js +1 -2
- package/dist/cjs/components/TextEditorV2/plugins/FloatingTextFormatToolbarPlugin/index.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/SanitizePastePlugin/index.d.ts +1 -0
- package/dist/cjs/components/TextEditorV2/plugins/SanitizePastePlugin/index.js +58 -0
- package/dist/cjs/components/TextEditorV2/plugins/SanitizePastePlugin/index.js.map +1 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/bold-text.js +2 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/bold-text.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/font-size.js +4 -6
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/font-size.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.d.ts +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.js +22 -10
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/italic-text.js +2 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/italic-text.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.d.ts +5 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.js +27 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.js.map +1 -0
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/text-color.js +1 -3
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/components/text-color.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/index.js +0 -4
- package/dist/cjs/components/TextEditorV2/plugins/ToolbarPlugin/index.js.map +1 -1
- package/dist/cjs/components/TextEditorV2/shared/LexicalErrorBoundary.d.ts +13 -0
- package/dist/cjs/components/TextEditorV2/shared/LexicalErrorBoundary.js +25 -0
- package/dist/cjs/components/TextEditorV2/shared/LexicalErrorBoundary.js.map +1 -0
- package/dist/cjs/components/TextEditorV2/style.js +21 -0
- package/dist/cjs/components/TextEditorV2/style.js.map +1 -1
- package/dist/esm/components/TextEditorV2/constants.d.ts +1 -1
- package/dist/esm/components/TextEditorV2/constants.js +15 -0
- package/dist/esm/components/TextEditorV2/constants.js.map +1 -1
- package/dist/esm/components/TextEditorV2/editor.js +9 -57
- package/dist/esm/components/TextEditorV2/editor.js.map +1 -1
- package/dist/esm/components/TextEditorV2/nodes/ImageComponent.js +1 -7
- package/dist/esm/components/TextEditorV2/nodes/ImageComponent.js.map +1 -1
- package/dist/esm/components/TextEditorV2/nodes/InlineImageComponent.js +1 -1
- package/dist/esm/components/TextEditorV2/nodes/InlineImageComponent.js.map +1 -1
- package/dist/esm/components/TextEditorV2/nodes/PlaygroundNodes.js +0 -19
- package/dist/esm/components/TextEditorV2/nodes/PlaygroundNodes.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/FloatingTextFormatToolbarPlugin/index.js +1 -2
- package/dist/esm/components/TextEditorV2/plugins/FloatingTextFormatToolbarPlugin/index.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/SanitizePastePlugin/index.d.ts +1 -0
- package/dist/esm/components/TextEditorV2/plugins/SanitizePastePlugin/index.js +55 -0
- package/dist/esm/components/TextEditorV2/plugins/SanitizePastePlugin/index.js.map +1 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/bold-text.js +2 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/bold-text.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/font-size.js +5 -7
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/font-size.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.d.ts +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.js +23 -11
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/heading.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/italic-text.js +2 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/italic-text.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.d.ts +5 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.js +24 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/list-marker-format.js.map +1 -0
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/text-color.js +2 -4
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/components/text-color.js.map +1 -1
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/index.js +0 -4
- package/dist/esm/components/TextEditorV2/plugins/ToolbarPlugin/index.js.map +1 -1
- package/dist/esm/components/TextEditorV2/shared/LexicalErrorBoundary.d.ts +13 -0
- package/dist/esm/components/TextEditorV2/shared/LexicalErrorBoundary.js +21 -0
- package/dist/esm/components/TextEditorV2/shared/LexicalErrorBoundary.js.map +1 -0
- package/dist/esm/components/TextEditorV2/style.js +21 -0
- package/dist/esm/components/TextEditorV2/style.js.map +1 -1
- package/package.json +9 -7
- package/dist/cjs/components/TextEditorV2/nodes/AutocompleteNode.d.ts +0 -25
- package/dist/cjs/components/TextEditorV2/nodes/AutocompleteNode.js +0 -60
- package/dist/cjs/components/TextEditorV2/nodes/AutocompleteNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/EmojiNode.d.ts +0 -18
- package/dist/cjs/components/TextEditorV2/nodes/EmojiNode.js +0 -62
- package/dist/cjs/components/TextEditorV2/nodes/EmojiNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/EquationComponent.d.ts +0 -9
- package/dist/cjs/components/TextEditorV2/nodes/EquationComponent.js +0 -70
- package/dist/cjs/components/TextEditorV2/nodes/EquationComponent.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/EquationNode.d.ts +0 -26
- package/dist/cjs/components/TextEditorV2/nodes/EquationNode.js +0 -121
- package/dist/cjs/components/TextEditorV2/nodes/EquationNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/PollComponent.d.ts +0 -8
- package/dist/cjs/components/TextEditorV2/nodes/PollComponent.js +0 -108
- package/dist/cjs/components/TextEditorV2/nodes/PollComponent.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/PollNode.d.ts +0 -33
- package/dist/cjs/components/TextEditorV2/nodes/PollNode.js +0 -145
- package/dist/cjs/components/TextEditorV2/nodes/PollNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/StickyComponent.d.ts +0 -9
- package/dist/cjs/components/TextEditorV2/nodes/StickyComponent.js +0 -166
- package/dist/cjs/components/TextEditorV2/nodes/StickyComponent.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/nodes/StickyNode.d.ts +0 -37
- package/dist/cjs/components/TextEditorV2/nodes/StickyNode.js +0 -91
- package/dist/cjs/components/TextEditorV2/nodes/StickyNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/ActionsPlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/ActionsPlugin/index.js +0 -148
- package/dist/cjs/components/TextEditorV2/plugins/ActionsPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/AutoEmbedPlugin/index.d.ts +0 -19
- package/dist/cjs/components/TextEditorV2/plugins/AutoEmbedPlugin/index.js +0 -168
- package/dist/cjs/components/TextEditorV2/plugins/AutoEmbedPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/AutocompletePlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/AutocompletePlugin/index.js +0 -2459
- package/dist/cjs/components/TextEditorV2/plugins/AutocompletePlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CodeHighlightPlugin/index.d.ts +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CodeHighlightPlugin/index.js +0 -12
- package/dist/cjs/components/TextEditorV2/plugins/CodeHighlightPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +0 -23
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.js +0 -88
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +0 -17
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.js +0 -68
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +0 -18
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.js +0 -92
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/index.js +0 -145
- package/dist/cjs/components/TextEditorV2/plugins/CollapsiblePlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/ContextMenuPlugin/index.d.ts +0 -11
- package/dist/cjs/components/TextEditorV2/plugins/ContextMenuPlugin/index.js +0 -129
- package/dist/cjs/components/TextEditorV2/plugins/ContextMenuPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/EmojiPickerPlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/EmojiPickerPlugin/index.js +0 -83
- package/dist/cjs/components/TextEditorV2/plugins/EmojiPickerPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/EmojisPlugin/index.d.ts +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/EmojisPlugin/index.js +0 -63
- package/dist/cjs/components/TextEditorV2/plugins/EmojisPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/EquationsPlugin/index.d.ts +0 -14
- package/dist/cjs/components/TextEditorV2/plugins/EquationsPlugin/index.js +0 -41
- package/dist/cjs/components/TextEditorV2/plugins/EquationsPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/ExcalidrawPlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/ExcalidrawPlugin/index.js +0 -28
- package/dist/cjs/components/TextEditorV2/plugins/ExcalidrawPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/FigmaPlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/FigmaPlugin/index.js +0 -25
- package/dist/cjs/components/TextEditorV2/plugins/FigmaPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/KeywordsPlugin/index.d.ts +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/KeywordsPlugin/index.js +0 -33
- package/dist/cjs/components/TextEditorV2/plugins/KeywordsPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +0 -6
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.js +0 -30
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.d.ts +0 -7
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.js +0 -85
- package/dist/cjs/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.js +0 -11
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownTransformers/index.d.ts +0 -8
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownTransformers/index.js +0 -241
- package/dist/cjs/components/TextEditorV2/plugins/MarkdownTransformers/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/MentionsPlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/MentionsPlugin/index.js +0 -551
- package/dist/cjs/components/TextEditorV2/plugins/MentionsPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/PageBreakPlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/PageBreakPlugin/index.js +0 -31
- package/dist/cjs/components/TextEditorV2/plugins/PageBreakPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/PollPlugin/index.d.ts +0 -8
- package/dist/cjs/components/TextEditorV2/plugins/PollPlugin/index.js +0 -45
- package/dist/cjs/components/TextEditorV2/plugins/PollPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/StickyPlugin/index.d.ts +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/StickyPlugin/index.js +0 -16
- package/dist/cjs/components/TextEditorV2/plugins/StickyPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/TabFocusPlugin/index.d.ts +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/TabFocusPlugin/index.js +0 -38
- package/dist/cjs/components/TextEditorV2/plugins/TabFocusPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/TableCellResizer/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/TableCellResizer/index.js +0 -248
- package/dist/cjs/components/TextEditorV2/plugins/TableCellResizer/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/TableOfContentsPlugin/index.d.ts +0 -2
- package/dist/cjs/components/TextEditorV2/plugins/TableOfContentsPlugin/index.js +0 -116
- package/dist/cjs/components/TextEditorV2/plugins/TableOfContentsPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/TwitterPlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/TwitterPlugin/index.js +0 -25
- package/dist/cjs/components/TextEditorV2/plugins/TwitterPlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/plugins/YouTubePlugin/index.d.ts +0 -3
- package/dist/cjs/components/TextEditorV2/plugins/YouTubePlugin/index.js +0 -25
- package/dist/cjs/components/TextEditorV2/plugins/YouTubePlugin/index.js.map +0 -1
- package/dist/cjs/components/TextEditorV2/ui/KatexEquationAlterer.d.ts +0 -7
- package/dist/cjs/components/TextEditorV2/ui/KatexEquationAlterer.js +0 -38
- package/dist/cjs/components/TextEditorV2/ui/KatexEquationAlterer.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/AutocompleteNode.d.ts +0 -25
- package/dist/esm/components/TextEditorV2/nodes/AutocompleteNode.js +0 -54
- package/dist/esm/components/TextEditorV2/nodes/AutocompleteNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/EmojiNode.d.ts +0 -18
- package/dist/esm/components/TextEditorV2/nodes/EmojiNode.js +0 -56
- package/dist/esm/components/TextEditorV2/nodes/EmojiNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/EquationComponent.d.ts +0 -9
- package/dist/esm/components/TextEditorV2/nodes/EquationComponent.js +0 -66
- package/dist/esm/components/TextEditorV2/nodes/EquationComponent.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/EquationNode.d.ts +0 -26
- package/dist/esm/components/TextEditorV2/nodes/EquationNode.js +0 -114
- package/dist/esm/components/TextEditorV2/nodes/EquationNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/PollComponent.d.ts +0 -8
- package/dist/esm/components/TextEditorV2/nodes/PollComponent.js +0 -104
- package/dist/esm/components/TextEditorV2/nodes/PollComponent.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/PollNode.d.ts +0 -33
- package/dist/esm/components/TextEditorV2/nodes/PollNode.js +0 -137
- package/dist/esm/components/TextEditorV2/nodes/PollNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/StickyComponent.d.ts +0 -9
- package/dist/esm/components/TextEditorV2/nodes/StickyComponent.js +0 -162
- package/dist/esm/components/TextEditorV2/nodes/StickyComponent.js.map +0 -1
- package/dist/esm/components/TextEditorV2/nodes/StickyNode.d.ts +0 -37
- package/dist/esm/components/TextEditorV2/nodes/StickyNode.js +0 -84
- package/dist/esm/components/TextEditorV2/nodes/StickyNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/ActionsPlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/ActionsPlugin/index.js +0 -144
- package/dist/esm/components/TextEditorV2/plugins/ActionsPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/AutoEmbedPlugin/index.d.ts +0 -19
- package/dist/esm/components/TextEditorV2/plugins/AutoEmbedPlugin/index.js +0 -162
- package/dist/esm/components/TextEditorV2/plugins/AutoEmbedPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/AutocompletePlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/AutocompletePlugin/index.js +0 -2455
- package/dist/esm/components/TextEditorV2/plugins/AutocompletePlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CodeHighlightPlugin/index.d.ts +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CodeHighlightPlugin/index.js +0 -9
- package/dist/esm/components/TextEditorV2/plugins/CodeHighlightPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +0 -23
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.js +0 -81
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContainerNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +0 -17
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.js +0 -61
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleContentNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +0 -18
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.js +0 -85
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/CollapsibleTitleNode.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/index.js +0 -141
- package/dist/esm/components/TextEditorV2/plugins/CollapsiblePlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/ContextMenuPlugin/index.d.ts +0 -11
- package/dist/esm/components/TextEditorV2/plugins/ContextMenuPlugin/index.js +0 -123
- package/dist/esm/components/TextEditorV2/plugins/ContextMenuPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/EmojiPickerPlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/EmojiPickerPlugin/index.js +0 -79
- package/dist/esm/components/TextEditorV2/plugins/EmojiPickerPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/EmojisPlugin/index.d.ts +0 -1
- package/dist/esm/components/TextEditorV2/plugins/EmojisPlugin/index.js +0 -60
- package/dist/esm/components/TextEditorV2/plugins/EmojisPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/EquationsPlugin/index.d.ts +0 -14
- package/dist/esm/components/TextEditorV2/plugins/EquationsPlugin/index.js +0 -35
- package/dist/esm/components/TextEditorV2/plugins/EquationsPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/ExcalidrawPlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/ExcalidrawPlugin/index.js +0 -24
- package/dist/esm/components/TextEditorV2/plugins/ExcalidrawPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/FigmaPlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/FigmaPlugin/index.js +0 -21
- package/dist/esm/components/TextEditorV2/plugins/FigmaPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/KeywordsPlugin/index.d.ts +0 -1
- package/dist/esm/components/TextEditorV2/plugins/KeywordsPlugin/index.js +0 -30
- package/dist/esm/components/TextEditorV2/plugins/KeywordsPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +0 -6
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.js +0 -26
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/InsertLayoutDialog.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.d.ts +0 -7
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.js +0 -81
- package/dist/esm/components/TextEditorV2/plugins/LayoutPlugin/LayoutPlugin.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.js +0 -7
- package/dist/esm/components/TextEditorV2/plugins/MarkdownShortcutPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/MarkdownTransformers/index.d.ts +0 -8
- package/dist/esm/components/TextEditorV2/plugins/MarkdownTransformers/index.js +0 -237
- package/dist/esm/components/TextEditorV2/plugins/MarkdownTransformers/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/MentionsPlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/MentionsPlugin/index.js +0 -547
- package/dist/esm/components/TextEditorV2/plugins/MentionsPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/PageBreakPlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/PageBreakPlugin/index.js +0 -27
- package/dist/esm/components/TextEditorV2/plugins/PageBreakPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/PollPlugin/index.d.ts +0 -8
- package/dist/esm/components/TextEditorV2/plugins/PollPlugin/index.js +0 -39
- package/dist/esm/components/TextEditorV2/plugins/PollPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/StickyPlugin/index.d.ts +0 -1
- package/dist/esm/components/TextEditorV2/plugins/StickyPlugin/index.js +0 -13
- package/dist/esm/components/TextEditorV2/plugins/StickyPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/TabFocusPlugin/index.d.ts +0 -1
- package/dist/esm/components/TextEditorV2/plugins/TabFocusPlugin/index.js +0 -35
- package/dist/esm/components/TextEditorV2/plugins/TabFocusPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/TableCellResizer/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/TableCellResizer/index.js +0 -244
- package/dist/esm/components/TextEditorV2/plugins/TableCellResizer/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/TableOfContentsPlugin/index.d.ts +0 -2
- package/dist/esm/components/TextEditorV2/plugins/TableOfContentsPlugin/index.js +0 -112
- package/dist/esm/components/TextEditorV2/plugins/TableOfContentsPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/TwitterPlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/TwitterPlugin/index.js +0 -21
- package/dist/esm/components/TextEditorV2/plugins/TwitterPlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/plugins/YouTubePlugin/index.d.ts +0 -3
- package/dist/esm/components/TextEditorV2/plugins/YouTubePlugin/index.js +0 -21
- package/dist/esm/components/TextEditorV2/plugins/YouTubePlugin/index.js.map +0 -1
- package/dist/esm/components/TextEditorV2/ui/KatexEquationAlterer.d.ts +0 -7
- package/dist/esm/components/TextEditorV2/ui/KatexEquationAlterer.js +0 -34
- package/dist/esm/components/TextEditorV2/ui/KatexEquationAlterer.js.map +0 -1
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = PollComponent;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const LexicalCollaborationContext_1 = require("@lexical/react/LexicalCollaborationContext");
|
|
6
|
-
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
7
|
-
const useLexicalNodeSelection_1 = require("@lexical/react/useLexicalNodeSelection");
|
|
8
|
-
const utils_1 = require("@lexical/utils");
|
|
9
|
-
const lexical_1 = require("lexical");
|
|
10
|
-
const React = tslib_1.__importStar(require("react"));
|
|
11
|
-
const react_1 = require("react");
|
|
12
|
-
const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
|
|
13
|
-
const joinClasses_1 = tslib_1.__importDefault(require("../utils/joinClasses"));
|
|
14
|
-
const PollNode_1 = require("./PollNode");
|
|
15
|
-
function getTotalVotes(options) {
|
|
16
|
-
return options.reduce((totalVotes, next) => totalVotes + next.votes.length, 0);
|
|
17
|
-
}
|
|
18
|
-
function PollOptionComponent({ index, option, options, totalVotes, withPollNode, }) {
|
|
19
|
-
const { clientID } = (0, LexicalCollaborationContext_1.useCollaborationContext)();
|
|
20
|
-
const checkboxRef = (0, react_1.useRef)(null);
|
|
21
|
-
const votesArray = option.votes;
|
|
22
|
-
const checkedIndex = votesArray.indexOf(clientID);
|
|
23
|
-
const checked = checkedIndex !== -1;
|
|
24
|
-
const votes = votesArray.length;
|
|
25
|
-
const text = option.text;
|
|
26
|
-
return (React.createElement("div", { className: 'PollNode__optionContainer' },
|
|
27
|
-
React.createElement("div", { className: (0, joinClasses_1.default)('PollNode__optionCheckboxWrapper', checked && 'PollNode__optionCheckboxChecked') },
|
|
28
|
-
React.createElement("input", { ref: checkboxRef, checked: checked, className: 'PollNode__optionCheckbox', onChange: () => {
|
|
29
|
-
withPollNode((node) => {
|
|
30
|
-
node.toggleVote(option, clientID);
|
|
31
|
-
});
|
|
32
|
-
}, type: 'checkbox' })),
|
|
33
|
-
React.createElement("div", { className: 'PollNode__optionInputWrapper' },
|
|
34
|
-
React.createElement("div", { className: 'PollNode__optionInputVotes', style: { width: `${votes === 0 ? 0 : (votes / totalVotes) * 100}%` } }),
|
|
35
|
-
React.createElement("span", { className: 'PollNode__optionInputVotesCount' }, votes > 0 && (votes === 1 ? '1 vote' : `${votes} votes`)),
|
|
36
|
-
React.createElement("input", { className: 'PollNode__optionInput', onChange: (e) => {
|
|
37
|
-
const target = e.target;
|
|
38
|
-
const value = target.value;
|
|
39
|
-
const selectionStart = target.selectionStart;
|
|
40
|
-
const selectionEnd = target.selectionEnd;
|
|
41
|
-
withPollNode((node) => {
|
|
42
|
-
node.setOptionText(option, value);
|
|
43
|
-
}, () => {
|
|
44
|
-
target.selectionStart = selectionStart;
|
|
45
|
-
target.selectionEnd = selectionEnd;
|
|
46
|
-
});
|
|
47
|
-
}, placeholder: `Option ${index + 1}`, type: 'text', value: text })),
|
|
48
|
-
React.createElement("button", { "aria-label": 'Remove', className: (0, joinClasses_1.default)('PollNode__optionDelete', options.length < 3 && 'PollNode__optionDeleteDisabled'), disabled: options.length < 3, onClick: () => {
|
|
49
|
-
withPollNode((node) => {
|
|
50
|
-
node.deleteOption(option);
|
|
51
|
-
});
|
|
52
|
-
}, type: 'button' })));
|
|
53
|
-
}
|
|
54
|
-
function PollComponent({ nodeKey, options, question, }) {
|
|
55
|
-
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
56
|
-
const totalVotes = (0, react_1.useMemo)(() => getTotalVotes(options), [options]);
|
|
57
|
-
const [isSelected, setSelected, clearSelection] = (0, useLexicalNodeSelection_1.useLexicalNodeSelection)(nodeKey);
|
|
58
|
-
const [selection, setSelection] = (0, react_1.useState)(null);
|
|
59
|
-
const ref = (0, react_1.useRef)(null);
|
|
60
|
-
const onDelete = (0, react_1.useCallback)((payload) => {
|
|
61
|
-
if (isSelected && (0, lexical_1.$isNodeSelection)((0, lexical_1.$getSelection)())) {
|
|
62
|
-
const event = payload;
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
const node = (0, lexical_1.$getNodeByKey)(nodeKey);
|
|
65
|
-
if ((0, PollNode_1.$isPollNode)(node)) {
|
|
66
|
-
node.remove();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
}, [isSelected, nodeKey]);
|
|
71
|
-
(0, react_1.useEffect)(() => (0, utils_1.mergeRegister)(editor.registerUpdateListener(({ editorState }) => {
|
|
72
|
-
setSelection(editorState.read(() => (0, lexical_1.$getSelection)()));
|
|
73
|
-
}), editor.registerCommand(lexical_1.CLICK_COMMAND, (payload) => {
|
|
74
|
-
const event = payload;
|
|
75
|
-
if (event.target === ref.current) {
|
|
76
|
-
if (!event.shiftKey) {
|
|
77
|
-
clearSelection();
|
|
78
|
-
}
|
|
79
|
-
setSelected(!isSelected);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
return false;
|
|
83
|
-
}, lexical_1.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical_1.KEY_DELETE_COMMAND, onDelete, lexical_1.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical_1.KEY_BACKSPACE_COMMAND, onDelete, lexical_1.COMMAND_PRIORITY_LOW)), [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
|
|
84
|
-
const withPollNode = (cb, onUpdate) => {
|
|
85
|
-
editor.update(() => {
|
|
86
|
-
const node = (0, lexical_1.$getNodeByKey)(nodeKey);
|
|
87
|
-
if ((0, PollNode_1.$isPollNode)(node)) {
|
|
88
|
-
cb(node);
|
|
89
|
-
}
|
|
90
|
-
}, { onUpdate });
|
|
91
|
-
};
|
|
92
|
-
const addOption = () => {
|
|
93
|
-
withPollNode((node) => {
|
|
94
|
-
node.addOption((0, PollNode_1.createPollOption)());
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
const isFocused = (0, lexical_1.$isNodeSelection)(selection) && isSelected;
|
|
98
|
-
return (React.createElement("div", { ref: ref, className: `PollNode__container ${isFocused ? 'focused' : ''}` },
|
|
99
|
-
React.createElement("div", { className: 'PollNode__inner' },
|
|
100
|
-
React.createElement("h2", { className: 'PollNode__heading' }, question),
|
|
101
|
-
options.map((option, index) => {
|
|
102
|
-
const key = option.uid;
|
|
103
|
-
return (React.createElement(PollOptionComponent, { key: key, index: index, option: option, options: options, totalVotes: totalVotes, withPollNode: withPollNode }));
|
|
104
|
-
}),
|
|
105
|
-
React.createElement("div", { className: 'PollNode__footer' },
|
|
106
|
-
React.createElement(Button_1.default, { onClick: addOption, small: true }, "Add Option")))));
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=PollComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PollComponent.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/PollComponent.tsx"],"names":[],"mappings":";;AA2GA,gCAwGC;;AAlND,4FAAoF;AACpF,kFAAiF;AACjF,oFAAgF;AAChF,0CAA8C;AAC9C,qCAUgB;AAChB,qDAA8B;AAC9B,iCAAyE;AACzE,kEAAiC;AACjC,+EAA8C;AAC9C,yCAA0D;AAE1D,SAAS,aAAa,CAAC,OAAgB;IACrC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAChF,CAAC;AAED,SAAS,mBAAmB,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,GAOb;IACC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,qDAAuB,GAAE,CAAA;IAC9C,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAA;IAChC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAA;IAC/B,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAA;IACnC,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAA;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IAExB,OAAO,CACL,6BAAK,SAAS,EAAC,2BAA2B;QACxC,6BAAK,SAAS,EAAE,IA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OMExportOutput, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export type Options = ReadonlyArray<Option>;
|
|
4
|
-
export type Option = Readonly<{
|
|
5
|
-
text: string;
|
|
6
|
-
uid: string;
|
|
7
|
-
votes: Array<number>;
|
|
8
|
-
}>;
|
|
9
|
-
export declare function createPollOption(text?: string): Option;
|
|
10
|
-
export type SerializedPollNode = Spread<{
|
|
11
|
-
question: string;
|
|
12
|
-
options: Options;
|
|
13
|
-
}, SerializedLexicalNode>;
|
|
14
|
-
export declare class PollNode extends DecoratorNode<React.JSX.Element> {
|
|
15
|
-
__question: string;
|
|
16
|
-
__options: Options;
|
|
17
|
-
static getType(): string;
|
|
18
|
-
static clone(node: PollNode): PollNode;
|
|
19
|
-
static importJSON(serializedNode: SerializedPollNode): PollNode;
|
|
20
|
-
constructor(question: string, options: Options, key?: NodeKey);
|
|
21
|
-
exportJSON(): SerializedPollNode;
|
|
22
|
-
addOption(option: Option): void;
|
|
23
|
-
deleteOption(option: Option): void;
|
|
24
|
-
setOptionText(option: Option, text: string): void;
|
|
25
|
-
toggleVote(option: Option, clientID: number): void;
|
|
26
|
-
static importDOM(): DOMConversionMap | null;
|
|
27
|
-
exportDOM(): DOMExportOutput;
|
|
28
|
-
createDOM(): HTMLElement;
|
|
29
|
-
updateDOM(): false;
|
|
30
|
-
decorate(): React.JSX.Element;
|
|
31
|
-
}
|
|
32
|
-
export declare function $createPollNode(question: string, options: Options): PollNode;
|
|
33
|
-
export declare function $isPollNode(node: LexicalNode | null | undefined): node is PollNode;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PollNode = void 0;
|
|
4
|
-
exports.createPollOption = createPollOption;
|
|
5
|
-
exports.$createPollNode = $createPollNode;
|
|
6
|
-
exports.$isPollNode = $isPollNode;
|
|
7
|
-
const tslib_1 = require("tslib");
|
|
8
|
-
const lexical_1 = require("lexical");
|
|
9
|
-
const React = tslib_1.__importStar(require("react"));
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const PollComponent = React.lazy(
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
() => Promise.resolve().then(() => tslib_1.__importStar(require('./PollComponent'))));
|
|
14
|
-
function createUID() {
|
|
15
|
-
return Math.random()
|
|
16
|
-
.toString(36)
|
|
17
|
-
.replace(/[^a-z]+/g, '')
|
|
18
|
-
.substr(0, 5);
|
|
19
|
-
}
|
|
20
|
-
function createPollOption(text = '') {
|
|
21
|
-
return {
|
|
22
|
-
text,
|
|
23
|
-
uid: createUID(),
|
|
24
|
-
votes: [],
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function cloneOption(option, text, votes) {
|
|
28
|
-
return {
|
|
29
|
-
text,
|
|
30
|
-
uid: option.uid,
|
|
31
|
-
votes: votes || Array.from(option.votes),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function convertPollElement(domNode) {
|
|
35
|
-
const question = domNode.getAttribute('data-lexical-poll-question');
|
|
36
|
-
const options = domNode.getAttribute('data-lexical-poll-options');
|
|
37
|
-
if (question !== null && options !== null) {
|
|
38
|
-
const node = $createPollNode(question, JSON.parse(options));
|
|
39
|
-
return { node };
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
class PollNode extends lexical_1.DecoratorNode {
|
|
44
|
-
static getType() {
|
|
45
|
-
return 'poll';
|
|
46
|
-
}
|
|
47
|
-
static clone(node) {
|
|
48
|
-
return new PollNode(node.__question, node.__options, node.__key);
|
|
49
|
-
}
|
|
50
|
-
static importJSON(serializedNode) {
|
|
51
|
-
const node = $createPollNode(serializedNode.question, serializedNode.options);
|
|
52
|
-
serializedNode.options.forEach(node.addOption);
|
|
53
|
-
return node;
|
|
54
|
-
}
|
|
55
|
-
constructor(question, options, key) {
|
|
56
|
-
super(key);
|
|
57
|
-
this.__question = question;
|
|
58
|
-
this.__options = options;
|
|
59
|
-
}
|
|
60
|
-
exportJSON() {
|
|
61
|
-
return {
|
|
62
|
-
options: this.__options,
|
|
63
|
-
question: this.__question,
|
|
64
|
-
type: 'poll',
|
|
65
|
-
version: 1,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
addOption(option) {
|
|
69
|
-
const self = this.getWritable();
|
|
70
|
-
const options = Array.from(self.__options);
|
|
71
|
-
options.push(option);
|
|
72
|
-
self.__options = options;
|
|
73
|
-
}
|
|
74
|
-
deleteOption(option) {
|
|
75
|
-
const self = this.getWritable();
|
|
76
|
-
const options = Array.from(self.__options);
|
|
77
|
-
const index = options.indexOf(option);
|
|
78
|
-
options.splice(index, 1);
|
|
79
|
-
self.__options = options;
|
|
80
|
-
}
|
|
81
|
-
setOptionText(option, text) {
|
|
82
|
-
const self = this.getWritable();
|
|
83
|
-
const clonedOption = cloneOption(option, text);
|
|
84
|
-
const options = Array.from(self.__options);
|
|
85
|
-
const index = options.indexOf(option);
|
|
86
|
-
options[index] = clonedOption;
|
|
87
|
-
self.__options = options;
|
|
88
|
-
}
|
|
89
|
-
toggleVote(option, clientID) {
|
|
90
|
-
const self = this.getWritable();
|
|
91
|
-
const votes = option.votes;
|
|
92
|
-
const votesClone = Array.from(votes);
|
|
93
|
-
const voteIndex = votes.indexOf(clientID);
|
|
94
|
-
if (voteIndex === -1) {
|
|
95
|
-
votesClone.push(clientID);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
votesClone.splice(voteIndex, 1);
|
|
99
|
-
}
|
|
100
|
-
const clonedOption = cloneOption(option, option.text, votesClone);
|
|
101
|
-
const options = Array.from(self.__options);
|
|
102
|
-
const index = options.indexOf(option);
|
|
103
|
-
options[index] = clonedOption;
|
|
104
|
-
self.__options = options;
|
|
105
|
-
}
|
|
106
|
-
static importDOM() {
|
|
107
|
-
return {
|
|
108
|
-
span: (domNode) => {
|
|
109
|
-
if (!domNode.hasAttribute('data-lexical-poll-question')) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
conversion: convertPollElement,
|
|
114
|
-
priority: 2,
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
exportDOM() {
|
|
120
|
-
const element = document.createElement('span');
|
|
121
|
-
element.setAttribute('data-lexical-poll-question', this.__question);
|
|
122
|
-
element.setAttribute('data-lexical-poll-options', JSON.stringify(this.__options));
|
|
123
|
-
return { element };
|
|
124
|
-
}
|
|
125
|
-
createDOM() {
|
|
126
|
-
const elem = document.createElement('span');
|
|
127
|
-
elem.style.display = 'inline-block';
|
|
128
|
-
return elem;
|
|
129
|
-
}
|
|
130
|
-
updateDOM() {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
decorate() {
|
|
134
|
-
return (React.createElement(react_1.Suspense, { fallback: null },
|
|
135
|
-
React.createElement(PollComponent, { nodeKey: this.__key, options: this.__options, question: this.__question })));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.PollNode = PollNode;
|
|
139
|
-
function $createPollNode(question, options) {
|
|
140
|
-
return new PollNode(question, options);
|
|
141
|
-
}
|
|
142
|
-
function $isPollNode(node) {
|
|
143
|
-
return node instanceof PollNode;
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=PollNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PollNode.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/PollNode.tsx"],"names":[],"mappings":";;;AAkCA,4CAMC;AA8ID,0CAEC;AAED,kCAEC;;AA5LD,qCASgB;AAChB,qDAA8B;AAC9B,iCAAgC;AAWhC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI;AAC9B,aAAa;AACb,GAAG,EAAE,2DAAQ,iBAAiB,GAAC,CAChC,CAAA;AAED,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,MAAM,EAAE;SACjB,QAAQ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|
3
|
-
export default function StickyComponent({ caption, color, nodeKey, x, y, }: {
|
|
4
|
-
caption: LexicalEditor;
|
|
5
|
-
color: 'pink' | 'yellow';
|
|
6
|
-
nodeKey: NodeKey;
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
}): React.JSX.Element;
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = StickyComponent;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const LexicalCollaborationContext_1 = require("@lexical/react/LexicalCollaborationContext");
|
|
6
|
-
const LexicalCollaborationPlugin_1 = require("@lexical/react/LexicalCollaborationPlugin");
|
|
7
|
-
const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
|
|
8
|
-
const LexicalErrorBoundary_1 = tslib_1.__importDefault(require("@lexical/react/LexicalErrorBoundary"));
|
|
9
|
-
const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
|
|
10
|
-
const LexicalNestedComposer_1 = require("@lexical/react/LexicalNestedComposer");
|
|
11
|
-
const LexicalPlainTextPlugin_1 = require("@lexical/react/LexicalPlainTextPlugin");
|
|
12
|
-
const lexical_1 = require("lexical");
|
|
13
|
-
const React = tslib_1.__importStar(require("react"));
|
|
14
|
-
const react_1 = require("react");
|
|
15
|
-
const SharedHistoryContext_1 = require("../context/SharedHistoryContext");
|
|
16
|
-
const collaboration_1 = require("../lib/collaboration");
|
|
17
|
-
const useLayoutEffect_1 = tslib_1.__importDefault(require("../shared/useLayoutEffect"));
|
|
18
|
-
const StickyEditorTheme_1 = tslib_1.__importDefault(require("../themes/StickyEditorTheme"));
|
|
19
|
-
const ContentEditable_1 = tslib_1.__importDefault(require("../ui/ContentEditable"));
|
|
20
|
-
const Placeholder_1 = tslib_1.__importDefault(require("../ui/Placeholder"));
|
|
21
|
-
const StickyNode_1 = require("./StickyNode");
|
|
22
|
-
function positionSticky(stickyElem, positioning) {
|
|
23
|
-
const style = stickyElem.style;
|
|
24
|
-
const rootElementRect = positioning.rootElementRect;
|
|
25
|
-
const rectLeft = rootElementRect !== null ? rootElementRect.left : 0;
|
|
26
|
-
const rectTop = rootElementRect !== null ? rootElementRect.top : 0;
|
|
27
|
-
style.top = rectTop + positioning.y + 'px';
|
|
28
|
-
style.left = rectLeft + positioning.x + 'px';
|
|
29
|
-
}
|
|
30
|
-
function StickyComponent({ caption, color, nodeKey, x, y, }) {
|
|
31
|
-
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
32
|
-
const stickyContainerRef = (0, react_1.useRef)(null);
|
|
33
|
-
const positioningRef = (0, react_1.useRef)({
|
|
34
|
-
isDragging: false,
|
|
35
|
-
offsetX: 0,
|
|
36
|
-
offsetY: 0,
|
|
37
|
-
rootElementRect: null,
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
});
|
|
41
|
-
const { isCollabActive } = (0, LexicalCollaborationContext_1.useCollaborationContext)();
|
|
42
|
-
(0, react_1.useEffect)(() => {
|
|
43
|
-
const position = positioningRef.current;
|
|
44
|
-
position.x = x;
|
|
45
|
-
position.y = y;
|
|
46
|
-
const stickyContainer = stickyContainerRef.current;
|
|
47
|
-
if (stickyContainer !== null) {
|
|
48
|
-
positionSticky(stickyContainer, position);
|
|
49
|
-
}
|
|
50
|
-
}, [x, y]);
|
|
51
|
-
(0, useLayoutEffect_1.default)(() => {
|
|
52
|
-
const position = positioningRef.current;
|
|
53
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
54
|
-
for (let i = 0; i < entries.length; i++) {
|
|
55
|
-
const entry = entries[i];
|
|
56
|
-
const { target } = entry;
|
|
57
|
-
position.rootElementRect = target.getBoundingClientRect();
|
|
58
|
-
const stickyContainer = stickyContainerRef.current;
|
|
59
|
-
if (stickyContainer !== null) {
|
|
60
|
-
positionSticky(stickyContainer, position);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const removeRootListener = editor.registerRootListener((nextRootElem, prevRootElem) => {
|
|
65
|
-
if (prevRootElem !== null) {
|
|
66
|
-
resizeObserver.unobserve(prevRootElem);
|
|
67
|
-
}
|
|
68
|
-
if (nextRootElem !== null) {
|
|
69
|
-
resizeObserver.observe(nextRootElem);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const handleWindowResize = () => {
|
|
73
|
-
const rootElement = editor.getRootElement();
|
|
74
|
-
const stickyContainer = stickyContainerRef.current;
|
|
75
|
-
if (rootElement !== null && stickyContainer !== null) {
|
|
76
|
-
position.rootElementRect = rootElement.getBoundingClientRect();
|
|
77
|
-
positionSticky(stickyContainer, position);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
window.addEventListener('resize', handleWindowResize);
|
|
81
|
-
return () => {
|
|
82
|
-
window.removeEventListener('resize', handleWindowResize);
|
|
83
|
-
removeRootListener();
|
|
84
|
-
};
|
|
85
|
-
}, [editor]);
|
|
86
|
-
(0, react_1.useEffect)(() => {
|
|
87
|
-
const stickyContainer = stickyContainerRef.current;
|
|
88
|
-
if (stickyContainer !== null) {
|
|
89
|
-
// Delay adding transition so we don't trigger the
|
|
90
|
-
// transition on load of the sticky.
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
stickyContainer.style.setProperty('transition', 'top 0.3s ease 0s, left 0.3s ease 0s');
|
|
93
|
-
}, 500);
|
|
94
|
-
}
|
|
95
|
-
}, []);
|
|
96
|
-
const handlePointerMove = (event) => {
|
|
97
|
-
const stickyContainer = stickyContainerRef.current;
|
|
98
|
-
const positioning = positioningRef.current;
|
|
99
|
-
const rootElementRect = positioning.rootElementRect;
|
|
100
|
-
if (stickyContainer !== null && positioning.isDragging && rootElementRect !== null) {
|
|
101
|
-
positioning.x = event.pageX - positioning.offsetX - rootElementRect.left;
|
|
102
|
-
positioning.y = event.pageY - positioning.offsetY - rootElementRect.top;
|
|
103
|
-
positionSticky(stickyContainer, positioning);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const handlePointerUp = () => {
|
|
107
|
-
const stickyContainer = stickyContainerRef.current;
|
|
108
|
-
const positioning = positioningRef.current;
|
|
109
|
-
if (stickyContainer !== null) {
|
|
110
|
-
positioning.isDragging = false;
|
|
111
|
-
stickyContainer.classList.remove('dragging');
|
|
112
|
-
editor.update(() => {
|
|
113
|
-
const node = (0, lexical_1.$getNodeByKey)(nodeKey);
|
|
114
|
-
if ((0, StickyNode_1.$isStickyNode)(node)) {
|
|
115
|
-
node.setPosition(positioning.x, positioning.y);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
document.removeEventListener('pointermove', handlePointerMove);
|
|
120
|
-
document.removeEventListener('pointerup', handlePointerUp);
|
|
121
|
-
};
|
|
122
|
-
const handleDelete = () => {
|
|
123
|
-
editor.update(() => {
|
|
124
|
-
const node = (0, lexical_1.$getNodeByKey)(nodeKey);
|
|
125
|
-
if ((0, StickyNode_1.$isStickyNode)(node)) {
|
|
126
|
-
node.remove();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
const handleColorChange = () => {
|
|
131
|
-
editor.update(() => {
|
|
132
|
-
const node = (0, lexical_1.$getNodeByKey)(nodeKey);
|
|
133
|
-
if ((0, StickyNode_1.$isStickyNode)(node)) {
|
|
134
|
-
node.toggleColor();
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
const { historyState } = (0, SharedHistoryContext_1.useSharedHistoryContext)();
|
|
139
|
-
return (React.createElement("div", { ref: stickyContainerRef, className: 'sticky-note-container' },
|
|
140
|
-
React.createElement("div", { className: `sticky-note ${color}`, onPointerDown: (event) => {
|
|
141
|
-
const stickyContainer = stickyContainerRef.current;
|
|
142
|
-
if (stickyContainer == null || event.button === 2 || event.target !== stickyContainer.firstChild) {
|
|
143
|
-
// Right click or click on editor should not work
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const stickContainer = stickyContainer;
|
|
147
|
-
const positioning = positioningRef.current;
|
|
148
|
-
if (stickContainer !== null) {
|
|
149
|
-
const { left, top } = stickContainer.getBoundingClientRect();
|
|
150
|
-
positioning.offsetX = event.clientX - left;
|
|
151
|
-
positioning.offsetY = event.clientY - top;
|
|
152
|
-
positioning.isDragging = true;
|
|
153
|
-
stickContainer.classList.add('dragging');
|
|
154
|
-
document.addEventListener('pointermove', handlePointerMove);
|
|
155
|
-
document.addEventListener('pointerup', handlePointerUp);
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
}
|
|
158
|
-
} },
|
|
159
|
-
React.createElement("button", { "aria-label": 'Delete sticky note', className: 'delete', onClick: handleDelete, title: 'Delete', type: 'button' }, "X"),
|
|
160
|
-
React.createElement("button", { "aria-label": 'Change sticky note color', className: 'color', onClick: handleColorChange, title: 'Color', type: 'button' },
|
|
161
|
-
React.createElement("i", { className: 'bucket' })),
|
|
162
|
-
React.createElement(LexicalNestedComposer_1.LexicalNestedComposer, { initialEditor: caption, initialTheme: StickyEditorTheme_1.default },
|
|
163
|
-
isCollabActive ? (React.createElement(LexicalCollaborationPlugin_1.CollaborationPlugin, { id: caption.getKey(), providerFactory: collaboration_1.createWebsocketProvider, shouldBootstrap: true })) : (React.createElement(LexicalHistoryPlugin_1.HistoryPlugin, { externalHistoryState: historyState })),
|
|
164
|
-
React.createElement(LexicalPlainTextPlugin_1.PlainTextPlugin, { contentEditable: React.createElement(ContentEditable_1.default, { className: 'StickyNode__contentEditable' }), ErrorBoundary: LexicalErrorBoundary_1.default, placeholder: React.createElement(Placeholder_1.default, { className: 'StickyNode__placeholder' }, "What's up?") })))));
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=StickyComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StickyComponent.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/StickyComponent.tsx"],"names":[],"mappings":";;AAqCA,kCA0LC;;AA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liates.
|
|
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 { EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedEditor, SerializedLexicalNode, Spread } from 'lexical';
|
|
9
|
-
import { DecoratorNode } from 'lexical';
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
type StickyNoteColor = 'pink' | 'yellow';
|
|
12
|
-
export type SerializedStickyNode = Spread<{
|
|
13
|
-
xOffset: number;
|
|
14
|
-
yOffset: number;
|
|
15
|
-
color: StickyNoteColor;
|
|
16
|
-
caption: SerializedEditor;
|
|
17
|
-
}, SerializedLexicalNode>;
|
|
18
|
-
export declare class StickyNode extends DecoratorNode<React.JSX.Element> {
|
|
19
|
-
__x: number;
|
|
20
|
-
__y: number;
|
|
21
|
-
__color: StickyNoteColor;
|
|
22
|
-
__caption: LexicalEditor;
|
|
23
|
-
static getType(): string;
|
|
24
|
-
static clone(node: StickyNode): StickyNode;
|
|
25
|
-
static importJSON(serializedNode: SerializedStickyNode): StickyNode;
|
|
26
|
-
constructor(x: number, y: number, color: 'pink' | 'yellow', caption?: LexicalEditor, key?: NodeKey);
|
|
27
|
-
exportJSON(): SerializedStickyNode;
|
|
28
|
-
createDOM(config: EditorConfig): HTMLElement;
|
|
29
|
-
updateDOM(): false;
|
|
30
|
-
setPosition(x: number, y: number): void;
|
|
31
|
-
toggleColor(): void;
|
|
32
|
-
decorate(editor: LexicalEditor, config: EditorConfig): React.JSX.Element;
|
|
33
|
-
isIsolated(): true;
|
|
34
|
-
}
|
|
35
|
-
export declare function $isStickyNode(node: LexicalNode | null | undefined): node is StickyNode;
|
|
36
|
-
export declare function $createStickyNode(xOffset: number, yOffset: number): StickyNode;
|
|
37
|
-
export {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
/**
|
|
4
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.StickyNode = void 0;
|
|
12
|
-
exports.$isStickyNode = $isStickyNode;
|
|
13
|
-
exports.$createStickyNode = $createStickyNode;
|
|
14
|
-
const tslib_1 = require("tslib");
|
|
15
|
-
const lexical_1 = require("lexical");
|
|
16
|
-
const React = tslib_1.__importStar(require("react"));
|
|
17
|
-
const react_1 = require("react");
|
|
18
|
-
const react_dom_1 = require("react-dom");
|
|
19
|
-
const StickyComponent = React.lazy(
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
() => Promise.resolve().then(() => tslib_1.__importStar(require('./StickyComponent'))));
|
|
22
|
-
class StickyNode extends lexical_1.DecoratorNode {
|
|
23
|
-
static getType() {
|
|
24
|
-
return 'sticky';
|
|
25
|
-
}
|
|
26
|
-
static clone(node) {
|
|
27
|
-
return new StickyNode(node.__x, node.__y, node.__color, node.__caption, node.__key);
|
|
28
|
-
}
|
|
29
|
-
static importJSON(serializedNode) {
|
|
30
|
-
const stickyNode = new StickyNode(serializedNode.xOffset, serializedNode.yOffset, serializedNode.color);
|
|
31
|
-
const caption = serializedNode.caption;
|
|
32
|
-
const nestedEditor = stickyNode.__caption;
|
|
33
|
-
const editorState = nestedEditor.parseEditorState(caption.editorState);
|
|
34
|
-
if (!editorState.isEmpty()) {
|
|
35
|
-
nestedEditor.setEditorState(editorState);
|
|
36
|
-
}
|
|
37
|
-
return stickyNode;
|
|
38
|
-
}
|
|
39
|
-
constructor(x, y, color, caption, key) {
|
|
40
|
-
super(key);
|
|
41
|
-
this.__x = x;
|
|
42
|
-
this.__y = y;
|
|
43
|
-
this.__caption = caption || (0, lexical_1.createEditor)();
|
|
44
|
-
this.__color = color;
|
|
45
|
-
}
|
|
46
|
-
exportJSON() {
|
|
47
|
-
return {
|
|
48
|
-
caption: this.__caption.toJSON(),
|
|
49
|
-
color: this.__color,
|
|
50
|
-
type: 'sticky',
|
|
51
|
-
version: 1,
|
|
52
|
-
xOffset: this.__x,
|
|
53
|
-
yOffset: this.__y,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
createDOM(config) {
|
|
57
|
-
console.log(config);
|
|
58
|
-
const div = document.createElement('div');
|
|
59
|
-
div.style.display = 'contents';
|
|
60
|
-
return div;
|
|
61
|
-
}
|
|
62
|
-
updateDOM() {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
setPosition(x, y) {
|
|
66
|
-
const writable = this.getWritable();
|
|
67
|
-
writable.__x = x;
|
|
68
|
-
writable.__y = y;
|
|
69
|
-
(0, lexical_1.$setSelection)(null);
|
|
70
|
-
}
|
|
71
|
-
toggleColor() {
|
|
72
|
-
const writable = this.getWritable();
|
|
73
|
-
writable.__color = writable.__color === 'pink' ? 'yellow' : 'pink';
|
|
74
|
-
}
|
|
75
|
-
decorate(editor, config) {
|
|
76
|
-
console.log(editor, config);
|
|
77
|
-
return (0, react_dom_1.createPortal)(React.createElement(react_1.Suspense, { fallback: null },
|
|
78
|
-
React.createElement(StickyComponent, { caption: this.__caption, color: this.__color, nodeKey: this.getKey(), x: this.__x, y: this.__y })), document.body);
|
|
79
|
-
}
|
|
80
|
-
isIsolated() {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.StickyNode = StickyNode;
|
|
85
|
-
function $isStickyNode(node) {
|
|
86
|
-
return node instanceof StickyNode;
|
|
87
|
-
}
|
|
88
|
-
function $createStickyNode(xOffset, yOffset) {
|
|
89
|
-
return new StickyNode(xOffset, yOffset, 'yellow');
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=StickyNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,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