@datalayer/lexical-loro 0.1.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +7 -7
- 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 -111
- 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 -44
- package/lib/collab/loro/Bindings.d.ts +0 -41
- package/lib/collab/loro/Bindings.js +0 -95
- package/lib/collab/loro/Debug.d.ts +0 -33
- package/lib/collab/loro/Debug.js +0 -448
- package/lib/collab/loro/LexicalCollaborationContext.d.ts +0 -19
- package/lib/collab/loro/LexicalCollaborationContext.js +0 -48
- 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 -90
- 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 -97
- package/lib/collab/loro/components/index.d.ts +0 -2
- package/lib/collab/loro/components/index.js +0 -2
- package/lib/collab/loro/index.d.ts +0 -6
- package/lib/collab/loro/index.js +0 -6
- package/lib/collab/loro/integrators/BaseIntegrator.d.ts +0 -14
- package/lib/collab/loro/integrators/BaseIntegrator.js +0 -1
- package/lib/collab/loro/integrators/CounterIntegrator.d.ts +0 -23
- package/lib/collab/loro/integrators/CounterIntegrator.js +0 -40
- package/lib/collab/loro/integrators/ListIntegrator.d.ts +0 -23
- package/lib/collab/loro/integrators/ListIntegrator.js +0 -49
- package/lib/collab/loro/integrators/MapIntegrator.d.ts +0 -24
- package/lib/collab/loro/integrators/MapIntegrator.js +0 -177
- package/lib/collab/loro/integrators/TextIntegrator.d.ts +0 -25
- package/lib/collab/loro/integrators/TextIntegrator.js +0 -51
- package/lib/collab/loro/integrators/TreeIntegrator.d.ts +0 -25
- package/lib/collab/loro/integrators/TreeIntegrator.js +0 -201
- package/lib/collab/loro/nodes/NodeFactory.d.ts +0 -8
- package/lib/collab/loro/nodes/NodeFactory.js +0 -105
- package/lib/collab/loro/nodes/NodesMapper.d.ts +0 -111
- package/lib/collab/loro/nodes/NodesMapper.js +0 -258
- package/lib/collab/loro/propagators/DecoratorNodePropagator.d.ts +0 -60
- package/lib/collab/loro/propagators/DecoratorNodePropagator.js +0 -302
- package/lib/collab/loro/propagators/ElementNodePropagator.d.ts +0 -62
- package/lib/collab/loro/propagators/ElementNodePropagator.js +0 -335
- package/lib/collab/loro/propagators/LineBreakNodePropagator.d.ts +0 -57
- package/lib/collab/loro/propagators/LineBreakNodePropagator.js +0 -196
- package/lib/collab/loro/propagators/RootNodePropagator.d.ts +0 -55
- package/lib/collab/loro/propagators/RootNodePropagator.js +0 -168
- package/lib/collab/loro/propagators/TextNodePropagator.d.ts +0 -60
- package/lib/collab/loro/propagators/TextNodePropagator.js +0 -434
- package/lib/collab/loro/propagators/index.d.ts +0 -49
- package/lib/collab/loro/propagators/index.js +0 -32
- package/lib/collab/loro/provider/websocket.d.ts +0 -116
- package/lib/collab/loro/provider/websocket.js +0 -907
- package/lib/collab/loro/servers/index.d.ts +0 -0
- package/lib/collab/loro/servers/index.js +0 -0
- package/lib/collab/loro/servers/ws/callback.d.ts +0 -5
- package/lib/collab/loro/servers/ws/callback.js +0 -85
- package/lib/collab/loro/servers/ws/server.d.ts +0 -2
- package/lib/collab/loro/servers/ws/server.js +0 -25
- package/lib/collab/loro/servers/ws/utils.d.ts +0 -40
- package/lib/collab/loro/servers/ws/utils.js +0 -513
- package/lib/collab/loro/sync/SyncCursors.d.ts +0 -32
- package/lib/collab/loro/sync/SyncCursors.js +0 -435
- package/lib/collab/loro/sync/SyncLexicalToLoro.d.ts +0 -4
- package/lib/collab/loro/sync/SyncLexicalToLoro.js +0 -80
- package/lib/collab/loro/sync/SyncLoroToLexical.d.ts +0 -5
- package/lib/collab/loro/sync/SyncLoroToLexical.js +0 -96
- package/lib/collab/loro/types/LexicalNodeData.d.ts +0 -32
- package/lib/collab/loro/types/LexicalNodeData.js +0 -71
- package/lib/collab/loro/useCollaboration.d.ts +0 -12
- package/lib/collab/loro/useCollaboration.js +0 -248
- package/lib/collab/loro/utils/InitialContent.d.ts +0 -64
- package/lib/collab/loro/utils/InitialContent.js +0 -109
- package/lib/collab/loro/utils/LexicalToLoro.d.ts +0 -18
- package/lib/collab/loro/utils/LexicalToLoro.js +0 -96
- package/lib/collab/loro/utils/Utils.d.ts +0 -44
- package/lib/collab/loro/utils/Utils.js +0 -153
- package/lib/collab/loro/wsProvider.d.ts +0 -8
- package/lib/collab/loro/wsProvider.js +0 -31
- package/lib/collab/utils/invariant.d.ts +0 -1
- package/lib/collab/utils/invariant.js +0 -11
- package/lib/collab/utils/simpleDiffWithCursor.d.ts +0 -5
- package/lib/collab/utils/simpleDiffWithCursor.js +0 -31
- 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 -324
- 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 -41
- package/lib/hooks/useFlashMessage.d.ts +0 -2
- package/lib/hooks/useFlashMessage.js +0 -4
- 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 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/nodes/AutocompleteNode.d.ts +0 -27
- package/lib/nodes/AutocompleteNode.js +0 -56
- 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 -50
- 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 -33
- package/lib/nodes/LayoutContainerNode.d.ts +0 -24
- package/lib/nodes/LayoutContainerNode.js +0 -91
- package/lib/nodes/LayoutItemNode.d.ts +0 -16
- package/lib/nodes/LayoutItemNode.js +0 -65
- package/lib/nodes/MentionNode.d.ts +0 -20
- package/lib/nodes/MentionNode.js +0 -81
- 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 -71
- 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 -50
- 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 -2473
- package/lib/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +0 -7
- package/lib/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +0 -42
- package/lib/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +0 -17
- package/lib/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +0 -111
- 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 -18
- package/lib/plugins/CodeHighlightPrismPlugin/index.d.ts +0 -2
- package/lib/plugins/CodeHighlightPrismPlugin/index.js +0 -10
- package/lib/plugins/CodeHighlightShikiPlugin/index.d.ts +0 -2
- package/lib/plugins/CodeHighlightShikiPlugin/index.js +0 -10
- package/lib/plugins/CollapsiblePlugin/CollapsibleContainerNode.d.ts +0 -25
- package/lib/plugins/CollapsiblePlugin/CollapsibleContainerNode.js +0 -131
- package/lib/plugins/CollapsiblePlugin/CollapsibleContentNode.d.ts +0 -16
- package/lib/plugins/CollapsiblePlugin/CollapsibleContentNode.js +0 -79
- package/lib/plugins/CollapsiblePlugin/CollapsibleTitleNode.d.ts +0 -16
- package/lib/plugins/CollapsiblePlugin/CollapsibleTitleNode.js +0 -81
- package/lib/plugins/CollapsiblePlugin/CollapsibleUtils.d.ts +0 -2
- package/lib/plugins/CollapsiblePlugin/CollapsibleUtils.js +0 -8
- package/lib/plugins/CollapsiblePlugin/index.d.ts +0 -3
- package/lib/plugins/CollapsiblePlugin/index.js +0 -128
- 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 -20
- package/lib/plugins/DatalayerPlugin/index.d.ts +0 -2
- package/lib/plugins/DatalayerPlugin/index.js +0 -218
- package/lib/plugins/DateTimePlugin/index.d.ts +0 -8
- package/lib/plugins/DateTimePlugin/index.js +0 -24
- 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 -33
- 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 -80
- package/lib/plugins/EmojisPlugin/index.d.ts +0 -2
- package/lib/plugins/EmojisPlugin/index.js +0 -52
- 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 -20
- 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 -31
- 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 -131
- 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 -234
- package/lib/plugins/MaxLengthPlugin/index.d.ts +0 -3
- package/lib/plugins/MaxLengthPlugin/index.js +0 -37
- 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 -27
- 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 -112
- package/lib/plugins/ShortcutsPlugin/shortcuts.d.ts +0 -59
- package/lib/plugins/ShortcutsPlugin/shortcuts.js +0 -169
- package/lib/plugins/SpecialTextPlugin/index.d.ts +0 -2
- package/lib/plugins/SpecialTextPlugin/index.js +0 -46
- package/lib/plugins/SpeechToTextPlugin/index.d.ts +0 -5
- package/lib/plugins/SpeechToTextPlugin/index.js +0 -82
- package/lib/plugins/StickyPlugin/index.d.ts +0 -2
- package/lib/plugins/StickyPlugin/index.js +0 -12
- package/lib/plugins/TabFocusPlugin/index.d.ts +0 -1
- package/lib/plugins/TabFocusPlugin/index.js +0 -34
- 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 -80
- 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 -243
- 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 -20
- package/lib/plugins/TypingPerfPlugin/index.d.ts +0 -2
- package/lib/plugins/TypingPerfPlugin/index.js +0 -93
- package/lib/plugins/YouTubePlugin/index.d.ts +0 -4
- package/lib/plugins/YouTubePlugin/index.js +0 -20
- package/lib/server/validation.d.ts +0 -1
- package/lib/server/validation.js +0 -111
- package/lib/setupEnv.d.ts +0 -2
- package/lib/setupEnv.js +0 -25
- package/lib/themes/CommentEditorTheme.d.ts +0 -4
- package/lib/themes/CommentEditorTheme.js +0 -7
- package/lib/themes/PlaygroundEditorTheme.d.ts +0 -4
- package/lib/themes/PlaygroundEditorTheme.js +0 -120
- package/lib/themes/StickyEditorTheme.d.ts +0 -4
- package/lib/themes/StickyEditorTheme.js +0 -7
- package/lib/tyes.dt.d.ts +0 -12
- package/lib/tyes.dt.js +0 -0
- 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 -56
- package/lib/utils/emoji-list.d.ts +0 -20
- package/lib/utils/emoji-list.js +0 -16605
- package/lib/utils/getDOMRangeRect.d.ts +0 -8
- package/lib/utils/getDOMRangeRect.js +0 -22
- package/lib/utils/getSelectedNode.d.ts +0 -2
- package/lib/utils/getSelectedNode.js +0 -24
- package/lib/utils/getThemeSelector.d.ts +0 -2
- package/lib/utils/getThemeSelector.js +0 -10
- package/lib/utils/isMobileWidth.d.ts +0 -7
- package/lib/utils/isMobileWidth.js +0 -7
- package/lib/utils/joinClasses.d.ts +0 -1
- package/lib/utils/joinClasses.js +0 -3
- package/lib/utils/setFloatingElemPosition.d.ts +0 -1
- package/lib/utils/setFloatingElemPosition.js +0 -55
- package/lib/utils/setFloatingElemPositionForLinkEditor.d.ts +0 -1
- package/lib/utils/setFloatingElemPositionForLinkEditor.js +0 -32
- package/lib/utils/swipe.d.ts +0 -4
- package/lib/utils/swipe.js +0 -90
- package/lib/utils/url.d.ts +0 -2
- package/lib/utils/url.js +0 -27
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BaseIntegrator } from './BaseIntegrator';
|
|
2
|
-
import { Binding } from '../Bindings';
|
|
3
|
-
import { Provider } from '../State';
|
|
4
|
-
interface TextDiff {
|
|
5
|
-
type: 'text';
|
|
6
|
-
diff?: Array<{
|
|
7
|
-
type: 'insert' | 'delete' | 'retain';
|
|
8
|
-
index?: number;
|
|
9
|
-
length?: number;
|
|
10
|
-
value?: string;
|
|
11
|
-
attributes?: any;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Handles text changes (character insertions, deletions, formatting)
|
|
16
|
-
*/
|
|
17
|
-
export declare class TextIntegrator implements BaseIntegrator<TextDiff> {
|
|
18
|
-
integrate(diff: TextDiff, binding: Binding, provider: Provider): void;
|
|
19
|
-
integrateInternal(diff: TextDiff, binding: Binding, provider: Provider): void;
|
|
20
|
-
private integrateTextInsert;
|
|
21
|
-
private integrateTextDelete;
|
|
22
|
-
private integrateTextRetain;
|
|
23
|
-
private applyTextFormatting;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handles text changes (character insertions, deletions, formatting)
|
|
3
|
-
*/
|
|
4
|
-
export class TextIntegrator {
|
|
5
|
-
integrate(diff, binding, provider) {
|
|
6
|
-
this.integrateInternal(diff, binding, provider);
|
|
7
|
-
}
|
|
8
|
-
// Internal method for use when already inside editor.update()
|
|
9
|
-
integrateInternal(diff, binding, provider) {
|
|
10
|
-
if (diff.diff) {
|
|
11
|
-
diff.diff.forEach((change) => {
|
|
12
|
-
switch (change.type) {
|
|
13
|
-
case 'insert':
|
|
14
|
-
this.integrateTextInsert(change, binding, provider);
|
|
15
|
-
break;
|
|
16
|
-
case 'delete':
|
|
17
|
-
this.integrateTextDelete(change, binding, provider);
|
|
18
|
-
break;
|
|
19
|
-
case 'retain':
|
|
20
|
-
this.integrateTextRetain(change, binding, provider);
|
|
21
|
-
break;
|
|
22
|
-
default:
|
|
23
|
-
console.warn(`📝 Unknown text change type: ${change.type}`);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
integrateTextInsert(change, binding, provider) {
|
|
29
|
-
// To integrate text insertion, we need to know which TextNode this applies to
|
|
30
|
-
// This information should come from the event context or be tracked separately
|
|
31
|
-
// For now, this is a placeholder - in a complete implementation,
|
|
32
|
-
// we would need to identify the target TextNode and update it
|
|
33
|
-
}
|
|
34
|
-
integrateTextDelete(change, binding, provider) {
|
|
35
|
-
// Similar to insert, we need target node context for text deletion
|
|
36
|
-
}
|
|
37
|
-
integrateTextRetain(change, binding, provider) {
|
|
38
|
-
if (change.attributes) {
|
|
39
|
-
// Handle text formatting changes
|
|
40
|
-
this.applyTextFormatting({ ...change, attributes: change.attributes }, binding, provider);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
applyTextFormatting(change, binding, provider) {
|
|
44
|
-
// Text formatting in Lexical is typically integrated through TextNode format property
|
|
45
|
-
// This would need to be coordinated with the specific TextNode being modified
|
|
46
|
-
// Example formatting attributes might include:
|
|
47
|
-
// - bold, italic, underline
|
|
48
|
-
// - font size, color
|
|
49
|
-
// - etc.
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { TreeID } from 'loro-crdt';
|
|
2
|
-
import { BaseIntegrator } from './BaseIntegrator';
|
|
3
|
-
import { Binding } from '../Bindings';
|
|
4
|
-
import { Provider } from '../State';
|
|
5
|
-
interface TreeDiff {
|
|
6
|
-
type: 'tree';
|
|
7
|
-
diff: Array<{
|
|
8
|
-
action: 'create' | 'move' | 'delete';
|
|
9
|
-
target: TreeID;
|
|
10
|
-
parent?: TreeID;
|
|
11
|
-
index?: number;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Simplified tree diff integrater that trusts Loro's CRDT conflict resolution
|
|
16
|
-
* and applies operations directly without complex filtering or context classification
|
|
17
|
-
*/
|
|
18
|
-
export declare class TreeIntegrator implements BaseIntegrator<TreeDiff> {
|
|
19
|
-
integrate(diff: TreeDiff, binding: Binding, provider: Provider): void;
|
|
20
|
-
integrateInternal(diff: TreeDiff, binding: Binding, provider: Provider): void;
|
|
21
|
-
private integrateCreate;
|
|
22
|
-
private integrateMove;
|
|
23
|
-
private integrateDelete;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { $getRoot, $getNodeByKey, $isElementNode } from 'lexical';
|
|
2
|
-
import { parseTreeID } from '../utils/Utils';
|
|
3
|
-
import { createLexicalNodeFromLoro } from '../nodes/NodeFactory';
|
|
4
|
-
/**
|
|
5
|
-
* Simplified tree diff integrater that trusts Loro's CRDT conflict resolution
|
|
6
|
-
* and applies operations directly without complex filtering or context classification
|
|
7
|
-
*/
|
|
8
|
-
export class TreeIntegrator {
|
|
9
|
-
integrate(diff, binding, provider) {
|
|
10
|
-
// Batch all changes in a single editor update
|
|
11
|
-
binding.editor.update(() => {
|
|
12
|
-
this.integrateInternal(diff, binding, provider);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
// Internal method that can be called when already inside editor.update()
|
|
16
|
-
integrateInternal(diff, binding, provider) {
|
|
17
|
-
// Sort operations: deletes first, then creates (element nodes before text), then moves
|
|
18
|
-
const operations = [...diff.diff];
|
|
19
|
-
operations.sort((a, b) => {
|
|
20
|
-
// Delete operations first
|
|
21
|
-
if (a.action === 'delete' && b.action !== 'delete')
|
|
22
|
-
return -1;
|
|
23
|
-
if (b.action === 'delete' && a.action !== 'delete')
|
|
24
|
-
return 1;
|
|
25
|
-
// Move operations last
|
|
26
|
-
if (a.action === 'move' && b.action !== 'move')
|
|
27
|
-
return 1;
|
|
28
|
-
if (b.action === 'move' && a.action !== 'move')
|
|
29
|
-
return -1;
|
|
30
|
-
// For create operations, prioritize element nodes over text nodes
|
|
31
|
-
if (a.action === 'create' && b.action === 'create') {
|
|
32
|
-
const aNode = binding.tree.getNodeByID(a.target);
|
|
33
|
-
const bNode = binding.tree.getNodeByID(b.target);
|
|
34
|
-
const aIsText = aNode?.data.get('elementType') === 'text';
|
|
35
|
-
const bIsText = bNode?.data.get('elementType') === 'text';
|
|
36
|
-
if (aIsText && !bIsText)
|
|
37
|
-
return 1; // b (element) comes before a (text)
|
|
38
|
-
if (!aIsText && bIsText)
|
|
39
|
-
return -1; // a (element) comes before b (text)
|
|
40
|
-
}
|
|
41
|
-
return 0; // Keep original order for same priority
|
|
42
|
-
});
|
|
43
|
-
operations.forEach(operation => {
|
|
44
|
-
switch (operation.action) {
|
|
45
|
-
case 'create':
|
|
46
|
-
this.integrateCreate(operation, binding, provider);
|
|
47
|
-
break;
|
|
48
|
-
case 'move':
|
|
49
|
-
this.integrateMove(operation, binding, provider);
|
|
50
|
-
break;
|
|
51
|
-
case 'delete':
|
|
52
|
-
this.integrateDelete(operation, binding, provider);
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
console.warn(`🌳 Unknown tree operation: ${operation.action}`);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
integrateCreate(operation, binding, provider) {
|
|
60
|
-
try {
|
|
61
|
-
let { nodeKey } = parseTreeID(operation.target);
|
|
62
|
-
// Skip root node creation - root is integrated during initial setup
|
|
63
|
-
// But ensure the root mapping exists
|
|
64
|
-
// Only treat as root if it's actually a root-type node in Loro
|
|
65
|
-
if (nodeKey === "0") {
|
|
66
|
-
const treeNode = binding.tree.getNodeByID(operation.target);
|
|
67
|
-
const elementType = treeNode?.data.get('elementType');
|
|
68
|
-
if (elementType === 'root' || !elementType) {
|
|
69
|
-
const root = $getRoot();
|
|
70
|
-
binding.nodeMapper.setMapping(root.getKey(), operation.target);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// If nodeKey is "0" but it's not actually a root element, continue with normal processing
|
|
74
|
-
}
|
|
75
|
-
// Check if node already exists and if it's the same TreeID
|
|
76
|
-
const existingNode = $getNodeByKey(nodeKey);
|
|
77
|
-
if (existingNode) {
|
|
78
|
-
const existingTreeID = binding.nodeMapper.getTreeIDByLexicalKey(nodeKey);
|
|
79
|
-
if (existingTreeID === operation.target) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Don't reuse existing keys for different TreeIDs - let Lexical generate a fresh one
|
|
84
|
-
nodeKey = undefined; // Let createLexicalNodeFromLoro generate a fresh key
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
// Create Lexical node from Loro data
|
|
88
|
-
const lexicalNode = createLexicalNodeFromLoro(operation.target, binding.tree, binding);
|
|
89
|
-
if (!lexicalNode) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
// Find parent node
|
|
93
|
-
let parentNode;
|
|
94
|
-
if (operation.parent) {
|
|
95
|
-
const parentKey = binding.nodeMapper.getLexicalKeyByLoroId(operation.parent);
|
|
96
|
-
const parentLexicalNode = parentKey ? $getNodeByKey(parentKey) : null;
|
|
97
|
-
if (parentLexicalNode && $isElementNode(parentLexicalNode)) {
|
|
98
|
-
parentNode = parentLexicalNode;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
// For text nodes, we MUST have a proper parent element
|
|
102
|
-
if (lexicalNode.getType() === 'text') {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
parentNode = $getRoot();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
parentNode = $getRoot();
|
|
110
|
-
}
|
|
111
|
-
// Normal insertion
|
|
112
|
-
if (operation.index !== undefined) {
|
|
113
|
-
parentNode.splice(operation.index, 0, [lexicalNode]);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
parentNode.append(lexicalNode);
|
|
117
|
-
}
|
|
118
|
-
// Set up mapping
|
|
119
|
-
binding.nodeMapper.setMapping(lexicalNode.getKey(), operation.target);
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
console.warn(`🌳 Error creating node for ${operation.target}:`, error);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
integrateMove(operation, binding, provider) {
|
|
126
|
-
try {
|
|
127
|
-
const lexicalKey = binding.nodeMapper.getLexicalKeyByLoroId(operation.target);
|
|
128
|
-
if (!lexicalKey) {
|
|
129
|
-
console.warn(`🌳 No Lexical key found for move target ${operation.target}`);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const nodeToMove = $getNodeByKey(lexicalKey);
|
|
133
|
-
if (!nodeToMove) {
|
|
134
|
-
console.warn(`🌳 Node to move not found: ${lexicalKey}`);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// Find new parent
|
|
138
|
-
let newParent;
|
|
139
|
-
if (operation.parent) {
|
|
140
|
-
const parentKey = binding.nodeMapper.getLexicalKeyByLoroId(operation.parent);
|
|
141
|
-
const parentNode = parentKey ? $getNodeByKey(parentKey) : null;
|
|
142
|
-
if (parentNode && $isElementNode(parentNode)) {
|
|
143
|
-
newParent = parentNode;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// For text nodes, we can't move them to root - skip this move operation
|
|
147
|
-
// The node is already in the correct position from our create fix
|
|
148
|
-
if (nodeToMove.getType() === 'text') {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
newParent = $getRoot();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
// For text nodes without a parent, skip the move
|
|
156
|
-
if (nodeToMove.getType() === 'text') {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
newParent = $getRoot();
|
|
160
|
-
}
|
|
161
|
-
// Remove from current position and insert at new position
|
|
162
|
-
nodeToMove.remove();
|
|
163
|
-
if (operation.index !== undefined) {
|
|
164
|
-
newParent.splice(operation.index, 0, [nodeToMove]);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
newParent.append(nodeToMove);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
console.warn(`🌳 Error moving node ${operation.target}:`, error);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
integrateDelete(operation, binding, provider) {
|
|
175
|
-
try {
|
|
176
|
-
const lexicalKey = binding.nodeMapper.getLexicalKeyByLoroId(operation.target);
|
|
177
|
-
if (!lexicalKey) {
|
|
178
|
-
console.warn(`🌳 No Lexical key found for delete target ${operation.target}`);
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const nodeToDelete = $getNodeByKey(lexicalKey);
|
|
182
|
-
if (!nodeToDelete) {
|
|
183
|
-
console.warn(`🌳 Node to delete not found: ${lexicalKey}`);
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
// Remove from Lexical tree
|
|
187
|
-
nodeToDelete.remove();
|
|
188
|
-
// Clean up mapping
|
|
189
|
-
binding.nodeMapper.deleteMapping(lexicalKey);
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
// Handle the case where Loro is trying to delete an already deleted node
|
|
193
|
-
if (error.message && error.message.includes('is deleted or does not exist')) {
|
|
194
|
-
console.log(`🌳 Node ${operation.target} already deleted (normal during restructuring):`, error.message);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
console.warn(`🌳 Error deleting node ${operation.target}:`, error);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TreeID, LoroTree } from 'loro-crdt';
|
|
2
|
-
import { LexicalNode, NodeKey } from 'lexical';
|
|
3
|
-
import { Binding } from '../Bindings';
|
|
4
|
-
/**
|
|
5
|
-
* Factory function to create Lexical nodes from Loro TreeID
|
|
6
|
-
* Uses the editor's registered node classes, similar to YJS implementation
|
|
7
|
-
*/
|
|
8
|
-
export declare function createLexicalNodeFromLoro(treeId: TreeID, loroTree: LoroTree, binding: Binding, parentKey?: NodeKey, nodeDataFromDiff?: any): LexicalNode | null;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Factory function to create Lexical nodes from Loro TreeID
|
|
3
|
-
* Uses the editor's registered node classes, similar to YJS implementation
|
|
4
|
-
*/
|
|
5
|
-
export function createLexicalNodeFromLoro(treeId, loroTree, binding, parentKey, nodeDataFromDiff) {
|
|
6
|
-
// Get node data from Loro tree
|
|
7
|
-
if (!loroTree.has(treeId)) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const treeNode = loroTree.getNodeByID(treeId);
|
|
11
|
-
// First try nodeData passed from TreeDiff integrater (has immediate lexical data)
|
|
12
|
-
let lexicalData = nodeDataFromDiff?.lexical;
|
|
13
|
-
// Fallback to tree node data
|
|
14
|
-
if (!lexicalData) {
|
|
15
|
-
lexicalData = treeNode?.data.get('lexical');
|
|
16
|
-
}
|
|
17
|
-
let nodeType;
|
|
18
|
-
let deserializedData = null;
|
|
19
|
-
if (lexicalData && typeof lexicalData === 'object') {
|
|
20
|
-
// JSON object format - the only supported format
|
|
21
|
-
nodeType = lexicalData.type || lexicalData.__type;
|
|
22
|
-
deserializedData = { lexicalNode: lexicalData };
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
// Fallback to element type from nodeDataFromDiff or old nodeType
|
|
26
|
-
const fallbackType = nodeDataFromDiff?.elementType || treeNode?.data.get('nodeType');
|
|
27
|
-
if (!fallbackType || typeof fallbackType !== 'string') {
|
|
28
|
-
console.warn('No lexical data or nodeType found for TreeID:', treeId);
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
nodeType = fallbackType;
|
|
32
|
-
}
|
|
33
|
-
// Get the registered node class from the editor (following YJS pattern)
|
|
34
|
-
const registeredNodes = binding.editor._nodes;
|
|
35
|
-
const nodeInfo = registeredNodes.get(nodeType);
|
|
36
|
-
if (!nodeInfo) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
// Create new instance of the registered node class
|
|
40
|
-
let lexicalNode;
|
|
41
|
-
// Special handling for HeadingNode which requires tag parameter in constructor
|
|
42
|
-
if (nodeType === 'heading') {
|
|
43
|
-
const tag = (deserializedData?.lexicalNode?.tag ||
|
|
44
|
-
(lexicalData && typeof lexicalData === 'object' && lexicalData.tag) ||
|
|
45
|
-
'h1');
|
|
46
|
-
try {
|
|
47
|
-
// HeadingNode constructor signature: new HeadingNode(tag, key)
|
|
48
|
-
// We pass tag as first argument, let Lexical generate the key
|
|
49
|
-
lexicalNode = new nodeInfo.klass(tag);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
console.warn(`🏭 NodeFactory: Failed to create HeadingNode:`, error);
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
try {
|
|
58
|
-
lexicalNode = new nodeInfo.klass();
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
console.warn(`🏭 NodeFactory: Failed to create ${nodeType} instance:`, error);
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Note: DO NOT set __parent manually - let Lexical integrate parent-child relationships
|
|
66
|
-
// through proper $ methods like append(), insertBefore(), etc.
|
|
67
|
-
// Apply properties from the deserialized data if available
|
|
68
|
-
if (deserializedData?.lexicalNode) {
|
|
69
|
-
const nodeData = deserializedData.lexicalNode;
|
|
70
|
-
// Apply all properties except system ones and tag (for HeadingNode)
|
|
71
|
-
Object.keys(nodeData).forEach(key => {
|
|
72
|
-
if (key !== '__parent' && key !== '__key') {
|
|
73
|
-
try {
|
|
74
|
-
if (key === 'tag' && nodeType === 'heading') {
|
|
75
|
-
// Tag is already set in HeadingNode constructor, skip
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
lexicalNode[key] = nodeData[key];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
console.warn(`Failed to set property ${key} on node:`, error);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
else if (lexicalData && typeof lexicalData === 'object') {
|
|
88
|
-
// For direct object format (like heading data), apply properties directly
|
|
89
|
-
const applicableKeys = Object.keys(lexicalData).filter(key => key !== '__parent' && key !== '__key' && key !== 'type' && key !== 'children');
|
|
90
|
-
applicableKeys.forEach(key => {
|
|
91
|
-
try {
|
|
92
|
-
if (key === 'tag' && nodeType === 'heading') {
|
|
93
|
-
// Tag is already set in HeadingNode constructor, skip
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
lexicalNode[key] = lexicalData[key];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
console.warn(`Failed to set property ${key} on node:`, error);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return lexicalNode;
|
|
105
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { LoroTree, LoroTreeNode, TreeID } from 'loro-crdt';
|
|
2
|
-
import { LexicalNode, NodeKey, EditorState } from 'lexical';
|
|
3
|
-
import { Binding } from '../Bindings';
|
|
4
|
-
/**
|
|
5
|
-
* Bidirectional mapping between Lexical NodeKeys and Loro TreeIDs
|
|
6
|
-
*/
|
|
7
|
-
export declare class NodeMapper {
|
|
8
|
-
private lexicalToLoro;
|
|
9
|
-
private loroToLexical;
|
|
10
|
-
private tree;
|
|
11
|
-
constructor(binding: Binding);
|
|
12
|
-
/**
|
|
13
|
-
* Create a bidirectional mapping between Lexical NodeKey and Loro TreeID
|
|
14
|
-
*/
|
|
15
|
-
private createMapping;
|
|
16
|
-
/**
|
|
17
|
-
* Remove bidirectional mapping
|
|
18
|
-
*/
|
|
19
|
-
private removeMapping;
|
|
20
|
-
/**
|
|
21
|
-
* Get Loro TreeNode based on Lexical NodeKey
|
|
22
|
-
* If the node doesn't exist, create it with proper parent-child relationship
|
|
23
|
-
*/
|
|
24
|
-
getLoroNodeByLexicalKey(nodeKey: NodeKey, lexicalNode?: LexicalNode, parentTreeID?: TreeID, index?: number): LoroTreeNode;
|
|
25
|
-
/**
|
|
26
|
-
* Get Lexical NodeKey based on Loro TreeID
|
|
27
|
-
* If the node doesn't exist in Lexical, it needs to be created externally
|
|
28
|
-
*/
|
|
29
|
-
getLexicalKeyByLoroId(treeId: TreeID): NodeKey | null;
|
|
30
|
-
/**
|
|
31
|
-
* Get Lexical Node from EditorState based on Loro TreeID
|
|
32
|
-
*/
|
|
33
|
-
getLexicalNodeByLoroId(treeId: TreeID, editorState: EditorState): LexicalNode | null;
|
|
34
|
-
/**
|
|
35
|
-
* Get Lexical parent node key for a Loro TreeID
|
|
36
|
-
* Returns null if no parent or if parent not found in Lexical
|
|
37
|
-
* Note: This method needs the LoroTree API to be clarified for parent relationships
|
|
38
|
-
*/
|
|
39
|
-
getLexicalParentByLoroId(treeId: TreeID, loroTree: LoroTree): NodeKey | null;
|
|
40
|
-
/**
|
|
41
|
-
* Manually set bidirectional mapping between Lexical NodeKey and Loro TreeID
|
|
42
|
-
*/
|
|
43
|
-
setMapping(nodeKey: NodeKey, treeId: TreeID): void;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new Loro TreeNode and establish mapping
|
|
46
|
-
*/
|
|
47
|
-
private createLoroNode;
|
|
48
|
-
/**
|
|
49
|
-
* Update the mapping when a node is moved or modified
|
|
50
|
-
*/
|
|
51
|
-
updateMapping(oldNodeKey: NodeKey, newNodeKey: NodeKey): void;
|
|
52
|
-
/**
|
|
53
|
-
* Remove mapping when a node is deleted
|
|
54
|
-
*/
|
|
55
|
-
deleteMapping(nodeKey: NodeKey): void;
|
|
56
|
-
/**
|
|
57
|
-
* Get TreeID by Lexical NodeKey (without creating if not found)
|
|
58
|
-
*/
|
|
59
|
-
getTreeIDByLexicalKey(nodeKey: NodeKey): TreeID | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Check if a mapping exists for a Lexical NodeKey
|
|
62
|
-
*/
|
|
63
|
-
hasLexicalMapping(nodeKey: NodeKey): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Check if a mapping exists for a Loro TreeID
|
|
66
|
-
*/
|
|
67
|
-
hasLoroMapping(treeId: TreeID): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Get all current mappings (for debugging)
|
|
70
|
-
*/
|
|
71
|
-
getAllMappings(): {
|
|
72
|
-
lexicalToLoro: Map<NodeKey, TreeID>;
|
|
73
|
-
loroToLexical: Map<TreeID, NodeKey>;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Clear all mappings (useful for testing or reset)
|
|
77
|
-
*/
|
|
78
|
-
clearMappings(): void;
|
|
79
|
-
/**
|
|
80
|
-
* Synchronize existing tree nodes with Lexical editor state
|
|
81
|
-
* This should be called during initialization to establish mappings
|
|
82
|
-
*
|
|
83
|
-
* Note: Since lexicalKey is no longer persisted in tree node data,
|
|
84
|
-
* this method now relies on the TreeIntegrator to create mappings
|
|
85
|
-
* as nodes are integrated from Loro tree operations.
|
|
86
|
-
*/
|
|
87
|
-
syncExistingNodes(editorState: EditorState): void;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Initialize the global node mapper
|
|
91
|
-
*/
|
|
92
|
-
export declare function initializeNodeMapper(binding: Binding): NodeMapper;
|
|
93
|
-
/**
|
|
94
|
-
* Get the global node mapper instance
|
|
95
|
-
*/
|
|
96
|
-
export declare function getNodeMapper(): NodeMapper;
|
|
97
|
-
/**
|
|
98
|
-
* Utility functions for common operations
|
|
99
|
-
*/
|
|
100
|
-
/**
|
|
101
|
-
* Get Loro TreeNode by Lexical NodeKey (using global mapper)
|
|
102
|
-
*/
|
|
103
|
-
export declare function getLoroNodeByLexicalKey(nodeKey: NodeKey, lexicalNode?: LexicalNode, parentTreeID?: TreeID, index?: number): LoroTreeNode;
|
|
104
|
-
/**
|
|
105
|
-
* Get Lexical NodeKey by Loro TreeID (using global mapper)
|
|
106
|
-
*/
|
|
107
|
-
export declare function getLexicalKeyByLoroId(treeId: TreeID): NodeKey | null;
|
|
108
|
-
/**
|
|
109
|
-
* Get Lexical Node by Loro TreeID (using global mapper)
|
|
110
|
-
*/
|
|
111
|
-
export declare function getLexicalNodeByLoroId(treeId: TreeID, editorState: EditorState): LexicalNode | null;
|