@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.cjs
CHANGED
|
@@ -33,9 +33,7 @@ const FLOATING_ELEMENT_COLLISION_PADDING = 10;
|
|
|
33
33
|
function applyToolbarSlot(slot, props) {
|
|
34
34
|
if (typeof slot === "function") {
|
|
35
35
|
const Component = slot;
|
|
36
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
37
|
-
...props
|
|
38
|
-
});
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
39
37
|
}
|
|
40
38
|
return slot;
|
|
41
39
|
}
|
|
@@ -54,10 +52,9 @@ const ToolbarButton = react.forwardRef(
|
|
|
54
52
|
},
|
|
55
53
|
[onKeyDown, closeFloatingToolbar]
|
|
56
54
|
);
|
|
57
|
-
return /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(_private.Button, {
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, { content: name, shortcut, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
_private.Button,
|
|
57
|
+
{
|
|
61
58
|
type: "button",
|
|
62
59
|
variant: "toolbar",
|
|
63
60
|
ref: forwardedRef,
|
|
@@ -67,20 +64,13 @@ const ToolbarButton = react.forwardRef(
|
|
|
67
64
|
...props,
|
|
68
65
|
onKeyDown: handleKeyDown,
|
|
69
66
|
children: !children && !icon ? name : children
|
|
70
|
-
}
|
|
71
|
-
});
|
|
67
|
+
}
|
|
68
|
+
) });
|
|
72
69
|
}
|
|
73
70
|
);
|
|
74
71
|
const ToolbarToggle = react.forwardRef(
|
|
75
72
|
({ active, ...props }, forwardedRef) => {
|
|
76
|
-
return /* @__PURE__ */ jsxRuntime.jsx(TogglePrimitive__namespace.Root, {
|
|
77
|
-
asChild: true,
|
|
78
|
-
pressed: active,
|
|
79
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, {
|
|
80
|
-
ref: forwardedRef,
|
|
81
|
-
...props
|
|
82
|
-
})
|
|
83
|
-
});
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TogglePrimitive__namespace.Root, { asChild: true, pressed: active, children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { ref: forwardedRef, ...props }) });
|
|
84
74
|
}
|
|
85
75
|
);
|
|
86
76
|
function createDefaultBlockSelectorItems(editor) {
|
|
@@ -173,65 +163,62 @@ const ToolbarBlockSelector = react.forwardRef(({ items, onKeyDown, ...props }, f
|
|
|
173
163
|
},
|
|
174
164
|
[onKeyDown, closeFloatingToolbar]
|
|
175
165
|
);
|
|
176
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
children: activeItem?.name ?? "Turn into\u2026"
|
|
191
|
-
}
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Content, {
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
167
|
+
SelectPrimitive__namespace.Root,
|
|
168
|
+
{
|
|
169
|
+
value: activeItem?.name,
|
|
170
|
+
onValueChange: handleItemChange,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, { content: "Turn into\u2026", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
+
SelectPrimitive__namespace.Trigger,
|
|
174
|
+
{
|
|
175
|
+
asChild: true,
|
|
176
|
+
...props,
|
|
177
|
+
ref: forwardedRef,
|
|
178
|
+
onKeyDown: handleKeyDown,
|
|
179
|
+
disabled: resolvedItems.length === 0,
|
|
180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(_private.SelectButton, { variant: "toolbar", children: activeItem?.name ?? "Turn into\u2026" })
|
|
181
|
+
}
|
|
182
|
+
) }),
|
|
183
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(shared.FloatingToolbarExternal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
SelectPrimitive__namespace.Content,
|
|
185
|
+
{
|
|
197
186
|
position: "popper",
|
|
198
187
|
sideOffset: BLOCK_SELECT_SIDE_OFFSET,
|
|
199
188
|
collisionPadding: FLOATING_ELEMENT_COLLISION_PADDING,
|
|
200
189
|
className: "lb-root lb-portal lb-elevation lb-dropdown lb-select-dropdown lb-tiptap-block-selector-dropdown",
|
|
201
|
-
children: resolvedItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
item.
|
|
207
|
-
|
|
208
|
-
children: item.icon
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
})
|
|
221
|
-
})
|
|
222
|
-
})
|
|
223
|
-
]
|
|
224
|
-
});
|
|
190
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
191
|
+
SelectPrimitive__namespace.Item,
|
|
192
|
+
{
|
|
193
|
+
value: item.name,
|
|
194
|
+
className: "lb-dropdown-item",
|
|
195
|
+
"data-name": item.name,
|
|
196
|
+
children: [
|
|
197
|
+
item.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-dropdown-item-icon lb-icon-container", children: item.icon }) : null,
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-dropdown-item-label", children: item.label ?? item.name }),
|
|
199
|
+
item.name === activeItem?.name ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-dropdown-item-accessory lb-icon-container", children: /* @__PURE__ */ jsxRuntime.jsx(_private.CheckIcon, {}) }) : null
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
item.name
|
|
203
|
+
))
|
|
204
|
+
}
|
|
205
|
+
) }) })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
);
|
|
225
209
|
});
|
|
226
210
|
const ToolbarSeparator = react.forwardRef(
|
|
227
211
|
({ className, ...props }, forwardedRef) => {
|
|
228
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
212
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
ref: forwardedRef,
|
|
216
|
+
role: "separator",
|
|
217
|
+
"aria-orientation": "vertical",
|
|
218
|
+
className: _private.cn("lb-tiptap-toolbar-separator", className),
|
|
219
|
+
...props
|
|
220
|
+
}
|
|
221
|
+
);
|
|
235
222
|
}
|
|
236
223
|
);
|
|
237
224
|
function ToolbarSectionHistory() {
|
|
@@ -239,24 +226,28 @@ function ToolbarSectionHistory() {
|
|
|
239
226
|
"SectionHistory",
|
|
240
227
|
"Toolbar or FloatingToolbar"
|
|
241
228
|
);
|
|
242
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
243
|
-
|
|
244
|
-
|
|
229
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
230
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
231
|
+
ToolbarButton,
|
|
232
|
+
{
|
|
245
233
|
name: "Undo",
|
|
246
234
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.UndoIcon, {}),
|
|
247
235
|
shortcut: "Mod-Z",
|
|
248
236
|
onClick: () => editor.chain().focus().undo().run(),
|
|
249
237
|
disabled: !editor.can().chain().focus().undo().run()
|
|
250
|
-
}
|
|
251
|
-
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
|
+
ToolbarButton,
|
|
242
|
+
{
|
|
252
243
|
name: "Redo",
|
|
253
244
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.RedoIcon, {}),
|
|
254
245
|
shortcut: "Mod-Shift-Z",
|
|
255
246
|
onClick: () => editor.chain().focus().redo().run(),
|
|
256
247
|
disabled: !editor.can().chain().focus().redo().run()
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
});
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] });
|
|
260
251
|
}
|
|
261
252
|
function ToolbarSectionInline() {
|
|
262
253
|
const editor = context.useCurrentEditor(
|
|
@@ -268,50 +259,63 @@ function ToolbarSectionInline() {
|
|
|
268
259
|
const supportsUnderline = "toggleUnderline" in editor.commands;
|
|
269
260
|
const supportsStrike = "toggleStrike" in editor.commands;
|
|
270
261
|
const supportsCode = "toggleCode" in editor.commands;
|
|
271
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
272
|
-
|
|
273
|
-
|
|
262
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
263
|
+
supportsBold && /* @__PURE__ */ jsxRuntime.jsx(
|
|
264
|
+
ToolbarToggle,
|
|
265
|
+
{
|
|
274
266
|
name: "Bold",
|
|
275
267
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.BoldIcon, {}),
|
|
276
268
|
shortcut: "Mod-B",
|
|
277
269
|
onClick: () => editor.chain().focus().toggleBold().run(),
|
|
278
270
|
disabled: !editor.can().chain().focus().toggleBold().run(),
|
|
279
271
|
active: editor.isActive("bold")
|
|
280
|
-
}
|
|
281
|
-
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
supportsItalic && /* @__PURE__ */ jsxRuntime.jsx(
|
|
275
|
+
ToolbarToggle,
|
|
276
|
+
{
|
|
282
277
|
name: "Italic",
|
|
283
278
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.ItalicIcon, {}),
|
|
284
279
|
shortcut: "Mod-I",
|
|
285
280
|
onClick: () => editor.chain().focus().toggleItalic().run(),
|
|
286
281
|
disabled: !editor.can().chain().focus().toggleItalic().run(),
|
|
287
282
|
active: editor.isActive("italic")
|
|
288
|
-
}
|
|
289
|
-
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
supportsUnderline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
+
ToolbarToggle,
|
|
287
|
+
{
|
|
290
288
|
name: "Underline",
|
|
291
289
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.UnderlineIcon, {}),
|
|
292
290
|
shortcut: "Mod-U",
|
|
293
291
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
294
292
|
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
295
293
|
active: editor.isActive("underline")
|
|
296
|
-
}
|
|
297
|
-
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
supportsStrike && /* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
+
ToolbarToggle,
|
|
298
|
+
{
|
|
298
299
|
name: "Strikethrough",
|
|
299
300
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.StrikethroughIcon, {}),
|
|
300
301
|
shortcut: "Mod-U",
|
|
301
302
|
onClick: () => editor.chain().focus().toggleStrike().run(),
|
|
302
303
|
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
303
304
|
active: editor.isActive("strike")
|
|
304
|
-
}
|
|
305
|
-
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
supportsCode && /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
ToolbarToggle,
|
|
309
|
+
{
|
|
306
310
|
name: "Inline code",
|
|
307
311
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CodeIcon, {}),
|
|
308
312
|
shortcut: "Mod-E",
|
|
309
313
|
onClick: () => editor.chain().focus().toggleCode().run(),
|
|
310
314
|
disabled: !editor.can().chain().focus().toggleCode().run(),
|
|
311
315
|
active: editor.isActive("code")
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
});
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] });
|
|
315
319
|
}
|
|
316
320
|
function ToolbarSectionCollaboration() {
|
|
317
321
|
const editor = context.useCurrentEditor(
|
|
@@ -319,64 +323,61 @@ function ToolbarSectionCollaboration() {
|
|
|
319
323
|
"Toolbar or FloatingToolbar"
|
|
320
324
|
);
|
|
321
325
|
const supportsThread = "addPendingComment" in editor.commands;
|
|
322
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
323
|
-
|
|
326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: supportsThread && /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
ToolbarButton,
|
|
328
|
+
{
|
|
324
329
|
name: "Add a comment",
|
|
325
330
|
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CommentIcon, {}),
|
|
326
331
|
onClick: () => editor.chain().focus().addPendingComment().run(),
|
|
327
332
|
children: "Comment"
|
|
328
|
-
}
|
|
329
|
-
});
|
|
333
|
+
}
|
|
334
|
+
) });
|
|
330
335
|
}
|
|
331
336
|
function ToolbarSectionAi() {
|
|
332
337
|
const editor = context.useCurrentEditor("SectionAi", "Toolbar or FloatingToolbar");
|
|
333
338
|
const supportsAi = "askAi" in editor.commands;
|
|
334
339
|
const aiName = editor.storage.liveblocksAi?.name;
|
|
335
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
340
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: supportsAi && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
341
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
342
|
+
ToolbarButton,
|
|
343
|
+
{
|
|
344
|
+
name: `Ask ${aiName} anything\u2026`,
|
|
345
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesIcon, {}),
|
|
346
|
+
onClick: () => editor.chain().focus().askAi(),
|
|
347
|
+
children: [
|
|
348
|
+
"Ask ",
|
|
349
|
+
aiName
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
354
|
+
ToolbarButton,
|
|
355
|
+
{
|
|
356
|
+
name: "Explain",
|
|
357
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.QuestionMarkIcon, {}),
|
|
358
|
+
onClick: () => editor.chain().focus().askAi("Explain what the text is about"),
|
|
359
|
+
children: "Explain"
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
] }) });
|
|
356
363
|
}
|
|
357
364
|
function DefaultToolbarContent({ editor }) {
|
|
358
365
|
const supportsThread = "addPendingComment" in editor.commands;
|
|
359
366
|
const supportsAi = "askAi" in editor.commands;
|
|
360
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
361
|
-
|
|
362
|
-
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
368
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionHistory, {}),
|
|
369
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
|
|
370
|
+
supportsAi ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
371
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionAi, {}),
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {})
|
|
373
|
+
] }) : null,
|
|
374
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarBlockSelector, {}),
|
|
375
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionInline, {}),
|
|
376
|
+
supportsThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
363
377
|
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {})
|
|
368
|
-
]
|
|
369
|
-
}) : null,
|
|
370
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarBlockSelector, {}),
|
|
371
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionInline, {}),
|
|
372
|
-
supportsThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
373
|
-
children: [
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
|
|
375
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionCollaboration, {})
|
|
376
|
-
]
|
|
377
|
-
}) : null
|
|
378
|
-
]
|
|
379
|
-
});
|
|
378
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSectionCollaboration, {})
|
|
379
|
+
] }) : null
|
|
380
|
+
] });
|
|
380
381
|
}
|
|
381
382
|
const Toolbar = Object.assign(
|
|
382
383
|
react.forwardRef(
|
|
@@ -392,34 +393,71 @@ const Toolbar = Object.assign(
|
|
|
392
393
|
return null;
|
|
393
394
|
}
|
|
394
395
|
const slotProps = { editor };
|
|
395
|
-
return /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
})
|
|
412
|
-
});
|
|
396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(context.EditorProvider, { editor, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
397
|
+
"div",
|
|
398
|
+
{
|
|
399
|
+
ref: forwardedRef,
|
|
400
|
+
role: "toolbar",
|
|
401
|
+
"aria-label": "Toolbar",
|
|
402
|
+
"aria-orientation": "horizontal",
|
|
403
|
+
className: _private.cn("lb-root lb-tiptap-toolbar", className),
|
|
404
|
+
...props,
|
|
405
|
+
children: [
|
|
406
|
+
applyToolbarSlot(before, slotProps),
|
|
407
|
+
applyToolbarSlot(children, slotProps),
|
|
408
|
+
applyToolbarSlot(after, slotProps)
|
|
409
|
+
]
|
|
410
|
+
}
|
|
411
|
+
) }) });
|
|
413
412
|
}
|
|
414
413
|
),
|
|
415
414
|
{
|
|
415
|
+
/**
|
|
416
|
+
* A button for triggering actions.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* <Toolbar.Button name="Comment" shortcut="Mod-Shift-E" onClick={() => { ... }} />
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* <Toolbar.Button name="Mention someone" icon={<Icon.Mention />} onClick={() => { ... }} />
|
|
423
|
+
*/
|
|
416
424
|
Button: ToolbarButton,
|
|
425
|
+
/**
|
|
426
|
+
* A toggle button for values that can be active or inactive.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* <Toolbar.Toggle name="Bold" active={isBold} />
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* <Toolbar.Toggle name="Italic" icon={<Icon.Italic />} shortcut="Mod-I" active={isItalic} onClick={() => { ... }} />
|
|
433
|
+
*/
|
|
417
434
|
Toggle: ToolbarToggle,
|
|
435
|
+
/**
|
|
436
|
+
* A dropdown selector to switch between different block types.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* <Toolbar.BlockSelector />
|
|
440
|
+
*/
|
|
418
441
|
BlockSelector: ToolbarBlockSelector,
|
|
442
|
+
/**
|
|
443
|
+
* A visual (and accessible) separator to separate sections in a toolbar.
|
|
444
|
+
*/
|
|
419
445
|
Separator: ToolbarSeparator,
|
|
446
|
+
/**
|
|
447
|
+
* A section containing history actions. (e.g. undo, redo)
|
|
448
|
+
*/
|
|
420
449
|
SectionHistory: ToolbarSectionHistory,
|
|
450
|
+
/**
|
|
451
|
+
* A section containing inline formatting actions. (e.g. bold, italic, underline, ...)
|
|
452
|
+
*/
|
|
421
453
|
SectionInline: ToolbarSectionInline,
|
|
454
|
+
/**
|
|
455
|
+
* A section containing collaborative actions. (e.g. adding a comment)
|
|
456
|
+
*/
|
|
422
457
|
SectionCollaboration: ToolbarSectionCollaboration,
|
|
458
|
+
/**
|
|
459
|
+
* A section containing AI actions. (e.g. opening the AI toolbar)
|
|
460
|
+
*/
|
|
423
461
|
SectionAi: ToolbarSectionAi
|
|
424
462
|
}
|
|
425
463
|
);
|