@liveblocks/react-tiptap 2.16.0-toolbars2 → 2.16.0-toolbars4

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/index.d.mts CHANGED
@@ -36,6 +36,9 @@ interface AnchoredThreadsProps<M extends BaseMetadata = DM> extends Omit<Compone
36
36
  }
37
37
  declare function AnchoredThreads({ threads, components, className, style, editor, ...props }: AnchoredThreadsProps): react_jsx_runtime.JSX.Element | null;
38
38
 
39
+ type FloatingComposerProps<M extends BaseMetadata$1 = DM> = Omit<ComposerProps<M>, "threadId" | "commentId"> & {
40
+ editor: Editor | null;
41
+ };
39
42
  declare const FloatingComposer: react.ForwardRefExoticComponent<Omit<ComposerProps<BaseMetadata$1>, "threadId" | "commentId"> & {
40
43
  editor: Editor | null;
41
44
  } & react.RefAttributes<HTMLFormElement>>;
@@ -79,49 +82,236 @@ interface ToolbarSlotProps {
79
82
  }
80
83
  type ToolbarSlot = ReactNode | ComponentType<ToolbarSlotProps>;
81
84
  interface ToolbarProps extends Omit<ComponentProps<"div">, "children"> {
85
+ /**
86
+ * The Tiptap editor.
87
+ */
82
88
  editor: Editor | null;
89
+ /**
90
+ * The content of the toolbar, overriding the default content.
91
+ * Use the `before` and `after` props if you want to keep and extend the default content.
92
+ */
83
93
  children?: ToolbarSlot;
94
+ /**
95
+ * The content to display at the start of the toolbar.
96
+ */
84
97
  before?: ToolbarSlot;
98
+ /**
99
+ * The content to display at the end of the toolbar.
100
+ */
85
101
  after?: ToolbarSlot;
86
102
  }
87
103
  interface ToolbarButtonProps extends ComponentProps<"button"> {
88
- icon?: ReactNode;
104
+ /**
105
+ * The name of this button displayed in its tooltip.
106
+ */
89
107
  name: string;
108
+ /**
109
+ * An optional icon displayed in this button.
110
+ */
111
+ icon?: ReactNode;
112
+ /**
113
+ * An optional keyboard shortcut displayed in this button's tooltip.
114
+ *
115
+ * @example
116
+ * "Mod-Alt-B" → "⌘⌥B" in Apple environments, "⌃⌥B" otherwise
117
+ * "Ctrl-Shift-Escape" → "⌃⇧⎋"
118
+ * "Space" → "␣"
119
+ */
90
120
  shortcut?: string;
91
121
  }
92
122
  interface ToolbarToggleProps extends ToolbarButtonProps {
123
+ /**
124
+ * Whether the button is toggled.
125
+ */
93
126
  active: boolean;
94
127
  }
95
128
  interface ToolbarBlockSelectorItem {
129
+ /**
130
+ * The name of this block element, displayed as the label of this item.
131
+ */
96
132
  name: string;
97
- isActive: (editor: Editor) => boolean;
133
+ /**
134
+ * Optionally replace the name used as the label of this item by any content.
135
+ */
136
+ label?: ReactNode;
137
+ /**
138
+ * An optional icon displayed in this item.
139
+ */
140
+ icon?: ReactNode;
141
+ /**
142
+ * Whether this block element is currently active.
143
+ * Set to `"default"` to display this item when no other item is active.
144
+ */
145
+ isActive: ((editor: Editor) => boolean) | "default";
146
+ /**
147
+ * A callback invoked when this item is selected.
148
+ */
98
149
  setActive: (editor: Editor) => void;
99
150
  }
100
151
  interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
101
- items?: ToolbarBlockSelectorItem[];
152
+ /**
153
+ * The items displayed in this block selector.
154
+ * When provided as an array, the default items are overridden. To avoid this,
155
+ * a function can be provided instead and it will receive the default items.
156
+ *
157
+ * @example
158
+ * <Toolbar.BlockSelector
159
+ * items={[
160
+ * {
161
+ * name: "Text",
162
+ * isActive: "default",
163
+ * setActive: () => { ... },
164
+ * },
165
+ * {
166
+ * name: "Heading 1",
167
+ * isActive: () => { ... },
168
+ * setActive: () => { ... },
169
+ * },
170
+ * ]}
171
+ * />
172
+ *
173
+ * @example
174
+ * <Toolbar.BlockSelector
175
+ * items={(defaultItems) => [
176
+ * ...defaultItems,
177
+ * {
178
+ * name: "Custom block",
179
+ * isActive: () => { ... },
180
+ * setActive: () => { ... },
181
+ * },
182
+ * ]}
183
+ * />
184
+ */
185
+ items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
102
186
  }
