phx-react 1.3.1717 → 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/MainWrapV4/MainWrapV4.js +1 -1
- package/dist/cjs/components/MainWrapV4/MainWrapV4.js.map +1 -1
- package/dist/cjs/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.d.ts +2 -2
- package/dist/cjs/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.js +41 -20
- package/dist/cjs/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.js.map +1 -1
- 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/MainWrapV4/MainWrapV4.js +1 -1
- package/dist/esm/components/MainWrapV4/MainWrapV4.js.map +1 -1
- package/dist/esm/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.d.ts +2 -2
- package/dist/esm/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.js +41 -20
- package/dist/esm/components/MainWrapV4/hooks/use-mainwrap-realtime-counts.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,54 +0,0 @@
|
|
|
1
|
-
import { DecoratorNode } from 'lexical';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useSharedAutocompleteContext } from '../context/SharedAutocompleteContext';
|
|
4
|
-
import { uuid as UUID } from '../plugins/AutocompletePlugin';
|
|
5
|
-
export class AutocompleteNode extends DecoratorNode {
|
|
6
|
-
static clone(node) {
|
|
7
|
-
return new AutocompleteNode(node.__uuid, node.__key);
|
|
8
|
-
}
|
|
9
|
-
static getType() {
|
|
10
|
-
return 'autocomplete';
|
|
11
|
-
}
|
|
12
|
-
static importJSON(serializedNode) {
|
|
13
|
-
const node = $createAutocompleteNode(serializedNode.uuid);
|
|
14
|
-
return node;
|
|
15
|
-
}
|
|
16
|
-
exportJSON() {
|
|
17
|
-
return {
|
|
18
|
-
...super.exportJSON(),
|
|
19
|
-
type: 'autocomplete',
|
|
20
|
-
uuid: this.__uuid,
|
|
21
|
-
version: 1,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
constructor(uuid, key) {
|
|
25
|
-
super(key);
|
|
26
|
-
this.__uuid = uuid;
|
|
27
|
-
}
|
|
28
|
-
updateDOM() {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
createDOM() {
|
|
32
|
-
return document.createElement('span');
|
|
33
|
-
}
|
|
34
|
-
decorate() {
|
|
35
|
-
if (this.__uuid !== UUID) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return React.createElement(AutocompleteComponent, null);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export function $createAutocompleteNode(uuid) {
|
|
42
|
-
return new AutocompleteNode(uuid);
|
|
43
|
-
}
|
|
44
|
-
function AutocompleteComponent() {
|
|
45
|
-
const [suggestion] = useSharedAutocompleteContext();
|
|
46
|
-
const userAgentData = window.navigator.userAgentData;
|
|
47
|
-
const isMobile = userAgentData !== undefined ? userAgentData.mobile : window.innerWidth <= 800 && window.innerHeight <= 600;
|
|
48
|
-
// TODO Move to theme
|
|
49
|
-
return (React.createElement("span", { spellCheck: 'false', style: { color: '#ccc' } },
|
|
50
|
-
suggestion,
|
|
51
|
-
" ",
|
|
52
|
-
isMobile ? '(SWIPE \u2B95)' : '(TAB)'));
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=AutocompleteNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteNode.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/AutocompleteNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAkC,MAAM,SAAS,CAAA;AACvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAA;AAiB5D,MAAM,OAAO,gBAAiB,SAAQ,aAAuC;IAIpE,MAAM,CAAC,KAAK,CAAC,IAAsB;QACxC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACtD,CAAC;IAEM,MAAM,CAAC,OAAO;QACnB,OAAO,cAAc,CAAA;IACvB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,cAA0C;QACjE,MAAM,IAAI,GAAG,uBAAuB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;QACzD,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,UAAU;QACf,OAAO;YACL,GAAG,KAAK,CAAC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
|
2
|
-
import { TextNode } from 'lexical';
|
|
3
|
-
export type SerializedEmojiNode = Spread<{
|
|
4
|
-
className: string;
|
|
5
|
-
}, SerializedTextNode>;
|
|
6
|
-
export declare class EmojiNode extends TextNode {
|
|
7
|
-
__className: string;
|
|
8
|
-
static getType(): string;
|
|
9
|
-
static clone(node: EmojiNode): EmojiNode;
|
|
10
|
-
constructor(className: string, text: string, key?: NodeKey);
|
|
11
|
-
createDOM(config: EditorConfig): HTMLElement;
|
|
12
|
-
updateDOM(prevNode: TextNode, dom: HTMLElement, config: EditorConfig): boolean;
|
|
13
|
-
static importJSON(serializedNode: SerializedEmojiNode): EmojiNode;
|
|
14
|
-
exportJSON(): SerializedEmojiNode;
|
|
15
|
-
getClassName(): string;
|
|
16
|
-
}
|
|
17
|
-
export declare function $isEmojiNode(node: LexicalNode | null | undefined): node is EmojiNode;
|
|
18
|
-
export declare function $createEmojiNode(className: string, emojiText: string): EmojiNode;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { $applyNodeReplacement, TextNode } from 'lexical';
|
|
2
|
-
export class EmojiNode extends TextNode {
|
|
3
|
-
static getType() {
|
|
4
|
-
return 'emoji';
|
|
5
|
-
}
|
|
6
|
-
static clone(node) {
|
|
7
|
-
return new EmojiNode(node.__className, node.__text, node.__key);
|
|
8
|
-
}
|
|
9
|
-
constructor(className, text, key) {
|
|
10
|
-
super(text, key);
|
|
11
|
-
this.__className = className;
|
|
12
|
-
}
|
|
13
|
-
createDOM(config) {
|
|
14
|
-
const dom = document.createElement('span');
|
|
15
|
-
const inner = super.createDOM(config);
|
|
16
|
-
dom.className = this.__className;
|
|
17
|
-
inner.className = 'emoji-inner';
|
|
18
|
-
dom.appendChild(inner);
|
|
19
|
-
return dom;
|
|
20
|
-
}
|
|
21
|
-
updateDOM(prevNode, dom, config) {
|
|
22
|
-
const inner = dom.firstChild;
|
|
23
|
-
if (inner === null) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
super.updateDOM(prevNode, inner, config);
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
static importJSON(serializedNode) {
|
|
30
|
-
const node = $createEmojiNode(serializedNode.className, serializedNode.text);
|
|
31
|
-
node.setFormat(serializedNode.format);
|
|
32
|
-
node.setDetail(serializedNode.detail);
|
|
33
|
-
node.setMode(serializedNode.mode);
|
|
34
|
-
node.setStyle(serializedNode.style);
|
|
35
|
-
return node;
|
|
36
|
-
}
|
|
37
|
-
exportJSON() {
|
|
38
|
-
return {
|
|
39
|
-
...super.exportJSON(),
|
|
40
|
-
className: this.getClassName(),
|
|
41
|
-
type: 'emoji',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
getClassName() {
|
|
45
|
-
const self = this.getLatest();
|
|
46
|
-
return self.__className;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export function $isEmojiNode(node) {
|
|
50
|
-
return node instanceof EmojiNode;
|
|
51
|
-
}
|
|
52
|
-
export function $createEmojiNode(className, emojiText) {
|
|
53
|
-
const node = new EmojiNode(className, emojiText).setMode('token');
|
|
54
|
-
return $applyNodeReplacement(node);
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=EmojiNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiNode.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/EmojiNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AASzD,MAAM,OAAO,SAAU,SAAQ,QAAQ;IAG9B,MAAM,CAAC,OAAO;QACnB,OAAO,OAAO,CAAA;IAChB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,IAAe;QACjC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACjE,CAAC;IAED,YAAY,SAAiB,EAAE,IAAY,EAA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AAC,YAAY,EAAE;YAC9B,IAAI,EAAE,OAAO;SACd,CAAA;IACH,CAAC;IAEM,YAAY;QACjB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAC,IAAoC;IAC/D,OAAO,IAAI,YAAY,SAAS,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,SAAiB;IACnE,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NodeKey } from 'lexical';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
type EquationComponentProps = {
|
|
4
|
-
equation: string;
|
|
5
|
-
inline: boolean;
|
|
6
|
-
nodeKey: NodeKey;
|
|
7
|
-
};
|
|
8
|
-
export default function EquationComponent({ equation, inline, nodeKey }: EquationComponentProps): React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
2
|
-
import { mergeRegister } from '@lexical/utils';
|
|
3
|
-
import { $getNodeByKey, $getSelection, $isNodeSelection, COMMAND_PRIORITY_HIGH, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from 'lexical';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
7
|
-
import EquationEditor from '../ui/EquationEditor';
|
|
8
|
-
import KatexRenderer from '../ui/KatexRenderer';
|
|
9
|
-
import { $isEquationNode } from './EquationNode';
|
|
10
|
-
export default function EquationComponent({ equation, inline, nodeKey }) {
|
|
11
|
-
const [editor] = useLexicalComposerContext();
|
|
12
|
-
const [equationValue, setEquationValue] = useState(equation);
|
|
13
|
-
const [showEquationEditor, setShowEquationEditor] = useState(false);
|
|
14
|
-
const inputRef = useRef(null);
|
|
15
|
-
const onHide = useCallback((restoreSelection) => {
|
|
16
|
-
setShowEquationEditor(false);
|
|
17
|
-
editor.update(() => {
|
|
18
|
-
const node = $getNodeByKey(nodeKey);
|
|
19
|
-
if ($isEquationNode(node)) {
|
|
20
|
-
node.setEquation(equationValue);
|
|
21
|
-
if (restoreSelection) {
|
|
22
|
-
node.selectNext(0, 0);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}, [editor, equationValue, nodeKey]);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!showEquationEditor && equationValue !== equation) {
|
|
29
|
-
setEquationValue(equation);
|
|
30
|
-
}
|
|
31
|
-
}, [showEquationEditor, equation, equationValue]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (showEquationEditor) {
|
|
34
|
-
return mergeRegister(editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
35
|
-
const activeElement = document.activeElement;
|
|
36
|
-
const inputElem = inputRef.current;
|
|
37
|
-
if (inputElem !== activeElement) {
|
|
38
|
-
onHide();
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}, COMMAND_PRIORITY_HIGH), editor.registerCommand(KEY_ESCAPE_COMMAND, () => {
|
|
42
|
-
const activeElement = document.activeElement;
|
|
43
|
-
const inputElem = inputRef.current;
|
|
44
|
-
if (inputElem === activeElement) {
|
|
45
|
-
onHide(true);
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
}, COMMAND_PRIORITY_HIGH));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return editor.registerUpdateListener(({ editorState }) => {
|
|
53
|
-
const isSelected = editorState.read(() => {
|
|
54
|
-
const selection = $getSelection();
|
|
55
|
-
return $isNodeSelection(selection) && selection.has(nodeKey) && selection.getNodes().length === 1;
|
|
56
|
-
});
|
|
57
|
-
if (isSelected) {
|
|
58
|
-
setShowEquationEditor(true);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, [editor, nodeKey, onHide, showEquationEditor]);
|
|
63
|
-
return (React.createElement(React.Fragment, null, showEquationEditor ? (React.createElement(EquationEditor, { ref: inputRef, equation: equationValue, inline: inline, setEquation: setEquationValue })) : (React.createElement(ErrorBoundary, { fallback: null, onError: (e) => editor._onError(e) },
|
|
64
|
-
React.createElement(KatexRenderer, { equation: equationValue, inline: inline, onDoubleClick: () => setShowEquationEditor(true) })))));
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=EquationComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EquationComponent.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/EquationComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAElB,wBAAwB,GACzB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,cAAc,MAAM,sBAAsB,CAAA;AACjD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAQhD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,QAAQ,EAAE,MAA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AM,EAAE,WAAW,EAAE,gBAAgB,GAAI,CAC1G,CAAC,CAAC,CAAC,CACF,oBAAC,aAAa,IAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/D,oBAAC,aAAa,IAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAI,CAC9F,CACjB,CACA,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { DOMConversionMap, EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
|
|
2
|
-
import { DecoratorNode, DOMExportOutput } from 'lexical';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
export type SerializedEquationNode = Spread<{
|
|
5
|
-
equation: string;
|
|
6
|
-
inline: boolean;
|
|
7
|
-
}, SerializedLexicalNode>;
|
|
8
|
-
export declare class EquationNode extends DecoratorNode<React.JSX.Element> {
|
|
9
|
-
__equation: string;
|
|
10
|
-
__inline: boolean;
|
|
11
|
-
static getType(): string;
|
|
12
|
-
static clone(node: EquationNode): EquationNode;
|
|
13
|
-
constructor(equation: string, inline?: boolean, key?: NodeKey);
|
|
14
|
-
static importJSON(serializedNode: SerializedEquationNode): EquationNode;
|
|
15
|
-
exportJSON(): SerializedEquationNode;
|
|
16
|
-
createDOM(_config: EditorConfig): HTMLElement;
|
|
17
|
-
exportDOM(): DOMExportOutput;
|
|
18
|
-
static importDOM(): DOMConversionMap | null;
|
|
19
|
-
updateDOM(prevNode: EquationNode): boolean;
|
|
20
|
-
getTextContent(): string;
|
|
21
|
-
getEquation(): string;
|
|
22
|
-
setEquation(equation: string): void;
|
|
23
|
-
decorate(): React.JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export declare function $createEquationNode(equation?: string, inline?: boolean): EquationNode;
|
|
26
|
-
export declare function $isEquationNode(node: LexicalNode | null | undefined): node is EquationNode;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import katex from 'katex';
|
|
2
|
-
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Suspense } from 'react';
|
|
5
|
-
const EquationComponent = React.lazy(
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
() => import('./EquationComponent'));
|
|
8
|
-
function convertEquationElement(domNode) {
|
|
9
|
-
let equation = domNode.getAttribute('data-lexical-equation');
|
|
10
|
-
const inline = domNode.getAttribute('data-lexical-inline') === 'true';
|
|
11
|
-
// Decode the equation from base64
|
|
12
|
-
equation = atob(equation || '');
|
|
13
|
-
if (equation) {
|
|
14
|
-
const node = $createEquationNode(equation, inline);
|
|
15
|
-
return { node };
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
export class EquationNode extends DecoratorNode {
|
|
20
|
-
static getType() {
|
|
21
|
-
return 'equation';
|
|
22
|
-
}
|
|
23
|
-
static clone(node) {
|
|
24
|
-
return new EquationNode(node.__equation, node.__inline, node.__key);
|
|
25
|
-
}
|
|
26
|
-
constructor(equation, inline, key) {
|
|
27
|
-
super(key);
|
|
28
|
-
this.__equation = equation;
|
|
29
|
-
this.__inline = inline !== null && inline !== void 0 ? inline : false;
|
|
30
|
-
}
|
|
31
|
-
static importJSON(serializedNode) {
|
|
32
|
-
const node = $createEquationNode(serializedNode.equation, serializedNode.inline);
|
|
33
|
-
return node;
|
|
34
|
-
}
|
|
35
|
-
exportJSON() {
|
|
36
|
-
return {
|
|
37
|
-
equation: this.getEquation(),
|
|
38
|
-
inline: this.__inline,
|
|
39
|
-
type: 'equation',
|
|
40
|
-
version: 1,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
-
createDOM(_config) {
|
|
45
|
-
const element = document.createElement(this.__inline ? 'span' : 'div');
|
|
46
|
-
// EquationNodes should implement `user-action:none` in their CSS to avoid issues with deletion on Android.
|
|
47
|
-
element.className = 'editor-equation';
|
|
48
|
-
return element;
|
|
49
|
-
}
|
|
50
|
-
exportDOM() {
|
|
51
|
-
const element = document.createElement(this.__inline ? 'span' : 'div');
|
|
52
|
-
// Encode the equation as base64 to avoid issues with special characters
|
|
53
|
-
const equation = btoa(this.__equation);
|
|
54
|
-
element.setAttribute('data-lexical-equation', equation);
|
|
55
|
-
element.setAttribute('data-lexical-inline', `${this.__inline}`);
|
|
56
|
-
katex.render(this.__equation, element, {
|
|
57
|
-
displayMode: !this.__inline, // true === block display //
|
|
58
|
-
errorColor: '#cc0000',
|
|
59
|
-
output: 'html',
|
|
60
|
-
strict: 'warn',
|
|
61
|
-
throwOnError: false,
|
|
62
|
-
trust: false,
|
|
63
|
-
});
|
|
64
|
-
return { element };
|
|
65
|
-
}
|
|
66
|
-
static importDOM() {
|
|
67
|
-
return {
|
|
68
|
-
div: (domNode) => {
|
|
69
|
-
if (!domNode.hasAttribute('data-lexical-equation')) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
conversion: convertEquationElement,
|
|
74
|
-
priority: 2,
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
span: (domNode) => {
|
|
78
|
-
if (!domNode.hasAttribute('data-lexical-equation')) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
conversion: convertEquationElement,
|
|
83
|
-
priority: 1,
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
updateDOM(prevNode) {
|
|
89
|
-
// If the inline property changes, replace the element
|
|
90
|
-
return this.__inline !== prevNode.__inline;
|
|
91
|
-
}
|
|
92
|
-
getTextContent() {
|
|
93
|
-
return this.__equation;
|
|
94
|
-
}
|
|
95
|
-
getEquation() {
|
|
96
|
-
return this.__equation;
|
|
97
|
-
}
|
|
98
|
-
setEquation(equation) {
|
|
99
|
-
const writable = this.getWritable();
|
|
100
|
-
writable.__equation = equation;
|
|
101
|
-
}
|
|
102
|
-
decorate() {
|
|
103
|
-
return (React.createElement(Suspense, { fallback: null },
|
|
104
|
-
React.createElement(EquationComponent, { equation: this.__equation, inline: this.__inline, nodeKey: this.__key })));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
export function $createEquationNode(equation = '', inline = false) {
|
|
108
|
-
const equationNode = new EquationNode(equation, inline);
|
|
109
|
-
return $applyNodeReplacement(equationNode);
|
|
110
|
-
}
|
|
111
|
-
export function $isEquationNode(node) {
|
|
112
|
-
return node instanceof EquationNode;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=EquationNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EquationNode.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/EquationNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAmB,MAAM,SAAS,CAAA;AAC/E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,iBAAiB,GAAG,KAAK,CAAC,IAAI;AAClC,aAAa;AACb,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CACpC,CAAA;AAUD,SAAS,sBAAsB,CAAC,OAAoB;IAClD,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,KAAK,MAAM,CAAA;IACrE,kCAAkC;IAClC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAC/B,IAAI,QAAQ,EAAE,CAAC;QACb,M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ACrC,sDAAsD;QACtD,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAA;IAC5C,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAEM,WAAW,CAAC,QAAgB;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QACnC,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAA;IAChC,CAAC;IAEM,QAAQ;QACb,OAAO,CACL,oBAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI;YACtB,oBAAC,iBAAiB,IAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,GAAI,CACnF,CACZ,CAAA;IACH,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAQ,GAAG,EAAE,EAAE,MAAM,GAAG,KAAK;IAC/D,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACvD,OAAO,qBAAqB,CAAC,YAAY,CAAC,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAoC;IAClE,OAAO,IAAI,YAAY,YAAY,CAAA;AACrC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Options } from './PollNode';
|
|
2
|
-
import { NodeKey } from 'lexical';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
export default function PollComponent({ nodeKey, options, question, }: {
|
|
5
|
-
nodeKey: NodeKey;
|
|
6
|
-
options: Options;
|
|
7
|
-
question: string;
|
|
8
|
-
}): React.JSX.Element;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { useCollaborationContext } from '@lexical/react/LexicalCollaborationContext';
|
|
2
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
-
import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection';
|
|
4
|
-
import { mergeRegister } from '@lexical/utils';
|
|
5
|
-
import { $getNodeByKey, $getSelection, $isNodeSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, } from 'lexical';
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
-
import Button from '../ui/Button';
|
|
9
|
-
import joinClasses from '../utils/joinClasses';
|
|
10
|
-
import { $isPollNode, createPollOption } from './PollNode';
|
|
11
|
-
function getTotalVotes(options) {
|
|
12
|
-
return options.reduce((totalVotes, next) => totalVotes + next.votes.length, 0);
|
|
13
|
-
}
|
|
14
|
-
function PollOptionComponent({ index, option, options, totalVotes, withPollNode, }) {
|
|
15
|
-
const { clientID } = useCollaborationContext();
|
|
16
|
-
const checkboxRef = useRef(null);
|
|
17
|
-
const votesArray = option.votes;
|
|
18
|
-
const checkedIndex = votesArray.indexOf(clientID);
|
|
19
|
-
const checked = checkedIndex !== -1;
|
|
20
|
-
const votes = votesArray.length;
|
|
21
|
-
const text = option.text;
|
|
22
|
-
return (React.createElement("div", { className: 'PollNode__optionContainer' },
|
|
23
|
-
React.createElement("div", { className: joinClasses('PollNode__optionCheckboxWrapper', checked && 'PollNode__optionCheckboxChecked') },
|
|
24
|
-
React.createElement("input", { ref: checkboxRef, checked: checked, className: 'PollNode__optionCheckbox', onChange: () => {
|
|
25
|
-
withPollNode((node) => {
|
|
26
|
-
node.toggleVote(option, clientID);
|
|
27
|
-
});
|
|
28
|
-
}, type: 'checkbox' })),
|
|
29
|
-
React.createElement("div", { className: 'PollNode__optionInputWrapper' },
|
|
30
|
-
React.createElement("div", { className: 'PollNode__optionInputVotes', style: { width: `${votes === 0 ? 0 : (votes / totalVotes) * 100}%` } }),
|
|
31
|
-
React.createElement("span", { className: 'PollNode__optionInputVotesCount' }, votes > 0 && (votes === 1 ? '1 vote' : `${votes} votes`)),
|
|
32
|
-
React.createElement("input", { className: 'PollNode__optionInput', onChange: (e) => {
|
|
33
|
-
const target = e.target;
|
|
34
|
-
const value = target.value;
|
|
35
|
-
const selectionStart = target.selectionStart;
|
|
36
|
-
const selectionEnd = target.selectionEnd;
|
|
37
|
-
withPollNode((node) => {
|
|
38
|
-
node.setOptionText(option, value);
|
|
39
|
-
}, () => {
|
|
40
|
-
target.selectionStart = selectionStart;
|
|
41
|
-
target.selectionEnd = selectionEnd;
|
|
42
|
-
});
|
|
43
|
-
}, placeholder: `Option ${index + 1}`, type: 'text', value: text })),
|
|
44
|
-
React.createElement("button", { "aria-label": 'Remove', className: joinClasses('PollNode__optionDelete', options.length < 3 && 'PollNode__optionDeleteDisabled'), disabled: options.length < 3, onClick: () => {
|
|
45
|
-
withPollNode((node) => {
|
|
46
|
-
node.deleteOption(option);
|
|
47
|
-
});
|
|
48
|
-
}, type: 'button' })));
|
|
49
|
-
}
|
|
50
|
-
export default function PollComponent({ nodeKey, options, question, }) {
|
|
51
|
-
const [editor] = useLexicalComposerContext();
|
|
52
|
-
const totalVotes = useMemo(() => getTotalVotes(options), [options]);
|
|
53
|
-
const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
|
|
54
|
-
const [selection, setSelection] = useState(null);
|
|
55
|
-
const ref = useRef(null);
|
|
56
|
-
const onDelete = useCallback((payload) => {
|
|
57
|
-
if (isSelected && $isNodeSelection($getSelection())) {
|
|
58
|
-
const event = payload;
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
const node = $getNodeByKey(nodeKey);
|
|
61
|
-
if ($isPollNode(node)) {
|
|
62
|
-
node.remove();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}, [isSelected, nodeKey]);
|
|
67
|
-
useEffect(() => mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
68
|
-
setSelection(editorState.read(() => $getSelection()));
|
|
69
|
-
}), editor.registerCommand(CLICK_COMMAND, (payload) => {
|
|
70
|
-
const event = payload;
|
|
71
|
-
if (event.target === ref.current) {
|
|
72
|
-
if (!event.shiftKey) {
|
|
73
|
-
clearSelection();
|
|
74
|
-
}
|
|
75
|
-
setSelected(!isSelected);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW)), [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
|
|
80
|
-
const withPollNode = (cb, onUpdate) => {
|
|
81
|
-
editor.update(() => {
|
|
82
|
-
const node = $getNodeByKey(nodeKey);
|
|
83
|
-
if ($isPollNode(node)) {
|
|
84
|
-
cb(node);
|
|
85
|
-
}
|
|
86
|
-
}, { onUpdate });
|
|
87
|
-
};
|
|
88
|
-
const addOption = () => {
|
|
89
|
-
withPollNode((node) => {
|
|
90
|
-
node.addOption(createPollOption());
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
const isFocused = $isNodeSelection(selection) && isSelected;
|
|
94
|
-
return (React.createElement("div", { ref: ref, className: `PollNode__container ${isFocused ? 'focused' : ''}` },
|
|
95
|
-
React.createElement("div", { className: 'PollNode__inner' },
|
|
96
|
-
React.createElement("h2", { className: 'PollNode__heading' }, question),
|
|
97
|
-
options.map((option, index) => {
|
|
98
|
-
const key = option.uid;
|
|
99
|
-
return (React.createElement(PollOptionComponent, { key: key, index: index, option: option, options: options, totalVotes: totalVotes, withPollNode: withPollNode }));
|
|
100
|
-
}),
|
|
101
|
-
React.createElement("div", { className: 'PollNode__footer' },
|
|
102
|
-
React.createElement(Button, { onClick: addOption, small: true }, "Add Option")))));
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=PollComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PollComponent.js","sourceRoot":"","sources":["../../../../../src/components/TextEditorV2/nodes/PollComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAEhB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,MAAM,MAAM,cAAc,CAAA;AACjC,OAAO,WAAW,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;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,uBAAuB,EAAE,CAAA;IAC9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAChC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAA;IAC/B,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAA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AK,uBAExB,CACL,CACF,CACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { DecoratorNode, DOMConversionMap, DOMExportOutput, 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;
|