@liveblocks/react-tiptap 2.16.0-toolbars3 → 2.16.0-toolbars5
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 +192 -3
- package/dist/index.d.ts +192 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/toolbar/FloatingToolbar.js +4 -4
- package/dist/toolbar/FloatingToolbar.js.map +1 -1
- package/dist/toolbar/FloatingToolbar.mjs +4 -4
- package/dist/toolbar/FloatingToolbar.mjs.map +1 -1
- package/dist/toolbar/Toolbar.js +4 -5
- package/dist/toolbar/Toolbar.js.map +1 -1
- package/dist/toolbar/Toolbar.mjs +4 -5
- package/dist/toolbar/Toolbar.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +6 -7
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,50 +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
|
-
|
|
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;
|
|
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
|
+
*/
|
|
97
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
|
+
*/
|
|
98
145
|
isActive: ((editor: Editor) => boolean) | "default";
|
|
146
|
+
/**
|
|
147
|
+
* A callback invoked when this item is selected.
|
|
148
|
+
*/
|
|
99
149
|
setActive: (editor: Editor) => void;
|
|
100
150
|
}
|
|
101
151
|
interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
|
|
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
|
+
*/
|
|
102
185
|
items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
|
|
103
186
|
}
|
|
187
|
+
type ToolbarSeparatorProps = ComponentProps<"div">;
|
|
104
188
|
declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
|
|
105
189
|
declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element;
|
|
106
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
|
+
*/
|
|
107
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
|
+
*/
|
|
108
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
|
+
*/
|
|
109
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
|
+
*/
|
|
110
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
|
+
*/
|
|
111
241
|
SectionHistory: typeof ToolbarSectionHistory;
|
|
242
|
+
/**
|
|
243
|
+
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
244
|
+
*/
|
|
112
245
|
SectionInline: typeof ToolbarSectionInline;
|
|
246
|
+
/**
|
|
247
|
+
* A section containing collaborative actions. (e.g. adding a comment)
|
|
248
|
+
*/
|
|
113
249
|
SectionCollaboration: typeof ToolbarSectionCollaboration;
|
|
114
|
-
BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
115
250
|
};
|
|
116
251
|
|
|
117
252
|
interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
253
|
+
/**
|
|
254
|
+
* The Tiptap editor.
|
|
255
|
+
*/
|
|
118
256
|
editor: Editor | null;
|
|
257
|
+
/**
|
|
258
|
+
* The vertical position of the floating toolbar.
|
|
259
|
+
*/
|
|
119
260
|
position?: FloatingPosition;
|
|
261
|
+
/**
|
|
262
|
+
* The vertical offset of the floating toolbar from the selection.
|
|
263
|
+
*/
|
|
120
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
|
+
*/
|
|
121
269
|
children?: ToolbarSlot;
|
|
270
|
+
/**
|
|
271
|
+
* The content to display at the start of the floating toolbar.
|
|
272
|
+
*/
|
|
122
273
|
before?: ToolbarSlot;
|
|
274
|
+
/**
|
|
275
|
+
* The content to display at the end of the floating toolbar.
|
|
276
|
+
*/
|
|
123
277
|
after?: ToolbarSlot;
|
|
124
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
|
+
*/
|
|
125
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
|
+
*/
|
|
126
315
|
External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
127
316
|
};
|
|
128
317
|
|
|
@@ -145,4 +334,4 @@ declare module "@tiptap/core" {
|
|
|
145
334
|
}
|
|
146
335
|
}
|
|
147
336
|
|
|
148
|
-
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,50 +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
|
-
|
|
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;
|
|
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
|
+
*/
|
|
97
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
|
+
*/
|
|
98
145
|
isActive: ((editor: Editor) => boolean) | "default";
|
|
146
|
+
/**
|
|
147
|
+
* A callback invoked when this item is selected.
|
|
148
|
+
*/
|
|
99
149
|
setActive: (editor: Editor) => void;
|
|
100
150
|
}
|
|
101
151
|
interface ToolbarBlockSelectorProps extends ComponentProps<"button"> {
|
|
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
|
+
*/
|
|
102
185
|
items?: ToolbarBlockSelectorItem[] | ((defaultItems: ToolbarBlockSelectorItem[]) => ToolbarBlockSelectorItem[]);
|
|
103
186
|
}
|
|
187
|
+
type ToolbarSeparatorProps = ComponentProps<"div">;
|
|
104
188
|
declare function ToolbarSectionHistory(): react_jsx_runtime.JSX.Element;
|
|
105
189
|
declare function ToolbarSectionInline(): react_jsx_runtime.JSX.Element;
|
|
106
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
|
+
*/
|
|
107
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
|
+
*/
|
|
108
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
|
+
*/
|
|
109
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
|
+
*/
|
|
110
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
|
+
*/
|
|
111
241
|
SectionHistory: typeof ToolbarSectionHistory;
|
|
242
|
+
/**
|
|
243
|
+
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
244
|
+
*/
|
|
112
245
|
SectionInline: typeof ToolbarSectionInline;
|
|
246
|
+
/**
|
|
247
|
+
* A section containing collaborative actions. (e.g. adding a comment)
|
|
248
|
+
*/
|
|
113
249
|
SectionCollaboration: typeof ToolbarSectionCollaboration;
|
|
114
|
-
BlockSelector: react.ForwardRefExoticComponent<Omit<ToolbarBlockSelectorProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
115
250
|
};
|
|
116
251
|
|
|
117
252
|
interface FloatingToolbarProps extends Omit<ComponentProps<"div">, "children"> {
|
|
253
|
+
/**
|
|
254
|
+
* The Tiptap editor.
|
|
255
|
+
*/
|
|
118
256
|
editor: Editor | null;
|
|
257
|
+
/**
|
|
258
|
+
* The vertical position of the floating toolbar.
|
|
259
|
+
*/
|
|
119
260
|
position?: FloatingPosition;
|
|
261
|
+
/**
|
|
262
|
+
* The vertical offset of the floating toolbar from the selection.
|
|
263
|
+
*/
|
|
120
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
|
+
*/
|
|
121
269
|
children?: ToolbarSlot;
|
|
270
|
+
/**
|
|
271
|
+
* The content to display at the start of the floating toolbar.
|
|
272
|
+
*/
|
|
122
273
|
before?: ToolbarSlot;
|
|
274
|
+
/**
|
|
275
|
+
* The content to display at the end of the floating toolbar.
|
|
276
|
+
*/
|
|
123
277
|
after?: ToolbarSlot;
|
|
124
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
|
+
*/
|
|
125
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
|
+
*/
|
|
126
315
|
External: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
127
316
|
};
|
|
128
317
|
|
|
@@ -145,4 +334,4 @@ declare module "@tiptap/core" {
|
|
|
145
334
|
}
|
|
146
335
|
}
|
|
147
336
|
|
|
148
|
-
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;;;;;;;;;;;"}
|
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 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"}
|
|
@@ -209,12 +209,12 @@ const FloatingToolbar = Object.assign(
|
|
|
209
209
|
setPointerDown(false);
|
|
210
210
|
};
|
|
211
211
|
editor.view.dom.addEventListener("pointerdown", handlePointerDown2);
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
document.addEventListener("pointercancel", handlePointerUp);
|
|
213
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
214
214
|
return () => {
|
|
215
215
|
editor.view.dom.removeEventListener("pointerdown", handlePointerDown2);
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
document.removeEventListener("pointercancel", handlePointerUp);
|
|
217
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
218
218
|
};
|
|
219
219
|
}, [editor]);
|
|
220
220
|
_private$1.useLayoutEffect(() => {
|