187
+ type ToolbarSeparatorProps = ComponentProps<"div">;
103
188
  declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
104
189
  declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element;
105
190
  declare function ToolbarSectionCollaboration(): react_jsx_runtime.JSX.Element;
191
+ /**
192
+ * A static toolbar containing actions and values related to the editor.
193
+ *
194
+ * @example
195
+ * <Toolbar editor={editor} />
196
+ *
197
+ * @example
198
+ * <Toolbar editor={editor}>
199
+ * <Toolbar.BlockSelector />
200
+ * <Toolbar.Separator />
201
+ * <Toolbar.SectionInline />
202
+ * <Toolbar.Separator />
203
+ * <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
204
+ * </Toolbar>
205
+ */
106
206
  declare const Toolbar: react.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
207
+ /**
208
+ * A button for triggering actions.
209
+ *
210
+ * @example
211
+ * <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }}>Comment</Toolbar.Button>
212
+ *
213
+ * @example
214
+ * <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
215
+ */
107
216
  Button: react.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
217
+ /**
218
+ * A toggle button for values that can be active or inactive.
219
+ *
220
+ * @example
221
+ * <Toolbar.Toggle name="Bold" active={isBold}>Bold</Toolbar.Toggle>
222
+ *
223
+ * @example
224
+ * <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
225
+ */
108
226
  Toggle: react.ForwardRefExoticComponent<Omit<ToolbarToggleProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
227
+ /**
228
+ * A dropdown selector to switch between different block types.
229
+ *
230
+ * @example
231
+ * <Toolbar.BlockSelector />
232
+ */
233
+ BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
234
+ /**
235
+ * A visual (and accessible) separator to separate sections in a toolbar.
236
+ */
109
237
  Separator: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
238
+ /**
239
+ * A section containing history actions. (e.g. undo, redo)
240
+ */
110
241
  SectionHistory: typeof ToolbarSectionHistory;
242
+ /**
243
+ * A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
244
+ */
111
245
  SectionInline: typeof ToolbarSectionInline;
246
+ /**
247
+ * A section containing collaborative actions. (e.g. adding a comment)
248
+ */
112
249
  SectionCollaboration: typeof ToolbarSectionCollaboration;
113
- BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
114
250
  };
115
251
 
116
252
  interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
253
+ /**
254
+ * The Tiptap editor.
255
+ */
117
256
  editor: Editor | null;
257
+ /**
258
+ * The vertical position of the floating toolbar.
259
+ */
118
260
  position?: FloatingPosition;
261
+ /**
262
+ * The vertical offset of the floating toolbar from the selection.
263
+ */
119
264
  offset?: number;
265
+ /**
266
+ * The content of the floating toolbar, overriding the default content.
267
+ * Use the `before` and `after` props if you want to keep and extend the default content.
268
+ */
120
269
  children?: ToolbarSlot;
270
+ /**
271
+ * The content to display at the start of the floating toolbar.
272
+ */
121
273
  before?: ToolbarSlot;
274
+ /**
275
+ * The content to display at the end of the floating toolbar.
276
+ */
122
277
  after?: ToolbarSlot;
123
278
  }
279
+ /**
280
+ * A floating toolbar attached to the selection and containing actions and values related to the editor.
281
+ *
282
+ * @example
283
+ * <FloatingToolbar editor={editor} />
284
+ *
285
+ * @example
286
+ * <FloatingToolbar editor={editor}>
287
+ * <Toolbar.BlockSelector />
288
+ * <Toolbar.Separator />
289
+ * <Toolbar.SectionInline />
290
+ * <Toolbar.Separator />
291
+ * <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
292
+ * </FloatingToolbar>
293
+ */
124
294
  declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
295
+ /**
296
+ * A component that can be wrapped around elements which are rendered outside of the floating
297
+ * toolbar (e.g. portals) to prevent the toolbar from closing when clicking/focusing within them.
298
+ *
299
+ * @example
300
+ * <FloatingToolbar editor={editor}>
301
+ * <Popover.Root>
302
+ * <Popover.Trigger asChild>
303
+ * <Toolbar.Button>Open popover</Toolbar.Button>
304
+ * </Popover.Trigger>
305
+ * <Popover.Portal>
306
+ * <FloatingToolbar.External>
307
+ * <Popover.Content>
308
+ * This popover is rendered outside of the floating toolbar, but the toolbar will not close when clicking/focusing within it.
309
+ * </Popover.Content>
310
+ * </FloatingToolbar.External>
311
+ * </Popover.Portal>
312
+ * </Popover.Root>
313
+ * </FloatingToolbar>
314
+ */
125
315
  External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
