@liveblocks/react-lexical 2.16.0-toolbars5 → 2.17.0-channels1
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/anchored-threads.js +2 -2
- package/dist/comments/anchored-threads.js.map +1 -1
- package/dist/comments/anchored-threads.mjs +1 -1
- package/dist/comments/anchored-threads.mjs.map +1 -1
- package/dist/comments/floating-composer.js +2 -4
- package/dist/comments/floating-composer.js.map +1 -1
- package/dist/comments/floating-composer.mjs +2 -4
- package/dist/comments/floating-composer.mjs.map +1 -1
- package/dist/index.d.mts +3 -239
- package/dist/index.d.ts +3 -239
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +1 -1
- package/dist/liveblocks-plugin-provider.js +15 -2
- package/dist/liveblocks-plugin-provider.js.map +1 -1
- package/dist/liveblocks-plugin-provider.mjs +14 -2
- package/dist/liveblocks-plugin-provider.mjs.map +1 -1
- package/dist/version-history/history-version-preview.js +10 -3
- package/dist/version-history/history-version-preview.js.map +1 -1
- package/dist/version-history/history-version-preview.mjs +10 -3
- package/dist/version-history/history-version-preview.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +6 -10
- package/src/styles/constants.css +1 -1
- package/src/styles/index.css +6 -44
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/is-block-node-active.js +0 -51
- package/dist/is-block-node-active.js.map +0 -1
- package/dist/is-block-node-active.mjs +0 -49
- package/dist/is-block-node-active.mjs.map +0 -1
- package/dist/is-command-registered.js +0 -11
- package/dist/is-command-registered.js.map +0 -1
- package/dist/is-command-registered.mjs +0 -9
- package/dist/is-command-registered.mjs.map +0 -1
- package/dist/is-text-format-active.js +0 -16
- package/dist/is-text-format-active.js.map +0 -1
- package/dist/is-text-format-active.mjs +0 -14
- package/dist/is-text-format-active.mjs.map +0 -1
- package/dist/toolbar/floating-toolbar.js +0 -309
- package/dist/toolbar/floating-toolbar.js.map +0 -1
- package/dist/toolbar/floating-toolbar.mjs +0 -306
- package/dist/toolbar/floating-toolbar.mjs.map +0 -1
- package/dist/toolbar/shared.js +0 -39
- package/dist/toolbar/shared.js.map +0 -1
- package/dist/toolbar/shared.mjs +0 -36
- package/dist/toolbar/shared.mjs.map +0 -1
- package/dist/toolbar/toolbar.js +0 -448
- package/dist/toolbar/toolbar.js.map +0 -1
- package/dist/toolbar/toolbar.mjs +0 -423
- package/dist/toolbar/toolbar.mjs.map +0 -1
- package/dist/use-root-element.js +0 -21
- package/dist/use-root-element.js.map +0 -1
- package/dist/use-root-element.mjs +0 -19
- package/dist/use-root-element.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,9 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { BaseMetadata, DM, ThreadData, HistoryVersion } from '@liveblocks/core';
|
|
3
3
|
import { ThreadProps, ComposerProps } from '@liveblocks/react-ui';
|
|
4
4
|
import * as react from 'react';
|
|
5
|
-
import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode
|
|
5
|
+
import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
6
6
|
import * as lexical from 'lexical';
|
|
7
|
-
import { LexicalCommand
|
|
7
|
+
import { LexicalCommand } from 'lexical';
|
|
8
8
|
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
9
9
|
|
|
10
10
|
type AnchoredThreadsComponents = {
|
|
@@ -77,10 +77,6 @@ interface FloatingThreadsProps<M extends BaseMetadata = DM> extends Omit<HTMLAtt
|
|
|
77
77
|
}
|
|
78
78
|
declare function FloatingThreads({ threads, components, ...props }: FloatingThreadsProps): react_jsx_runtime.JSX.Element | null;
|
|
79
79
|
|
|
80
|
-
declare function isBlockNodeActive(editor: LexicalEditor, isActive: (node: LexicalNode) => boolean): boolean;
|
|
81
|
-
|
|
82
|
-
declare function isTextFormatActive(editor: LexicalEditor, format: TextFormatType): boolean;
|
|
83
|
-
|
|
84
80
|
/**
|
|
85
81
|
* Function that takes a Lexical editor config and modifies it to add the necessary
|
|
86
82
|
* `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
|
|
@@ -183,238 +179,6 @@ type LiveblocksPluginProps = {
|
|
|
183
179
|
*/
|
|
184
180
|
declare const LiveblocksPlugin: ({ children, }: LiveblocksPluginProps) => JSX.Element;
|
|
185
181
|
|
|
186
|
-
type FloatingPosition = "top" | "bottom";
|
|
187
|
-
|
|
188
|
-
interface ToolbarSlotProps {
|
|
189
|
-
editor: LexicalEditor;
|
|
190
|
-
}
|
|
191
|
-
type ToolbarSlot = ReactNode | ComponentType<ToolbarSlotProps>;
|
|
192
|
-
interface ToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
193
|
-
/**
|
|
194
|
-
* The content of the toolbar, overriding the default content.
|
|
195
|
-
* Use the `before` and `after` props if you want to keep and extend the default content.
|
|
196
|
-
*/
|
|
197
|
-
children?: ToolbarSlot;
|
|
198
|
-
/**
|
|
199
|
-
* The content to display at the start of the toolbar.
|
|
200
|
-
*/
|
|
201
|
-
before?: ToolbarSlot;
|
|
202
|
-
/**
|
|
203
|
-
* The content to display at the end of the toolbar.
|
|
204
|
-
*/
|
|
205
|
-
after?: ToolbarSlot;
|
|
206
|
-
}
|
|
207
|
-
interface ToolbarButtonProps extends ComponentProps<"button"> {
|
|
208
|
-
/**
|
|
209
|
-
* The name of this button displayed in its tooltip.
|
|
210
|
-
*/
|
|
211
|
-
name: string;
|
|
212
|
-
/**
|
|
213
|
-
* An optional icon displayed in this button.
|
|
214
|
-
*/
|
|
215
|
-
icon?: ReactNode;
|
|
216
|
-
/**
|
|
217
|
-
* An optional keyboard shortcut displayed in this button's tooltip.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* "Mod-Alt-B" → "⌘⌥B" in Apple environments, "⌃⌥B" otherwise
|
|
221
|
-
* "Ctrl-Shift-Escape" → "⌃⇧⎋"
|
|
222
|
-
* "Space" → "␣"
|
|
223
|
-
*/
|
|
224
|
-
shortcut?: string;
|
|
225
|
-
}
|
|
226
|
-
interface ToolbarToggleProps extends ToolbarButtonProps {
|
|
227
|
-
/**
|
|
228
|
-
* Whether the button is toggled.
|
|
229
|
-
*/
|
|
230
|
-
active: boolean;
|
|
231
|
-
}
|
|
232
|
-
type ToolbarSeparatorProps = ComponentProps<"div">;
|
|
233
|
-
interface ToolbarBlockSelectorItem {
|
|
234
|
-
/**
|
|
235
|
-
* The name of this block element, displayed as the label of this item.
|
|
236
|
-
*/
|
|
237
|
-
name: string;
|
|
238
|
-
/**
|
|
239
|
-
* Optionally replace the name used as the label of this item by any content.
|
|
240
|
-
*/
|
|
241
|
-
label?: ReactNode;
|
|
242
|
-
/**
|
|
243
|
-
* An optional icon displayed in this item.
|
|
244
|
-
*/
|
|
245
|
-
icon?: ReactNode;
|
|
246
|
-
/**
|
|
247
|
-
* Whether this block element is currently active.
|
|
248
|
-
* Set to `"default"` to display this item when no other item is active.
|
|
249
|
-
*/
|
|
250
|
-
isActive: ((editor: LexicalEditor) => boolean) | "default";
|
|
251
|
-
/**
|
|
252
|
-
* A callback invoked when this item is selected.
|
|
253
|
-
*/
|
|
254
|
-
setActive: (editor: LexicalEditor) => void;
|
|
255
|
-
}
|
|
256
|
-
interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
|
|
257
|
-
/**
|
|
258
|
-
* The items displayed in this block selector.
|
|
259
|
-
* When provided as an array, the default items are overridden. To avoid this,
|
|
260
|
-
* a function can be provided instead and it will receive the default items.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* <Toolbar.BlockSelector
|
|
264
|
-
* items={[
|
|
265
|
-
* {
|
|
266
|
-
* name: "Text",
|
|
267
|
-
* isActive: "default",
|
|
268
|
-
* setActive: () => { ... },
|
|
269
|
-
* },
|
|
270
|
-
* {
|
|
271
|
-
* name: "Heading 1",
|
|
272
|
-
* isActive: () => { ... },
|
|
273
|
-
* setActive: () => { ... },
|
|
274
|
-
* },
|
|
275
|
-
* ]}
|
|
276
|
-
* />
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* <Toolbar.BlockSelector
|
|
280
|
-
* items={(defaultItems) => [
|
|
281
|
-
* ...defaultItems,
|
|
282
|
-
* {
|
|
283
|
-
* name: "Custom block",
|
|
284
|
-
* isActive: () => { ... },
|
|
285
|
-
* setActive: () => { ... },
|
|
286
|
-
* },
|
|
287
|
-
* ]}
|
|
288
|
-
* />
|
|
289
|
-
*/
|
|
290
|
-
items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
|
|
291
|
-
}
|
|
292
|
-
declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
|
|
293
|
-
declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element | null;
|
|
294
|
-
declare function ToolbarSectionCollaboration(): react_jsx_runtime.JSX.Element;
|
|
295
|
-
/**
|
|
296
|
-
* A static toolbar containing actions and values related to the editor.
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* <Toolbar />
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* <Toolbar >
|
|
303
|
-
* <Toolbar.BlockSelector />
|
|
304
|
-
* <Toolbar.Separator />
|
|
305
|
-
* <Toolbar.SectionInline />
|
|
306
|
-
* <Toolbar.Separator />
|
|
307
|
-
* <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
|
|
308
|
-
* </Toolbar>
|
|
309
|
-
*/
|
|
310
|
-
declare const Toolbar: react.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
311
|
-
/**
|
|
312
|
-
* A button for triggering actions.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }}>Comment</Toolbar.Button>
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
|
|
319
|
-
*/
|
|
320
|
-
Button: react.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
321
|
-
/**
|
|
322
|
-
* A toggle button for values that can be active or inactive.
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* <Toolbar.Toggle name="Bold" active={isBold}>Bold</Toolbar.Toggle>
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
|
|
329
|
-
*/
|
|
330
|
-
Toggle: react.ForwardRefExoticComponent<Omit<ToolbarToggleProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
331
|
-
/**
|
|
332
|
-
* A dropdown selector to switch between different block types.
|
|
333
|
-
*
|
|
334
|
-
* @example
|
|
335
|
-
* <Toolbar.BlockSelector />
|
|
336
|
-
*/
|
|
337
|
-
BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
338
|
-
/**
|
|
339
|
-
* A visual (and accessible) separator to separate sections in a toolbar.
|
|
340
|
-
*/
|
|
341
|
-
Separator: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
342
|
-
/**
|
|
343
|
-
* A section containing history actions. (e.g. undo, redo)
|
|
344
|
-
*/
|
|
345
|
-
SectionHistory: typeof ToolbarSectionHistory;
|
|
346
|
-
/**
|
|
347
|
-
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
348
|
-
*/
|
|
349
|
-
SectionInline: typeof ToolbarSectionInline;
|
|
350
|
-
/**
|
|
351
|
-
* A section containing collaborative actions. (e.g. adding a comment)
|
|
352
|
-
*/
|
|
353
|
-
SectionCollaboration: typeof ToolbarSectionCollaboration;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
357
|
-
/**
|
|
358
|
-
* The vertical position of the floating toolbar.
|
|
359
|
-
*/
|
|
360
|
-
position?: FloatingPosition;
|
|
361
|
-
/**
|
|
362
|
-
* The vertical offset of the floating toolbar from the selection.
|
|
363
|
-
*/
|
|
364
|
-
offset?: number;
|
|
365
|
-
/**
|
|
366
|
-
* The content of the floating toolbar, overriding the default content.
|
|
367
|
-
* Use the `before` and `after` props if you want to keep and extend the default content.
|
|
368
|
-
*/
|
|
369
|
-
children?: ToolbarSlot;
|
|
370
|
-
/**
|
|
371
|
-
* The content to display at the start of the floating toolbar.
|
|
372
|
-
*/
|
|
373
|
-
before?: ToolbarSlot;
|
|
374
|
-
/**
|
|
375
|
-
* The content to display at the end of the floating toolbar.
|
|
376
|
-
*/
|
|
377
|
-
after?: ToolbarSlot;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* A floating toolbar attached to the selection and containing actions and values related to the editor.
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* <FloatingToolbar />
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* <FloatingToolbar>
|
|
387
|
-
* <Toolbar.BlockSelector />
|
|
388
|
-
* <Toolbar.Separator />
|
|
389
|
-
* <Toolbar.SectionInline />
|
|
390
|
-
* <Toolbar.Separator />
|
|
391
|
-
* <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
|
|
392
|
-
* </FloatingToolbar>
|
|
393
|
-
*/
|
|
394
|
-
declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
395
|
-
/**
|
|
396
|
-
* A component that can be wrapped around elements which are rendered outside of the floating
|
|
397
|
-
* toolbar (e.g. portals) to prevent the toolbar from closing when clicking/focusing within them.
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* <FloatingToolbar>
|
|
401
|
-
* <Popover.Root>
|
|
402
|
-
* <Popover.Trigger asChild>
|
|
403
|
-
* <Toolbar.Button>Open popover</Toolbar.Button>
|
|
404
|
-
* </Popover.Trigger>
|
|
405
|
-
* <Popover.Portal>
|
|
406
|
-
* <FloatingToolbar.External>
|
|
407
|
-
* <Popover.Content>
|
|
408
|
-
* This popover is rendered outside of the floating toolbar, but the toolbar will not close when clicking/focusing within it.
|
|
409
|
-
* </Popover.Content>
|
|
410
|
-
* </FloatingToolbar.External>
|
|
411
|
-
* </Popover.Portal>
|
|
412
|
-
* </Popover.Root>
|
|
413
|
-
* </FloatingToolbar>
|
|
414
|
-
*/
|
|
415
|
-
External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
182
|
interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
|
|
419
183
|
version: HistoryVersion;
|
|
420
184
|
onVersionRestore?: (version: HistoryVersion) => void;
|
|
@@ -427,4 +191,4 @@ interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
427
191
|
*/
|
|
428
192
|
declare const HistoryVersionPreview: react.ForwardRefExoticComponent<HistoryVersionPreviewProps & react.RefAttributes<HTMLDivElement>>;
|
|
429
193
|
|
|
430
|
-
export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps,
|
|
194
|
+
export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { BaseMetadata, DM, ThreadData, HistoryVersion } from '@liveblocks/core';
|
|
3
3
|
import { ThreadProps, ComposerProps } from '@liveblocks/react-ui';
|
|
4
4
|
import * as react from 'react';
|
|
5
|
-
import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode
|
|
5
|
+
import { ComponentPropsWithoutRef, ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
6
6
|
import * as lexical from 'lexical';
|
|
7
|
-
import { LexicalCommand
|
|
7
|
+
import { LexicalCommand } from 'lexical';
|
|
8
8
|
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
9
9
|
|
|
10
10
|
type AnchoredThreadsComponents = {
|
|
@@ -77,10 +77,6 @@ interface FloatingThreadsProps<M extends BaseMetadata = DM> extends Omit<HTMLAtt
|
|
|
77
77
|
}
|
|
78
78
|
declare function FloatingThreads({ threads, components, ...props }: FloatingThreadsProps): react_jsx_runtime.JSX.Element | null;
|
|
79
79
|
|
|
80
|
-
declare function isBlockNodeActive(editor: LexicalEditor, isActive: (node: LexicalNode) => boolean): boolean;
|
|
81
|
-
|
|
82
|
-
declare function isTextFormatActive(editor: LexicalEditor, format: TextFormatType): boolean;
|
|
83
|
-
|
|
84
80
|
/**
|
|
85
81
|
* Function that takes a Lexical editor config and modifies it to add the necessary
|
|
86
82
|
* `nodes` and `theme` to make `LiveblocksPlugin` works correctly.
|
|
@@ -183,238 +179,6 @@ type LiveblocksPluginProps = {
|
|
|
183
179
|
*/
|
|
184
180
|
declare const LiveblocksPlugin: ({ children, }: LiveblocksPluginProps) => JSX.Element;
|
|
185
181
|
|
|
186
|
-
type FloatingPosition = "top" | "bottom";
|
|
187
|
-
|
|
188
|
-
interface ToolbarSlotProps {
|
|
189
|
-
editor: LexicalEditor;
|
|
190
|
-
}
|
|
191
|
-
type ToolbarSlot = ReactNode | ComponentType<ToolbarSlotProps>;
|
|
192
|
-
interface ToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
193
|
-
/**
|
|
194
|
-
* The content of the toolbar, overriding the default content.
|
|
195
|
-
* Use the `before` and `after` props if you want to keep and extend the default content.
|
|
196
|
-
*/
|
|
197
|
-
children?: ToolbarSlot;
|
|
198
|
-
/**
|
|
199
|
-
* The content to display at the start of the toolbar.
|
|
200
|
-
*/
|
|
201
|
-
before?: ToolbarSlot;
|
|
202
|
-
/**
|
|
203
|
-
* The content to display at the end of the toolbar.
|
|
204
|
-
*/
|
|
205
|
-
after?: ToolbarSlot;
|
|
206
|
-
}
|
|
207
|
-
interface ToolbarButtonProps extends ComponentProps<"button"> {
|
|
208
|
-
/**
|
|
209
|
-
* The name of this button displayed in its tooltip.
|
|
210
|
-
*/
|
|
211
|
-
name: string;
|
|
212
|
-
/**
|
|
213
|
-
* An optional icon displayed in this button.
|
|
214
|
-
*/
|
|
215
|
-
icon?: ReactNode;
|
|
216
|
-
/**
|
|
217
|
-
* An optional keyboard shortcut displayed in this button's tooltip.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* "Mod-Alt-B" → "⌘⌥B" in Apple environments, "⌃⌥B" otherwise
|
|
221
|
-
* "Ctrl-Shift-Escape" → "⌃⇧⎋"
|
|
222
|
-
* "Space" → "␣"
|
|
223
|
-
*/
|
|
224
|
-
shortcut?: string;
|
|
225
|
-
}
|
|
226
|
-
interface ToolbarToggleProps extends ToolbarButtonProps {
|
|
227
|
-
/**
|
|
228
|
-
* Whether the button is toggled.
|
|
229
|
-
*/
|
|
230
|
-
active: boolean;
|
|
231
|
-
}
|
|
232
|
-
type ToolbarSeparatorProps = ComponentProps<"div">;
|
|
233
|
-
interface ToolbarBlockSelectorItem {
|
|
234
|
-
/**
|
|
235
|
-
* The name of this block element, displayed as the label of this item.
|
|
236
|
-
*/
|
|
237
|
-
name: string;
|
|
238
|
-
/**
|
|
239
|
-
* Optionally replace the name used as the label of this item by any content.
|
|
240
|
-
*/
|
|
241
|
-
label?: ReactNode;
|
|
242
|
-
/**
|
|
243
|
-
* An optional icon displayed in this item.
|
|
244
|
-
*/
|
|
245
|
-
icon?: ReactNode;
|
|
246
|
-
/**
|
|
247
|
-
* Whether this block element is currently active.
|
|
248
|
-
* Set to `"default"` to display this item when no other item is active.
|
|
249
|
-
*/
|
|
250
|
-
isActive: ((editor: LexicalEditor) => boolean) | "default";
|
|
251
|
-
/**
|
|
252
|
-
* A callback invoked when this item is selected.
|
|
253
|
-
*/
|
|
254
|
-
setActive: (editor: LexicalEditor) => void;
|
|
255
|
-
}
|
|
256
|
-
interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
|
|
257
|
-
/**
|
|
258
|
-
* The items displayed in this block selector.
|
|
259
|
-
* When provided as an array, the default items are overridden. To avoid this,
|
|
260
|
-
* a function can be provided instead and it will receive the default items.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* <Toolbar.BlockSelector
|
|
264
|
-
* items={[
|
|
265
|
-
* {
|
|
266
|
-
* name: "Text",
|
|
267
|
-
* isActive: "default",
|
|
268
|
-
* setActive: () => { ... },
|
|
269
|
-
* },
|
|
270
|
-
* {
|
|
271
|
-
* name: "Heading 1",
|
|
272
|
-
* isActive: () => { ... },
|
|
273
|
-
* setActive: () => { ... },
|
|
274
|
-
* },
|
|
275
|
-
* ]}
|
|
276
|
-
* />
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* <Toolbar.BlockSelector
|
|
280
|
-
* items={(defaultItems) => [
|
|
281
|
-
* ...defaultItems,
|
|
282
|
-
* {
|
|
283
|
-
* name: "Custom block",
|
|
284
|
-
* isActive: () => { ... },
|
|
285
|
-
* setActive: () => { ... },
|
|
286
|
-
* },
|
|
287
|
-
* ]}
|
|
288
|
-
* />
|
|
289
|
-
*/
|
|
290
|
-
items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
|
|
291
|
-
}
|
|
292
|
-
declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
|
|
293
|
-
declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element | null;
|
|
294
|
-
declare function ToolbarSectionCollaboration(): react_jsx_runtime.JSX.Element;
|
|
295
|
-
/**
|
|
296
|
-
* A static toolbar containing actions and values related to the editor.
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* <Toolbar />
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* <Toolbar >
|
|
303
|
-
* <Toolbar.BlockSelector />
|
|
304
|
-
* <Toolbar.Separator />
|
|
305
|
-
* <Toolbar.SectionInline />
|
|
306
|
-
* <Toolbar.Separator />
|
|
307
|
-
* <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
|
|
308
|
-
* </Toolbar>
|
|
309
|
-
*/
|
|
310
|
-
declare const Toolbar: react.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
311
|
-
/**
|
|
312
|
-
* A button for triggering actions.
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }}>Comment</Toolbar.Button>
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
|
|
319
|
-
*/
|
|
320
|
-
Button: react.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
321
|
-
/**
|
|
322
|
-
* A toggle button for values that can be active or inactive.
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* <Toolbar.Toggle name="Bold" active={isBold}>Bold</Toolbar.Toggle>
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
|
|
329
|
-
*/
|
|
330
|
-
Toggle: react.ForwardRefExoticComponent<Omit<ToolbarToggleProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
331
|
-
/**
|
|
332
|
-
* A dropdown selector to switch between different block types.
|
|
333
|
-
*
|
|
334
|
-
* @example
|
|
335
|
-
* <Toolbar.BlockSelector />
|
|
336
|
-
*/
|
|
337
|
-
BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
338
|
-
/**
|
|
339
|
-
* A visual (and accessible) separator to separate sections in a toolbar.
|
|
340
|
-
*/
|
|
341
|
-
Separator: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
342
|
-
/**
|
|
343
|
-
* A section containing history actions. (e.g. undo, redo)
|
|
344
|
-
*/
|
|
345
|
-
SectionHistory: typeof ToolbarSectionHistory;
|
|
346
|
-
/**
|
|
347
|
-
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
348
|
-
*/
|
|
349
|
-
SectionInline: typeof ToolbarSectionInline;
|
|
350
|
-
/**
|
|
351
|
-
* A section containing collaborative actions. (e.g. adding a comment)
|
|
352
|
-
*/
|
|
353
|
-
SectionCollaboration: typeof ToolbarSectionCollaboration;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
357
|
-
/**
|
|
358
|
-
* The vertical position of the floating toolbar.
|
|
359
|
-
*/
|
|
360
|
-
position?: FloatingPosition;
|
|
361
|
-
/**
|
|
362
|
-
* The vertical offset of the floating toolbar from the selection.
|
|
363
|
-
*/
|
|
364
|
-
offset?: number;
|
|
365
|
-
/**
|
|
366
|
-
* The content of the floating toolbar, overriding the default content.
|
|
367
|
-
* Use the `before` and `after` props if you want to keep and extend the default content.
|
|
368
|
-
*/
|
|
369
|
-
children?: ToolbarSlot;
|
|
370
|
-
/**
|
|
371
|
-
* The content to display at the start of the floating toolbar.
|
|
372
|
-
*/
|
|
373
|
-
before?: ToolbarSlot;
|
|
374
|
-
/**
|
|
375
|
-
* The content to display at the end of the floating toolbar.
|
|
376
|
-
*/
|
|
377
|
-
after?: ToolbarSlot;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* A floating toolbar attached to the selection and containing actions and values related to the editor.
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* <FloatingToolbar />
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* <FloatingToolbar>
|
|
387
|
-
* <Toolbar.BlockSelector />
|
|
388
|
-
* <Toolbar.Separator />
|
|
389
|
-
* <Toolbar.SectionInline />
|
|
390
|
-
* <Toolbar.Separator />
|
|
391
|
-
* <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
|
|
392
|
-
* </FloatingToolbar>
|
|
393
|
-
*/
|
|
394
|
-
declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
395
|
-
/**
|
|
396
|
-
* A component that can be wrapped around elements which are rendered outside of the floating
|
|
397
|
-
* toolbar (e.g. portals) to prevent the toolbar from closing when clicking/focusing within them.
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* <FloatingToolbar>
|
|
401
|
-
* <Popover.Root>
|
|
402
|
-
* <Popover.Trigger asChild>
|
|
403
|
-
* <Toolbar.Button>Open popover</Toolbar.Button>
|
|
404
|
-
* </Popover.Trigger>
|
|
405
|
-
* <Popover.Portal>
|
|
406
|
-
* <FloatingToolbar.External>
|
|
407
|
-
* <Popover.Content>
|
|
408
|
-
* This popover is rendered outside of the floating toolbar, but the toolbar will not close when clicking/focusing within it.
|
|
409
|
-
* </Popover.Content>
|
|
410
|
-
* </FloatingToolbar.External>
|
|
411
|
-
* </Popover.Portal>
|
|
412
|
-
* </Popover.Root>
|
|
413
|
-
* </FloatingToolbar>
|
|
414
|
-
*/
|
|
415
|
-
External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
416
|
-
};
|
|
417
|
-
|
|
418
182
|
interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
|
|
419
183
|
version: HistoryVersion;
|
|
420
184
|
onVersionRestore?: (version: HistoryVersion) => void;
|
|
@@ -427,4 +191,4 @@ interface HistoryVersionPreviewProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
427
191
|
*/
|
|
428
192
|
declare const HistoryVersionPreview: react.ForwardRefExoticComponent<HistoryVersionPreviewProps & react.RefAttributes<HTMLDivElement>>;
|
|
429
193
|
|
|
430
|
-
export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps,
|
|
194
|
+
export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, HistoryVersionPreview, HistoryVersionPreviewProps, LiveblocksPlugin, OPEN_FLOATING_COMPOSER_COMMAND, liveblocksConfig, useEditorStatus, useIsEditorReady, useIsThreadActive };
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,8 @@ var anchoredThreads = require('./comments/anchored-threads.js');
|
|
|
6
6
|
var commentPluginProvider = require('./comments/comment-plugin-provider.js');
|
|
7
7
|
var floatingComposer = require('./comments/floating-composer.js');
|
|
8
8
|
var floatingThreads = require('./comments/floating-threads.js');
|
|
9
|
-
var isBlockNodeActive = require('./is-block-node-active.js');
|
|
10
|
-
var isTextFormatActive = require('./is-text-format-active.js');
|
|
11
9
|
var liveblocksConfig = require('./liveblocks-config.js');
|
|
12
10
|
var liveblocksPluginProvider = require('./liveblocks-plugin-provider.js');
|
|
13
|
-
var floatingToolbar = require('./toolbar/floating-toolbar.js');
|
|
14
|
-
var toolbar = require('./toolbar/toolbar.js');
|
|
15
11
|
var historyVersionPreview = require('./version-history/history-version-preview.js');
|
|
16
12
|
|
|
17
13
|
core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
|
|
@@ -21,13 +17,9 @@ exports.useIsThreadActive = commentPluginProvider.useIsThreadActive;
|
|
|
21
17
|
exports.FloatingComposer = floatingComposer.FloatingComposer;
|
|
22
18
|
exports.OPEN_FLOATING_COMPOSER_COMMAND = floatingComposer.OPEN_FLOATING_COMPOSER_COMMAND;
|
|
23
19
|
exports.FloatingThreads = floatingThreads.FloatingThreads;
|
|
24
|
-
exports.isBlockNodeActive = isBlockNodeActive.isBlockNodeActive;
|
|
25
|
-
exports.isTextFormatActive = isTextFormatActive.isTextFormatActive;
|
|
26
20
|
exports.liveblocksConfig = liveblocksConfig.liveblocksConfig;
|
|
27
21
|
exports.LiveblocksPlugin = liveblocksPluginProvider.LiveblocksPlugin;
|
|
28
22
|
exports.useEditorStatus = liveblocksPluginProvider.useEditorStatus;
|
|
29
23
|
exports.useIsEditorReady = liveblocksPluginProvider.useIsEditorReady;
|
|
30
|
-
exports.FloatingToolbar = floatingToolbar.FloatingToolbar;
|
|
31
|
-
exports.Toolbar = toolbar.Toolbar;
|
|
32
24
|
exports.HistoryVersionPreview = historyVersionPreview.HistoryVersionPreview;
|
|
33
25
|
//# 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 type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\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 type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -4,12 +4,8 @@ export { AnchoredThreads } from './comments/anchored-threads.mjs';
|
|
|
4
4
|
export { useIsThreadActive } from './comments/comment-plugin-provider.mjs';
|
|
5
5
|
export { FloatingComposer, OPEN_FLOATING_COMPOSER_COMMAND } from './comments/floating-composer.mjs';
|
|
6
6
|
export { FloatingThreads } from './comments/floating-threads.mjs';
|
|
7
|
-
export { isBlockNodeActive } from './is-block-node-active.mjs';
|
|
8
|
-
export { isTextFormatActive } from './is-text-format-active.mjs';
|
|
9
7
|
export { liveblocksConfig } from './liveblocks-config.mjs';
|
|
10
8
|
export { LiveblocksPlugin, useEditorStatus, useIsEditorReady } from './liveblocks-plugin-provider.mjs';
|
|
11
|
-
export { FloatingToolbar } from './toolbar/floating-toolbar.mjs';
|
|
12
|
-
export { Toolbar } from './toolbar/toolbar.mjs';
|
|
13
9
|
export { HistoryVersionPreview } from './version-history/history-version-preview.mjs';
|
|
14
10
|
|
|
15
11
|
detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
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 type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\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 type { AnchoredThreadsProps } from \"./comments/anchored-threads\";\nexport { AnchoredThreads } from \"./comments/anchored-threads\";\nexport { useIsThreadActive } from \"./comments/comment-plugin-provider\";\nexport type { FloatingComposerProps } from \"./comments/floating-composer\";\nexport {\n FloatingComposer,\n OPEN_FLOATING_COMPOSER_COMMAND,\n} from \"./comments/floating-composer\";\nexport type { FloatingThreadsProps } from \"./comments/floating-threads\";\nexport { FloatingThreads } from \"./comments/floating-threads\";\nexport { liveblocksConfig } from \"./liveblocks-config\";\nexport {\n LiveblocksPlugin,\n useEditorStatus,\n useIsEditorReady,\n} from \"./liveblocks-plugin-provider\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/history-version-preview\";\nexport { HistoryVersionPreview } from \"./version-history/history-version-preview\";\n"],"names":[],"mappings":";;;;;;;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
|
|
@@ -14,7 +14,6 @@ var commentPluginProvider = require('./comments/comment-plugin-provider.js');
|
|
|
14
14
|
var threadMarkNode = require('./comments/thread-mark-node.js');
|
|
15
15
|
var mentionNode = require('./mentions/mention-node.js');
|
|
16
16
|
var mentionPlugin = require('./mentions/mention-plugin.js');
|
|
17
|
-
var useRootElement = require('./use-root-element.js');
|
|
18
17
|
|
|
19
18
|
const providersMap = /* @__PURE__ */ new Map();
|
|
20
19
|
function useEditorStatus() {
|
|
@@ -119,7 +118,7 @@ const LiveblocksPlugin = ({
|
|
|
119
118
|
},
|
|
120
119
|
[room]
|
|
121
120
|
);
|
|
122
|
-
const root = useRootElement
|
|
121
|
+
const root = useRootElement();
|
|
123
122
|
_private.useLayoutEffect(() => {
|
|
124
123
|
if (root === null)
|
|
125
124
|
return;
|
|
@@ -161,8 +160,22 @@ const LiveblocksPlugin = ({
|
|
|
161
160
|
]
|
|
162
161
|
});
|
|
163
162
|
};
|
|
163
|
+
function useRootElement() {
|
|
164
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
165
|
+
const subscribe = react.useCallback(
|
|
166
|
+
(onStoreChange) => {
|
|
167
|
+
return editor.registerRootListener(onStoreChange);
|
|
168
|
+
},
|
|
169
|
+
[editor]
|
|
170
|
+
);
|
|
171
|
+
const getSnapshot = react.useCallback(() => {
|
|
172
|
+
return editor.getRootElement();
|
|
173
|
+
}, [editor]);
|
|
174
|
+
return react.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
175
|
+
}
|
|
164
176
|
|
|
165
177
|
exports.LiveblocksPlugin = LiveblocksPlugin;
|
|
166
178
|
exports.useEditorStatus = useEditorStatus;
|
|
167
179
|
exports.useIsEditorReady = useIsEditorReady;
|
|
180
|
+
exports.useRootElement = useRootElement;
|
|
168
181
|
//# sourceMappingURL=liveblocks-plugin-provider.js.map
|