@liveblocks/react-lexical 2.0.0-alpha2 → 2.0.0-alpha4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comments/comment-plugin-provider.js +19 -10
- package/dist/comments/comment-plugin-provider.js.map +1 -1
- package/dist/comments/comment-plugin-provider.mjs +20 -13
- package/dist/comments/comment-plugin-provider.mjs.map +1 -1
- package/dist/comments/floating-composer.js.map +1 -1
- package/dist/comments/floating-composer.mjs.map +1 -1
- package/dist/index.d.mts +115 -82
- package/dist/index.d.ts +115 -82
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -5
- package/dist/index.mjs.map +1 -1
- package/dist/liveblocks-config.js.map +1 -1
- package/dist/liveblocks-config.mjs.map +1 -1
- package/dist/liveblocks-plugin-provider.js +100 -16
- package/dist/liveblocks-plugin-provider.js.map +1 -1
- package/dist/liveblocks-plugin-provider.mjs +103 -20
- package/dist/liveblocks-plugin-provider.mjs.map +1 -1
- package/dist/mentions/mention-component.js +1 -1
- package/dist/mentions/mention-component.js.map +1 -1
- package/dist/mentions/mention-component.mjs +1 -1
- package/dist/mentions/mention-component.mjs.map +1 -1
- package/dist/mentions/mention-plugin.js +0 -12
- package/dist/mentions/mention-plugin.js.map +1 -1
- package/dist/mentions/mention-plugin.mjs +1 -13
- package/dist/mentions/mention-plugin.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +6 -6
- package/src/styles/index.css +1 -13
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/comments/ThreadPanel.js +0 -46
- package/dist/comments/ThreadPanel.js.map +0 -1
- package/dist/comments/ThreadPanel.mjs +0 -44
- package/dist/comments/ThreadPanel.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,74 +1,84 @@
|
|
|
1
|
-
import { BaseMetadata
|
|
1
|
+
import { BaseMetadata } from '@liveblocks/core';
|
|
2
2
|
import { ComposerProps } from '@liveblocks/react-ui';
|
|
3
3
|
import * as lexical from 'lexical';
|
|
4
|
-
import { LexicalCommand
|
|
5
|
-
import React
|
|
4
|
+
import { LexicalCommand } from 'lexical';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether the associated thread annotation for the given thread id is selected or not in the editor.
|
|
10
|
+
* @param threadId The id of the thread to check if the associated annotation is selected or not.
|
|
11
|
+
* @returns true if the associated annotation for the thread is selected, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
declare function useIsThreadActive(threadId: string): boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Dispatching OPEN_FLOATING_COMPOSER_COMMAND will display the FloatingComposer
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
20
|
+
* import { OPEN_FLOATING_COMPOSER_COMMAND } from "@liveblocks/react-lexical";
|
|
21
|
+
*
|
|
22
|
+
* function Toolbar() {
|
|
23
|
+
* const [editor] = useLexicalComposerContext();
|
|
24
|
+
*
|
|
25
|
+
* return (
|
|
26
|
+
* <button
|
|
27
|
+
* onClick={() => {
|
|
28
|
+
* editor.dispatchCommand(OPEN_FLOATING_COMPOSER_COMMAND);
|
|
29
|
+
* }}
|
|
30
|
+
* >
|
|
31
|
+
* 💬 New comment
|
|
32
|
+
* </button>
|
|
33
|
+
* );
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
8
36
|
declare const OPEN_FLOATING_COMPOSER_COMMAND: LexicalCommand<void>;
|
|
9
37
|
declare type ThreadMetadata = {
|
|
10
38
|
resolved?: boolean;
|
|
11
39
|
};
|
|
12
40
|
declare type FloatingComposerProps<M extends BaseMetadata = ThreadMetadata> = Omit<ComposerProps<M>, "threadId" | "commentId">;
|
|
41
|
+
/**
|
|
42
|
+
* Displays a `Composer` near the current lexical selection.
|
|
43
|
+
*
|
|
44
|
+
* To open it, dispatch `OPEN_FLOATING_COMPOSER_COMMAND`.
|
|
45
|
+
*
|
|
46
|
+
* Submitting a comment will attach an annotation thread at the current selection.
|
|
47
|
+
* Should be nested inside `LiveblocksPlugin`.
|
|
48
|
+
*/
|
|
13
49
|
declare const FloatingComposer: React.ForwardRefExoticComponent<FloatingComposerProps<ThreadMetadata> & React.RefAttributes<HTMLFormElement>>;
|
|
14
50
|
|
|
15
51
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
-
* in the Software without restriction, including without limitation the rights
|
|
22
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
-
* furnished to do so, subject to the following conditions:
|
|
52
|
+
* Function that takes a Lexical editor config and modifies it to add the necessary
|
|
53
|
+
* `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
|
|
25
54
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
55
|
+
* @example
|
|
56
|
+
* import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
57
|
+
* import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
58
|
+
* import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
59
|
+
* import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
60
|
+
* import { liveblocksConfig, LiveblocksPlugin } from "@liveblocks/react-lexical";
|
|
28
61
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
62
|
+
* const initialConfig = liveblocksConfig({
|
|
63
|
+
* namespace: "MyEditor",
|
|
64
|
+
* theme: {},
|
|
65
|
+
* nodes: [],
|
|
66
|
+
* onError: (err) => console.error(err),
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* function Editor() {
|
|
70
|
+
* return (
|
|
71
|
+
* <LexicalComposer initialConfig={initialConfig}>
|
|
72
|
+
* <LiveblocksPlugin />
|
|
73
|
+
* <RichTextPlugin
|
|
74
|
+
* contentEditable={<ContentEditable />}
|
|
75
|
+
* placeholder={<div>Enter some text...</div>}
|
|
76
|
+
* ErrorBoundary={LexicalErrorBoundary}
|
|
77
|
+
* />
|
|
78
|
+
* </LexicalComposer>
|
|
79
|
+
* );
|
|
80
|
+
* }
|
|
36
81
|
*/
|
|
37
|
-
|
|
38
|
-
declare type SerializedThreadMarkNode = Spread<{
|
|
39
|
-
ids: Array<string>;
|
|
40
|
-
}, SerializedElementNode>;
|
|
41
|
-
declare class ThreadMarkNode extends ElementNode {
|
|
42
|
-
static getType(): string;
|
|
43
|
-
static clone(node: ThreadMarkNode): ThreadMarkNode;
|
|
44
|
-
static importDOM(): null;
|
|
45
|
-
static importJSON(serializedNode: SerializedThreadMarkNode): ThreadMarkNode;
|
|
46
|
-
exportJSON(): SerializedThreadMarkNode;
|
|
47
|
-
constructor(ids: Array<string>, key?: NodeKey);
|
|
48
|
-
createDOM(): HTMLElement;
|
|
49
|
-
updateDOM(): boolean;
|
|
50
|
-
hasID(id: string): boolean;
|
|
51
|
-
getIDs(): Array<string>;
|
|
52
|
-
addID(id: string): void;
|
|
53
|
-
deleteID(id: string): void;
|
|
54
|
-
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): null | ElementNode;
|
|
55
|
-
canInsertTextBefore(): false;
|
|
56
|
-
canInsertTextAfter(): false;
|
|
57
|
-
canBeEmpty(): false;
|
|
58
|
-
isInline(): true;
|
|
59
|
-
extractWithChild(_: LexicalNode, selection: BaseSelection, destination: "clone" | "html"): boolean;
|
|
60
|
-
excludeFromCopy(destination: "clone" | "html"): boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare type ThreadProps = {
|
|
64
|
-
thread: ThreadData<BaseMetadata>;
|
|
65
|
-
isActive: boolean;
|
|
66
|
-
};
|
|
67
|
-
declare type ThreadPanelProps = {
|
|
68
|
-
renderThread?: ComponentType<ThreadProps>;
|
|
69
|
-
};
|
|
70
|
-
declare const ThreadPanel: ({ renderThread }: ThreadPanelProps) => React.JSX.Element;
|
|
71
|
-
|
|
72
82
|
declare function liveblocksConfig(editorConfig: Omit<InitialConfigType, "editorState">): {
|
|
73
83
|
nodes: (lexical.KlassConstructor<typeof lexical.LexicalNode> | lexical.LexicalNodeReplacement)[];
|
|
74
84
|
editorState: null;
|
|
@@ -80,34 +90,57 @@ declare function liveblocksConfig(editorConfig: Omit<InitialConfigType, "editorS
|
|
|
80
90
|
theme?: lexical.EditorThemeClasses | undefined;
|
|
81
91
|
};
|
|
82
92
|
|
|
93
|
+
declare type EditorStatus = "not-loaded" | "loading"
|
|
94
|
+
/**
|
|
95
|
+
* Not working yet! Will be available in a future release.
|
|
96
|
+
* Some editor state modifications has not been acknowledged yet by the server
|
|
97
|
+
*/
|
|
98
|
+
| "synchronizing" | "synchronized";
|
|
99
|
+
/**
|
|
100
|
+
* Get the storage status.
|
|
101
|
+
*
|
|
102
|
+
* - `not-loaded`: Initial state when entering the room.
|
|
103
|
+
* - `loading`: Once the editor state has been requested by LiveblocksPlugin.
|
|
104
|
+
* - `synchronizing`: Not working yet! Will be available in a future release.
|
|
105
|
+
* - `synchronized`: The editor state is sync with Liveblocks servers.
|
|
106
|
+
*/
|
|
107
|
+
declare function useEditorStatus(): EditorStatus;
|
|
83
108
|
declare type LiveblocksPluginProps = {
|
|
84
109
|
children?: React.ReactNode;
|
|
85
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Liveblocks plugin for Lexical that adds collaboration to your editor.
|
|
113
|
+
*
|
|
114
|
+
* `LiveblocksPlugin` should always be nested inside `LexicalComposer`.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
*
|
|
118
|
+
* import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
119
|
+
* import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
120
|
+
* import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
121
|
+
* import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
122
|
+
* import { liveblocksConfig, LiveblocksPlugin } from "@liveblocks/react-lexical";
|
|
123
|
+
*
|
|
124
|
+
* const initialConfig = liveblocksConfig({
|
|
125
|
+
* namespace: "MyEditor",
|
|
126
|
+
* theme: {},
|
|
127
|
+
* nodes: [],
|
|
128
|
+
* onError: (err) => console.error(err),
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* function Editor() {
|
|
132
|
+
* return (
|
|
133
|
+
* <LexicalComposer initialConfig={initialConfig}>
|
|
134
|
+
* <LiveblocksPlugin />
|
|
135
|
+
* <RichTextPlugin
|
|
136
|
+
* contentEditable={<ContentEditable />}
|
|
137
|
+
* placeholder={<div>Enter some text...</div>}
|
|
138
|
+
* ErrorBoundary={LexicalErrorBoundary}
|
|
139
|
+
* />
|
|
140
|
+
* </LexicalComposer>
|
|
141
|
+
* );
|
|
142
|
+
* }
|
|
143
|
+
*/
|
|
86
144
|
declare const LiveblocksPlugin: ({ children, }: LiveblocksPluginProps) => JSX.Element;
|
|
87
145
|
|
|
88
|
-
|
|
89
|
-
nodeKey: NodeKey;
|
|
90
|
-
children: ReactNode;
|
|
91
|
-
}): React.JSX.Element;
|
|
92
|
-
|
|
93
|
-
declare type SerializedMentionNode = Spread<{
|
|
94
|
-
userId: string;
|
|
95
|
-
}, SerializedLexicalNode>;
|
|
96
|
-
declare class MentionNode extends DecoratorNode<JSX$1.Element> {
|
|
97
|
-
__id: string;
|
|
98
|
-
__userId: string;
|
|
99
|
-
constructor(id: string, userId: string, key?: NodeKey);
|
|
100
|
-
static getType(): string;
|
|
101
|
-
static clone(node: MentionNode): MentionNode;
|
|
102
|
-
createDOM(): HTMLElement;
|
|
103
|
-
updateDOM(): boolean;
|
|
104
|
-
static importDom(): DOMConversionMap<HTMLElement> | null;
|
|
105
|
-
exportDOM(): DOMExportOutput;
|
|
106
|
-
static importJSON(serializedNode: SerializedMentionNode): MentionNode;
|
|
107
|
-
exportJSON(): SerializedMentionNode;
|
|
108
|
-
getUserId(): string;
|
|
109
|
-
getId(): string;
|
|
110
|
-
decorate(): JSX$1.Element;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { FloatingComposer, LiveblocksPlugin, Mention, MentionNode, OPEN_FLOATING_COMPOSER_COMMAND, ThreadMarkNode, ThreadPanel, liveblocksConfig };
|
|
146
|
+
export { FloatingComposer, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, liveblocksConfig, useEditorStatus, useIsThreadActive };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,84 @@
|
|
|
1
|
-
import { BaseMetadata
|
|
1
|
+
import { BaseMetadata } from '@liveblocks/core';
|
|
2
2
|
import { ComposerProps } from '@liveblocks/react-ui';
|
|
3
3
|
import * as lexical from 'lexical';
|
|
4
|
-
import { LexicalCommand
|
|
5
|
-
import React
|
|
4
|
+
import { LexicalCommand } from 'lexical';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether the associated thread annotation for the given thread id is selected or not in the editor.
|
|
10
|
+
* @param threadId The id of the thread to check if the associated annotation is selected or not.
|
|
11
|
+
* @returns true if the associated annotation for the thread is selected, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
declare function useIsThreadActive(threadId: string): boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Dispatching OPEN_FLOATING_COMPOSER_COMMAND will display the FloatingComposer
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
20
|
+
* import { OPEN_FLOATING_COMPOSER_COMMAND } from "@liveblocks/react-lexical";
|
|
21
|
+
*
|
|
22
|
+
* function Toolbar() {
|
|
23
|
+
* const [editor] = useLexicalComposerContext();
|
|
24
|
+
*
|
|
25
|
+
* return (
|
|
26
|
+
* <button
|
|
27
|
+
* onClick={() => {
|
|
28
|
+
* editor.dispatchCommand(OPEN_FLOATING_COMPOSER_COMMAND);
|
|
29
|
+
* }}
|
|
30
|
+
* >
|
|
31
|
+
* 💬 New comment
|
|
32
|
+
* </button>
|
|
33
|
+
* );
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
8
36
|
declare const OPEN_FLOATING_COMPOSER_COMMAND: LexicalCommand<void>;
|
|
9
37
|
declare type ThreadMetadata = {
|
|
10
38
|
resolved?: boolean;
|
|
11
39
|
};
|
|
12
40
|
declare type FloatingComposerProps<M extends BaseMetadata = ThreadMetadata> = Omit<ComposerProps<M>, "threadId" | "commentId">;
|
|
41
|
+
/**
|
|
42
|
+
* Displays a `Composer` near the current lexical selection.
|
|
43
|
+
*
|
|
44
|
+
* To open it, dispatch `OPEN_FLOATING_COMPOSER_COMMAND`.
|
|
45
|
+
*
|
|
46
|
+
* Submitting a comment will attach an annotation thread at the current selection.
|
|
47
|
+
* Should be nested inside `LiveblocksPlugin`.
|
|
48
|
+
*/
|
|
13
49
|
declare const FloatingComposer: React.ForwardRefExoticComponent<FloatingComposerProps<ThreadMetadata> & React.RefAttributes<HTMLFormElement>>;
|
|
14
50
|
|
|
15
51
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
-
* in the Software without restriction, including without limitation the rights
|
|
22
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
-
* furnished to do so, subject to the following conditions:
|
|
52
|
+
* Function that takes a Lexical editor config and modifies it to add the necessary
|
|
53
|
+
* `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
|
|
25
54
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
55
|
+
* @example
|
|
56
|
+
* import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
57
|
+
* import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
58
|
+
* import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
59
|
+
* import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
60
|
+
* import { liveblocksConfig, LiveblocksPlugin } from "@liveblocks/react-lexical";
|
|
28
61
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
62
|
+
* const initialConfig = liveblocksConfig({
|
|
63
|
+
* namespace: "MyEditor",
|
|
64
|
+
* theme: {},
|
|
65
|
+
* nodes: [],
|
|
66
|
+
* onError: (err) => console.error(err),
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* function Editor() {
|
|
70
|
+
* return (
|
|
71
|
+
* <LexicalComposer initialConfig={initialConfig}>
|
|
72
|
+
* <LiveblocksPlugin />
|
|
73
|
+
* <RichTextPlugin
|
|
74
|
+
* contentEditable={<ContentEditable />}
|
|
75
|
+
* placeholder={<div>Enter some text...</div>}
|
|
76
|
+
* ErrorBoundary={LexicalErrorBoundary}
|
|
77
|
+
* />
|
|
78
|
+
* </LexicalComposer>
|
|
79
|
+
* );
|
|
80
|
+
* }
|
|
36
81
|
*/
|
|
37
|
-
|
|
38
|
-
declare type SerializedThreadMarkNode = Spread<{
|
|
39
|
-
ids: Array<string>;
|
|
40
|
-
}, SerializedElementNode>;
|
|
41
|
-
declare class ThreadMarkNode extends ElementNode {
|
|
42
|
-
static getType(): string;
|
|
43
|
-
static clone(node: ThreadMarkNode): ThreadMarkNode;
|
|
44
|
-
static importDOM(): null;
|
|
45
|
-
static importJSON(serializedNode: SerializedThreadMarkNode): ThreadMarkNode;
|
|
46
|
-
exportJSON(): SerializedThreadMarkNode;
|
|
47
|
-
constructor(ids: Array<string>, key?: NodeKey);
|
|
48
|
-
createDOM(): HTMLElement;
|
|
49
|
-
updateDOM(): boolean;
|
|
50
|
-
hasID(id: string): boolean;
|
|
51
|
-
getIDs(): Array<string>;
|
|
52
|
-
addID(id: string): void;
|
|
53
|
-
deleteID(id: string): void;
|
|
54
|
-
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): null | ElementNode;
|
|
55
|
-
canInsertTextBefore(): false;
|
|
56
|
-
canInsertTextAfter(): false;
|
|
57
|
-
canBeEmpty(): false;
|
|
58
|
-
isInline(): true;
|
|
59
|
-
extractWithChild(_: LexicalNode, selection: BaseSelection, destination: "clone" | "html"): boolean;
|
|
60
|
-
excludeFromCopy(destination: "clone" | "html"): boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare type ThreadProps = {
|
|
64
|
-
thread: ThreadData<BaseMetadata>;
|
|
65
|
-
isActive: boolean;
|
|
66
|
-
};
|
|
67
|
-
declare type ThreadPanelProps = {
|
|
68
|
-
renderThread?: ComponentType<ThreadProps>;
|
|
69
|
-
};
|
|
70
|
-
declare const ThreadPanel: ({ renderThread }: ThreadPanelProps) => React.JSX.Element;
|
|
71
|
-
|
|
72
82
|
declare function liveblocksConfig(editorConfig: Omit<InitialConfigType, "editorState">): {
|
|
73
83
|
nodes: (lexical.KlassConstructor<typeof lexical.LexicalNode> | lexical.LexicalNodeReplacement)[];
|
|
74
84
|
editorState: null;
|
|
@@ -80,34 +90,57 @@ declare function liveblocksConfig(editorConfig: Omit<InitialConfigType, "editorS
|
|
|
80
90
|
theme?: lexical.EditorThemeClasses | undefined;
|
|
81
91
|
};
|
|
82
92
|
|
|
93
|
+
declare type EditorStatus = "not-loaded" | "loading"
|
|
94
|
+
/**
|
|
95
|
+
* Not working yet! Will be available in a future release.
|
|
96
|
+
* Some editor state modifications has not been acknowledged yet by the server
|
|
97
|
+
*/
|
|
98
|
+
| "synchronizing" | "synchronized";
|
|
99
|
+
/**
|
|
100
|
+
* Get the storage status.
|
|
101
|
+
*
|
|
102
|
+
* - `not-loaded`: Initial state when entering the room.
|
|
103
|
+
* - `loading`: Once the editor state has been requested by LiveblocksPlugin.
|
|
104
|
+
* - `synchronizing`: Not working yet! Will be available in a future release.
|
|
105
|
+
* - `synchronized`: The editor state is sync with Liveblocks servers.
|
|
106
|
+
*/
|
|
107
|
+
declare function useEditorStatus(): EditorStatus;
|
|
83
108
|
declare type LiveblocksPluginProps = {
|
|
84
109
|
children?: React.ReactNode;
|
|
85
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Liveblocks plugin for Lexical that adds collaboration to your editor.
|
|
113
|
+
*
|
|
114
|
+
* `LiveblocksPlugin` should always be nested inside `LexicalComposer`.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
*
|
|
118
|
+
* import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
119
|
+
* import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
120
|
+
* import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
121
|
+
* import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
122
|
+
* import { liveblocksConfig, LiveblocksPlugin } from "@liveblocks/react-lexical";
|
|
123
|
+
*
|
|
124
|
+
* const initialConfig = liveblocksConfig({
|
|
125
|
+
* namespace: "MyEditor",
|
|
126
|
+
* theme: {},
|
|
127
|
+
* nodes: [],
|
|
128
|
+
* onError: (err) => console.error(err),
|
|
129
|
+
* });
|
|
130
|
+
*
|
|
131
|
+
* function Editor() {
|
|
132
|
+
* return (
|
|
133
|
+
* <LexicalComposer initialConfig={initialConfig}>
|
|
134
|
+
* <LiveblocksPlugin />
|
|
135
|
+
* <RichTextPlugin
|
|
136
|
+
* contentEditable={<ContentEditable />}
|
|
137
|
+
* placeholder={<div>Enter some text...</div>}
|
|
138
|
+
* ErrorBoundary={LexicalErrorBoundary}
|
|
139
|
+
* />
|
|
140
|
+
* </LexicalComposer>
|
|
141
|
+
* );
|
|
142
|
+
* }
|
|
143
|
+
*/
|
|
86
144
|
declare const LiveblocksPlugin: ({ children, }: LiveblocksPluginProps) => JSX.Element;
|
|
87
145
|
|
|
88
|
-
|
|
89
|
-
nodeKey: NodeKey;
|
|
90
|
-
children: ReactNode;
|
|
91
|
-
}): React.JSX.Element;
|
|
92
|
-
|
|
93
|
-
declare type SerializedMentionNode = Spread<{
|
|
94
|
-
userId: string;
|
|
95
|
-
}, SerializedLexicalNode>;
|
|
96
|
-
declare class MentionNode extends DecoratorNode<JSX$1.Element> {
|
|
97
|
-
__id: string;
|
|
98
|
-
__userId: string;
|
|
99
|
-
constructor(id: string, userId: string, key?: NodeKey);
|
|
100
|
-
static getType(): string;
|
|
101
|
-
static clone(node: MentionNode): MentionNode;
|
|
102
|
-
createDOM(): HTMLElement;
|
|
103
|
-
updateDOM(): boolean;
|
|
104
|
-
static importDom(): DOMConversionMap<HTMLElement> | null;
|
|
105
|
-
exportDOM(): DOMExportOutput;
|
|
106
|
-
static importJSON(serializedNode: SerializedMentionNode): MentionNode;
|
|
107
|
-
exportJSON(): SerializedMentionNode;
|
|
108
|
-
getUserId(): string;
|
|
109
|
-
getId(): string;
|
|
110
|
-
decorate(): JSX$1.Element;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export { FloatingComposer, LiveblocksPlugin, Mention, MentionNode, OPEN_FLOATING_COMPOSER_COMMAND, ThreadMarkNode, ThreadPanel, liveblocksConfig };
|
|
146
|
+
export { FloatingComposer, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, liveblocksConfig, useEditorStatus, useIsThreadActive };
|
package/dist/index.js
CHANGED
|
@@ -2,22 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@liveblocks/core');
|
|
4
4
|
var version = require('./version.js');
|
|
5
|
+
var commentPluginProvider = require('./comments/comment-plugin-provider.js');
|
|
5
6
|
var floatingComposer = require('./comments/floating-composer.js');
|
|
6
|
-
var threadMarkNode = require('./comments/thread-mark-node.js');
|
|
7
|
-
var ThreadPanel = require('./comments/ThreadPanel.js');
|
|
8
7
|
var liveblocksConfig = require('./liveblocks-config.js');
|
|
9
8
|
var liveblocksPluginProvider = require('./liveblocks-plugin-provider.js');
|
|
10
|
-
var mentionComponent = require('./mentions/mention-component.js');
|
|
11
|
-
var mentionNode = require('./mentions/mention-node.js');
|
|
12
9
|
|
|
13
10
|
core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
|
|
14
11
|
|
|
12
|
+
exports.useIsThreadActive = commentPluginProvider.useIsThreadActive;
|
|
15
13
|
exports.FloatingComposer = floatingComposer.FloatingComposer;
|
|
16
14
|
exports.OPEN_FLOATING_COMPOSER_COMMAND = floatingComposer.OPEN_FLOATING_COMPOSER_COMMAND;
|
|
17
|
-
exports.ThreadMarkNode = threadMarkNode.ThreadMarkNode;
|
|
18
|
-
exports.ThreadPanel = ThreadPanel.ThreadPanel;
|
|
19
15
|
exports.liveblocksConfig = liveblocksConfig.liveblocksConfig;
|
|
20
16
|
exports.LiveblocksPlugin = liveblocksPluginProvider.LiveblocksPlugin;
|
|
21
|
-
exports.
|
|
22
|
-
exports.MentionNode = mentionNode.MentionNode;
|
|
17
|
+
exports.useEditorStatus = liveblocksPluginProvider.useEditorStatus;
|
|
23
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n} from \"./liveblocks-plugin-provider\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { detectDupes } from '@liveblocks/core';
|
|
2
2
|
import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.mjs';
|
|
3
|
+
export { useIsThreadActive } from './comments/comment-plugin-provider.mjs';
|
|
3
4
|
export { FloatingComposer, OPEN_FLOATING_COMPOSER_COMMAND } from './comments/floating-composer.mjs';
|
|
4
|
-
export { ThreadMarkNode } from './comments/thread-mark-node.mjs';
|
|
5
|
-
export { ThreadPanel } from './comments/ThreadPanel.mjs';
|
|
6
5
|
export { liveblocksConfig } from './liveblocks-config.mjs';
|
|
7
|
-
export { LiveblocksPlugin } from './liveblocks-plugin-provider.mjs';
|
|
8
|
-
export { Mention } from './mentions/mention-component.mjs';
|
|
9
|
-
export { MentionNode } from './mentions/mention-node.mjs';
|
|
6
|
+
export { LiveblocksPlugin, useEditorStatus } from './liveblocks-plugin-provider.mjs';
|
|
10
7
|
|
|
11
8
|
detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
12
9
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n} from \"./liveblocks-plugin-provider\";\n"],"names":[],"mappings":";;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveblocks-config.js","sources":["../src/liveblocks-config.ts"],"sourcesContent":["import type { InitialConfigType } from \"@lexical/react/LexicalComposer\";\n\nimport { ThreadMarkNode } from \"./comments/thread-mark-node\";\nimport { MentionNode } from \"./mentions/mention-node\";\n\nexport function liveblocksConfig(\n editorConfig: Omit<InitialConfigType, \"editorState\">\n) {\n const nodes = [...(editorConfig.nodes ?? [])];\n\n nodes.push(ThreadMarkNode, MentionNode);\n\n return {\n ...editorConfig,\n nodes,\n editorState: null, // explicitly null because CollabProvider requires it\n };\n}\n"],"names":["ThreadMarkNode","MentionNode"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"liveblocks-config.js","sources":["../src/liveblocks-config.ts"],"sourcesContent":["import type { InitialConfigType } from \"@lexical/react/LexicalComposer\";\n\nimport { ThreadMarkNode } from \"./comments/thread-mark-node\";\nimport { MentionNode } from \"./mentions/mention-node\";\n\n/**\n * Function that takes a Lexical editor config and modifies it to add the necessary\n * `nodes` and `theme` to make `LiveblocksPlugin` works correctly.\n *\n * @example\n * import { LexicalComposer } from \"@lexical/react/LexicalComposer\";\n * import { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\n * import { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\n * import { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\n * import { liveblocksConfig, LiveblocksPlugin } from \"@liveblocks/react-lexical\";\n *\n * const initialConfig = liveblocksConfig({\n * namespace: \"MyEditor\",\n * theme: {},\n * nodes: [],\n * onError: (err) => console.error(err),\n * });\n *\n * function Editor() {\n * return (\n * <LexicalComposer initialConfig={initialConfig}>\n * <LiveblocksPlugin />\n * <RichTextPlugin\n * contentEditable={<ContentEditable />}\n * placeholder={<div>Enter some text...</div>}\n * ErrorBoundary={LexicalErrorBoundary}\n * />\n * </LexicalComposer>\n * );\n * }\n */\nexport function liveblocksConfig(\n editorConfig: Omit<InitialConfigType, \"editorState\">\n) {\n const nodes = [...(editorConfig.nodes ?? [])];\n\n nodes.push(ThreadMarkNode, MentionNode);\n\n return {\n ...editorConfig,\n nodes,\n editorState: null, // explicitly null because CollabProvider requires it\n };\n}\n"],"names":["ThreadMarkNode","MentionNode"],"mappings":";;;;;AAoCO,SAAS,iBACd,YACA,EAAA;AACA,EAAA,MAAM,QAAQ,CAAC,GAAI,YAAa,CAAA,KAAA,IAAS,EAAG,CAAA,CAAA;AAE5C,EAAM,KAAA,CAAA,IAAA,CAAKA,+BAAgBC,uBAAW,CAAA,CAAA;AAEtC,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,KAAA;AAAA,IACA,WAAa,EAAA,IAAA;AAAA,GACf,CAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveblocks-config.mjs","sources":["../src/liveblocks-config.ts"],"sourcesContent":["import type { InitialConfigType } from \"@lexical/react/LexicalComposer\";\n\nimport { ThreadMarkNode } from \"./comments/thread-mark-node\";\nimport { MentionNode } from \"./mentions/mention-node\";\n\nexport function liveblocksConfig(\n editorConfig: Omit<InitialConfigType, \"editorState\">\n) {\n const nodes = [...(editorConfig.nodes ?? [])];\n\n nodes.push(ThreadMarkNode, MentionNode);\n\n return {\n ...editorConfig,\n nodes,\n editorState: null, // explicitly null because CollabProvider requires it\n };\n}\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"liveblocks-config.mjs","sources":["../src/liveblocks-config.ts"],"sourcesContent":["import type { InitialConfigType } from \"@lexical/react/LexicalComposer\";\n\nimport { ThreadMarkNode } from \"./comments/thread-mark-node\";\nimport { MentionNode } from \"./mentions/mention-node\";\n\n/**\n * Function that takes a Lexical editor config and modifies it to add the necessary\n * `nodes` and `theme` to make `LiveblocksPlugin` works correctly.\n *\n * @example\n * import { LexicalComposer } from \"@lexical/react/LexicalComposer\";\n * import { RichTextPlugin } from \"@lexical/react/LexicalRichTextPlugin\";\n * import { ContentEditable } from \"@lexical/react/LexicalContentEditable\";\n * import { LexicalErrorBoundary } from \"@lexical/react/LexicalErrorBoundary\";\n * import { liveblocksConfig, LiveblocksPlugin } from \"@liveblocks/react-lexical\";\n *\n * const initialConfig = liveblocksConfig({\n * namespace: \"MyEditor\",\n * theme: {},\n * nodes: [],\n * onError: (err) => console.error(err),\n * });\n *\n * function Editor() {\n * return (\n * <LexicalComposer initialConfig={initialConfig}>\n * <LiveblocksPlugin />\n * <RichTextPlugin\n * contentEditable={<ContentEditable />}\n * placeholder={<div>Enter some text...</div>}\n * ErrorBoundary={LexicalErrorBoundary}\n * />\n * </LexicalComposer>\n * );\n * }\n */\nexport function liveblocksConfig(\n editorConfig: Omit<InitialConfigType, \"editorState\">\n) {\n const nodes = [...(editorConfig.nodes ?? [])];\n\n nodes.push(ThreadMarkNode, MentionNode);\n\n return {\n ...editorConfig,\n nodes,\n editorState: null, // explicitly null because CollabProvider requires it\n };\n}\n"],"names":[],"mappings":";;;AAoCO,SAAS,iBACd,YACA,EAAA;AACA,EAAA,MAAM,QAAQ,CAAC,GAAI,YAAa,CAAA,KAAA,IAAS,EAAG,CAAA,CAAA;AAE5C,EAAM,KAAA,CAAA,IAAA,CAAK,gBAAgB,WAAW,CAAA,CAAA;AAEtC,EAAO,OAAA;AAAA,IACL,GAAG,YAAA;AAAA,IACH,KAAA;AAAA,IACA,WAAa,EAAA,IAAA;AAAA,GACf,CAAA;AACF;;;;"}
|