126
316
  };
127
317
 
@@ -144,4 +334,4 @@ declare module "@tiptap/core" {
144
334
  }
145
335
  }
146
336
 
147
- export { AnchoredThreads, FloatingComposer, FloatingThreads, FloatingToolbar, HistoryVersionPreview, Toolbar, useIsEditorReady, useLiveblocksExtension };
337
+ export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, Toolbar, ToolbarBlockSelectorItem, ToolbarBlockSelectorProps, ToolbarButtonProps, ToolbarProps, ToolbarSeparatorProps, ToolbarToggleProps, useIsEditorReady, useLiveblocksExtension };
package/dist/index.d.ts CHANGED
@@ -36,6 +36,9 @@ interface AnchoredThreadsProps<M extends BaseMetadata = DM> extends Omit<Compone
36
36
  }
37
37
  declare function AnchoredThreads({ threads, components, className, style, editor, ...props }: AnchoredThreadsProps): react_jsx_runtime.JSX.Element | null;
38
38
 
39
+ type FloatingComposerProps<M extends BaseMetadata$1 = DM> = Omit<ComposerProps<M>, "threadId" | "commentId"> & {
40
+ editor: Editor | null;
41
+ };
39
42
  declare const FloatingComposer: react.ForwardRefExoticComponent<Omit<ComposerProps<BaseMetadata$1>, "threadId" | "commentId"> & {
40
43
  editor: Editor | null;
41
44
  } & react.RefAttributes<HTMLFormElement>>;
@@ -79,49 +82,236 @@ interface ToolbarSlotProps {
79
82
  }
80
83
  type ToolbarSlot = ReactNode | ComponentType<ToolbarSlotProps>;
81
84
  interface ToolbarProps extends Omit<ComponentProps<"div">, "children"> {
85
+ /**
86
+ * The Tiptap editor.
87
+ */
82
88
  editor: Editor | null;
89
+ /**
90
+ * The content of the toolbar, overriding the default content.
91
+ * Use the `before` and `after` props if you want to keep and extend the default content.
92
+ */
83
93
  children?: ToolbarSlot;
94
+ /**
95
+ * The content to display at the start of the toolbar.
96
+ */
84
97
  before?: ToolbarSlot;
98
+ /**
99
+ * The content to display at the end of the toolbar.
100
+ */
85
101
  after?: ToolbarSlot;
86
102
  }
87
103
  interface ToolbarButtonProps extends ComponentProps<"button"> {
88
- icon?: ReactNode;
104
+ /**
105
+ * The name of this button displayed in its tooltip.
106
+ */
89
107
  name: string;
108
+ /**
109
+ * An optional icon displayed in this button.
110
+ */
111
+ icon?: ReactNode;
112
+ /**
113
+ * An optional keyboard shortcut displayed in this button's tooltip.
114
+ *
115
+ * @example
116
+ * "Mod-Alt-B" → "⌘⌥B" in Apple environments, "⌃⌥B" otherwise
117
+ * "Ctrl-Shift-Escape" → "⌃⇧⎋"
118
+ * "Space" → "␣"
119
+ */
90
120
  shortcut?: string;
91
121
  }
92
122
  interface ToolbarToggleProps extends ToolbarButtonProps {
123
+ /**
124
+ * Whether the button is toggled.
125
+ */
93
126
  active: boolean;
94
127
  }
95
128
  interface ToolbarBlockSelectorItem {
129
+ /**
130
+ * The name of this block element, displayed as the label of this item.
131
+ */
96
132
  name: string;
97
- isActive: (editor: Editor) => boolean;
133
+ /**
134
+ * Optionally replace the name used as the label of this item by any content.
135
+ */
136
+ label?: ReactNode;
137
+ /**
138
+ * An optional icon displayed in this item.
139
+ */
140
+ icon?: ReactNode;
141
+ /**
142
+ * Whether this block element is currently active.
143
+ * Set to `"default"` to display this item when no other item is active.
144
+ */
145
+ isActive: ((editor: Editor) => boolean) | "default";
146
+ /**
147
+ * A callback invoked when this item is selected.
148
+ */
98
149
  setActive: (editor: Editor) => void;
99
150
  }
