@liveblocks/react-tiptap 3.9.1 → 3.9.2-tiptap1
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/LiveblocksExtension.cjs +7 -3
- package/dist/LiveblocksExtension.cjs.map +1 -1
- package/dist/LiveblocksExtension.js +7 -3
- package/dist/LiveblocksExtension.js.map +1 -1
- package/dist/ai/AiExtension.cjs +8 -0
- package/dist/ai/AiExtension.cjs.map +1 -1
- package/dist/ai/AiExtension.js +8 -0
- package/dist/ai/AiExtension.js.map +1 -1
- package/dist/ai/AiToolbar.cjs +256 -235
- package/dist/ai/AiToolbar.cjs.map +1 -1
- package/dist/ai/AiToolbar.js +256 -235
- package/dist/ai/AiToolbar.js.map +1 -1
- package/dist/comments/AnchoredThreads.cjs +63 -50
- package/dist/comments/AnchoredThreads.cjs.map +1 -1
- package/dist/comments/AnchoredThreads.js +63 -50
- package/dist/comments/AnchoredThreads.js.map +1 -1
- package/dist/comments/CommentsExtension.cjs +3 -0
- package/dist/comments/CommentsExtension.cjs.map +1 -1
- package/dist/comments/CommentsExtension.js +3 -0
- package/dist/comments/CommentsExtension.js.map +1 -1
- package/dist/comments/FloatingComposer.cjs +32 -22
- package/dist/comments/FloatingComposer.cjs.map +1 -1
- package/dist/comments/FloatingComposer.js +32 -22
- package/dist/comments/FloatingComposer.js.map +1 -1
- package/dist/comments/FloatingThreads.cjs +39 -33
- package/dist/comments/FloatingThreads.cjs.map +1 -1
- package/dist/comments/FloatingThreads.js +39 -33
- package/dist/comments/FloatingThreads.js.map +1 -1
- package/dist/context.cjs +1 -4
- package/dist/context.cjs.map +1 -1
- package/dist/context.js +1 -4
- package/dist/context.js.map +1 -1
- package/dist/index.d.cts +135 -4
- package/dist/index.d.ts +135 -4
- package/dist/mentions/GroupMentionNode.cjs +2 -0
- package/dist/mentions/GroupMentionNode.cjs.map +1 -1
- package/dist/mentions/GroupMentionNode.js +2 -0
- package/dist/mentions/GroupMentionNode.js.map +1 -1
- package/dist/mentions/Mention.cjs +35 -42
- package/dist/mentions/Mention.cjs.map +1 -1
- package/dist/mentions/Mention.js +34 -41
- package/dist/mentions/Mention.js.map +1 -1
- package/dist/mentions/MentionExtension.cjs +1 -0
- package/dist/mentions/MentionExtension.cjs.map +1 -1
- package/dist/mentions/MentionExtension.js +1 -0
- package/dist/mentions/MentionExtension.js.map +1 -1
- package/dist/mentions/MentionNode.cjs +2 -0
- package/dist/mentions/MentionNode.cjs.map +1 -1
- package/dist/mentions/MentionNode.js +2 -0
- package/dist/mentions/MentionNode.js.map +1 -1
- package/dist/mentions/MentionsList.cjs +66 -51
- package/dist/mentions/MentionsList.cjs.map +1 -1
- package/dist/mentions/MentionsList.js +66 -51
- package/dist/mentions/MentionsList.js.map +1 -1
- package/dist/toolbar/FloatingToolbar.cjs +43 -28
- package/dist/toolbar/FloatingToolbar.cjs.map +1 -1
- package/dist/toolbar/FloatingToolbar.js +43 -28
- package/dist/toolbar/FloatingToolbar.js.map +1 -1
- package/dist/toolbar/Toolbar.cjs +191 -153
- package/dist/toolbar/Toolbar.cjs.map +1 -1
- package/dist/toolbar/Toolbar.js +191 -153
- package/dist/toolbar/Toolbar.js.map +1 -1
- package/dist/toolbar/shared.cjs +12 -11
- package/dist/toolbar/shared.cjs.map +1 -1
- package/dist/toolbar/shared.js +12 -11
- package/dist/toolbar/shared.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/version-history/HistoryVersionPreview.cjs +30 -42
- package/dist/version-history/HistoryVersionPreview.cjs.map +1 -1
- package/dist/version-history/HistoryVersionPreview.js +30 -42
- package/dist/version-history/HistoryVersionPreview.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +14 -14
- package/src/styles/index.css +3 -2
- package/styles.css +1 -1
- package/styles.css.map +1 -1
package/dist/toolbar/Toolbar.js
CHANGED
|
@@ -11,9 +11,7 @@ const FLOATING_ELEMENT_COLLISION_PADDING = 10;
|
|
|
11
11
|
function applyToolbarSlot(slot, props) {
|
|
12
12
|
if (typeof slot === "function") {
|
|
13
13
|
const Component = slot;
|
|
14
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
15
|
-
...props
|
|
16
|
-
});
|
|
14
|
+
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
17
15
|
}
|
|
18
16
|
return slot;
|
|
19
17
|
}
|
|
@@ -32,10 +30,9 @@ const ToolbarButton = forwardRef(
|
|
|
32
30
|
},
|
|
33
31
|
[onKeyDown, closeFloatingToolbar]
|
|
34
32
|
);
|
|
35
|
-
return /* @__PURE__ */ jsx(ShortcutTooltip, {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
33
|
+
return /* @__PURE__ */ jsx(ShortcutTooltip, { content: name, shortcut, children: /* @__PURE__ */ jsx(
|
|
34
|
+
Button,
|
|
35
|
+
{
|
|
39
36
|
type: "button",
|
|
40
37
|
variant: "toolbar",
|
|
41
38
|
ref: forwardedRef,
|
|
@@ -45,20 +42,13 @@ const ToolbarButton = forwardRef(
|
|
|
45
42
|
...props,
|
|
46
43
|
onKeyDown: handleKeyDown,
|
|
47
44
|
children: !children && !icon ? name : children
|
|
48
|
-
}
|
|
49
|
-
});
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
50
47
|
}
|
|
51
48
|
);
|
|
52
49
|
const ToolbarToggle = forwardRef(
|
|
53
50
|
({ active, ...props }, forwardedRef) => {
|
|
54
|
-
return /* @__PURE__ */ jsx(TogglePrimitive.Root, {
|
|
55
|
-
asChild: true,
|
|
56
|
-
pressed: active,
|
|
57
|
-
children: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
58
|
-
ref: forwardedRef,
|
|
59
|
-
...props
|
|
60
|
-
})
|
|
61
|
-
});
|
|
51
|
+
return /* @__PURE__ */ jsx(TogglePrimitive.Root, { asChild: true, pressed: active, children: /* @__PURE__ */ jsx(ToolbarButton, { ref: forwardedRef, ...props }) });
|
|
62
52
|
}
|
|
63
53
|
);
|
|
64
54
|
function createDefaultBlockSelectorItems(editor) {
|
|
@@ -151,65 +141,62 @@ const ToolbarBlockSelector = forwardRef(({ items, onKeyDown, ...props }, forward
|
|
|
151
141
|
},
|
|
152
142
|
[onKeyDown, closeFloatingToolbar]
|
|
153
143
|
);
|
|
154
|
-
return /* @__PURE__ */ jsxs(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
children: /* @__PURE__ */ jsx(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
children: activeItem?.name ?? "Turn into\u2026"
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
children: /* @__PURE__ */ jsx(SelectPrimitive.Content, {
|
|
144
|
+
return /* @__PURE__ */ jsxs(
|
|
145
|
+
SelectPrimitive.Root,
|
|
146
|
+
{
|
|
147
|
+
value: activeItem?.name,
|
|
148
|
+
onValueChange: handleItemChange,
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsx(ShortcutTooltip, { content: "Turn into\u2026", children: /* @__PURE__ */ jsx(
|
|
151
|
+
SelectPrimitive.Trigger,
|
|
152
|
+
{
|
|
153
|
+
asChild: true,
|
|
154
|
+
...props,
|
|
155
|
+
ref: forwardedRef,
|
|
156
|
+
onKeyDown: handleKeyDown,
|
|
157
|
+
disabled: resolvedItems.length === 0,
|
|
158
|
+
children: /* @__PURE__ */ jsx(SelectButton, { variant: "toolbar", children: activeItem?.name ?? "Turn into\u2026" })
|
|
159
|
+
}
|
|
160
|
+
) }),
|
|
161
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(FloatingToolbarExternal, { children: /* @__PURE__ */ jsx(
|
|
162
|
+
SelectPrimitive.Content,
|
|
163
|
+
{
|
|
175
164
|
position: "popper",
|
|
176
165
|
sideOffset: BLOCK_SELECT_SIDE_OFFSET,
|
|
177
166
|
collisionPadding: FLOATING_ELEMENT_COLLISION_PADDING,
|
|
178
167
|
className: "lb-root lb-portal lb-elevation lb-dropdown lb-select-dropdown lb-tiptap-block-selector-dropdown",
|
|
179
|
-
children: resolvedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
item.
|
|
185
|
-
|
|
186
|
-
children: item.icon
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
})
|
|
201
|
-
]
|
|
202
|
-
});
|
|
168
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
169
|
+
SelectPrimitive.Item,
|
|
170
|
+
{
|
|
171
|
+
value: item.name,
|
|
172
|
+
className: "lb-dropdown-item",
|
|
173
|
+
"data-name": item.name,
|
|
174
|
+
children: [
|
|
175
|
+
item.icon ? /* @__PURE__ */ jsx("span", { className: "lb-dropdown-item-icon lb-icon-container", children: item.icon }) : null,
|
|
176
|
+
/* @__PURE__ */ jsx("span", { className: "lb-dropdown-item-label", children: item.label ?? item.name }),
|
|
177
|
+
item.name === activeItem?.name ? /* @__PURE__ */ jsx("span", { className: "lb-dropdown-item-accessory lb-icon-container", children: /* @__PURE__ */ jsx(CheckIcon, {}) }) : null
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
item.name
|
|
181
|
+
))
|
|
182
|
+
}
|
|
183
|
+
) }) })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
203
187
|
});
|
|
204
188
|
const ToolbarSeparator = forwardRef(
|
|
205
189
|
({ className, ...props }, forwardedRef) => {
|
|
206
|
-
return /* @__PURE__ */ jsx(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
190
|
+
return /* @__PURE__ */ jsx(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
ref: forwardedRef,
|
|
194
|
+
role: "separator",
|
|
195
|
+
"aria-orientation": "vertical",
|
|
196
|
+
className: cn("lb-tiptap-toolbar-separator", className),
|
|
197
|
+
...props
|
|
198
|
+
}
|
|
199
|
+
);
|
|
213
200
|
}
|
|
214
201
|
);
|
|
215
202
|
function ToolbarSectionHistory() {
|
|
@@ -217,24 +204,28 @@ function ToolbarSectionHistory() {
|
|
|
217
204
|
"SectionHistory",
|
|
218
205
|
"Toolbar or FloatingToolbar"
|
|
219
206
|
);
|
|
220
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
221
|
-
|
|
222
|
-
|
|
207
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
ToolbarButton,
|
|
210
|
+
{
|
|
223
211
|
name: "Undo",
|
|
224
212
|
icon: /* @__PURE__ */ jsx(UndoIcon, {}),
|
|
225
213
|
shortcut: "Mod-Z",
|
|
226
214
|
onClick: () => editor.chain().focus().undo().run(),
|
|
227
215
|
disabled: !editor.can().chain().focus().undo().run()
|
|
228
|
-
}
|
|
229
|
-
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsx(
|
|
219
|
+
ToolbarButton,
|
|
220
|
+
{
|
|
230
221
|
name: "Redo",
|
|
231
222
|
icon: /* @__PURE__ */ jsx(RedoIcon, {}),
|
|
232
223
|
shortcut: "Mod-Shift-Z",
|
|
233
224
|
onClick: () => editor.chain().focus().redo().run(),
|
|
234
225
|
disabled: !editor.can().chain().focus().redo().run()
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
});
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] });
|
|
238
229
|
}
|
|
239
230
|
function ToolbarSectionInline() {
|
|
240
231
|
const editor = useCurrentEditor(
|
|
@@ -246,50 +237,63 @@ function ToolbarSectionInline() {
|
|
|
246
237
|
const supportsUnderline = "toggleUnderline" in editor.commands;
|
|
247
238
|
const supportsStrike = "toggleStrike" in editor.commands;
|
|
248
239
|
const supportsCode = "toggleCode" in editor.commands;
|
|
249
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
250
|
-
|
|
251
|
-
|
|
240
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
241
|
+
supportsBold && /* @__PURE__ */ jsx(
|
|
242
|
+
ToolbarToggle,
|
|
243
|
+
{
|
|
252
244
|
name: "Bold",
|
|
253
245
|
icon: /* @__PURE__ */ jsx(BoldIcon, {}),
|
|
254
246
|
shortcut: "Mod-B",
|
|
255
247
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
256
248
|
disabled: !editor.can().chain().focus().toggleBold().run(),
|
|
257
249
|
active: editor.isActive("bold")
|
|
258
|
-
}
|
|
259
|
-
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
supportsItalic && /* @__PURE__ */ jsx(
|
|
253
|
+
ToolbarToggle,
|
|
254
|
+
{
|
|
260
255
|
name: "Italic",
|
|
261
256
|
icon: /* @__PURE__ */ jsx(ItalicIcon, {}),
|
|
262
257
|
shortcut: "Mod-I",
|
|
263
258
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
264
259
|
disabled: !editor.can().chain().focus().toggleItalic().run(),
|
|
265
260
|
active: editor.isActive("italic")
|
|
266
|
-
}
|
|
267
|
-
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
supportsUnderline && /* @__PURE__ */ jsx(
|
|
264
|
+
ToolbarToggle,
|
|
265
|
+
{
|
|
268
266
|
name: "Underline",
|
|
269
267
|
icon: /* @__PURE__ */ jsx(UnderlineIcon, {}),
|
|
270
268
|
shortcut: "Mod-U",
|
|
271
269
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
272
270
|
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
273
271
|
active: editor.isActive("underline")
|
|
274
|
-
}
|
|
275
|
-
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
supportsStrike && /* @__PURE__ */ jsx(
|
|
275
|
+
ToolbarToggle,
|
|
276
|
+
{
|
|
276
277
|
name: "Strikethrough",
|
|
277
278
|
icon: /* @__PURE__ */ jsx(StrikethroughIcon, {}),
|
|
278
279
|
shortcut: "Mod-U",
|
|
279
280
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
280
281
|
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
281
282
|
active: editor.isActive("strike")
|
|
282
|
-
}
|
|
283
|
-
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
supportsCode && /* @__PURE__ */ jsx(
|
|
286
|
+
ToolbarToggle,
|
|
287
|
+
{
|
|
284
288
|
name: "Inline code",
|
|
285
289
|
icon: /* @__PURE__ */ jsx(CodeIcon, {}),
|
|
286
290
|
shortcut: "Mod-E",
|
|
287
291
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
288
292
|
disabled: !editor.can().chain().focus().toggleCode().run(),
|
|
289
293
|
active: editor.isActive("code")
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
});
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] });
|
|
293
297
|
}
|
|
294
298
|
function ToolbarSectionCollaboration() {
|
|
295
299
|
const editor = useCurrentEditor(
|
|
@@ -297,64 +301,61 @@ function ToolbarSectionCollaboration() {
|
|
|
297
301
|
"Toolbar or FloatingToolbar"
|
|
298
302
|
);
|
|
299
303
|
const supportsThread = "addPendingComment" in editor.commands;
|
|
300
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
301
|
-
|
|
304
|
+
return /* @__PURE__ */ jsx(Fragment, { children: supportsThread && /* @__PURE__ */ jsx(
|
|
305
|
+
ToolbarButton,
|
|
306
|
+
{
|
|
302
307
|
name: "Add a comment",
|
|
303
308
|
icon: /* @__PURE__ */ jsx(CommentIcon, {}),
|
|
304
309
|
onClick: () => editor.chain().focus().addPendingComment().run(),
|
|
305
310
|
children: "Comment"
|
|
306
|
-
}
|
|
307
|
-
});
|
|
311
|
+
}
|
|
312
|
+
) });
|
|
308
313
|
}
|
|
309
314
|
function ToolbarSectionAi() {
|
|
310
315
|
const editor = useCurrentEditor("SectionAi", "Toolbar or FloatingToolbar");
|
|
311
316
|
const supportsAi = "askAi" in editor.commands;
|
|
312
317
|
const aiName = editor.storage.liveblocksAi?.name;
|
|
313
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
318
|
+
return /* @__PURE__ */ jsx(Fragment, { children: supportsAi && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
319
|
+
/* @__PURE__ */ jsxs(
|
|
320
|
+
ToolbarButton,
|
|
321
|
+
{
|
|
322
|
+
name: `Ask ${aiName} anything\u2026`,
|
|
323
|
+
icon: /* @__PURE__ */ jsx(SparklesIcon, {}),
|
|
324
|
+
onClick: () => editor.chain().focus().askAi(),
|
|
325
|
+
children: [
|
|
326
|
+
"Ask ",
|
|
327
|
+
aiName
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
/* @__PURE__ */ jsx(
|
|
332
|
+
ToolbarButton,
|
|
333
|
+
{
|
|
334
|
+
name: "Explain",
|
|
335
|
+
icon: /* @__PURE__ */ jsx(QuestionMarkIcon, {}),
|
|
336
|
+
onClick: () => editor.chain().focus().askAi("Explain what the text is about"),
|
|
337
|
+
children: "Explain"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] }) });
|
|
334
341
|
}
|
|
335
342
|
function DefaultToolbarContent({ editor }) {
|
|
336
343
|
const supportsThread = "addPendingComment" in editor.commands;
|
|
337
344
|
const supportsAi = "askAi" in editor.commands;
|
|
338
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
339
|
-
|
|
340
|
-
|
|
345
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
346
|
+
/* @__PURE__ */ jsx(ToolbarSectionHistory, {}),
|
|
347
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
348
|
+
supportsAi ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
349
|
+
/* @__PURE__ */ jsx(ToolbarSectionAi, {}),
|
|
350
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {})
|
|
351
|
+
] }) : null,
|
|
352
|
+
/* @__PURE__ */ jsx(ToolbarBlockSelector, {}),
|
|
353
|
+
/* @__PURE__ */ jsx(ToolbarSectionInline, {}),
|
|
354
|
+
supportsThread ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
341
355
|
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
/* @__PURE__ */ jsx(ToolbarSeparator, {})
|
|
346
|
-
]
|
|
347
|
-
}) : null,
|
|
348
|
-
/* @__PURE__ */ jsx(ToolbarBlockSelector, {}),
|
|
349
|
-
/* @__PURE__ */ jsx(ToolbarSectionInline, {}),
|
|
350
|
-
supportsThread ? /* @__PURE__ */ jsxs(Fragment, {
|
|
351
|
-
children: [
|
|
352
|
-
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
353
|
-
/* @__PURE__ */ jsx(ToolbarSectionCollaboration, {})
|
|
354
|
-
]
|
|
355
|
-
}) : null
|
|
356
|
-
]
|
|
357
|
-
});
|
|
356
|
+
/* @__PURE__ */ jsx(ToolbarSectionCollaboration, {})
|
|
357
|
+
] }) : null
|
|
358
|
+
] });
|
|
358
359
|
}
|
|
359
360
|
const Toolbar = Object.assign(
|
|
360
361
|
forwardRef(
|
|
@@ -370,34 +371,71 @@ const Toolbar = Object.assign(
|
|
|
370
371
|
return null;
|
|
371
372
|
}
|
|
372
373
|
const slotProps = { editor };
|
|
373
|
-
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
})
|
|
390
|
-
});
|
|
374
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(EditorProvider, { editor, children: /* @__PURE__ */ jsxs(
|
|
375
|
+
"div",
|
|
376
|
+
{
|
|
377
|
+
ref: forwardedRef,
|
|
378
|
+
role: "toolbar",
|
|
379
|
+
"aria-label": "Toolbar",
|
|
380
|
+
"aria-orientation": "horizontal",
|
|
381
|
+
className: cn("lb-root lb-tiptap-toolbar", className),
|
|
382
|
+
...props,
|
|
383
|
+
children: [
|
|
384
|
+
applyToolbarSlot(before, slotProps),
|
|
385
|
+
applyToolbarSlot(children, slotProps),
|
|
386
|
+
applyToolbarSlot(after, slotProps)
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
) }) });
|
|
391
390
|
}
|
|
392
391
|
),
|
|
393
392
|
{
|
|
393
|
+
/**
|
|
394
|
+
* A button for triggering actions.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }} />
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
|
|
401
|
+
*/
|
|
394
402
|
Button: ToolbarButton,
|
|
403
|
+
/**
|
|
404
|
+
* A toggle button for values that can be active or inactive.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* <Toolbar.Toggle name="Bold" active={isBold} />
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
|
|
411
|
+
*/
|
|
395
412
|
Toggle: ToolbarToggle,
|
|
413
|
+
/**
|
|
414
|
+
* A dropdown selector to switch between different block types.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* <Toolbar.BlockSelector />
|
|
418
|
+
*/
|
|
396
419
|
BlockSelector: ToolbarBlockSelector,
|
|
420
|
+
/**
|
|
421
|
+
* A visual (and accessible) separator to separate sections in a toolbar.
|
|
422
|
+
*/
|
|
397
423
|
Separator: ToolbarSeparator,
|
|
424
|
+
/**
|
|
425
|
+
* A section containing history actions. (e.g. undo, redo)
|
|
426
|
+
*/
|
|
398
427
|
SectionHistory: ToolbarSectionHistory,
|
|
428
|
+
/**
|
|
429
|
+
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
430
|
+
*/
|
|
399
431
|
SectionInline: ToolbarSectionInline,
|
|
432
|
+
/**
|
|
433
|
+
* A section containing collaborative actions. (e.g. adding a comment)
|
|
434
|
+
*/
|
|
400
435
|
SectionCollaboration: ToolbarSectionCollaboration,
|
|
436
|
+
/**
|
|
437
|
+
* A section containing AI actions. (e.g. opening the AI toolbar)
|
|
438
|
+
*/
|
|
401
439
|
SectionAi: ToolbarSectionAi
|
|
402
440
|
}
|
|
403
441
|
);
|