@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,42 +0,0 @@
|
|
|
1
|
-
import type { AppState, BinaryFiles, ExcalidrawInitialDataState } from '@excalidraw/excalidraw/types';
|
|
2
|
-
import './ExcalidrawModal.css';
|
|
3
|
-
import { ReactPortal } from 'react';
|
|
4
|
-
export type ExcalidrawInitialElements = ExcalidrawInitialDataState['elements'];
|
|
5
|
-
type Props = {
|
|
6
|
-
closeOnClickOutside?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* The initial set of elements to draw into the scene
|
|
9
|
-
*/
|
|
10
|
-
initialElements: ExcalidrawInitialElements;
|
|
11
|
-
/**
|
|
12
|
-
* The initial set of elements to draw into the scene
|
|
13
|
-
*/
|
|
14
|
-
initialAppState: AppState;
|
|
15
|
-
/**
|
|
16
|
-
* The initial set of elements to draw into the scene
|
|
17
|
-
*/
|
|
18
|
-
initialFiles: BinaryFiles;
|
|
19
|
-
/**
|
|
20
|
-
* Controls the visibility of the modal
|
|
21
|
-
*/
|
|
22
|
-
isShown?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Callback when closing and discarding the new changes
|
|
25
|
-
*/
|
|
26
|
-
onClose: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Completely remove Excalidraw component
|
|
29
|
-
*/
|
|
30
|
-
onDelete: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* Callback when the save button is clicked
|
|
33
|
-
*/
|
|
34
|
-
onSave: (elements: ExcalidrawInitialElements, appState: Partial<AppState>, files: BinaryFiles) => void;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @explorer-desc
|
|
38
|
-
* A component which renders a modal with Excalidraw (a painting app)
|
|
39
|
-
* which can be used to export an editable image
|
|
40
|
-
*/
|
|
41
|
-
export default function ExcalidrawModal({ closeOnClickOutside, onSave, initialElements, initialAppState, initialFiles, isShown, onDelete, onClose, }: Props): ReactPortal | null;
|
|
42
|
-
export {};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './ExcalidrawModal.css';
|
|
3
|
-
import { Excalidraw } from '@excalidraw/excalidraw';
|
|
4
|
-
import { isDOMNode } from 'lexical';
|
|
5
|
-
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
-
import { createPortal } from 'react-dom';
|
|
7
|
-
import Button from './Button';
|
|
8
|
-
import Modal from './Modal';
|
|
9
|
-
/**
|
|
10
|
-
* @explorer-desc
|
|
11
|
-
* A component which renders a modal with Excalidraw (a painting app)
|
|
12
|
-
* which can be used to export an editable image
|
|
13
|
-
*/
|
|
14
|
-
export default function ExcalidrawModal({ closeOnClickOutside = false, onSave, initialElements, initialAppState, initialFiles, isShown = false, onDelete, onClose, }) {
|
|
15
|
-
const excaliDrawModelRef = useRef(null);
|
|
16
|
-
const [excalidrawAPI, setExcalidrawAPI] = useState(null);
|
|
17
|
-
const [discardModalOpen, setDiscardModalOpen] = useState(false);
|
|
18
|
-
const [elements, setElements] = useState(initialElements);
|
|
19
|
-
const [files, setFiles] = useState(initialFiles);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
excaliDrawModelRef.current?.focus();
|
|
22
|
-
}, []);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
let modalOverlayElement = null;
|
|
25
|
-
const clickOutsideHandler = (event) => {
|
|
26
|
-
const target = event.target;
|
|
27
|
-
if (excaliDrawModelRef.current !== null &&
|
|
28
|
-
isDOMNode(target) &&
|
|
29
|
-
!excaliDrawModelRef.current.contains(target) &&
|
|
30
|
-
closeOnClickOutside) {
|
|
31
|
-
onDelete();
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
if (excaliDrawModelRef.current !== null) {
|
|
35
|
-
modalOverlayElement = excaliDrawModelRef.current?.parentElement;
|
|
36
|
-
modalOverlayElement?.addEventListener('click', clickOutsideHandler);
|
|
37
|
-
}
|
|
38
|
-
return () => {
|
|
39
|
-
modalOverlayElement?.removeEventListener('click', clickOutsideHandler);
|
|
40
|
-
};
|
|
41
|
-
}, [closeOnClickOutside, onDelete]);
|
|
42
|
-
useLayoutEffect(() => {
|
|
43
|
-
const currentModalRef = excaliDrawModelRef.current;
|
|
44
|
-
const onKeyDown = (event) => {
|
|
45
|
-
if (event.key === 'Escape') {
|
|
46
|
-
onDelete();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
currentModalRef?.addEventListener('keydown', onKeyDown);
|
|
50
|
-
return () => {
|
|
51
|
-
currentModalRef?.removeEventListener('keydown', onKeyDown);
|
|
52
|
-
};
|
|
53
|
-
}, [elements, files, onDelete]);
|
|
54
|
-
const save = () => {
|
|
55
|
-
if (elements?.some((el) => !el.isDeleted)) {
|
|
56
|
-
const appState = excalidrawAPI?.getAppState();
|
|
57
|
-
// We only need a subset of the state
|
|
58
|
-
const partialState = {
|
|
59
|
-
exportBackground: appState?.exportBackground,
|
|
60
|
-
exportScale: appState?.exportScale,
|
|
61
|
-
exportWithDarkMode: appState?.theme === 'dark',
|
|
62
|
-
isBindingEnabled: appState?.isBindingEnabled,
|
|
63
|
-
isLoading: appState?.isLoading,
|
|
64
|
-
name: appState?.name,
|
|
65
|
-
theme: appState?.theme,
|
|
66
|
-
viewBackgroundColor: appState?.viewBackgroundColor,
|
|
67
|
-
viewModeEnabled: appState?.viewModeEnabled,
|
|
68
|
-
zenModeEnabled: appState?.zenModeEnabled,
|
|
69
|
-
zoom: appState?.zoom,
|
|
70
|
-
};
|
|
71
|
-
onSave(elements, partialState, files);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// delete node if the scene is clear
|
|
75
|
-
onDelete();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const discard = () => {
|
|
79
|
-
setDiscardModalOpen(true);
|
|
80
|
-
};
|
|
81
|
-
function ShowDiscardDialog() {
|
|
82
|
-
return (_jsxs(Modal, { title: "Discard", onClose: () => {
|
|
83
|
-
setDiscardModalOpen(false);
|
|
84
|
-
}, closeOnClickOutside: false, children: ["Are you sure you want to discard the changes?", _jsxs("div", { className: "ExcalidrawModal__discardModal", children: [_jsx(Button, { onClick: () => {
|
|
85
|
-
setDiscardModalOpen(false);
|
|
86
|
-
onClose();
|
|
87
|
-
}, children: "Discard" }), ' ', _jsx(Button, { onClick: () => {
|
|
88
|
-
setDiscardModalOpen(false);
|
|
89
|
-
}, children: "Cancel" })] })] }));
|
|
90
|
-
}
|
|
91
|
-
if (isShown === false) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
const onChange = (els, _, fls) => {
|
|
95
|
-
setElements(els);
|
|
96
|
-
setFiles(fls);
|
|
97
|
-
};
|
|
98
|
-
return createPortal(_jsx("div", { className: "ExcalidrawModal__overlay", role: "dialog", children: _jsx("div", { className: "ExcalidrawModal__modal", ref: excaliDrawModelRef, tabIndex: -1, children: _jsxs("div", { className: "ExcalidrawModal__row", children: [discardModalOpen && _jsx(ShowDiscardDialog, {}), _jsx(Excalidraw, { onChange: onChange, excalidrawAPI: setExcalidrawAPI, initialData: {
|
|
99
|
-
appState: initialAppState || { isLoading: false },
|
|
100
|
-
elements: initialElements,
|
|
101
|
-
files: initialFiles,
|
|
102
|
-
} }), _jsxs("div", { className: "ExcalidrawModal__actions", children: [_jsx("button", { className: "action-button", onClick: discard, children: "Discard" }), _jsx("button", { className: "action-button", onClick: save, children: "Save" })] })] }) }) }), document.body);
|
|
103
|
-
}
|
package/lib/ui/FileInput.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import './Input.css';
|
|
3
|
-
type Props = Readonly<{
|
|
4
|
-
'data-test-id'?: string;
|
|
5
|
-
accept?: string;
|
|
6
|
-
label: string;
|
|
7
|
-
onChange: (files: FileList | null) => void;
|
|
8
|
-
}>;
|
|
9
|
-
export default function FileInput({ accept, label, onChange, 'data-test-id': dataTestId, }: Props): JSX.Element;
|
|
10
|
-
export {};
|
package/lib/ui/FileInput.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './Input.css';
|
|
3
|
-
export default function FileInput({ accept, label, onChange, 'data-test-id': dataTestId, }) {
|
|
4
|
-
return (_jsxs("div", { className: "Input__wrapper", children: [_jsx("label", { className: "Input__label", children: label }), _jsx("input", { type: "file", accept: accept, className: "Input__input", onChange: (e) => onChange(e.target.files), "data-test-id": dataTestId })] }));
|
|
5
|
-
}
|
package/lib/ui/FlashMessage.d.ts
DELETED
package/lib/ui/FlashMessage.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import './FlashMessage.css';
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
export default function FlashMessage({ children, }) {
|
|
5
|
-
return createPortal(_jsx("div", { className: "FlashMessage__overlay", role: "dialog", children: _jsx("p", { className: "FlashMessage__alert", role: "alert", children: children }) }), document.body);
|
|
6
|
-
}
|
package/lib/ui/ImageResizer.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { LexicalEditor } from 'lexical';
|
|
2
|
-
import type { JSX } from 'react';
|
|
3
|
-
export default function ImageResizer({ onResizeStart, onResizeEnd, buttonRef, imageRef, maxWidth, editor, showCaption, setShowCaption, captionsEnabled, }: {
|
|
4
|
-
editor: LexicalEditor;
|
|
5
|
-
buttonRef: {
|
|
6
|
-
current: null | HTMLButtonElement;
|
|
7
|
-
};
|
|
8
|
-
imageRef: {
|
|
9
|
-
current: null | HTMLElement;
|
|
10
|
-
};
|
|
11
|
-
maxWidth?: number;
|
|
12
|
-
onResizeEnd: (width: 'inherit' | number, height: 'inherit' | number) => void;
|
|
13
|
-
onResizeStart: () => void;
|
|
14
|
-
setShowCaption: (show: boolean) => void;
|
|
15
|
-
showCaption: boolean;
|
|
16
|
-
captionsEnabled: boolean;
|
|
17
|
-
}): JSX.Element;
|
package/lib/ui/ImageResizer.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { calculateZoomLevel } from '@lexical/utils';
|
|
3
|
-
import { useRef } from 'react';
|
|
4
|
-
function clamp(value, min, max) {
|
|
5
|
-
return Math.min(Math.max(value, min), max);
|
|
6
|
-
}
|
|
7
|
-
const Direction = {
|
|
8
|
-
east: 1 << 0,
|
|
9
|
-
north: 1 << 3,
|
|
10
|
-
south: 1 << 1,
|
|
11
|
-
west: 1 << 2,
|
|
12
|
-
};
|
|
13
|
-
export default function ImageResizer({ onResizeStart, onResizeEnd, buttonRef, imageRef, maxWidth, editor, showCaption, setShowCaption, captionsEnabled, }) {
|
|
14
|
-
const controlWrapperRef = useRef(null);
|
|
15
|
-
const userSelect = useRef({
|
|
16
|
-
priority: '',
|
|
17
|
-
value: 'default',
|
|
18
|
-
});
|
|
19
|
-
const positioningRef = useRef({
|
|
20
|
-
currentHeight: 0,
|
|
21
|
-
currentWidth: 0,
|
|
22
|
-
direction: 0,
|
|
23
|
-
isResizing: false,
|
|
24
|
-
ratio: 0,
|
|
25
|
-
startHeight: 0,
|
|
26
|
-
startWidth: 0,
|
|
27
|
-
startX: 0,
|
|
28
|
-
startY: 0,
|
|
29
|
-
});
|
|
30
|
-
const editorRootElement = editor.getRootElement();
|
|
31
|
-
// Find max width, accounting for editor padding.
|
|
32
|
-
const maxWidthContainer = maxWidth
|
|
33
|
-
? maxWidth
|
|
34
|
-
: editorRootElement !== null
|
|
35
|
-
? editorRootElement.getBoundingClientRect().width - 20
|
|
36
|
-
: 100;
|
|
37
|
-
const maxHeightContainer = editorRootElement !== null
|
|
38
|
-
? editorRootElement.getBoundingClientRect().height - 20
|
|
39
|
-
: 100;
|
|
40
|
-
const minWidth = 100;
|
|
41
|
-
const minHeight = 100;
|
|
42
|
-
const setStartCursor = (direction) => {
|
|
43
|
-
const ew = direction === Direction.east || direction === Direction.west;
|
|
44
|
-
const ns = direction === Direction.north || direction === Direction.south;
|
|
45
|
-
const nwse = (direction & Direction.north && direction & Direction.west) ||
|
|
46
|
-
(direction & Direction.south && direction & Direction.east);
|
|
47
|
-
const cursorDir = ew ? 'ew' : ns ? 'ns' : nwse ? 'nwse' : 'nesw';
|
|
48
|
-
if (editorRootElement !== null) {
|
|
49
|
-
editorRootElement.style.setProperty('cursor', `${cursorDir}-resize`, 'important');
|
|
50
|
-
}
|
|
51
|
-
if (document.body !== null) {
|
|
52
|
-
document.body.style.setProperty('cursor', `${cursorDir}-resize`, 'important');
|
|
53
|
-
userSelect.current.value = document.body.style.getPropertyValue('-webkit-user-select');
|
|
54
|
-
userSelect.current.priority = document.body.style.getPropertyPriority('-webkit-user-select');
|
|
55
|
-
document.body.style.setProperty('-webkit-user-select', `none`, 'important');
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const setEndCursor = () => {
|
|
59
|
-
if (editorRootElement !== null) {
|
|
60
|
-
editorRootElement.style.setProperty('cursor', 'text');
|
|
61
|
-
}
|
|
62
|
-
if (document.body !== null) {
|
|
63
|
-
document.body.style.setProperty('cursor', 'default');
|
|
64
|
-
document.body.style.setProperty('-webkit-user-select', userSelect.current.value, userSelect.current.priority);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
const handlePointerDown = (event, direction) => {
|
|
68
|
-
if (!editor.isEditable()) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const image = imageRef.current;
|
|
72
|
-
const controlWrapper = controlWrapperRef.current;
|
|
73
|
-
if (image !== null && controlWrapper !== null) {
|
|
74
|
-
event.preventDefault();
|
|
75
|
-
const { width, height } = image.getBoundingClientRect();
|
|
76
|
-
const zoom = calculateZoomLevel(image);
|
|
77
|
-
const positioning = positioningRef.current;
|
|
78
|
-
positioning.startWidth = width;
|
|
79
|
-
positioning.startHeight = height;
|
|
80
|
-
positioning.ratio = width / height;
|
|
81
|
-
positioning.currentWidth = width;
|
|
82
|
-
positioning.currentHeight = height;
|
|
83
|
-
positioning.startX = event.clientX / zoom;
|
|
84
|
-
positioning.startY = event.clientY / zoom;
|
|
85
|
-
positioning.isResizing = true;
|
|
86
|
-
positioning.direction = direction;
|
|
87
|
-
setStartCursor(direction);
|
|
88
|
-
onResizeStart();
|
|
89
|
-
controlWrapper.classList.add('image-control-wrapper--resizing');
|
|
90
|
-
image.style.height = `${height}px`;
|
|
91
|
-
image.style.width = `${width}px`;
|
|
92
|
-
document.addEventListener('pointermove', handlePointerMove);
|
|
93
|
-
document.addEventListener('pointerup', handlePointerUp);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const handlePointerMove = (event) => {
|
|
97
|
-
const image = imageRef.current;
|
|
98
|
-
const positioning = positioningRef.current;
|
|
99
|
-
const isHorizontal = positioning.direction & (Direction.east | Direction.west);
|
|
100
|
-
const isVertical = positioning.direction & (Direction.south | Direction.north);
|
|
101
|
-
if (image !== null && positioning.isResizing) {
|
|
102
|
-
const zoom = calculateZoomLevel(image);
|
|
103
|
-
// Corner cursor
|
|
104
|
-
if (isHorizontal && isVertical) {
|
|
105
|
-
let diff = Math.floor(positioning.startX - event.clientX / zoom);
|
|
106
|
-
diff = positioning.direction & Direction.east ? -diff : diff;
|
|
107
|
-
const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);
|
|
108
|
-
const height = width / positioning.ratio;
|
|
109
|
-
image.style.width = `${width}px`;
|
|
110
|
-
image.style.height = `${height}px`;
|
|
111
|
-
positioning.currentHeight = height;
|
|
112
|
-
positioning.currentWidth = width;
|
|
113
|
-
}
|
|
114
|
-
else if (isVertical) {
|
|
115
|
-
let diff = Math.floor(positioning.startY - event.clientY / zoom);
|
|
116
|
-
diff = positioning.direction & Direction.south ? -diff : diff;
|
|
117
|
-
const height = clamp(positioning.startHeight + diff, minHeight, maxHeightContainer);
|
|
118
|
-
image.style.height = `${height}px`;
|
|
119
|
-
positioning.currentHeight = height;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
let diff = Math.floor(positioning.startX - event.clientX / zoom);
|
|
123
|
-
diff = positioning.direction & Direction.east ? -diff : diff;
|
|
124
|
-
const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);
|
|
125
|
-
image.style.width = `${width}px`;
|
|
126
|
-
positioning.currentWidth = width;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const handlePointerUp = () => {
|
|
131
|
-
const image = imageRef.current;
|
|
132
|
-
const positioning = positioningRef.current;
|
|
133
|
-
const controlWrapper = controlWrapperRef.current;
|
|
134
|
-
if (image !== null && controlWrapper !== null && positioning.isResizing) {
|
|
135
|
-
const width = positioning.currentWidth;
|
|
136
|
-
const height = positioning.currentHeight;
|
|
137
|
-
positioning.startWidth = 0;
|
|
138
|
-
positioning.startHeight = 0;
|
|
139
|
-
positioning.ratio = 0;
|
|
140
|
-
positioning.startX = 0;
|
|
141
|
-
positioning.startY = 0;
|
|
142
|
-
positioning.currentWidth = 0;
|
|
143
|
-
positioning.currentHeight = 0;
|
|
144
|
-
positioning.isResizing = false;
|
|
145
|
-
controlWrapper.classList.remove('image-control-wrapper--resizing');
|
|
146
|
-
setEndCursor();
|
|
147
|
-
onResizeEnd(width, height);
|
|
148
|
-
document.removeEventListener('pointermove', handlePointerMove);
|
|
149
|
-
document.removeEventListener('pointerup', handlePointerUp);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
return (_jsxs("div", { ref: controlWrapperRef, children: [!showCaption && captionsEnabled && (_jsx("button", { className: "image-caption-button", ref: buttonRef, onClick: () => {
|
|
153
|
-
setShowCaption(!showCaption);
|
|
154
|
-
}, children: "Add Caption" })), _jsx("div", { className: "image-resizer image-resizer-n", onPointerDown: (event) => {
|
|
155
|
-
handlePointerDown(event, Direction.north);
|
|
156
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-ne", onPointerDown: (event) => {
|
|
157
|
-
handlePointerDown(event, Direction.north | Direction.east);
|
|
158
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-e", onPointerDown: (event) => {
|
|
159
|
-
handlePointerDown(event, Direction.east);
|
|
160
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-se", onPointerDown: (event) => {
|
|
161
|
-
handlePointerDown(event, Direction.south | Direction.east);
|
|
162
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-s", onPointerDown: (event) => {
|
|
163
|
-
handlePointerDown(event, Direction.south);
|
|
164
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-sw", onPointerDown: (event) => {
|
|
165
|
-
handlePointerDown(event, Direction.south | Direction.west);
|
|
166
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-w", onPointerDown: (event) => {
|
|
167
|
-
handlePointerDown(event, Direction.west);
|
|
168
|
-
} }), _jsx("div", { className: "image-resizer image-resizer-nw", onPointerDown: (event) => {
|
|
169
|
-
handlePointerDown(event, Direction.north | Direction.west);
|
|
170
|
-
} })] }));
|
|
171
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import './KatexEquationAlterer.css';
|
|
3
|
-
type Props = {
|
|
4
|
-
initialEquation?: string;
|
|
5
|
-
onConfirm: (equation: string, inline: boolean) => void;
|
|
6
|
-
};
|
|
7
|
-
export default function KatexEquationAlterer({ onConfirm, initialEquation, }: Props): JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import './KatexEquationAlterer.css';
|
|
3
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
4
|
-
import { useCallback, useState } from 'react';
|
|
5
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
|
-
import Button from '../ui/Button';
|
|
7
|
-
import KatexRenderer from './KatexRenderer';
|
|
8
|
-
export default function KatexEquationAlterer({ onConfirm, initialEquation = '', }) {
|
|
9
|
-
const [editor] = useLexicalComposerContext();
|
|
10
|
-
const [equation, setEquation] = useState(initialEquation);
|
|
11
|
-
const [inline, setInline] = useState(true);
|
|
12
|
-
const onClick = useCallback(() => {
|
|
13
|
-
onConfirm(equation, inline);
|
|
14
|
-
}, [onConfirm, equation, inline]);
|
|
15
|
-
const onCheckboxChange = useCallback(() => {
|
|
16
|
-
setInline(!inline);
|
|
17
|
-
}, [setInline, inline]);
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "KatexEquationAlterer_defaultRow", children: ["Inline", _jsx("input", { type: "checkbox", checked: inline, onChange: onCheckboxChange })] }), _jsx("div", { className: "KatexEquationAlterer_defaultRow", children: "Equation " }), _jsx("div", { className: "KatexEquationAlterer_centerRow", children: inline ? (_jsx("input", { onChange: (event) => {
|
|
19
|
-
setEquation(event.target.value);
|
|
20
|
-
}, value: equation, className: "KatexEquationAlterer_textArea" })) : (_jsx("textarea", { onChange: (event) => {
|
|
21
|
-
setEquation(event.target.value);
|
|
22
|
-
}, value: equation, className: "KatexEquationAlterer_textArea" })) }), _jsx("div", { className: "KatexEquationAlterer_defaultRow", children: "Visualization " }), _jsx("div", { className: "KatexEquationAlterer_centerRow", children: _jsx(ErrorBoundary, { onError: (e) => editor._onError(e), fallback: null, children: _jsx(KatexRenderer, { equation: equation, inline: false, onDoubleClick: () => null }) }) }), _jsx("div", { className: "KatexEquationAlterer_dialogActions", children: _jsx(Button, { onClick: onClick, children: "Confirm" }) })] }));
|
|
23
|
-
}
|
package/lib/ui/KatexRenderer.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import katex from 'katex';
|
|
3
|
-
import { useEffect, useRef } from 'react';
|
|
4
|
-
export default function KatexRenderer({ equation, inline, onDoubleClick, }) {
|
|
5
|
-
const katexElementRef = useRef(null);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const katexElement = katexElementRef.current;
|
|
8
|
-
if (katexElement !== null) {
|
|
9
|
-
katex.render(equation, katexElement, {
|
|
10
|
-
displayMode: !inline, // true === block display //
|
|
11
|
-
errorColor: '#cc0000',
|
|
12
|
-
output: 'html',
|
|
13
|
-
strict: 'warn',
|
|
14
|
-
throwOnError: false,
|
|
15
|
-
trust: false,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}, [equation, inline]);
|
|
19
|
-
return (
|
|
20
|
-
// We use an empty image tag either side to ensure Android doesn't try and compose from the
|
|
21
|
-
// inner text from Katex. There didn't seem to be any other way of making this work,
|
|
22
|
-
// without having a physical space.
|
|
23
|
-
_jsxs(_Fragment, { children: [_jsx("img", { src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", width: "0", height: "0", alt: "" }), _jsx("span", { role: "button", tabIndex: -1, onDoubleClick: onDoubleClick, ref: katexElementRef }), _jsx("img", { src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", width: "0", height: "0", alt: "" })] }));
|
|
24
|
-
}
|
package/lib/ui/Modal.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import './Modal.css';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
export default function Modal({ onClose, children, title, closeOnClickOutside, }: {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
closeOnClickOutside?: boolean;
|
|
7
|
-
onClose: () => void;
|
|
8
|
-
title: string;
|
|
9
|
-
}): JSX.Element;
|
package/lib/ui/Modal.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './Modal.css';
|
|
3
|
-
import { isDOMNode } from 'lexical';
|
|
4
|
-
import { useEffect, useRef } from 'react';
|
|
5
|
-
import { createPortal } from 'react-dom';
|
|
6
|
-
function PortalImpl({ onClose, children, title, closeOnClickOutside, }) {
|
|
7
|
-
const modalRef = useRef(null);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (modalRef.current !== null) {
|
|
10
|
-
modalRef.current.focus();
|
|
11
|
-
}
|
|
12
|
-
}, []);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
let modalOverlayElement = null;
|
|
15
|
-
const handler = (event) => {
|
|
16
|
-
if (event.key === 'Escape') {
|
|
17
|
-
onClose();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const clickOutsideHandler = (event) => {
|
|
21
|
-
const target = event.target;
|
|
22
|
-
if (modalRef.current !== null &&
|
|
23
|
-
isDOMNode(target) &&
|
|
24
|
-
!modalRef.current.contains(target) &&
|
|
25
|
-
closeOnClickOutside) {
|
|
26
|
-
onClose();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const modelElement = modalRef.current;
|
|
30
|
-
if (modelElement !== null) {
|
|
31
|
-
modalOverlayElement = modelElement.parentElement;
|
|
32
|
-
if (modalOverlayElement !== null) {
|
|
33
|
-
modalOverlayElement.addEventListener('click', clickOutsideHandler);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
window.addEventListener('keydown', handler);
|
|
37
|
-
return () => {
|
|
38
|
-
window.removeEventListener('keydown', handler);
|
|
39
|
-
if (modalOverlayElement !== null) {
|
|
40
|
-
modalOverlayElement?.removeEventListener('click', clickOutsideHandler);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [closeOnClickOutside, onClose]);
|
|
44
|
-
return (_jsx("div", { className: "Modal__overlay", role: "dialog", children: _jsxs("div", { className: "Modal__modal", tabIndex: -1, ref: modalRef, children: [_jsx("h2", { className: "Modal__title", children: title }), _jsx("button", { className: "Modal__closeButton", "aria-label": "Close modal", type: "button", onClick: onClose, children: "X" }), _jsx("div", { className: "Modal__content", children: children })] }) }));
|
|
45
|
-
}
|
|
46
|
-
export default function Modal({ onClose, children, title, closeOnClickOutside = false, }) {
|
|
47
|
-
return createPortal(_jsx(PortalImpl, { onClose: onClose, title: title, closeOnClickOutside: closeOnClickOutside, children: children }), document.body);
|
|
48
|
-
}
|
package/lib/ui/Select.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import './Select.css';
|
|
3
|
-
type SelectIntrinsicProps = JSX.IntrinsicElements['select'];
|
|
4
|
-
interface SelectProps extends SelectIntrinsicProps {
|
|
5
|
-
label: string;
|
|
6
|
-
}
|
|
7
|
-
export default function Select({ children, label, className, ...other }: SelectProps): JSX.Element;
|
|
8
|
-
export {};
|
package/lib/ui/Select.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './Select.css';
|
|
3
|
-
export default function Select({ children, label, className, ...other }) {
|
|
4
|
-
return (_jsxs("div", { className: "Input__wrapper", children: [_jsx("label", { style: { marginTop: '-1em' }, className: "Input__label", children: label }), _jsx("select", { ...other, className: className || 'select', children: children })] }));
|
|
5
|
-
}
|
package/lib/ui/Switch.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export default function Switch({ checked, onClick, text, id, }: Readonly<{
|
|
4
|
-
checked: boolean;
|
|
5
|
-
id?: string;
|
|
6
|
-
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
7
|
-
text: string;
|
|
8
|
-
}>): JSX.Element;
|
package/lib/ui/Switch.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
export default function Switch({ checked, onClick, text, id, }) {
|
|
4
|
-
const buttonId = useMemo(() => 'id_' + Math.floor(Math.random() * 10000), []);
|
|
5
|
-
return (_jsxs("div", { className: "switch", id: id, children: [_jsx("label", { htmlFor: buttonId, children: text }), _jsx("button", { role: "switch", "aria-checked": checked, id: buttonId, onClick: onClick, children: _jsx("span", {}) })] }));
|
|
6
|
-
}
|
package/lib/ui/TextInput.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import './Input.css';
|
|
3
|
-
import { HTMLInputTypeAttribute } from 'react';
|
|
4
|
-
type Props = Readonly<{
|
|
5
|
-
'data-test-id'?: string;
|
|
6
|
-
label: string;
|
|
7
|
-
onChange: (val: string) => void;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
value: string;
|
|
10
|
-
type?: HTMLInputTypeAttribute;
|
|
11
|
-
}>;
|
|
12
|
-
export default function TextInput({ label, value, onChange, placeholder, 'data-test-id': dataTestId, type, }: Props): JSX.Element;
|
|
13
|
-
export {};
|
package/lib/ui/TextInput.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import './Input.css';
|
|
3
|
-
export default function TextInput({ label, value, onChange, placeholder = '', 'data-test-id': dataTestId, type = 'text', }) {
|
|
4
|
-
return (_jsxs("div", { className: "Input__wrapper", children: [_jsx("label", { className: "Input__label", children: label }), _jsx("input", { type: type, className: "Input__input", placeholder: placeholder, value: value, onChange: (e) => {
|
|
5
|
-
onChange(e.target.value);
|
|
6
|
-
}, "data-test-id": dataTestId })] }));
|
|
7
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
async function* generateReader(reader) {
|
|
3
|
-
let done = false;
|
|
4
|
-
while (!done) {
|
|
5
|
-
const res = await reader.read();
|
|
6
|
-
const { value } = res;
|
|
7
|
-
if (value !== undefined) {
|
|
8
|
-
yield value;
|
|
9
|
-
}
|
|
10
|
-
done = res.done;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
async function readBytestoString(reader) {
|
|
14
|
-
const output = [];
|
|
15
|
-
const chunkSize = 0x8000;
|
|
16
|
-
for await (const value of generateReader(reader)) {
|
|
17
|
-
for (let i = 0; i < value.length; i += chunkSize) {
|
|
18
|
-
output.push(String.fromCharCode(...value.subarray(i, i + chunkSize)));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return output.join('');
|
|
22
|
-
}
|
|
23
|
-
export async function docToHash(doc) {
|
|
24
|
-
const cs = new CompressionStream('gzip');
|
|
25
|
-
const writer = cs.writable.getWriter();
|
|
26
|
-
const [, output] = await Promise.all([
|
|
27
|
-
writer
|
|
28
|
-
.write(new TextEncoder().encode(JSON.stringify(doc)))
|
|
29
|
-
.then(() => writer.close()),
|
|
30
|
-
readBytestoString(cs.readable.getReader()),
|
|
31
|
-
]);
|
|
32
|
-
return `#doc=${btoa(output)
|
|
33
|
-
.replace(/\//g, '_')
|
|
34
|
-
.replace(/\+/g, '-')
|
|
35
|
-
.replace(/=+$/, '')}`;
|
|
36
|
-
}
|
|
37
|
-
export async function docFromHash(hash) {
|
|
38
|
-
const m = /^#doc=(.*)$/.exec(hash);
|
|
39
|
-
if (!m) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
const ds = new DecompressionStream('gzip');
|
|
43
|
-
const writer = ds.writable.getWriter();
|
|
44
|
-
const b64 = atob(m[1].replace(/_/g, '/').replace(/-/g, '+'));
|
|
45
|
-
const array = new Uint8Array(b64.length);
|
|
46
|
-
for (let i = 0; i < b64.length; i++) {
|
|
47
|
-
array[i] = b64.charCodeAt(i);
|
|
48
|
-
}
|
|
49
|
-
const closed = writer.write(array).then(() => writer.close());
|
|
50
|
-
const output = [];
|
|
51
|
-
for await (const chunk of generateReader(ds.readable.pipeThrough(new TextDecoderStream()).getReader())) {
|
|
52
|
-
output.push(chunk);
|
|
53
|
-
}
|
|
54
|
-
await closed;
|
|
55
|
-
return JSON.parse(output.join(''));
|
|
56
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare const _default: ({
|
|
2
|
-
description: string;
|
|
3
|
-
emoji: string;
|
|
4
|
-
category: string;
|
|
5
|
-
aliases: string[];
|
|
6
|
-
tags: string[];
|
|
7
|
-
unicode_version: string;
|
|
8
|
-
ios_version: string;
|
|
9
|
-
skin_tones?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
emoji: string;
|
|
12
|
-
description: string;
|
|
13
|
-
category: string;
|
|
14
|
-
aliases: string[];
|
|
15
|
-
tags: string[];
|
|
16
|
-
unicode_version: string;
|
|
17
|
-
ios_version: string;
|
|
18
|
-
skin_tones: boolean;
|
|
19
|
-
})[];
|
|
20
|
-
export default _default;
|