100
151
  interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
101
- items?: ToolbarBlockSelectorItem[];
152
+ /**
153
+ * The items displayed in this block selector.
154
+ * When provided as an array, the default items are overridden. To avoid this,
155
+ * a function can be provided instead and it will receive the default items.
156
+ *
157
+ * @example
158
+ * <Toolbar.BlockSelector
159
+ * items={[
160
+ * {
161
+ * name: "Text",
162
+ * isActive: "default",
163
+ * setActive: () => { ... },
164
+ * },
165
+ * {
166
+ * name: "Heading 1",
167
+ * isActive: () => { ... },
168
+ * setActive: () => { ... },
169
+ * },
170
+ * ]}
171
+ * />
172
+ *
173
+ * @example
174
+ * <Toolbar.BlockSelector
175
+ * items={(defaultItems) => [
176
+ * ...defaultItems,
177
+ * {
178
+ * name: "Custom block",
179
+ * isActive: () => { ... },
180
+ * setActive: () => { ... },
181
+ * },
182
+ * ]}
183
+ * />
184
+ */
185
+ items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
102
186
  }
187
+ type ToolbarSeparatorProps = ComponentProps<"div">;
103
188
  declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
104
189
  declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element;
105
190
  declare function ToolbarSectionCollaboration(): react_jsx_runtime.JSX.Element;
191
+ /**
192
+ * A static toolbar containing actions and values related to the editor.
193
+ *
194
+ * @example
195
+ * <Toolbar editor={editor} />
196
+ *
197
+ * @example
198
+ * <Toolbar editor={editor}>
199
+ * <Toolbar.BlockSelector />
200
+ * <Toolbar.Separator />
201
+ * <Toolbar.SectionInline />
202
+ * <Toolbar.Separator />
203
+ * <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
204
+ * </Toolbar>
205
+ */
106
206
  declare const Toolbar: react.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
207
+ /**
208
+ * A button for triggering actions.
209
+ *
210
+ * @example
211
+ * <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }}>Comment</Toolbar.Button>
212
+ *
213
+ * @example
214
+ * <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
215
+ */
107
216
  Button: react.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
217
+ /**
218
+ * A toggle button for values that can be active or inactive.
219
+ *
220
+ * @example
221
+ * <Toolbar.Toggle name="Bold" active={isBold}>Bold</Toolbar.Toggle>
222
+ *
223
+ * @example
224
+ * <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
225
+ */
108
226
  Toggle: react.ForwardRefExoticComponent<Omit<ToolbarToggleProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
227
+ /**
228
+ * A dropdown selector to switch between different block types.
229
+ *
230
+ * @example
231
+ * <Toolbar.BlockSelector />
232
+ */
233
+ BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
234
+ /**
235
+ * A visual (and accessible) separator to separate sections in a toolbar.
236
+ */
109
237
  Separator: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
238
+ /**
239
+ * A section containing history actions. (e.g. undo, redo)
240
+ */
110
241
  SectionHistory: typeof ToolbarSectionHistory;
242
+ /**
243
+ * A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
244
+ */
111
245
  SectionInline: typeof ToolbarSectionInline;
246
+ /**
247
+ * A section containing collaborative actions. (e.g. adding a comment)
248
+ */
112
249
  SectionCollaboration: typeof ToolbarSectionCollaboration;
113
- BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
114
250
  };
115
251
 
116
252
  interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
253
+ /**
254
+ * The Tiptap editor.
255
+ */
117
256
  editor: Editor | null;
257
+ /**
258
+ * The vertical position of the floating toolbar.
259
+ */
118
260
  position?: FloatingPosition;
261
+ /**
262
+ * The vertical offset of the floating toolbar from the selection.
263
+ */
119
264
  offset?: number;
265
+ /**
266
+ * The content of the floating toolbar, overriding the default content.
267
+ * Use the `before` and `after` props if you want to keep and extend the default content.
268
+ */
120
269
  children?: ToolbarSlot;
270
+ /**
271
+ * The content to display at the start of the floating toolbar.
272
+ */
121
273
  before?: ToolbarSlot;
274
+ /**
275
+ * The content to display at the end of the floating toolbar.
276
+ */
122
277
  after?: ToolbarSlot;
123
278
  }
