@datalayer/lexical-loro 0.2.5 → 1.0.1
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/package.json +1 -1
- package/lib/App.d.ts +0 -2
- package/lib/App.js +0 -141
- package/lib/Editor.d.ts +0 -2
- package/lib/Editor.js +0 -115
- package/lib/Settings.d.ts +0 -2
- package/lib/Settings.js +0 -57
- package/lib/appSettings.d.ts +0 -36
- package/lib/appSettings.js +0 -48
- package/lib/collab/loro/Bindings.d.ts +0 -41
- package/lib/collab/loro/Bindings.js +0 -99
- package/lib/collab/loro/Debug.d.ts +0 -33
- package/lib/collab/loro/Debug.js +0 -452
- package/lib/collab/loro/LexicalCollaborationContext.d.ts +0 -19
- package/lib/collab/loro/LexicalCollaborationContext.js +0 -52
- package/lib/collab/loro/LexicalCollaborationPlugin.d.ts +0 -24
- package/lib/collab/loro/LexicalCollaborationPlugin.js +0 -83
- package/lib/collab/loro/State.d.ts +0 -53
- package/lib/collab/loro/State.js +0 -94
- package/lib/collab/loro/components/LoroCollaborationUI.d.ts +0 -13
- package/lib/collab/loro/components/LoroCollaborationUI.js +0 -9
- package/lib/collab/loro/components/LoroCollaborators.d.ts +0 -8
- package/lib/collab/loro/components/LoroCollaborators.js +0 -102
- package/lib/collab/loro/components/index.d.ts +0 -2
- package/lib/collab/loro/components/index.js +0 -6
- package/lib/collab/loro/index.d.ts +0 -6
- package/lib/collab/loro/index.js +0 -10
- package/lib/collab/loro/integrators/BaseIntegrator.d.ts +0 -14
- package/lib/collab/loro/integrators/BaseIntegrator.js +0 -5
- package/lib/collab/loro/integrators/CounterIntegrator.d.ts +0 -23
- package/lib/collab/loro/integrators/CounterIntegrator.js +0 -44
- package/lib/collab/loro/integrators/ListIntegrator.d.ts +0 -23
- package/lib/collab/loro/integrators/ListIntegrator.js +0 -53
- package/lib/collab/loro/integrators/MapIntegrator.d.ts +0 -24
- package/lib/collab/loro/integrators/MapIntegrator.js +0 -235
- package/lib/collab/loro/integrators/TextIntegrator.d.ts +0 -25
- package/lib/collab/loro/integrators/TextIntegrator.js +0 -55
- package/lib/collab/loro/integrators/TreeIntegrator.d.ts +0 -36
- package/lib/collab/loro/integrators/TreeIntegrator.js +0 -251
- package/lib/collab/loro/nodes/NodeFactory.d.ts +0 -15
- package/lib/collab/loro/nodes/NodeFactory.js +0 -101
- package/lib/collab/loro/nodes/NodesMapper.d.ts +0 -120
- package/lib/collab/loro/nodes/NodesMapper.js +0 -277
- package/lib/collab/loro/propagators/DecoratorNodePropagator.d.ts +0 -60
- package/lib/collab/loro/propagators/DecoratorNodePropagator.js +0 -306
- package/lib/collab/loro/propagators/ElementNodePropagator.d.ts +0 -62
- package/lib/collab/loro/propagators/ElementNodePropagator.js +0 -326
- package/lib/collab/loro/propagators/LineBreakNodePropagator.d.ts +0 -57
- package/lib/collab/loro/propagators/LineBreakNodePropagator.js +0 -200
- package/lib/collab/loro/propagators/RootNodePropagator.d.ts +0 -55
- package/lib/collab/loro/propagators/RootNodePropagator.js +0 -174
- package/lib/collab/loro/propagators/TextNodePropagator.d.ts +0 -60
- package/lib/collab/loro/propagators/TextNodePropagator.js +0 -440
- package/lib/collab/loro/propagators/index.d.ts +0 -49
- package/lib/collab/loro/propagators/index.js +0 -30
- package/lib/collab/loro/provider/websocket.d.ts +0 -116
- package/lib/collab/loro/provider/websocket.js +0 -911
- package/lib/collab/loro/servers/index.d.ts +0 -0
- package/lib/collab/loro/servers/index.js +0 -4
- package/lib/collab/loro/servers/ws/callback.d.ts +0 -5
- package/lib/collab/loro/servers/ws/callback.js +0 -89
- package/lib/collab/loro/servers/ws/server.d.ts +0 -2
- package/lib/collab/loro/servers/ws/server.js +0 -29
- package/lib/collab/loro/servers/ws/utils.d.ts +0 -40
- package/lib/collab/loro/servers/ws/utils.js +0 -517
- package/lib/collab/loro/sync/SyncCursors.d.ts +0 -32
- package/lib/collab/loro/sync/SyncCursors.js +0 -475
- package/lib/collab/loro/sync/SyncLexicalToLoro.d.ts +0 -4
- package/lib/collab/loro/sync/SyncLexicalToLoro.js +0 -113
- package/lib/collab/loro/sync/SyncLoroToLexical.d.ts +0 -5
- package/lib/collab/loro/sync/SyncLoroToLexical.js +0 -100
- package/lib/collab/loro/types/LexicalNodeData.d.ts +0 -32
- package/lib/collab/loro/types/LexicalNodeData.js +0 -75
- package/lib/collab/loro/useCollaboration.d.ts +0 -12
- package/lib/collab/loro/useCollaboration.js +0 -260
- package/lib/collab/loro/utils/InitialContent.d.ts +0 -64
- package/lib/collab/loro/utils/InitialContent.js +0 -113
- package/lib/collab/loro/utils/LexicalToLoro.d.ts +0 -18
- package/lib/collab/loro/utils/LexicalToLoro.js +0 -100
- package/lib/collab/loro/utils/Utils.d.ts +0 -44
- package/lib/collab/loro/utils/Utils.js +0 -157
- package/lib/collab/loro/wsProvider.d.ts +0 -8
- package/lib/collab/loro/wsProvider.js +0 -35
- package/lib/collab/utils/invariant.d.ts +0 -1
- package/lib/collab/utils/invariant.js +0 -15
- package/lib/collab/utils/simpleDiffWithCursor.d.ts +0 -5
- package/lib/collab/utils/simpleDiffWithCursor.js +0 -35
- package/lib/collab/yjs/Bindings.d.ts +0 -23
- package/lib/collab/yjs/Bindings.js +0 -26
- package/lib/collab/yjs/Debug.d.ts +0 -23
- package/lib/collab/yjs/Debug.js +0 -213
- package/lib/collab/yjs/LexicalCollaborationContext.d.ts +0 -10
- package/lib/collab/yjs/LexicalCollaborationContext.js +0 -37
- package/lib/collab/yjs/LexicalCollaborationPlugin.d.ts +0 -21
- package/lib/collab/yjs/LexicalCollaborationPlugin.js +0 -63
- package/lib/collab/yjs/State.d.ts +0 -51
- package/lib/collab/yjs/State.js +0 -35
- package/lib/collab/yjs/nodes/AnyCollabNode.d.ts +0 -5
- package/lib/collab/yjs/nodes/AnyCollabNode.js +0 -1
- package/lib/collab/yjs/nodes/CollabDecoratorNode.d.ts +0 -22
- package/lib/collab/yjs/nodes/CollabDecoratorNode.js +0 -64
- package/lib/collab/yjs/nodes/CollabElementNode.d.ts +0 -40
- package/lib/collab/yjs/nodes/CollabElementNode.js +0 -462
- package/lib/collab/yjs/nodes/CollabLineBreakNode.d.ts +0 -19
- package/lib/collab/yjs/nodes/CollabLineBreakNode.js +0 -44
- package/lib/collab/yjs/nodes/CollabTextNode.d.ts +0 -25
- package/lib/collab/yjs/nodes/CollabTextNode.js +0 -103
- package/lib/collab/yjs/provider/websocket.d.ts +0 -88
- package/lib/collab/yjs/provider/websocket.js +0 -415
- package/lib/collab/yjs/servers/index.d.ts +0 -0
- package/lib/collab/yjs/servers/index.js +0 -0
- package/lib/collab/yjs/servers/ws/callback.d.ts +0 -5
- package/lib/collab/yjs/servers/ws/callback.js +0 -72
- package/lib/collab/yjs/servers/ws/server.d.ts +0 -2
- package/lib/collab/yjs/servers/ws/server.js +0 -25
- package/lib/collab/yjs/servers/ws/utils.d.ts +0 -49
- package/lib/collab/yjs/servers/ws/utils.js +0 -284
- package/lib/collab/yjs/sync/SyncCursors.d.ts +0 -39
- package/lib/collab/yjs/sync/SyncCursors.js +0 -351
- package/lib/collab/yjs/sync/SyncEditorStates.d.ts +0 -10
- package/lib/collab/yjs/sync/SyncEditorStates.js +0 -200
- package/lib/collab/yjs/useCollaboration.d.ts +0 -12
- package/lib/collab/yjs/useCollaboration.js +0 -255
- package/lib/collab/yjs/utils/Utils.d.ts +0 -25
- package/lib/collab/yjs/utils/Utils.js +0 -402
- package/lib/collab/yjs/wsProvider.d.ts +0 -3
- package/lib/collab/yjs/wsProvider.js +0 -21
- package/lib/commenting/index.d.ts +0 -41
- package/lib/commenting/index.js +0 -328
- package/lib/context/FlashMessageContext.d.ts +0 -7
- package/lib/context/FlashMessageContext.js +0 -24
- package/lib/context/SettingsContext.d.ts +0 -12
- package/lib/context/SettingsContext.js +0 -38
- package/lib/context/SharedHistoryContext.d.ts +0 -11
- package/lib/context/SharedHistoryContext.js +0 -11
- package/lib/context/ToolbarContext.d.ts +0 -65
- package/lib/context/ToolbarContext.js +0 -84
- package/lib/demo.d.ts +0 -12
- package/lib/demo.js +0 -45
- package/lib/hooks/useFlashMessage.d.ts +0 -2
- package/lib/hooks/useFlashMessage.js +0 -8
- package/lib/hooks/useModal.d.ts +0 -5
- package/lib/hooks/useModal.js +0 -26
- package/lib/hooks/useReport.d.ts +0 -1
- package/lib/hooks/useReport.js +0 -50
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -5
- package/lib/nodes/AutocompleteNode.d.ts +0 -27
- package/lib/nodes/AutocompleteNode.js +0 -60
- package/lib/nodes/CounterComponent.d.ts +0 -6
- package/lib/nodes/CounterComponent.js +0 -137
- package/lib/nodes/CounterNode.d.ts +0 -23
- package/lib/nodes/CounterNode.js +0 -47
- package/lib/nodes/DateTimeNode/DateTimeComponent.d.ts +0 -8
- package/lib/nodes/DateTimeNode/DateTimeComponent.js +0 -119
- package/lib/nodes/DateTimeNode/DateTimeNode.d.ts +0 -27
- package/lib/nodes/DateTimeNode/DateTimeNode.js +0 -82
- package/lib/nodes/EmojiNode.d.ts +0 -18
- package/lib/nodes/EmojiNode.js +0 -54
- package/lib/nodes/EquationComponent.d.ts +0 -9
- package/lib/nodes/EquationComponent.js +0 -75
- package/lib/nodes/EquationNode.d.ts +0 -26
- package/lib/nodes/EquationNode.js +0 -109
- package/lib/nodes/ExcalidrawNode/ExcalidrawComponent.d.ts +0 -8
- package/lib/nodes/ExcalidrawNode/ExcalidrawComponent.js +0 -110
- package/lib/nodes/ExcalidrawNode/ExcalidrawImage.d.ts +0 -50
- package/lib/nodes/ExcalidrawNode/ExcalidrawImage.js +0 -55
- package/lib/nodes/ExcalidrawNode/index.d.ts +0 -32
- package/lib/nodes/ExcalidrawNode/index.js +0 -117
- package/lib/nodes/FigmaNode.d.ts +0 -20
- package/lib/nodes/FigmaNode.js +0 -52
- package/lib/nodes/ImageComponent.d.ts +0 -16
- package/lib/nodes/ImageComponent.js +0 -272
- package/lib/nodes/ImageNode.d.ts +0 -50
- package/lib/nodes/ImageNode.js +0 -151
- package/lib/nodes/InlineImageNode/InlineImageComponent.d.ts +0 -26
- package/lib/nodes/InlineImageNode/InlineImageComponent.js +0 -161
- package/lib/nodes/InlineImageNode/InlineImageNode.d.ts +0 -59
- package/lib/nodes/InlineImageNode/InlineImageNode.js +0 -162
- package/lib/nodes/KeywordNode.d.ts +0 -14
- package/lib/nodes/KeywordNode.js +0 -37
- package/lib/nodes/LayoutContainerNode.d.ts +0 -24
- package/lib/nodes/LayoutContainerNode.js +0 -95
- package/lib/nodes/LayoutItemNode.d.ts +0 -16
- package/lib/nodes/LayoutItemNode.js +0 -69
- package/lib/nodes/MentionNode.d.ts +0 -20
- package/lib/nodes/MentionNode.js +0 -85
- package/lib/nodes/PageBreakNode/index.d.ts +0 -17
- package/lib/nodes/PageBreakNode/index.js +0 -83
- package/lib/nodes/PlaygroundNodes.d.ts +0 -3
- package/lib/nodes/PlaygroundNodes.js +0 -75
- package/lib/nodes/PollComponent.d.ts +0 -9
- package/lib/nodes/PollComponent.js +0 -85
- package/lib/nodes/PollNode.d.ts +0 -43
- package/lib/nodes/PollNode.js +0 -153
- package/lib/nodes/SpecialTextNode.d.ts +0 -24
- package/lib/nodes/SpecialTextNode.js +0 -54
- package/lib/nodes/StickyComponent.d.ts +0 -10
- package/lib/nodes/StickyComponent.js +0 -162
- package/lib/nodes/StickyNode.d.ts +0 -31
- package/lib/nodes/StickyNode.js +0 -76
- package/lib/nodes/TweetNode.d.ts +0 -21
- package/lib/nodes/TweetNode.js +0 -119
- package/lib/nodes/YouTubeNode.d.ts +0 -22
- package/lib/nodes/YouTubeNode.js +0 -84
- package/lib/plugins/ActionsPlugin/index.d.ts +0 -5
- package/lib/plugins/ActionsPlugin/index.js +0 -168
- package/lib/plugins/AutoEmbedPlugin/index.d.ts +0 -19
- package/lib/plugins/AutoEmbedPlugin/index.js +0 -158
- package/lib/plugins/AutoLinkPlugin/index.d.ts +0 -2
- package/lib/plugins/AutoLinkPlugin/index.js +0 -15
- package/lib/plugins/AutocompletePlugin/index.d.ts +0 -10
- package/lib/plugins/AutocompletePlugin/index.js +0 -2477
- package/lib/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +0 -7
- package/lib/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +0 -46
- package/lib/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +0 -17
- package/lib/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +0 -115
- package/lib/plugins/CodeActionMenuPlugin/index.d.ts +0 -5
- package/lib/plugins/CodeActionMenuPlugin/index.js +0 -104
- package/lib/plugins/CodeActionMenuPlugin/utils.d.ts +0 -1
- package/lib/plugins/CodeActionMenuPlugin/utils.js +0 -22
- package/lib/plugins/CodeHighlightPrismPlugin/index.d.ts +0 -2
- package/lib/plugins/CodeHighlightPrismPlugin/index.js +0 -14
- package/lib/plugins/CodeHighlightShikiPlugin/index.d.ts +0 -2
- package/lib/plugins/CodeHighlightShikiPlugin/index.js +0 -14
- package/lib/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +0 -25
- package/lib/plugins/CollapsiblePlugin/CollapsibleContainerNode.js +0 -135
- package/lib/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +0 -16
- package/lib/plugins/CollapsiblePlugin/CollapsibleContentNode.js +0 -83
- package/lib/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +0 -16
- package/lib/plugins/CollapsiblePlugin/CollapsibleTitleNode.js +0 -85
- package/lib/plugins/CollapsiblePlugin/CollapsibleUtils.d.ts +0 -2
- package/lib/plugins/CollapsiblePlugin/CollapsibleUtils.js +0 -12
- package/lib/plugins/CollapsiblePlugin/index.d.ts +0 -3
- package/lib/plugins/CollapsiblePlugin/index.js +0 -132
- package/lib/plugins/CommentPlugin/index.d.ts +0 -9
- package/lib/plugins/CommentPlugin/index.js +0 -460
- package/lib/plugins/ComponentPickerPlugin/index.d.ts +0 -2
- package/lib/plugins/ComponentPickerPlugin/index.js +0 -276
- package/lib/plugins/ContextMenuPlugin/index.d.ts +0 -2
- package/lib/plugins/ContextMenuPlugin/index.js +0 -112
- package/lib/plugins/CounterPlugin/index.d.ts +0 -3
- package/lib/plugins/CounterPlugin/index.js +0 -24
- package/lib/plugins/DateTimePlugin/index.d.ts +0 -8
- package/lib/plugins/DateTimePlugin/index.js +0 -28
- package/lib/plugins/DebugPlugin/index.d.ts +0 -3
- package/lib/plugins/DebugPlugin/index.js +0 -219
- package/lib/plugins/DocsPlugin/index.d.ts +0 -2
- package/lib/plugins/DocsPlugin/index.js +0 -4
- package/lib/plugins/DragDropPastePlugin/index.d.ts +0 -1
- package/lib/plugins/DragDropPastePlugin/index.js +0 -37
- package/lib/plugins/DraggableBlockPlugin/index.d.ts +0 -12
- package/lib/plugins/DraggableBlockPlugin/index.js +0 -36
- package/lib/plugins/EmojiPickerPlugin/index.d.ts +0 -1
- package/lib/plugins/EmojiPickerPlugin/index.js +0 -84
- package/lib/plugins/EmojisPlugin/index.d.ts +0 -2
- package/lib/plugins/EmojisPlugin/index.js +0 -56
- package/lib/plugins/EquationsPlugin/index.d.ts +0 -14
- package/lib/plugins/EquationsPlugin/index.js +0 -34
- package/lib/plugins/ExcalidrawPlugin/index.d.ts +0 -5
- package/lib/plugins/ExcalidrawPlugin/index.js +0 -44
- package/lib/plugins/FigmaPlugin/index.d.ts +0 -4
- package/lib/plugins/FigmaPlugin/index.js +0 -24
- package/lib/plugins/FloatingLinkEditorPlugin/index.d.ts +0 -15
- package/lib/plugins/FloatingLinkEditorPlugin/index.js +0 -280
- package/lib/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +0 -7
- package/lib/plugins/FloatingTextFormatToolbarPlugin/index.js +0 -219
- package/lib/plugins/ImagesPlugin/index.d.ts +0 -24
- package/lib/plugins/ImagesPlugin/index.js +0 -195
- package/lib/plugins/InlineImagePlugin/index.d.ts +0 -17
- package/lib/plugins/InlineImagePlugin/index.js +0 -180
- package/lib/plugins/KeywordsPlugin/index.d.ts +0 -2
- package/lib/plugins/KeywordsPlugin/index.js +0 -35
- package/lib/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +0 -6
- package/lib/plugins/LayoutPlugin/InsertLayoutDialog.js +0 -21
- package/lib/plugins/LayoutPlugin/LayoutPlugin.d.ts +0 -7
- package/lib/plugins/LayoutPlugin/LayoutPlugin.js +0 -135
- package/lib/plugins/LinkPlugin/index.d.ts +0 -6
- package/lib/plugins/LinkPlugin/index.js +0 -11
- package/lib/plugins/MarkdownShortcutPlugin/index.d.ts +0 -2
- package/lib/plugins/MarkdownShortcutPlugin/index.js +0 -6
- package/lib/plugins/MarkdownTransformers/index.d.ts +0 -8
- package/lib/plugins/MarkdownTransformers/index.js +0 -238
- package/lib/plugins/MaxLengthPlugin/index.d.ts +0 -3
- package/lib/plugins/MaxLengthPlugin/index.js +0 -41
- package/lib/plugins/MentionsPlugin/index.d.ts +0 -2
- package/lib/plugins/MentionsPlugin/index.js +0 -564
- package/lib/plugins/PageBreakPlugin/index.d.ts +0 -4
- package/lib/plugins/PageBreakPlugin/index.js +0 -31
- package/lib/plugins/PasteLogPlugin/index.d.ts +0 -2
- package/lib/plugins/PasteLogPlugin/index.js +0 -27
- package/lib/plugins/PollPlugin/index.d.ts +0 -8
- package/lib/plugins/PollPlugin/index.js +0 -38
- package/lib/plugins/ShortcutsPlugin/index.d.ts +0 -6
- package/lib/plugins/ShortcutsPlugin/index.js +0 -116
- package/lib/plugins/ShortcutsPlugin/shortcuts.d.ts +0 -59
- package/lib/plugins/ShortcutsPlugin/shortcuts.js +0 -173
- package/lib/plugins/SpecialTextPlugin/index.d.ts +0 -2
- package/lib/plugins/SpecialTextPlugin/index.js +0 -50
- package/lib/plugins/SpeechToTextPlugin/index.d.ts +0 -5
- package/lib/plugins/SpeechToTextPlugin/index.js +0 -86
- package/lib/plugins/StickyPlugin/index.d.ts +0 -2
- package/lib/plugins/StickyPlugin/index.js +0 -16
- package/lib/plugins/TabFocusPlugin/index.d.ts +0 -1
- package/lib/plugins/TabFocusPlugin/index.js +0 -38
- package/lib/plugins/TableActionMenuPlugin/index.d.ts +0 -5
- package/lib/plugins/TableActionMenuPlugin/index.js +0 -492
- package/lib/plugins/TableCellResizer/index.d.ts +0 -3
- package/lib/plugins/TableCellResizer/index.js +0 -297
- package/lib/plugins/TableHoverActionsPlugin/index.d.ts +0 -4
- package/lib/plugins/TableHoverActionsPlugin/index.js +0 -188
- package/lib/plugins/TableOfContentsPlugin/index.d.ts +0 -2
- package/lib/plugins/TableOfContentsPlugin/index.js +0 -116
- package/lib/plugins/TablePlugin.d.ts +0 -31
- package/lib/plugins/TablePlugin.js +0 -63
- package/lib/plugins/TestRecorderPlugin/index.d.ts +0 -3
- package/lib/plugins/TestRecorderPlugin/index.js +0 -346
- package/lib/plugins/ToolbarPlugin/fontSize.d.ts +0 -9
- package/lib/plugins/ToolbarPlugin/fontSize.js +0 -84
- package/lib/plugins/ToolbarPlugin/index.d.ts +0 -9
- package/lib/plugins/ToolbarPlugin/index.js +0 -500
- package/lib/plugins/ToolbarPlugin/utils.d.ts +0 -26
- package/lib/plugins/ToolbarPlugin/utils.js +0 -247
- package/lib/plugins/TreeViewPlugin/index.d.ts +0 -2
- package/lib/plugins/TreeViewPlugin/index.js +0 -7
- package/lib/plugins/TwitterPlugin/index.d.ts +0 -4
- package/lib/plugins/TwitterPlugin/index.js +0 -24
- package/lib/plugins/TypingPerfPlugin/index.d.ts +0 -2
- package/lib/plugins/TypingPerfPlugin/index.js +0 -97
- package/lib/plugins/YouTubePlugin/index.d.ts +0 -4
- package/lib/plugins/YouTubePlugin/index.js +0 -24
- package/lib/server/validation.d.ts +0 -1
- package/lib/server/validation.js +0 -115
- package/lib/setupEnv.d.ts +0 -2
- package/lib/setupEnv.js +0 -29
- package/lib/themes/CommentEditorTheme.d.ts +0 -4
- package/lib/themes/CommentEditorTheme.js +0 -11
- package/lib/themes/PlaygroundEditorTheme.d.ts +0 -4
- package/lib/themes/PlaygroundEditorTheme.js +0 -124
- package/lib/themes/StickyEditorTheme.d.ts +0 -4
- package/lib/themes/StickyEditorTheme.js +0 -11
- package/lib/tyes.dt.d.ts +0 -12
- package/lib/tyes.dt.js +0 -4
- package/lib/ui/Button.d.ts +0 -12
- package/lib/ui/Button.js +0 -6
- package/lib/ui/ColorPicker.d.ts +0 -14
- package/lib/ui/ColorPicker.js +0 -219
- package/lib/ui/ContentEditable.d.ts +0 -9
- package/lib/ui/ContentEditable.js +0 -6
- package/lib/ui/Dialog.d.ts +0 -10
- package/lib/ui/Dialog.js +0 -8
- package/lib/ui/DropDown.d.ts +0 -18
- package/lib/ui/DropDown.js +0 -133
- package/lib/ui/DropdownColorPicker.d.ts +0 -13
- package/lib/ui/DropdownColorPicker.js +0 -6
- package/lib/ui/EquationEditor.d.ts +0 -8
- package/lib/ui/EquationEditor.js +0 -11
- package/lib/ui/ExcalidrawModal.d.ts +0 -42
- package/lib/ui/ExcalidrawModal.js +0 -103
- package/lib/ui/FileInput.d.ts +0 -10
- package/lib/ui/FileInput.js +0 -5
- package/lib/ui/FlashMessage.d.ts +0 -7
- package/lib/ui/FlashMessage.js +0 -6
- package/lib/ui/ImageResizer.d.ts +0 -17
- package/lib/ui/ImageResizer.js +0 -171
- package/lib/ui/KatexEquationAlterer.d.ts +0 -8
- package/lib/ui/KatexEquationAlterer.js +0 -23
- package/lib/ui/KatexRenderer.d.ts +0 -6
- package/lib/ui/KatexRenderer.js +0 -24
- package/lib/ui/Modal.d.ts +0 -9
- package/lib/ui/Modal.js +0 -48
- package/lib/ui/Select.d.ts +0 -8
- package/lib/ui/Select.js +0 -5
- package/lib/ui/Switch.d.ts +0 -8
- package/lib/ui/Switch.js +0 -6
- package/lib/ui/TextInput.d.ts +0 -13
- package/lib/ui/TextInput.js +0 -7
- package/lib/utils/docSerialization.d.ts +0 -3
- package/lib/utils/docSerialization.js +0 -60
- package/lib/utils/emoji-list.d.ts +0 -20
- package/lib/utils/emoji-list.js +0 -16609
- package/lib/utils/getDOMRangeRect.d.ts +0 -8
- package/lib/utils/getDOMRangeRect.js +0 -26
- package/lib/utils/getSelectedNode.d.ts +0 -2
- package/lib/utils/getSelectedNode.js +0 -28
- package/lib/utils/getThemeSelector.d.ts +0 -2
- package/lib/utils/getThemeSelector.js +0 -14
- package/lib/utils/isMobileWidth.d.ts +0 -7
- package/lib/utils/isMobileWidth.js +0 -11
- package/lib/utils/joinClasses.d.ts +0 -1
- package/lib/utils/joinClasses.js +0 -7
- package/lib/utils/setFloatingElemPosition.d.ts +0 -1
- package/lib/utils/setFloatingElemPosition.js +0 -59
- package/lib/utils/setFloatingElemPositionForLinkEditor.d.ts +0 -1
- package/lib/utils/setFloatingElemPositionForLinkEditor.js +0 -36
- package/lib/utils/swipe.d.ts +0 -4
- package/lib/utils/swipe.js +0 -94
- package/lib/utils/url.d.ts +0 -2
- package/lib/utils/url.js +0 -31
package/package.json
CHANGED
package/lib/App.d.ts
DELETED
package/lib/App.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { $createLinkNode } from '@lexical/link';
|
|
3
|
-
import { $createListItemNode, $createListNode } from '@lexical/list';
|
|
4
|
-
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
5
|
-
import { $createHeadingNode, $createQuoteNode } from '@lexical/rich-text';
|
|
6
|
-
import { $createParagraphNode, $createTextNode, $getRoot, $isTextNode, TextNode, } from 'lexical';
|
|
7
|
-
import { isDevPlayground } from './appSettings';
|
|
8
|
-
import { FlashMessageContext } from './context/FlashMessageContext';
|
|
9
|
-
import { SettingsContext, useSettings } from './context/SettingsContext';
|
|
10
|
-
import { SharedHistoryContext } from './context/SharedHistoryContext';
|
|
11
|
-
import { ToolbarContext } from './context/ToolbarContext';
|
|
12
|
-
import Editor from './Editor';
|
|
13
|
-
import PlaygroundNodes from './nodes/PlaygroundNodes';
|
|
14
|
-
import DocsPlugin from './plugins/DocsPlugin';
|
|
15
|
-
import PasteLogPlugin from './plugins/PasteLogPlugin';
|
|
16
|
-
import { TableContext } from './plugins/TablePlugin';
|
|
17
|
-
import TestRecorderPlugin from './plugins/TestRecorderPlugin';
|
|
18
|
-
import { parseAllowedFontSize } from './plugins/ToolbarPlugin/fontSize';
|
|
19
|
-
import TypingPerfPlugin from './plugins/TypingPerfPlugin';
|
|
20
|
-
import Settings from './Settings';
|
|
21
|
-
import PlaygroundEditorTheme from './themes/PlaygroundEditorTheme';
|
|
22
|
-
import { parseAllowedColor } from './ui/ColorPicker';
|
|
23
|
-
import logo from './images/logo.svg';
|
|
24
|
-
console.warn('If you are profiling the playground app, please ensure you turn off the debug view. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.');
|
|
25
|
-
function $prepopulatedRichText() {
|
|
26
|
-
const root = $getRoot();
|
|
27
|
-
if (root.getFirstChild() === null) {
|
|
28
|
-
const heading = $createHeadingNode('h1');
|
|
29
|
-
heading.append($createTextNode('Welcome to the playground'));
|
|
30
|
-
root.append(heading);
|
|
31
|
-
const quote = $createQuoteNode();
|
|
32
|
-
quote.append($createTextNode(`In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. ` +
|
|
33
|
-
`You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.`));
|
|
34
|
-
root.append(quote);
|
|
35
|
-
const paragraph = $createParagraphNode();
|
|
36
|
-
paragraph.append($createTextNode('The playground is a demo environment built with '), $createTextNode('@lexical/react').toggleFormat('code'), $createTextNode('.'), $createTextNode(' Try typing in '), $createTextNode('some text').toggleFormat('bold'), $createTextNode(' with '), $createTextNode('different').toggleFormat('italic'), $createTextNode(' formats.'));
|
|
37
|
-
root.append(paragraph);
|
|
38
|
-
const paragraph2 = $createParagraphNode();
|
|
39
|
-
paragraph2.append($createTextNode('Make sure to check out the various plugins in the toolbar. You can also use #hashtags or @-mentions too!'));
|
|
40
|
-
root.append(paragraph2);
|
|
41
|
-
const paragraph3 = $createParagraphNode();
|
|
42
|
-
paragraph3.append($createTextNode(`If you'd like to find out more about Lexical, you can:`));
|
|
43
|
-
root.append(paragraph3);
|
|
44
|
-
const list = $createListNode('bullet');
|
|
45
|
-
list.append($createListItemNode().append($createTextNode(`Visit the `), $createLinkNode('https://lexical.dev/').append($createTextNode('Lexical website')), $createTextNode(` for documentation and more information.`)), $createListItemNode().append($createTextNode(`Check out the code on our `), $createLinkNode('https://github.com/facebook/lexical').append($createTextNode('GitHub repository')), $createTextNode(`.`)), $createListItemNode().append($createTextNode(`Playground code can be found `), $createLinkNode('https://github.com/facebook/lexical/tree/main/packages/lexical-playground').append($createTextNode('here')), $createTextNode(`.`)), $createListItemNode().append($createTextNode(`Join our `), $createLinkNode('https://discord.com/invite/KmG4wQnnD9').append($createTextNode('Discord Server')), $createTextNode(` and chat with the team.`)));
|
|
46
|
-
root.append(list);
|
|
47
|
-
const paragraph4 = $createParagraphNode();
|
|
48
|
-
paragraph4.append($createTextNode(`Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance :).`));
|
|
49
|
-
root.append(paragraph4);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function getExtraStyles(element) {
|
|
53
|
-
// Parse styles from pasted input, but only if they match exactly the
|
|
54
|
-
// sort of styles that would be produced by exportDOM
|
|
55
|
-
let extraStyles = '';
|
|
56
|
-
const fontSize = parseAllowedFontSize(element.style.fontSize);
|
|
57
|
-
const backgroundColor = parseAllowedColor(element.style.backgroundColor);
|
|
58
|
-
const color = parseAllowedColor(element.style.color);
|
|
59
|
-
if (fontSize !== '' && fontSize !== '15px') {
|
|
60
|
-
extraStyles += `font-size: ${fontSize};`;
|
|
61
|
-
}
|
|
62
|
-
if (backgroundColor !== '' && backgroundColor !== 'rgb(255, 255, 255)') {
|
|
63
|
-
extraStyles += `background-color: ${backgroundColor};`;
|
|
64
|
-
}
|
|
65
|
-
if (color !== '' && color !== 'rgb(0, 0, 0)') {
|
|
66
|
-
extraStyles += `color: ${color};`;
|
|
67
|
-
}
|
|
68
|
-
return extraStyles;
|
|
69
|
-
}
|
|
70
|
-
function buildImportMap() {
|
|
71
|
-
const importMap = {};
|
|
72
|
-
// Wrap all TextNode importers with a function that also imports
|
|
73
|
-
// the custom styles implemented by the playground
|
|
74
|
-
for (const [tag, fn] of Object.entries(TextNode.importDOM() || {})) {
|
|
75
|
-
importMap[tag] = (importNode) => {
|
|
76
|
-
const importer = fn(importNode);
|
|
77
|
-
if (!importer) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
...importer,
|
|
82
|
-
conversion: (element) => {
|
|
83
|
-
const output = importer.conversion(element);
|
|
84
|
-
if (output === null ||
|
|
85
|
-
output.forChild === undefined ||
|
|
86
|
-
output.after !== undefined ||
|
|
87
|
-
output.node !== null) {
|
|
88
|
-
return output;
|
|
89
|
-
}
|
|
90
|
-
const extraStyles = getExtraStyles(element);
|
|
91
|
-
if (extraStyles) {
|
|
92
|
-
const { forChild } = output;
|
|
93
|
-
return {
|
|
94
|
-
...output,
|
|
95
|
-
forChild: (child, parent) => {
|
|
96
|
-
const textNode = forChild(child, parent);
|
|
97
|
-
if ($isTextNode(textNode)) {
|
|
98
|
-
textNode.setStyle(textNode.getStyle() + extraStyles);
|
|
99
|
-
}
|
|
100
|
-
return textNode;
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return output;
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return importMap;
|
|
110
|
-
}
|
|
111
|
-
function App() {
|
|
112
|
-
const { settings: { isCollab, emptyEditor, measureTypingPerf }, } = useSettings();
|
|
113
|
-
const initialConfig = {
|
|
114
|
-
editorState: isCollab
|
|
115
|
-
? null
|
|
116
|
-
: emptyEditor
|
|
117
|
-
? undefined
|
|
118
|
-
: $prepopulatedRichText,
|
|
119
|
-
html: { import: buildImportMap() },
|
|
120
|
-
namespace: 'Lexical Loro Playground',
|
|
121
|
-
nodes: [...PlaygroundNodes],
|
|
122
|
-
onError: (error) => {
|
|
123
|
-
throw error;
|
|
124
|
-
},
|
|
125
|
-
theme: PlaygroundEditorTheme,
|
|
126
|
-
};
|
|
127
|
-
return (_jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsx(SharedHistoryContext, { children: _jsx(TableContext, { children: _jsxs(ToolbarContext, { children: [_jsx("header", { children: _jsx("a", { href: "https://lexical.dev", target: "_blank", rel: "noreferrer", children: _jsx("img", { src: logo, alt: "Lexical Logo" }) }) }), _jsx("div", { className: "editor-shell", children: _jsx(Editor, {}) }), _jsx(Settings, {}), isDevPlayground ? _jsx(DocsPlugin, {}) : null, isDevPlayground ? _jsx(PasteLogPlugin, {}) : null, isDevPlayground ? _jsx(TestRecorderPlugin, {}) : null, measureTypingPerf ? _jsx(TypingPerfPlugin, {}) : null] }) }) }) }));
|
|
128
|
-
}
|
|
129
|
-
export default function PlaygroundApp() {
|
|
130
|
-
return (_jsxs(SettingsContext, { children: [_jsx(FlashMessageContext, { children: _jsx(App, {}) }), _jsx("a", { href: "https://github.com/facebook/lexical/tree/main/packages/lexical-playground", className: "github-corner", "aria-label": "View source on GitHub", children: _jsxs("svg", { width: "80", height: "80", viewBox: "0 0 250 250", style: {
|
|
131
|
-
border: '0',
|
|
132
|
-
color: '#eee',
|
|
133
|
-
fill: '#222',
|
|
134
|
-
left: '0',
|
|
135
|
-
position: 'absolute',
|
|
136
|
-
top: '0',
|
|
137
|
-
transform: 'scale(-1,1)',
|
|
138
|
-
}, "aria-hidden": "true", children: [_jsx("path", { d: "M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" }), _jsx("path", { d: "M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2", fill: "currentColor", style: {
|
|
139
|
-
transformOrigin: '130px 106px',
|
|
140
|
-
}, className: "octo-arm" }), _jsx("path", { d: "M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z", fill: "currentColor", className: "octo-body" })] }) })] }));
|
|
141
|
-
}
|
package/lib/Editor.d.ts
DELETED
package/lib/Editor.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
4
|
-
* Distributed under the terms of the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
7
|
-
import { AutoFocusPlugin } from '@lexical/react/LexicalAutoFocusPlugin';
|
|
8
|
-
import { CharacterLimitPlugin } from '@lexical/react/LexicalCharacterLimitPlugin';
|
|
9
|
-
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
10
|
-
import { ClearEditorPlugin } from '@lexical/react/LexicalClearEditorPlugin';
|
|
11
|
-
import { ClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin';
|
|
12
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
13
|
-
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
14
|
-
import { HashtagPlugin } from '@lexical/react/LexicalHashtagPlugin';
|
|
15
|
-
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
16
|
-
import { HorizontalRulePlugin } from '@lexical/react/LexicalHorizontalRulePlugin';
|
|
17
|
-
import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
18
|
-
import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
|
|
19
|
-
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
20
|
-
import { SelectionAlwaysOnDisplay } from '@lexical/react/LexicalSelectionAlwaysOnDisplay';
|
|
21
|
-
import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
|
|
22
|
-
import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
23
|
-
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
24
|
-
import { CAN_USE_DOM } from '@lexical/utils';
|
|
25
|
-
import { useSettings } from './context/SettingsContext';
|
|
26
|
-
import { useSharedHistoryContext } from './context/SharedHistoryContext';
|
|
27
|
-
import ActionsPlugin from './plugins/ActionsPlugin';
|
|
28
|
-
import AutocompletePlugin from './plugins/AutocompletePlugin';
|
|
29
|
-
import AutoEmbedPlugin from './plugins/AutoEmbedPlugin';
|
|
30
|
-
import AutoLinkPlugin from './plugins/AutoLinkPlugin';
|
|
31
|
-
import CodeActionMenuPlugin from './plugins/CodeActionMenuPlugin';
|
|
32
|
-
import CodeHighlightPrismPlugin from './plugins/CodeHighlightPrismPlugin';
|
|
33
|
-
import CodeHighlightShikiPlugin from './plugins/CodeHighlightShikiPlugin';
|
|
34
|
-
import CollapsiblePlugin from './plugins/CollapsiblePlugin';
|
|
35
|
-
import CommentPlugin from './plugins/CommentPlugin';
|
|
36
|
-
import ComponentPickerPlugin from './plugins/ComponentPickerPlugin';
|
|
37
|
-
import ContextMenuPlugin from './plugins/ContextMenuPlugin';
|
|
38
|
-
import CounterPlugin from './plugins/CounterPlugin';
|
|
39
|
-
import DateTimePlugin from './plugins/DateTimePlugin';
|
|
40
|
-
import DragDropPaste from './plugins/DragDropPastePlugin';
|
|
41
|
-
import DraggableBlockPlugin from './plugins/DraggableBlockPlugin';
|
|
42
|
-
import EmojiPickerPlugin from './plugins/EmojiPickerPlugin';
|
|
43
|
-
import EmojisPlugin from './plugins/EmojisPlugin';
|
|
44
|
-
import EquationsPlugin from './plugins/EquationsPlugin';
|
|
45
|
-
import ExcalidrawPlugin from './plugins/ExcalidrawPlugin';
|
|
46
|
-
import FigmaPlugin from './plugins/FigmaPlugin';
|
|
47
|
-
import FloatingLinkEditorPlugin from './plugins/FloatingLinkEditorPlugin';
|
|
48
|
-
import FloatingTextFormatToolbarPlugin from './plugins/FloatingTextFormatToolbarPlugin';
|
|
49
|
-
import ImagesPlugin from './plugins/ImagesPlugin';
|
|
50
|
-
import InlineImagePlugin from './plugins/InlineImagePlugin';
|
|
51
|
-
import KeywordsPlugin from './plugins/KeywordsPlugin';
|
|
52
|
-
import { LayoutPlugin } from './plugins/LayoutPlugin/LayoutPlugin';
|
|
53
|
-
import LinkPlugin from './plugins/LinkPlugin';
|
|
54
|
-
import MarkdownShortcutPlugin from './plugins/MarkdownShortcutPlugin';
|
|
55
|
-
import { MaxLengthPlugin } from './plugins/MaxLengthPlugin';
|
|
56
|
-
import MentionsPlugin from './plugins/MentionsPlugin';
|
|
57
|
-
import PageBreakPlugin from './plugins/PageBreakPlugin';
|
|
58
|
-
import PollPlugin from './plugins/PollPlugin';
|
|
59
|
-
import ShortcutsPlugin from './plugins/ShortcutsPlugin';
|
|
60
|
-
import SpecialTextPlugin from './plugins/SpecialTextPlugin';
|
|
61
|
-
import SpeechToTextPlugin from './plugins/SpeechToTextPlugin';
|
|
62
|
-
import TabFocusPlugin from './plugins/TabFocusPlugin';
|
|
63
|
-
import TableCellActionMenuPlugin from './plugins/TableActionMenuPlugin';
|
|
64
|
-
import TableCellResizer from './plugins/TableCellResizer';
|
|
65
|
-
import TableHoverActionsPlugin from './plugins/TableHoverActionsPlugin';
|
|
66
|
-
import TableOfContentsPlugin from './plugins/TableOfContentsPlugin';
|
|
67
|
-
import ToolbarPlugin from './plugins/ToolbarPlugin';
|
|
68
|
-
import TreeViewPlugin from './plugins/TreeViewPlugin';
|
|
69
|
-
import TwitterPlugin from './plugins/TwitterPlugin';
|
|
70
|
-
import YouTubePlugin from './plugins/YouTubePlugin';
|
|
71
|
-
import ContentEditable from './ui/ContentEditable';
|
|
72
|
-
import DebugPlugin from './plugins/DebugPlugin';
|
|
73
|
-
import { LoroCollaborationPlugin as LoroCollaborationPlugin } from './collab/loro/LexicalCollaborationPlugin';
|
|
74
|
-
import { createWebsocketProvider as createLoroWebsocketProvider } from './collab/loro/wsProvider';
|
|
75
|
-
import { CollaborationPlugin as YjsCollaborationPlugin } from './collab/yjs/LexicalCollaborationPlugin';
|
|
76
|
-
import { createWebsocketProvider as createYjsWebsocketProvider } from './collab/yjs/wsProvider';
|
|
77
|
-
const skipCollaborationInit =
|
|
78
|
-
// @ts-expect-error: window.parent may not exist in all environments, but we need to check iframe context
|
|
79
|
-
window.parent != null && window.parent.frames.right === window;
|
|
80
|
-
export default function Editor() {
|
|
81
|
-
const { historyState } = useSharedHistoryContext();
|
|
82
|
-
const { settings: { useYjs, isCodeHighlighted, isCodeShiki, isCollab, isAutocomplete, isMaxLength, isCharLimit, hasLinkAttributes, isCharLimitUtf8, isRichText, showTreeView, showTableOfContents, shouldUseLexicalContextMenu, shouldPreserveNewLinesInMarkdown, tableCellMerge, tableCellBackgroundColor, tableHorizontalScroll, shouldAllowHighlightingWithBrackets, selectionAlwaysOnDisplay, listStrictIndent, }, } = useSettings();
|
|
83
|
-
const isEditable = useLexicalEditable();
|
|
84
|
-
const placeholder = isCollab
|
|
85
|
-
? 'Enter some collaborative rich text...'
|
|
86
|
-
: isRichText
|
|
87
|
-
? 'Enter some rich text...'
|
|
88
|
-
: 'Enter some plain text...';
|
|
89
|
-
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
90
|
-
const [isSmallWidthViewport, setIsSmallWidthViewport] = useState(false);
|
|
91
|
-
const [editor] = useLexicalComposerContext();
|
|
92
|
-
const [activeEditor, setActiveEditor] = useState(editor);
|
|
93
|
-
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
94
|
-
const onRef = (_floatingAnchorElem) => {
|
|
95
|
-
if (_floatingAnchorElem !== null) {
|
|
96
|
-
setFloatingAnchorElem(_floatingAnchorElem);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
const updateViewPortWidth = () => {
|
|
101
|
-
const isNextSmallWidthViewport = CAN_USE_DOM && window.matchMedia('(max-width: 1025px)').matches;
|
|
102
|
-
if (isNextSmallWidthViewport !== isSmallWidthViewport) {
|
|
103
|
-
setIsSmallWidthViewport(isNextSmallWidthViewport);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
updateViewPortWidth();
|
|
107
|
-
window.addEventListener('resize', updateViewPortWidth);
|
|
108
|
-
return () => {
|
|
109
|
-
window.removeEventListener('resize', updateViewPortWidth);
|
|
110
|
-
};
|
|
111
|
-
}, [isSmallWidthViewport]);
|
|
112
|
-
return (_jsxs(_Fragment, { children: [isRichText && (_jsx(ToolbarPlugin, { editor: editor, activeEditor: activeEditor, setActiveEditor: setActiveEditor, setIsLinkEditMode: setIsLinkEditMode })), isRichText && (_jsx(ShortcutsPlugin, { editor: activeEditor, setIsLinkEditMode: setIsLinkEditMode })), _jsxs("div", { className: `editor-container ${showTreeView ? 'tree-view' : ''} ${!isRichText ? 'plain-text' : ''}`, children: [isMaxLength && _jsx(MaxLengthPlugin, { maxLength: 30 }), _jsx(DragDropPaste, {}), _jsx(DebugPlugin, {}), _jsx(AutoFocusPlugin, {}), selectionAlwaysOnDisplay && _jsx(SelectionAlwaysOnDisplay, {}), _jsx(ClearEditorPlugin, {}), _jsx(ComponentPickerPlugin, {}), _jsx(EmojiPickerPlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(MentionsPlugin, {}), _jsx(EmojisPlugin, {}), _jsx(HashtagPlugin, {}), _jsx(KeywordsPlugin, {}), _jsx(SpeechToTextPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(DateTimePlugin, {}), useYjs &&
|
|
113
|
-
_jsx(CommentPlugin, { providerFactory: isCollab ? createYjsWebsocketProvider : undefined }), isRichText ? (_jsxs(_Fragment, { children: [isCollab ? (useYjs ? (_jsx(YjsCollaborationPlugin, { id: "main", providerFactory: createYjsWebsocketProvider, shouldBootstrap: !skipCollaborationInit })) : (_jsx(LoroCollaborationPlugin, { id: "main", showCollaborators: true, providerFactory: createLoroWebsocketProvider, shouldBootstrap: !skipCollaborationInit }))) : (_jsx(HistoryPlugin, { externalHistoryState: historyState })), _jsx(RichTextPlugin, { contentEditable: _jsx("div", { className: "editor-scroller", children: _jsx("div", { className: "editor", ref: onRef, children: _jsx(ContentEditable, { placeholder: placeholder }) }) }), ErrorBoundary: LexicalErrorBoundary }), _jsx(MarkdownShortcutPlugin, {}), isCodeHighlighted &&
|
|
114
|
-
(isCodeShiki ? (_jsx(CodeHighlightShikiPlugin, {})) : (_jsx(CodeHighlightPrismPlugin, {}))), _jsx(ListPlugin, { hasStrictIndent: listStrictIndent }), _jsx(CheckListPlugin, {}), _jsx(TablePlugin, { hasCellMerge: tableCellMerge, hasCellBackgroundColor: tableCellBackgroundColor, hasHorizontalScroll: tableHorizontalScroll }), _jsx(TableCellResizer, {}), _jsx(ImagesPlugin, {}), _jsx(InlineImagePlugin, {}), _jsx(LinkPlugin, { hasLinkAttributes: hasLinkAttributes }), _jsx(PollPlugin, {}), _jsx(TwitterPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(FigmaPlugin, {}), _jsx(ClickableLinkPlugin, { disabled: isEditable }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(ExcalidrawPlugin, {}), _jsx(TabFocusPlugin, {}), _jsx(TabIndentationPlugin, { maxIndent: 7 }), _jsx(CollapsiblePlugin, {}), _jsx(CounterPlugin, {}), _jsx(PageBreakPlugin, {}), _jsx(LayoutPlugin, {}), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode }), _jsx(TableCellActionMenuPlugin, { anchorElem: floatingAnchorElem, cellMerge: true })] })), floatingAnchorElem && !isSmallWidthViewport && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem }), _jsx(TableHoverActionsPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem, setIsLinkEditMode: setIsLinkEditMode })] }))] })) : (_jsxs(_Fragment, { children: [_jsx(PlainTextPlugin, { contentEditable: _jsx(ContentEditable, { placeholder: placeholder }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, { externalHistoryState: historyState })] })), (isCharLimit || isCharLimitUtf8) && (_jsx(CharacterLimitPlugin, { charset: isCharLimit ? 'UTF-16' : 'UTF-8', maxLength: 5 })), isAutocomplete && _jsx(AutocompletePlugin, {}), _jsx("div", { children: showTableOfContents && _jsx(TableOfContentsPlugin, {}) }), shouldUseLexicalContextMenu && _jsx(ContextMenuPlugin, {}), shouldAllowHighlightingWithBrackets && _jsx(SpecialTextPlugin, {}), _jsx(ActionsPlugin, { isRichText: isRichText, shouldPreserveNewLinesInMarkdown: shouldPreserveNewLinesInMarkdown })] }), showTreeView && _jsx(TreeViewPlugin, {})] }));
|
|
115
|
-
}
|
package/lib/Settings.d.ts
DELETED
package/lib/Settings.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { CAN_USE_BEFORE_INPUT } from '@lexical/utils';
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { INITIAL_SETTINGS, isDevPlayground } from './appSettings';
|
|
5
|
-
import { useSettings } from './context/SettingsContext';
|
|
6
|
-
import Switch from './ui/Switch';
|
|
7
|
-
export default function Settings() {
|
|
8
|
-
const windowLocation = window.location;
|
|
9
|
-
const { setOption, settings: { measureTypingPerf, isCollab, isRichText, isMaxLength, hasLinkAttributes, isCharLimit, isCharLimitUtf8, isAutocomplete, showTreeView, showNestedEditorTreeView,
|
|
10
|
-
// disableBeforeInput,
|
|
11
|
-
showTableOfContents, shouldUseLexicalContextMenu, shouldPreserveNewLinesInMarkdown, shouldAllowHighlightingWithBrackets,
|
|
12
|
-
// tableHorizontalScroll,
|
|
13
|
-
selectionAlwaysOnDisplay, isCodeHighlighted, isCodeShiki, useYjs, }, } = useSettings();
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (INITIAL_SETTINGS.disableBeforeInput && CAN_USE_BEFORE_INPUT) {
|
|
16
|
-
console.error(`Legacy events are enabled (disableBeforeInput) but CAN_USE_BEFORE_INPUT is true`);
|
|
17
|
-
}
|
|
18
|
-
}, []);
|
|
19
|
-
const [showSettings, setShowSettings] = useState(false);
|
|
20
|
-
const [isSplitScreen, search] = useMemo(() => {
|
|
21
|
-
const parentWindow = window.parent;
|
|
22
|
-
const _search = windowLocation.search;
|
|
23
|
-
const _isSplitScreen = parentWindow && parentWindow.location.pathname === '/split/';
|
|
24
|
-
return [_isSplitScreen, _search];
|
|
25
|
-
}, [windowLocation]);
|
|
26
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { id: "options-button", className: `editor-dev-button ${showSettings ? 'active' : ''}`, onClick: () => setShowSettings(!showSettings) }), showSettings ? (_jsxs("div", { className: "switches", children: [isRichText && isDevPlayground && (_jsx(Switch, { onClick: () => {
|
|
27
|
-
setOption('isCollab', !isCollab);
|
|
28
|
-
window.location.reload();
|
|
29
|
-
}, checked: isCollab, text: "Collaboration" })), isRichText && isDevPlayground && isCollab && (_jsx(Switch, { onClick: () => {
|
|
30
|
-
setOption('useYjs', !useYjs);
|
|
31
|
-
window.location.reload();
|
|
32
|
-
}, checked: useYjs, text: "Use Y.js (vs Loro)" })), isDevPlayground && (_jsx(Switch, { onClick: () => {
|
|
33
|
-
if (isSplitScreen) {
|
|
34
|
-
window.parent.location.href = `/${search}`;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
window.location.href = `/split/${search}`;
|
|
38
|
-
}
|
|
39
|
-
}, checked: isSplitScreen, text: "Split Screen" })), _jsx(Switch, { onClick: () => setOption('measureTypingPerf', !measureTypingPerf), checked: measureTypingPerf, text: "Measure Perf" }), _jsx(Switch, { onClick: () => setOption('showTreeView', !showTreeView), checked: showTreeView, text: "Debug View" }), _jsx(Switch, { onClick: () => setOption('showNestedEditorTreeView', !showNestedEditorTreeView), checked: showNestedEditorTreeView, text: "Nested Editors Debug View" }), _jsx(Switch, { onClick: () => {
|
|
40
|
-
setOption('isRichText', !isRichText);
|
|
41
|
-
setOption('isCollab', false);
|
|
42
|
-
}, checked: isRichText, text: "Rich Text" }), _jsx(Switch, { onClick: () => setOption('isCharLimit', !isCharLimit), checked: isCharLimit, text: "Char Limit" }), _jsx(Switch, { onClick: () => setOption('isCharLimitUtf8', !isCharLimitUtf8), checked: isCharLimitUtf8, text: "Char Limit (UTF-8)" }), _jsx(Switch, { onClick: () => setOption('hasLinkAttributes', !hasLinkAttributes), checked: hasLinkAttributes, text: "Link Attributes" }), _jsx(Switch, { onClick: () => setOption('isMaxLength', !isMaxLength), checked: isMaxLength, text: "Max Length" }), _jsx(Switch, { onClick: () => setOption('isAutocomplete', !isAutocomplete), checked: isAutocomplete, text: "Autocomplete" }), _jsx(Switch, { onClick: () => {
|
|
43
|
-
setOption('showTableOfContents', !showTableOfContents);
|
|
44
|
-
}, checked: showTableOfContents, text: "Table Of Contents" }), _jsx(Switch, { onClick: () => {
|
|
45
|
-
setOption('shouldUseLexicalContextMenu', !shouldUseLexicalContextMenu);
|
|
46
|
-
}, checked: shouldUseLexicalContextMenu, text: "Use Lexical Context Menu" }), _jsx(Switch, { onClick: () => {
|
|
47
|
-
setOption('shouldPreserveNewLinesInMarkdown', !shouldPreserveNewLinesInMarkdown);
|
|
48
|
-
}, checked: shouldPreserveNewLinesInMarkdown, text: "Preserve newlines in Markdown" }), _jsx(Switch, { onClick: () => {
|
|
49
|
-
setOption('shouldAllowHighlightingWithBrackets', !shouldAllowHighlightingWithBrackets);
|
|
50
|
-
}, checked: shouldAllowHighlightingWithBrackets, text: "Use Brackets for Highlighting" }), _jsx(Switch, { onClick: () => {
|
|
51
|
-
setOption('selectionAlwaysOnDisplay', !selectionAlwaysOnDisplay);
|
|
52
|
-
}, checked: selectionAlwaysOnDisplay, text: "Retain selection" }), _jsx(Switch, { onClick: () => {
|
|
53
|
-
setOption('isCodeHighlighted', !isCodeHighlighted);
|
|
54
|
-
}, checked: isCodeHighlighted, text: "Enable Code Highlighting" }), _jsx(Switch, { onClick: () => {
|
|
55
|
-
setOption('isCodeShiki', !isCodeShiki);
|
|
56
|
-
}, checked: isCodeShiki, text: "Use Shiki for Code Highlighting" })] })) : null] }));
|
|
57
|
-
}
|
package/lib/appSettings.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export declare const isDevPlayground: boolean;
|
|
2
|
-
export declare const DEFAULT_SETTINGS: {
|
|
3
|
-
readonly useYjs: false;
|
|
4
|
-
readonly disableBeforeInput: false;
|
|
5
|
-
readonly emptyEditor: boolean;
|
|
6
|
-
readonly hasLinkAttributes: false;
|
|
7
|
-
readonly isAutocomplete: false;
|
|
8
|
-
readonly isCharLimit: false;
|
|
9
|
-
readonly isCharLimitUtf8: false;
|
|
10
|
-
readonly isCodeHighlighted: true;
|
|
11
|
-
readonly isCodeShiki: false;
|
|
12
|
-
readonly isCollab: true;
|
|
13
|
-
readonly isMaxLength: false;
|
|
14
|
-
readonly isRichText: true;
|
|
15
|
-
readonly listStrictIndent: false;
|
|
16
|
-
readonly measureTypingPerf: false;
|
|
17
|
-
readonly selectionAlwaysOnDisplay: false;
|
|
18
|
-
readonly shouldAllowHighlightingWithBrackets: false;
|
|
19
|
-
readonly shouldPreserveNewLinesInMarkdown: false;
|
|
20
|
-
readonly shouldUseLexicalContextMenu: false;
|
|
21
|
-
readonly showNestedEditorTreeView: false;
|
|
22
|
-
readonly showTableOfContents: false;
|
|
23
|
-
readonly showTreeView: true;
|
|
24
|
-
readonly tableCellBackgroundColor: true;
|
|
25
|
-
readonly tableCellMerge: true;
|
|
26
|
-
readonly tableHorizontalScroll: true;
|
|
27
|
-
readonly debug: false;
|
|
28
|
-
};
|
|
29
|
-
export declare const INITIAL_SETTINGS: Record<SettingName, boolean>;
|
|
30
|
-
export type SettingName = keyof typeof DEFAULT_SETTINGS;
|
|
31
|
-
export type Settings = typeof INITIAL_SETTINGS;
|
|
32
|
-
/**
|
|
33
|
-
* Check if debug mode is enabled via URL parameter
|
|
34
|
-
* @returns true if ?debug=true is in the URL, false otherwise
|
|
35
|
-
*/
|
|
36
|
-
export declare function isDebugEnabled(): boolean;
|
package/lib/appSettings.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
const hostName = window.location.hostname;
|
|
6
|
-
export const isDevPlayground = hostName !== 'playground.lexical.dev' &&
|
|
7
|
-
hostName !== 'lexical-playground.vercel.app';
|
|
8
|
-
export const DEFAULT_SETTINGS = {
|
|
9
|
-
useYjs: false,
|
|
10
|
-
disableBeforeInput: false,
|
|
11
|
-
emptyEditor: isDevPlayground,
|
|
12
|
-
hasLinkAttributes: false,
|
|
13
|
-
isAutocomplete: false,
|
|
14
|
-
isCharLimit: false,
|
|
15
|
-
isCharLimitUtf8: false,
|
|
16
|
-
isCodeHighlighted: true,
|
|
17
|
-
isCodeShiki: false,
|
|
18
|
-
isCollab: true, // Enable collaboration by default for testing
|
|
19
|
-
isMaxLength: false,
|
|
20
|
-
isRichText: true,
|
|
21
|
-
listStrictIndent: false,
|
|
22
|
-
measureTypingPerf: false,
|
|
23
|
-
selectionAlwaysOnDisplay: false,
|
|
24
|
-
shouldAllowHighlightingWithBrackets: false,
|
|
25
|
-
shouldPreserveNewLinesInMarkdown: false,
|
|
26
|
-
shouldUseLexicalContextMenu: false,
|
|
27
|
-
showNestedEditorTreeView: false,
|
|
28
|
-
showTableOfContents: false,
|
|
29
|
-
showTreeView: true,
|
|
30
|
-
tableCellBackgroundColor: true,
|
|
31
|
-
tableCellMerge: true,
|
|
32
|
-
tableHorizontalScroll: true,
|
|
33
|
-
debug: false, // Enable Loro debugging utilities
|
|
34
|
-
};
|
|
35
|
-
// These are mutated in setupEnv
|
|
36
|
-
export const INITIAL_SETTINGS = {
|
|
37
|
-
...DEFAULT_SETTINGS,
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Check if debug mode is enabled via URL parameter
|
|
41
|
-
* @returns true if ?debug=true is in the URL, false otherwise
|
|
42
|
-
*/
|
|
43
|
-
export function isDebugEnabled() {
|
|
44
|
-
if (typeof window === 'undefined')
|
|
45
|
-
return false;
|
|
46
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
47
|
-
return urlParams.get('debug') === 'true';
|
|
48
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { LexicalEditor } from 'lexical';
|
|
2
|
-
import { Klass, LexicalNode } from 'lexical';
|
|
3
|
-
import type { LoroDoc, LoroTree } from 'loro-crdt';
|
|
4
|
-
import type { CollabCursor } from './sync/SyncCursors';
|
|
5
|
-
import { NodeMapper } from './nodes/NodesMapper';
|
|
6
|
-
import { Provider } from './State';
|
|
7
|
-
export type ClientID = number;
|
|
8
|
-
export type Binding = {
|
|
9
|
-
tree: LoroTree;
|
|
10
|
-
clientID: ClientID;
|
|
11
|
-
cursors: Map<ClientID, CollabCursor>;
|
|
12
|
-
cursorsContainer: null | HTMLElement;
|
|
13
|
-
doc: LoroDoc;
|
|
14
|
-
docMap: Map<string, LoroDoc>;
|
|
15
|
-
editor: LexicalEditor;
|
|
16
|
-
id: string;
|
|
17
|
-
nodeProperties: Map<string, Array<string>>;
|
|
18
|
-
excludedProperties: ExcludedProperties;
|
|
19
|
-
nodeMapper: NodeMapper;
|
|
20
|
-
commitTimeout?: NodeJS.Timeout | null;
|
|
21
|
-
pendingCommit?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type ExcludedProperties = Map<Klass<LexicalNode>, Set<string>>;
|
|
24
|
-
export declare function createBinding(editor: LexicalEditor, provider: Provider, id: string, doc: LoroDoc | null | undefined, docMap: Map<string, LoroDoc>, excludedProperties?: ExcludedProperties): Binding;
|
|
25
|
-
/**
|
|
26
|
-
* Schedules an asynchronous commit for the binding to reduce latency with large documents.
|
|
27
|
-
* Uses debouncing to prevent excessive commits during rapid mutations.
|
|
28
|
-
*
|
|
29
|
-
* @param binding - The binding to commit
|
|
30
|
-
* @param delay - Debounce delay in milliseconds (default: 100ms)
|
|
31
|
-
*/
|
|
32
|
-
export declare function scheduleAsyncCommit(binding: Binding, delay?: number): void;
|
|
33
|
-
/**
|
|
34
|
-
* Forces an immediate commit if there are pending changes.
|
|
35
|
-
* Useful for ensuring changes are committed before important operations.
|
|
36
|
-
*
|
|
37
|
-
* @param binding - The binding to commit
|
|
38
|
-
*/
|
|
39
|
-
export declare function flushPendingCommit(binding: Binding): void;
|
|
40
|
-
export { LoroCollaborators, type LoroCollaboratorsProps, LoroCollaborationUI, type LoroCollaborationUIProps } from './components';
|
|
41
|
-
export { setupLoroDebugging, addDebugPanel, logTreeStructure, verifyTreeStructure } from './Debug';
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
-
* Distributed under the terms of the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import invariant from '../utils/invariant';
|
|
6
|
-
import { getLoroTree, generateClientID } from './utils/Utils';
|
|
7
|
-
import { initializeNodeMapper } from './nodes/NodesMapper';
|
|
8
|
-
import { setupLoroDebugging } from './Debug';
|
|
9
|
-
import { isDebugEnabled } from '../../appSettings';
|
|
10
|
-
export function createBinding(editor, provider, id, doc, docMap, excludedProperties) {
|
|
11
|
-
invariant(doc !== undefined && doc !== null, 'createBinding: doc is null or undefined');
|
|
12
|
-
// Initialize the tree - content will come from server snapshot via sync
|
|
13
|
-
const tree = getLoroTree(doc);
|
|
14
|
-
console.log('📄 Loro tree initialized, content will be populated via server sync');
|
|
15
|
-
const clientID = generateClientID(doc);
|
|
16
|
-
console.log('🏗️ BINDING DEBUG - Creating binding:', {
|
|
17
|
-
bindingId: id,
|
|
18
|
-
localPeerId: doc.peerId,
|
|
19
|
-
generatedClientID: clientID,
|
|
20
|
-
docPeerIdType: typeof doc.peerId,
|
|
21
|
-
awarenessKey: clientID.toString()
|
|
22
|
-
});
|
|
23
|
-
const binding = {
|
|
24
|
-
clientID: clientID,
|
|
25
|
-
cursors: new Map(),
|
|
26
|
-
cursorsContainer: null,
|
|
27
|
-
doc,
|
|
28
|
-
docMap,
|
|
29
|
-
editor,
|
|
30
|
-
tree,
|
|
31
|
-
excludedProperties: excludedProperties || new Map(),
|
|
32
|
-
id,
|
|
33
|
-
nodeProperties: new Map(),
|
|
34
|
-
nodeMapper: null, // Will be initialized below
|
|
35
|
-
// Initialize async commit properties
|
|
36
|
-
commitTimeout: null,
|
|
37
|
-
pendingCommit: false,
|
|
38
|
-
};
|
|
39
|
-
// Initialize the NodeMapper with the binding
|
|
40
|
-
binding.nodeMapper = initializeNodeMapper(binding);
|
|
41
|
-
// Setup debugging utilities only if debug is enabled via URL parameter
|
|
42
|
-
if (isDebugEnabled()) {
|
|
43
|
-
setupLoroDebugging(binding);
|
|
44
|
-
console.log('🐛 Loro debugging enabled via ?debug=true URL parameter');
|
|
45
|
-
}
|
|
46
|
-
return binding;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Schedules an asynchronous commit for the binding to reduce latency with large documents.
|
|
50
|
-
* Uses debouncing to prevent excessive commits during rapid mutations.
|
|
51
|
-
*
|
|
52
|
-
* @param binding - The binding to commit
|
|
53
|
-
* @param delay - Debounce delay in milliseconds (default: 100ms)
|
|
54
|
-
*/
|
|
55
|
-
export function scheduleAsyncCommit(binding, delay = 500) {
|
|
56
|
-
// Clear any existing timeout
|
|
57
|
-
if (binding.commitTimeout) {
|
|
58
|
-
clearTimeout(binding.commitTimeout);
|
|
59
|
-
}
|
|
60
|
-
// Mark that we have pending changes
|
|
61
|
-
binding.pendingCommit = true;
|
|
62
|
-
// Schedule the commit after the specified delay
|
|
63
|
-
binding.commitTimeout = setTimeout(() => {
|
|
64
|
-
if (binding.pendingCommit) {
|
|
65
|
-
try {
|
|
66
|
-
// Perform the actual commit
|
|
67
|
-
binding.doc.commit({ origin: binding.doc.peerIdStr });
|
|
68
|
-
console.log('🔄 Async commit completed for binding:', binding.id);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
console.error('❌ Async commit failed for binding:', binding.id, error);
|
|
72
|
-
}
|
|
73
|
-
// Reset pending state
|
|
74
|
-
binding.pendingCommit = false;
|
|
75
|
-
}
|
|
76
|
-
binding.commitTimeout = null;
|
|
77
|
-
}, delay);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Forces an immediate commit if there are pending changes.
|
|
81
|
-
* Useful for ensuring changes are committed before important operations.
|
|
82
|
-
*
|
|
83
|
-
* @param binding - The binding to commit
|
|
84
|
-
*/
|
|
85
|
-
export function flushPendingCommit(binding) {
|
|
86
|
-
if (binding.commitTimeout) {
|
|
87
|
-
clearTimeout(binding.commitTimeout);
|
|
88
|
-
binding.commitTimeout = null;
|
|
89
|
-
}
|
|
90
|
-
if (binding.pendingCommit) {
|
|
91
|
-
binding.doc.commit({ origin: binding.doc.peerIdStr });
|
|
92
|
-
binding.pendingCommit = false;
|
|
93
|
-
console.log('🔄 Forced commit completed for binding:', binding.id);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Export components
|
|
97
|
-
export { LoroCollaborators, LoroCollaborationUI } from './components';
|
|
98
|
-
// Export debug utilities for development use
|
|
99
|
-
export { setupLoroDebugging, addDebugPanel, logTreeStructure, verifyTreeStructure } from './Debug';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Binding } from './Bindings';
|
|
2
|
-
/**
|
|
3
|
-
* Debugging utilities for Loro collaboration
|
|
4
|
-
* This module provides comprehensive debugging tools for inspecting tree structure,
|
|
5
|
-
* node mappings, and collaboration state in the Loro-Lexical integration.
|
|
6
|
-
*/
|
|
7
|
-
export interface LoroDebugger {
|
|
8
|
-
binding: Binding | null;
|
|
9
|
-
logStructure: () => void;
|
|
10
|
-
verifyStructure: () => void;
|
|
11
|
-
inspectNode: (treeId: string) => void;
|
|
12
|
-
generateTreeHTML: (nodes: any[], rootNode?: any, prefix?: string, isLast?: boolean, depth?: number) => string;
|
|
13
|
-
addDebugToPage: () => void;
|
|
14
|
-
cleanupEphemeralStore: (provider?: any) => void;
|
|
15
|
-
resetGlobalEphemeralStore: () => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Sets up global debugging utilities for Loro collaboration.
|
|
19
|
-
* Attaches comprehensive debugging tools to window.debugLoro for development use.
|
|
20
|
-
*/
|
|
21
|
-
export declare function setupLoroDebugging(binding: Binding): void;
|
|
22
|
-
/**
|
|
23
|
-
* Quick access function to add debug panel to page
|
|
24
|
-
*/
|
|
25
|
-
export declare function addDebugPanel(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Quick access function to log tree structure
|
|
28
|
-
*/
|
|
29
|
-
export declare function logTreeStructure(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Quick access function to verify tree structure
|
|
32
|
-
*/
|
|
33
|
-
export declare function verifyTreeStructure(): void;
|