279
+ /**
280
+ * A floating toolbar attached to the selection and containing actions and values related to the editor.
281
+ *
282
+ * @example
283
+ * <FloatingToolbar editor={editor} />
284
+ *
285
+ * @example
286
+ * <FloatingToolbar editor={editor}>
287
+ * <Toolbar.BlockSelector />
288
+ * <Toolbar.Separator />
289
+ * <Toolbar.SectionInline />
290
+ * <Toolbar.Separator />
291
+ * <Toolbar.Button name="Custom action" onClick={() => { ... }} icon={<Icon.QuestionMark />} />
292
+ * </FloatingToolbar>
293
+ */
124
294
  declare const FloatingToolbar: react.ForwardRefExoticComponent<Omit<FloatingToolbarProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
295
+ /**
296
+ * A component that can be wrapped around elements which are rendered outside of the floating
297
+ * toolbar (e.g. portals) to prevent the toolbar from closing when clicking/focusing within them.
298
+ *
299
+ * @example
300
+ * <FloatingToolbar editor={editor}>
301
+ * <Popover.Root>
302
+ * <Popover.Trigger asChild>
303
+ * <Toolbar.Button>Open popover</Toolbar.Button>
304
+ * </Popover.Trigger>
305
+ * <Popover.Portal>
306
+ * <FloatingToolbar.External>
307
+ * <Popover.Content>
308
+ * This popover is rendered outside of the floating toolbar, but the toolbar will not close when clicking/focusing within it.
309
+ * </Popover.Content>
310
+ * </FloatingToolbar.External>
311
+ * </Popover.Portal>
312
+ * </Popover.Root>
313
+ * </FloatingToolbar>
314
+ */
125
315
  External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
126
316
  };
127
317
 
@@ -144,4 +334,4 @@ declare module "@tiptap/core" {
144
334
  }
145
335
  }
146
336
 
147
- export { AnchoredThreads, FloatingComposer, FloatingThreads, FloatingToolbar, HistoryVersionPreview, Toolbar, useIsEditorReady, useLiveblocksExtension };
337
+ export { AnchoredThreads, AnchoredThreadsProps, FloatingComposer, FloatingComposerProps, FloatingThreads, FloatingThreadsProps, FloatingToolbar, FloatingToolbarProps, HistoryVersionPreview, HistoryVersionPreviewProps, Toolbar, ToolbarBlockSelectorItem, ToolbarBlockSelectorProps, ToolbarButtonProps, ToolbarProps, ToolbarSeparatorProps, ToolbarToggleProps, useIsEditorReady, useLiveblocksExtension };
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 type { CommentsCommands } from \"./types\";\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { AnchoredThreads } from \"./comments/AnchoredThreads\";\nexport { FloatingComposer } from \"./comments/FloatingComposer\";\nexport { FloatingThreads } from \"./comments/FloatingThreads\";\nexport { useLiveblocksExtension } from \"./LiveblocksExtension\";\nexport { useIsEditorReady } from \"./LiveblocksExtension\";\nexport { FloatingToolbar } from \"./toolbar/FloatingToolbar\";\nexport { Toolbar } from \"./toolbar/Toolbar\";\nexport { HistoryVersionPreview } from \"./version-history/HistoryVersionPreview\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n comments: CommentsCommands<ReturnType>;\n }\n}\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;AAKAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport type { CommentsCommands } from \"./types\";\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/AnchoredThreads\";\nexport { AnchoredThreads } from \"./comments/AnchoredThreads\";\nexport type { FloatingComposerProps } from \"./comments/FloatingComposer\";\nexport { FloatingComposer } from \"./comments/FloatingComposer\";\nexport type { FloatingThreadsProps } from \"./comments/FloatingThreads\";\nexport { FloatingThreads } from \"./comments/FloatingThreads\";\nexport { useLiveblocksExtension } from \"./LiveblocksExtension\";\nexport { useIsEditorReady } from \"./LiveblocksExtension\";\nexport type { FloatingToolbarProps } from \"./toolbar/FloatingToolbar\";\nexport { FloatingToolbar } from \"./toolbar/FloatingToolbar\";\nexport type {\n ToolbarBlockSelectorItem,\n ToolbarBlockSelectorProps,\n ToolbarButtonProps,\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarToggleProps,\n} from \"./toolbar/Toolbar\";\nexport { Toolbar } from \"./toolbar/Toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/HistoryVersionPreview\";\nexport { HistoryVersionPreview } from \"./version-history/HistoryVersionPreview\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n comments: CommentsCommands<ReturnType>;\n }\n}\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;AAKAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport type { CommentsCommands } from \"./types\";\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { AnchoredThreads } from \"./comments/AnchoredThreads\";\nexport { FloatingComposer } from \"./comments/FloatingComposer\";\nexport { FloatingThreads } from \"./comments/FloatingThreads\";\nexport { useLiveblocksExtension } from \"./LiveblocksExtension\";\nexport { useIsEditorReady } from \"./LiveblocksExtension\";\nexport { FloatingToolbar } from \"./toolbar/FloatingToolbar\";\nexport { Toolbar } from \"./toolbar/Toolbar\";\nexport { HistoryVersionPreview } from \"./version-history/HistoryVersionPreview\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n comments: CommentsCommands<ReturnType>;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport type { CommentsCommands } from \"./types\";\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AnchoredThreadsProps } from \"./comments/AnchoredThreads\";\nexport { AnchoredThreads } from \"./comments/AnchoredThreads\";\nexport type { FloatingComposerProps } from \"./comments/FloatingComposer\";\nexport { FloatingComposer } from \"./comments/FloatingComposer\";\nexport type { FloatingThreadsProps } from \"./comments/FloatingThreads\";\nexport { FloatingThreads } from \"./comments/FloatingThreads\";\nexport { useLiveblocksExtension } from \"./LiveblocksExtension\";\nexport { useIsEditorReady } from \"./LiveblocksExtension\";\nexport type { FloatingToolbarProps } from \"./toolbar/FloatingToolbar\";\nexport { FloatingToolbar } from \"./toolbar/FloatingToolbar\";\nexport type {\n ToolbarBlockSelectorItem,\n ToolbarBlockSelectorProps,\n ToolbarButtonProps,\n ToolbarProps,\n ToolbarSeparatorProps,\n ToolbarToggleProps,\n} from \"./toolbar/Toolbar\";\nexport { Toolbar } from \"./toolbar/Toolbar\";\nexport type { HistoryVersionPreviewProps } from \"./version-history/HistoryVersionPreview\";\nexport { HistoryVersionPreview } from \"./version-history/HistoryVersionPreview\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n comments: CommentsCommands<ReturnType>;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
@@ -49,11 +49,6 @@ const FloatingToolbar = Object.assign(
49
49
  const [isPointerDown, setPointerDown] = react.useState(false);
50
50
  const [isFocused, setFocused] = react.useState(false);
51
51
  const [isManuallyClosed, setManuallyClosed] = react.useState(false);
52
- const isEditable = react$1.useEditorState({
53
- editor,
54
- equalityFn: Object.is,
55
- selector: (ctx) => ctx.editor?.isEditable ?? false
56
- }) ?? false;
57
52
  const hasSelectionRange = react$1.useEditorState({
58
53
  editor,
59
54
  equalityFn: Object.is,
@@ -204,7 +199,7 @@ const FloatingToolbar = Object.assign(
204
199
  [onPointerDown]
205
200
  );
206
201
  react.useEffect(() => {
207
- if (!editor || !isEditable) {
202
+ if (!editor) {
208
203
  return;
209
204
  }
210
205
  const handlePointerDown2 = () => {
@@ -213,15 +208,15 @@ const FloatingToolbar = Object.assign(
213
208
  const handlePointerUp = () => {
214
209
  setPointerDown(false);
215
210
  };
216
- document.addEventListener("pointerdown", handlePointerDown2);
217
- document.addEventListener("pointercancel", handlePointerUp);
218
- document.addEventListener("pointerup", handlePointerUp);
211
+ editor.view.dom.addEventListener("pointerdown", handlePointerDown2);
212
+ editor.view.dom.addEventListener("pointercancel", handlePointerUp);
213
+ editor.view.dom.addEventListener("pointerup", handlePointerUp);
219
214
  return () => {
220
- document.removeEventListener("pointerdown", handlePointerDown2);
221
- document.removeEventListener("pointercancel", handlePointerUp);
222
- document.removeEventListener("pointerup", handlePointerUp);
215
+ editor.view.dom.removeEventListener("pointerdown", handlePointerDown2);
216
+ editor.view.dom.removeEventListener("pointercancel", handlePointerUp);
217
+ editor.view.dom.removeEventListener("pointerup", handlePointerUp);
223
218
  };
224
- }, [editor, isEditable]);
219
+ }, [editor]);
225
220
  _private$1.useLayoutEffect(() => {
226
221
  if (!editor || !delayedIsOpen) {
227
222
  return;