@vibe-tiptap/shadcn-ui 1.1.0 → 1.1.2
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/README.md +24 -4
- package/dist/index.js +543 -516
- package/dist/mention-menu.d.ts +3 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/vibe-tiptap-provider.d.ts +4 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,27 +4,27 @@ import { PRESET_HIGHLIGHT_COLORS as e, PRESET_TEXT_COLORS as t, TOOLBAR_HEADING_
|
|
|
4
4
|
import { TOOLBAR_MARKDOWN_IMPORT_ACCEPT as a, TOOLBAR_MARKDOWN_OPTIONS as o, TOOLBAR_MARKDOWN_OPTIONS as s, copyMarkdown as c, copyMarkdown as l, exportMarkdownFile as u, exportMarkdownFile as d, importMarkdownFile as f, importMarkdownFile as p, resolveMarkdownFileOptions as m } from "@vibe-tiptap/editor-ui/markdown-file";
|
|
5
5
|
import { printEditorContent as h, printEditorContent as g } from "@vibe-tiptap/editor-ui/print-editor-content";
|
|
6
6
|
import { DEFAULT_CODE_BLOCK_LANGUAGES as _, DEFAULT_HORIZONTAL_RULES as v, NAIVE_UI_DEFAULT_TOOLBAR as y, TOOLBAR_ALIGN_OPTIONS as b, TOOLBAR_ALIGN_OPTIONS as x, TOOLBAR_HEADING_OPTIONS as S, TOOLBAR_HEADING_OPTIONS as C, TOOLBAR_TABLE_GRID as w, normalizeToolbarConfig as T, normalizeToolbarConfig as E, resolveToolbarMenuOptions as ee } from "@vibe-tiptap/editor-ui/toolbar-config";
|
|
7
|
-
import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitMention as te, exitSlashCommand as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { getMarkRange as
|
|
10
|
-
import { cloneElement as
|
|
11
|
-
import { NodeSelection as
|
|
12
|
-
import { AlignCenter as
|
|
7
|
+
import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitMention as te, exitSlashCommand as ne, formatFileSize as M, getActiveHeadingLevel as N, getActiveLinkRange as P, getActiveTextAlign as re, getMediaInsertionNodeType as ie, getMentionTarget as ae, getNativeMarkdownManager as oe, getSelectedFileAttachment as F, isFindReplaceOpenTransaction as I, isToolbarCommandActive as se, isToolbarCommandEnabled as L, normalizeHttpUrl as ce, normalizeSlashCommandInput as R, notifyAssetUploadFailure as le, resolveEditorBehaviorOptions as z, resolveMediaResourcePath as B, runSlashCommandItem as ue, runToolbarCommand as de, slashCommandPluginKey as V, startWhiteboardDrawing as fe, trackUploadRange as pe, useReactEditor as me, useReactEditorState as H, validateAssetFile as he } from "@vibe-tiptap/react-adapter";
|
|
8
|
+
import { Fragment as ge, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
9
|
+
import { getMarkRange as _e } from "@tiptap/core";
|
|
10
|
+
import { cloneElement as ve, createContext as ye, createElement as be, forwardRef as xe, memo as Se, useCallback as Ce, useContext as we, useEffect as G, useId as Te, useLayoutEffect as K, useMemo as Ee, useRef as q, useState as J } from "react";
|
|
11
|
+
import { NodeSelection as De, TextSelection as Oe } from "@tiptap/pm/state";
|
|
12
|
+
import { AlignCenter as ke, AlignJustify as Ae, AlignLeft as je, AlignRight as Me, ArrowDown as Ne, ArrowLeft as Pe, ArrowRight as Fe, ArrowUp as Ie, Bold as Le, Captions as Re, CaseSensitive as ze, ChevronDown as Be, ChevronLeft as Ve, ChevronRight as He, ChevronUp as Ue, Code as We, CodeXml as Ge, Copy as Ke, Download as qe, Ellipsis as Je, EllipsisVertical as Ye, Eraser as Xe, ExternalLink as Ze, Eye as Qe, Film as $e, Heading1 as et, Heading2 as tt, Heading3 as nt, Heading4 as rt, Heading5 as it, Heading6 as at, Highlighter as ot, Image as st, ImagePlay as ct, ImagePlus as lt, ImageUp as ut, IndentDecrease as dt, IndentIncrease as ft, Italic as pt, Link as mt, List as ht, ListChecks as gt, ListOrdered as _t, LoaderCircle as vt, Maximize2 as yt, Minimize2 as bt, Minus as xt, Music as St, Palette as Ct, Paperclip as wt, Pencil as Tt, PencilRuler as Et, Pilcrow as Dt, Plus as Ot, Printer as kt, Quote as At, Redo2 as jt, Replace as Mt, ReplaceAll as Nt, RotateCcw as Pt, RotateCw as Ft, Search as It, Strikethrough as Lt, Subscript as Rt, Superscript as zt, Table as Bt, TableProperties as Vt, Trash2 as Ht, TvMinimalPlay as Ut, Underline as Wt, Undo2 as Gt, Unlink as Kt, Video as qt, Workflow as Jt, X as Yt, ZoomIn as Xt, ZoomOut as Zt } from "lucide-react";
|
|
13
13
|
import { twMerge as Y } from "tailwind-merge";
|
|
14
|
-
import { FIRST_LINE_INDENT_ICON as
|
|
15
|
-
import { TransformComponent as
|
|
16
|
-
import { createPortal as
|
|
17
|
-
import { bindMentionHover as
|
|
18
|
-
import { TableMap as
|
|
14
|
+
import { FIRST_LINE_INDENT_ICON as Qt, MARKDOWN_ACTION_ICON_PATHS as $t, MARKDOWN_ACTION_ICON_TRANSFORM as en, MARKDOWN_ICON as tn, TOOLBAR_ICON_VIEW_BOX as nn } from "@vibe-tiptap/editor-ui/custom-icons";
|
|
15
|
+
import { TransformComponent as rn, TransformWrapper as an } from "react-zoom-pan-pinch";
|
|
16
|
+
import { createPortal as on } from "react-dom";
|
|
17
|
+
import { bindMentionHover as sn } from "@vibe-tiptap/editor-ui/mention-hover";
|
|
18
|
+
import { TableMap as cn, cellAround as ln } from "@tiptap/pm/tables";
|
|
19
19
|
// src/editor-content.tsx
|
|
20
|
-
function
|
|
20
|
+
function un({ context: e, className: t, ...n }) {
|
|
21
21
|
return /* @__PURE__ */ U(O, {
|
|
22
22
|
...n,
|
|
23
23
|
editor: e.editor,
|
|
24
24
|
className: ["vibe-shadcn-tiptap__content", t].filter(Boolean).join(" ")
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function dn({ context: e }) {
|
|
28
28
|
let t = H(e, (e) => e.wordCount.characters) ?? 0;
|
|
29
29
|
return /* @__PURE__ */ U("div", {
|
|
30
30
|
className: "vibe-shadcn-tiptap__status",
|
|
@@ -33,28 +33,28 @@ function un({ context: e }) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
// src/components.ts
|
|
36
|
-
var
|
|
36
|
+
var fn = ye(void 0), pn = fn.Provider;
|
|
37
37
|
function X() {
|
|
38
|
-
let e =
|
|
38
|
+
let e = we(fn);
|
|
39
39
|
if (!e) throw Error("ShadcnTiptap requires a components mapping.");
|
|
40
40
|
return e;
|
|
41
41
|
}
|
|
42
42
|
// src/ui-styles.ts
|
|
43
|
-
var Z = "flex flex-wrap items-center gap-1",
|
|
43
|
+
var Z = "flex flex-wrap items-center gap-1", mn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", hn = {
|
|
44
44
|
default: void 0,
|
|
45
45
|
outline: "border border-input bg-background dark:bg-background",
|
|
46
46
|
ghost: "border-transparent bg-transparent shadow-none dark:bg-transparent"
|
|
47
|
-
},
|
|
48
|
-
function
|
|
49
|
-
let t =
|
|
47
|
+
}, gn = ye(void 0), _n = gn.Provider;
|
|
48
|
+
function vn(e) {
|
|
49
|
+
let t = we(gn);
|
|
50
50
|
return {
|
|
51
51
|
size: e?.size ?? t?.size,
|
|
52
52
|
variant: e?.variant ?? t?.variant,
|
|
53
53
|
className: Y(t?.className, e?.className)
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
var Q =
|
|
57
|
-
let { Button: s } = X(), c =
|
|
56
|
+
var Q = xe(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
|
|
57
|
+
let { Button: s } = X(), c = vn(e);
|
|
58
58
|
return /* @__PURE__ */ U(s, {
|
|
59
59
|
...a,
|
|
60
60
|
ref: o,
|
|
@@ -63,15 +63,15 @@ var Q = be(function({ appearance: e, className: t, defaultSizeClassName: n, size
|
|
|
63
63
|
className: Y(t, c.size === void 0 && n, c.className)
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
|
-
function
|
|
67
|
-
let { className: n, size: r, variant: i } =
|
|
68
|
-
return r === void 0 && i === void 0 ?
|
|
66
|
+
function yn({ appearance: e, children: t }) {
|
|
67
|
+
let { className: n, size: r, variant: i } = vn(e);
|
|
68
|
+
return r === void 0 && i === void 0 ? ve(t, { className: Y(t.props.className, n) }) : /* @__PURE__ */ U(Q, {
|
|
69
69
|
asChild: !0,
|
|
70
70
|
appearance: e,
|
|
71
71
|
children: t
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
var $ =
|
|
74
|
+
var $ = xe(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
|
|
75
75
|
let { Tooltip: s } = X();
|
|
76
76
|
return /* @__PURE__ */ W(s.Root, {
|
|
77
77
|
disableHoverableContent: !0,
|
|
@@ -93,25 +93,25 @@ var $ = be(function({ label: e, overlayTarget: t, className: n, size: r = "icon"
|
|
|
93
93
|
children: e
|
|
94
94
|
})]
|
|
95
95
|
});
|
|
96
|
-
}),
|
|
96
|
+
}), bn = [
|
|
97
97
|
["small", .25],
|
|
98
98
|
["medium", .5],
|
|
99
99
|
["large", .75],
|
|
100
100
|
["original", null]
|
|
101
|
-
],
|
|
102
|
-
left:
|
|
103
|
-
center:
|
|
104
|
-
right:
|
|
105
|
-
},
|
|
101
|
+
], xn = {
|
|
102
|
+
left: je,
|
|
103
|
+
center: ke,
|
|
104
|
+
right: Me
|
|
105
|
+
}, Sn = [
|
|
106
106
|
"left",
|
|
107
107
|
"center",
|
|
108
108
|
"right"
|
|
109
|
-
],
|
|
110
|
-
image:
|
|
111
|
-
audio:
|
|
112
|
-
video:
|
|
109
|
+
], Cn = {
|
|
110
|
+
image: st,
|
|
111
|
+
audio: St,
|
|
112
|
+
video: $e
|
|
113
113
|
};
|
|
114
|
-
function
|
|
114
|
+
function wn(e, t) {
|
|
115
115
|
if (typeof e == "string" && e) try {
|
|
116
116
|
let n = new URL(e, t);
|
|
117
117
|
if ([
|
|
@@ -124,8 +124,8 @@ function Cn(e, t) {
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = q(null), [h, g] = J(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x =
|
|
127
|
+
function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhiteboardEdit: i, behaviorOptions: a, onCaptionFocus: o, onCopyUrl: s }) {
|
|
128
|
+
let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = q(null), [h, g] = J(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x = wn(B(c, f, d.attrs), p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
|
|
129
129
|
function w(e, t, r, i) {
|
|
130
130
|
return /* @__PURE__ */ U($, {
|
|
131
131
|
...i,
|
|
@@ -139,12 +139,12 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
139
139
|
c.isEditable && c.chain().focus().deleteSelection().run();
|
|
140
140
|
}
|
|
141
141
|
if (f === "fileAttachment") {
|
|
142
|
-
let t =
|
|
142
|
+
let t = F(c);
|
|
143
143
|
if (!t) return null;
|
|
144
|
-
let n =
|
|
144
|
+
let n = wn(t.href, p), r = j(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = U(i ? Ze : qe, {
|
|
145
145
|
size: 16,
|
|
146
146
|
"aria-hidden": !0
|
|
147
|
-
}), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o &&
|
|
147
|
+
}), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && Cn[o];
|
|
148
148
|
return /* @__PURE__ */ W("div", {
|
|
149
149
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
150
150
|
children: [
|
|
@@ -160,7 +160,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
160
160
|
children: a
|
|
161
161
|
})
|
|
162
162
|
}),
|
|
163
|
-
n && w("file.action.copy", /* @__PURE__ */ U(
|
|
163
|
+
n && w("file.action.copy", /* @__PURE__ */ U(Ke, {
|
|
164
164
|
size: 16,
|
|
165
165
|
"aria-hidden": !0
|
|
166
166
|
}), () => s(n, !0)),
|
|
@@ -176,7 +176,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
176
176
|
audio: () => l.setAudioDisplay("player"),
|
|
177
177
|
video: () => l.setVideoDisplay("player")
|
|
178
178
|
}[o]),
|
|
179
|
-
w("file.action.delete", /* @__PURE__ */ U(
|
|
179
|
+
w("file.action.delete", /* @__PURE__ */ U(Ht, {
|
|
180
180
|
size: 16,
|
|
181
181
|
"aria-hidden": !0
|
|
182
182
|
}), T)
|
|
@@ -198,11 +198,11 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
198
198
|
function ee(e) {
|
|
199
199
|
_ ? l.setImageAlign(e) : v ? c.chain().focus().updateAttributes("whiteboard", { align: e }).run() : y ? l.setAudioAlign(e) : l.setVideoAlign(e);
|
|
200
200
|
}
|
|
201
|
-
let D = y || b ? d.attrs.size :
|
|
201
|
+
let D = y || b ? d.attrs.size : bn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
|
|
202
202
|
return /* @__PURE__ */ W("div", {
|
|
203
203
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
204
204
|
children: [
|
|
205
|
-
|
|
205
|
+
bn.map(([e, t]) => /* @__PURE__ */ U(Q, {
|
|
206
206
|
type: "button",
|
|
207
207
|
className: "vibe-shadcn-tiptap__button",
|
|
208
208
|
title: u(`image.size.${e}Tooltip`),
|
|
@@ -214,8 +214,8 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
214
214
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
215
215
|
"aria-hidden": "true"
|
|
216
216
|
}),
|
|
217
|
-
|
|
218
|
-
let t =
|
|
217
|
+
Sn.map((e) => {
|
|
218
|
+
let t = xn[e];
|
|
219
219
|
return /* @__PURE__ */ U($, {
|
|
220
220
|
label: u(`image.align.${e}`),
|
|
221
221
|
"aria-pressed": (d.attrs.align ?? "center") === e,
|
|
@@ -231,21 +231,21 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
231
231
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
232
232
|
"aria-hidden": "true"
|
|
233
233
|
}),
|
|
234
|
-
C && w("image.caption", /* @__PURE__ */ U(
|
|
234
|
+
C && w("image.caption", /* @__PURE__ */ U(Re, {
|
|
235
235
|
size: 16,
|
|
236
236
|
"aria-hidden": !0
|
|
237
237
|
}), () => {
|
|
238
238
|
C.readOnly || (C.hidden = !1, C.focus(), o());
|
|
239
239
|
}),
|
|
240
|
-
v && r && w("whiteboard.edit", /* @__PURE__ */ U(
|
|
240
|
+
v && r && w("whiteboard.edit", /* @__PURE__ */ U(Et, {
|
|
241
241
|
size: 16,
|
|
242
242
|
"aria-hidden": !0
|
|
243
243
|
}), i),
|
|
244
|
-
_ && r && /* @__PURE__ */ W(
|
|
244
|
+
_ && r && /* @__PURE__ */ W(ge, { children: [/* @__PURE__ */ U("input", {
|
|
245
245
|
ref: m,
|
|
246
246
|
type: "file",
|
|
247
247
|
hidden: !0,
|
|
248
|
-
accept:
|
|
248
|
+
accept: z(a).image.accept,
|
|
249
249
|
onChange: async (t) => {
|
|
250
250
|
let n = t.currentTarget.files?.[0];
|
|
251
251
|
if (t.currentTarget.value = "", n && !h) {
|
|
@@ -253,21 +253,21 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
253
253
|
try {
|
|
254
254
|
await l.uploadAndReplaceImage(n);
|
|
255
255
|
} catch {
|
|
256
|
-
c.isDestroyed ||
|
|
256
|
+
c.isDestroyed || le(e.notify, u, "image");
|
|
257
257
|
} finally {
|
|
258
258
|
g(!1);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
}), w("image.replace", /* @__PURE__ */ U(
|
|
262
|
+
}), w("image.replace", /* @__PURE__ */ U(ut, {
|
|
263
263
|
size: 16,
|
|
264
264
|
"aria-hidden": !0
|
|
265
265
|
}), () => m.current?.click(), { disabled: h })] }),
|
|
266
|
-
x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(
|
|
266
|
+
x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(Ke, {
|
|
267
267
|
size: 16,
|
|
268
268
|
"aria-hidden": !0
|
|
269
269
|
}), () => s(x)),
|
|
270
|
-
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(
|
|
270
|
+
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(wt, {
|
|
271
271
|
size: 16,
|
|
272
272
|
"aria-hidden": !0
|
|
273
273
|
}), () => {
|
|
@@ -277,7 +277,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
277
277
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
278
278
|
"aria-hidden": "true"
|
|
279
279
|
}),
|
|
280
|
-
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(
|
|
280
|
+
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(Ht, {
|
|
281
281
|
size: 16,
|
|
282
282
|
"aria-hidden": !0
|
|
283
283
|
}), _ ? l.removeImage : y ? l.removeAudio : b ? l.removeVideo : T)
|
|
@@ -285,26 +285,26 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
// src/color-picker.tsx
|
|
288
|
-
var
|
|
289
|
-
function
|
|
290
|
-
let { Popover: u } = X(), d =
|
|
288
|
+
var En = /^(#[\da-f]{6})ff$/;
|
|
289
|
+
function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
|
|
290
|
+
let { Popover: u } = X(), d = vn(), f = {
|
|
291
291
|
size: e?.button?.size ?? d?.size,
|
|
292
292
|
variant: e?.button?.variant ?? d?.variant,
|
|
293
293
|
className: Y(d?.className, e?.button?.className)
|
|
294
|
-
}, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(
|
|
294
|
+
}, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(En, "$1"), w = Ee(() => {
|
|
295
295
|
let e = /* @__PURE__ */ new Set();
|
|
296
296
|
return n.flatMap((t) => {
|
|
297
|
-
let n = i(t, g)?.replace(
|
|
297
|
+
let n = i(t, g)?.replace(En, "$1"), r = n ?? t.trim();
|
|
298
298
|
return e.has(r) ? [] : (e.add(r), [{
|
|
299
299
|
value: t,
|
|
300
300
|
canonical: n
|
|
301
301
|
}]);
|
|
302
302
|
});
|
|
303
|
-
}, [n, g]), T = r === "color" ?
|
|
303
|
+
}, [n, g]), T = r === "color" ? Ct : ot;
|
|
304
304
|
function E(e) {
|
|
305
|
-
!o &&
|
|
305
|
+
!o && L(t, r, e) && de(t, r, e);
|
|
306
306
|
}
|
|
307
|
-
return /* @__PURE__ */ U(
|
|
307
|
+
return /* @__PURE__ */ U(_n, {
|
|
308
308
|
value: f,
|
|
309
309
|
children: /* @__PURE__ */ W(u.Root, {
|
|
310
310
|
open: c,
|
|
@@ -371,7 +371,7 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
371
371
|
h(m("notify.clipboardUnavailable"), "warning");
|
|
372
372
|
}
|
|
373
373
|
},
|
|
374
|
-
children: [/* @__PURE__ */ U(
|
|
374
|
+
children: [/* @__PURE__ */ U(Ke, {
|
|
375
375
|
size: 14,
|
|
376
376
|
"aria-hidden": !0
|
|
377
377
|
}), S]
|
|
@@ -379,7 +379,7 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
379
379
|
type: "button",
|
|
380
380
|
size: "sm",
|
|
381
381
|
className: "vibe-shadcn-tiptap__button",
|
|
382
|
-
disabled: o || !
|
|
382
|
+
disabled: o || !L(t, r, ""),
|
|
383
383
|
onClick: () => E(""),
|
|
384
384
|
children: m(r === "color" ? "toolbar.color.clear" : "toolbar.highlight.clear")
|
|
385
385
|
})]
|
|
@@ -389,20 +389,20 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
391
|
// src/insertion-popover.tsx
|
|
392
|
-
function
|
|
393
|
-
return /* @__PURE__ */ U(
|
|
392
|
+
function On(e) {
|
|
393
|
+
return /* @__PURE__ */ U(_n, {
|
|
394
394
|
value: e.appearance?.button,
|
|
395
|
-
children: e.request.kind === "link" ? /* @__PURE__ */ U(
|
|
395
|
+
children: e.request.kind === "link" ? /* @__PURE__ */ U(An, {
|
|
396
396
|
...e,
|
|
397
397
|
request: e.request
|
|
398
|
-
}) : /* @__PURE__ */ U(
|
|
398
|
+
}) : /* @__PURE__ */ U(Nn, {
|
|
399
399
|
...e,
|
|
400
400
|
request: e.request
|
|
401
401
|
})
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
function
|
|
405
|
-
let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u =
|
|
404
|
+
function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
|
|
405
|
+
let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u = Ee(() => ({ current: {
|
|
406
406
|
contextElement: n ?? c.view.dom,
|
|
407
407
|
getBoundingClientRect() {
|
|
408
408
|
if (n) return n.getBoundingClientRect();
|
|
@@ -448,8 +448,8 @@ function On({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
|
|
|
448
448
|
})]
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
let { Input: a, Checkbox: o } = X(), s = Y(
|
|
451
|
+
function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
|
|
452
|
+
let { Input: a, Checkbox: o } = X(), s = Y(hn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = Te(), p = Te(), m = Te(), [h] = J(() => r.link ?? P(c)), [g] = J(() => h ? {
|
|
453
453
|
from: h.from,
|
|
454
454
|
to: h.to
|
|
455
455
|
} : {
|
|
@@ -466,13 +466,13 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
466
466
|
}, [c, i]);
|
|
467
467
|
function w() {
|
|
468
468
|
if (!c.isEditable) return;
|
|
469
|
-
let e =
|
|
469
|
+
let e = ce(b);
|
|
470
470
|
e ? (l.insertLinkText(e, _, {
|
|
471
471
|
target: S ? "_blank" : "_self",
|
|
472
472
|
range: g
|
|
473
473
|
}), i()) : d(u(b.trim() ? "notify.linkInvalid" : "notify.linkEmpty"), "warning");
|
|
474
474
|
}
|
|
475
|
-
return /* @__PURE__ */ U(
|
|
475
|
+
return /* @__PURE__ */ U(kn, {
|
|
476
476
|
className: e?.className,
|
|
477
477
|
context: t,
|
|
478
478
|
anchor: r.anchor,
|
|
@@ -510,7 +510,7 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
510
510
|
}),
|
|
511
511
|
/* @__PURE__ */ W("div", {
|
|
512
512
|
className: "vibe-shadcn-tiptap__checkbox-field flex items-center gap-1.5",
|
|
513
|
-
children: [/* @__PURE__ */ U(
|
|
513
|
+
children: [/* @__PURE__ */ U(yn, {
|
|
514
514
|
appearance: e?.checkbox,
|
|
515
515
|
children: /* @__PURE__ */ U(o, {
|
|
516
516
|
id: f,
|
|
@@ -550,19 +550,19 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
550
550
|
})
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
var
|
|
553
|
+
var jn = {
|
|
554
554
|
image: "notify.invalidImageUrl",
|
|
555
555
|
video: "notify.invalidVideoUrl",
|
|
556
556
|
audio: "notify.invalidAudioUrl",
|
|
557
557
|
attachment: "notify.invalidFileUrl"
|
|
558
|
-
},
|
|
559
|
-
image:
|
|
560
|
-
video:
|
|
561
|
-
audio:
|
|
562
|
-
attachment:
|
|
558
|
+
}, Mn = {
|
|
559
|
+
image: st,
|
|
560
|
+
video: $e,
|
|
561
|
+
audio: St,
|
|
562
|
+
attachment: wt
|
|
563
563
|
};
|
|
564
|
-
function
|
|
565
|
-
let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h =
|
|
564
|
+
function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
|
|
565
|
+
let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = Mn[p], g = Te(), _ = p === "attachment" ? "file" : p, v = z(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[ie(_)], x = b && i, S = b && (p !== "image" || v.image.allowUrl), C = x || S, [w, T] = J(n.tab ?? (x ? "upload" : "url")), E = w === "upload" ? x ? "upload" : "url" : S ? "url" : "upload", [ee, D] = J(""), O = q(void 0), k = q(o);
|
|
566
566
|
K(() => {
|
|
567
567
|
k.current = o;
|
|
568
568
|
}, [o]), K(() => {
|
|
@@ -570,7 +570,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
570
570
|
k.current();
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
|
-
let e =
|
|
573
|
+
let e = pe(l, () => k.current());
|
|
574
574
|
return O.current = e, () => {
|
|
575
575
|
e.dispose(), O.current = void 0;
|
|
576
576
|
};
|
|
@@ -585,25 +585,25 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
585
585
|
attachment: u.uploadAndInsertFile
|
|
586
586
|
}[p];
|
|
587
587
|
o(), n(y.multiple ? e : e.slice(0, 1), t).catch(() => {
|
|
588
|
-
l.isDestroyed ||
|
|
588
|
+
l.isDestroyed || le(f, d, _);
|
|
589
589
|
});
|
|
590
590
|
}
|
|
591
591
|
function j() {
|
|
592
592
|
let e = O.current?.range;
|
|
593
593
|
if (!e || !l.isEditable || !S) return;
|
|
594
|
-
let t =
|
|
595
|
-
if (!t) f(d(
|
|
594
|
+
let t = ce(ee);
|
|
595
|
+
if (!t) f(d(jn[p]), "warning");
|
|
596
596
|
else {
|
|
597
597
|
if (p === "video" || p === "audio") {
|
|
598
598
|
if (!(p === "video" ? u.insertVideoUrl : u.insertAudioUrl)(t, e)) {
|
|
599
|
-
f(d(
|
|
599
|
+
f(d(jn[p]), "warning");
|
|
600
600
|
return;
|
|
601
601
|
}
|
|
602
602
|
} else l.commands.setTextSelection(e), p === "image" ? u.setImage(t) : u.insertFile(t);
|
|
603
603
|
o();
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
return C ? /* @__PURE__ */ W(
|
|
606
|
+
return C ? /* @__PURE__ */ W(kn, {
|
|
607
607
|
className: e?.className,
|
|
608
608
|
context: t,
|
|
609
609
|
anchor: m,
|
|
@@ -620,13 +620,13 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
620
620
|
x && S && /* @__PURE__ */ W(c.List, {
|
|
621
621
|
className: Y("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
|
|
622
622
|
"aria-label": d(`command.${p}`),
|
|
623
|
-
children: [/* @__PURE__ */ U(
|
|
623
|
+
children: [/* @__PURE__ */ U(yn, {
|
|
624
624
|
appearance: e?.tabs?.trigger,
|
|
625
625
|
children: /* @__PURE__ */ U(c.Trigger, {
|
|
626
626
|
value: "upload",
|
|
627
627
|
children: d(`toolbar.${p}.upload`)
|
|
628
628
|
})
|
|
629
|
-
}), /* @__PURE__ */ U(
|
|
629
|
+
}), /* @__PURE__ */ U(yn, {
|
|
630
630
|
appearance: e?.tabs?.trigger,
|
|
631
631
|
children: /* @__PURE__ */ U(c.Trigger, {
|
|
632
632
|
value: "url",
|
|
@@ -671,7 +671,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
671
671
|
e.preventDefault(), j();
|
|
672
672
|
},
|
|
673
673
|
children: /* @__PURE__ */ U(s, {
|
|
674
|
-
className: Y(
|
|
674
|
+
className: Y(hn[e?.input?.variant ?? "default"], e?.input?.className),
|
|
675
675
|
"data-initial-focus": !0,
|
|
676
676
|
"aria-label": d(`toolbar.${p}.url`),
|
|
677
677
|
placeholder: d(`toolbar.${p}.urlPlaceholder`),
|
|
@@ -699,7 +699,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
699
699
|
}) : null;
|
|
700
700
|
}
|
|
701
701
|
// src/table-picker.tsx
|
|
702
|
-
var
|
|
702
|
+
var Pn = Se(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
|
|
703
703
|
return /* @__PURE__ */ U("button", {
|
|
704
704
|
type: "button",
|
|
705
705
|
className: Y("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
|
|
@@ -716,14 +716,14 @@ var Nn = xe(function({ row: e, col: t, active: n, current: r, className: i, grid
|
|
|
716
716
|
}
|
|
717
717
|
});
|
|
718
718
|
});
|
|
719
|
-
function
|
|
719
|
+
function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
|
|
720
720
|
let { Popover: o } = X(), { editor: s, commands: c, t: l } = t, [u, d] = J(!1), [f, p] = J({
|
|
721
721
|
row: 1,
|
|
722
722
|
col: 1
|
|
723
723
|
}), m = q(void 0), h = q(!1), g = q(null), { maxRows: _, maxCols: v } = i;
|
|
724
724
|
K(() => {
|
|
725
725
|
if (!u || a) return;
|
|
726
|
-
let e =
|
|
726
|
+
let e = pe(s, () => d(!1));
|
|
727
727
|
return m.current = e, () => {
|
|
728
728
|
e.dispose(), m.current = void 0;
|
|
729
729
|
};
|
|
@@ -732,12 +732,12 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
732
732
|
s,
|
|
733
733
|
u
|
|
734
734
|
]);
|
|
735
|
-
let y =
|
|
735
|
+
let y = Ce((e, t) => {
|
|
736
736
|
p((n) => n.row === e && n.col === t ? n : {
|
|
737
737
|
row: e,
|
|
738
738
|
col: t
|
|
739
739
|
});
|
|
740
|
-
}, []), b =
|
|
740
|
+
}, []), b = Ce((e, t) => {
|
|
741
741
|
let n = m.current?.range;
|
|
742
742
|
n && s.isEditable && !a && (h.current = !0, s.commands.setTextSelection(n), c.insertTable(e, t), d(!1));
|
|
743
743
|
}, [
|
|
@@ -778,7 +778,7 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
778
778
|
style: { gridTemplateColumns: `repeat(${v}, max-content)` },
|
|
779
779
|
children: Array.from({ length: _ * v }, (t, n) => {
|
|
780
780
|
let r = Math.floor(n / v) + 1, i = n % v + 1;
|
|
781
|
-
return /* @__PURE__ */ U(
|
|
781
|
+
return /* @__PURE__ */ U(Pn, {
|
|
782
782
|
row: r,
|
|
783
783
|
col: i,
|
|
784
784
|
active: r <= f.row && i <= f.col,
|
|
@@ -794,8 +794,8 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
794
794
|
});
|
|
795
795
|
}
|
|
796
796
|
// src/vibe-tiptap-provider.tsx
|
|
797
|
-
var
|
|
798
|
-
function
|
|
797
|
+
var In = ye({});
|
|
798
|
+
function Ln(e, t) {
|
|
799
799
|
return {
|
|
800
800
|
components: t.components ?? e.components,
|
|
801
801
|
ui: t.ui ?? e.ui,
|
|
@@ -808,15 +808,21 @@ function In(e, t) {
|
|
|
808
808
|
showWordCount: t.showWordCount ?? e.showWordCount
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
|
-
function
|
|
812
|
-
let
|
|
813
|
-
|
|
814
|
-
|
|
811
|
+
function Rn({ children: e, mediaResources: t, ...n }) {
|
|
812
|
+
let r = we(In), i = {
|
|
813
|
+
...Ln(r, n),
|
|
814
|
+
mediaResources: t ?? r.mediaResources
|
|
815
|
+
};
|
|
816
|
+
return /* @__PURE__ */ U(In.Provider, {
|
|
817
|
+
value: i,
|
|
815
818
|
children: e
|
|
816
819
|
});
|
|
817
820
|
}
|
|
818
|
-
function
|
|
819
|
-
|
|
821
|
+
function zn() {
|
|
822
|
+
return we(In).mediaResources;
|
|
823
|
+
}
|
|
824
|
+
function Bn(e) {
|
|
825
|
+
let { components: t, ...n } = Ln(we(In), e);
|
|
820
826
|
if (!t) throw Error("Pass a components mapping to VibeTiptapProvider or directly to the editor or toolbar.");
|
|
821
827
|
return {
|
|
822
828
|
components: t,
|
|
@@ -824,20 +830,20 @@ function Rn(e) {
|
|
|
824
830
|
};
|
|
825
831
|
}
|
|
826
832
|
// src/whiteboard-dialog.tsx
|
|
827
|
-
function
|
|
828
|
-
let { Dialog: o } = X(), { editor: s, t: c } = t, [l, u] = J(null), [d, f] = J(), [p, m] = J(!1), [h, g] = J(""), [_] = J(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs
|
|
833
|
+
function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
|
|
834
|
+
let { Dialog: o } = X(), { editor: s, t: c } = t, [l, u] = J(null), [d, f] = J(), [p, m] = J(!1), [h, g] = J(""), [_] = J(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs : void 0), v = _?.sceneData, y = _?.caption, b = typeof y == "string" && y.trim() || c("command.whiteboard"), x = q(void 0), S = q(a), C = q(!1), w = q(null), T = q(!1);
|
|
829
835
|
K(() => {
|
|
830
|
-
|
|
836
|
+
S.current = a;
|
|
831
837
|
}, [a]), G(() => {
|
|
832
838
|
if (!l) return;
|
|
833
839
|
let e = l, n = new AbortController(), r = /* @__PURE__ */ new Map(), a, o;
|
|
834
840
|
async function u() {
|
|
835
841
|
if (n.signal.aborted) return;
|
|
836
842
|
o = t.holdWhiteboardSession();
|
|
837
|
-
let l = () =>
|
|
843
|
+
let l = () => S.current(), u = i ? pe(s, l) : void 0, d = i ? void 0 : fe(s, l);
|
|
838
844
|
if (!(u?.range || d?.active)) l();
|
|
839
845
|
else {
|
|
840
|
-
|
|
846
|
+
x.current = {
|
|
841
847
|
requests: n,
|
|
842
848
|
imageUrls: r,
|
|
843
849
|
target: u,
|
|
@@ -846,8 +852,8 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
846
852
|
try {
|
|
847
853
|
let { mountWhiteboard: t } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
|
|
848
854
|
if (n.signal.aborted) return;
|
|
849
|
-
if (i && typeof
|
|
850
|
-
let o = await t(e, typeof
|
|
855
|
+
if (i && typeof v != "string") throw Error();
|
|
856
|
+
let o = await t(e, typeof v == "string" ? v : void 0, r, n.signal, (e) => {
|
|
851
857
|
n.signal.aborted || f(e);
|
|
852
858
|
});
|
|
853
859
|
n.signal.aborted ? o?.() : a = o;
|
|
@@ -858,56 +864,56 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
858
864
|
}
|
|
859
865
|
return queueMicrotask(() => void u()), () => {
|
|
860
866
|
n.abort();
|
|
861
|
-
let e =
|
|
862
|
-
e?.requests === n && (
|
|
867
|
+
let e = x.current;
|
|
868
|
+
e?.requests === n && (x.current = void 0, e.target?.dispose(), e.draft?.cancel()), a && queueMicrotask(a), o?.();
|
|
863
869
|
};
|
|
864
870
|
}, [
|
|
865
871
|
l,
|
|
866
872
|
t,
|
|
867
873
|
i,
|
|
868
874
|
s,
|
|
869
|
-
|
|
875
|
+
v,
|
|
870
876
|
c
|
|
871
877
|
]);
|
|
872
|
-
async function
|
|
873
|
-
let e =
|
|
874
|
-
if (!e || !d ||
|
|
878
|
+
async function E() {
|
|
879
|
+
let e = x.current;
|
|
880
|
+
if (!e || !d || C.current || !s.isEditable) return;
|
|
875
881
|
let { requests: { signal: r }, imageUrls: a, target: o, draft: l } = e, u = () => !r.aborted && !s.isDestroyed && s.isEditable && !!(i ? o?.range : l?.active);
|
|
876
|
-
|
|
882
|
+
C.current = !0, m(!0), g("");
|
|
877
883
|
try {
|
|
878
884
|
let { exportWhiteboard: e } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
|
|
879
885
|
if (!u()) return;
|
|
880
886
|
let f = s.view.dom.ownerDocument.baseURI, { sceneData: p, file: m } = await e(d, a, n, f, r);
|
|
881
887
|
if (!u()) return;
|
|
882
|
-
let h =
|
|
888
|
+
let h = he(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
|
|
883
889
|
if (h?.reason === "too-large") {
|
|
884
890
|
g(c("notify.assetFileTooLarge", {
|
|
885
|
-
size:
|
|
886
|
-
limit:
|
|
891
|
+
size: M(h.size),
|
|
892
|
+
limit: M(h.maxSize)
|
|
887
893
|
}));
|
|
888
894
|
return;
|
|
889
895
|
}
|
|
890
|
-
let
|
|
896
|
+
let _ = await n(m, "whiteboard"), y = (typeof _ == "string" ? _ : _?.url)?.trim();
|
|
891
897
|
if (!u()) return;
|
|
892
|
-
if (!
|
|
898
|
+
if (!y || new URL(y, f).protocol === "data:") throw Error();
|
|
893
899
|
if (i) {
|
|
894
900
|
let e = o?.range;
|
|
895
901
|
if (!e) return;
|
|
896
902
|
let { doc: t, tr: n } = s.state, r = t.nodeAt(e.from);
|
|
897
|
-
if (r?.type.name !== "whiteboard" || r.attrs.sceneData !==
|
|
898
|
-
s.view.dispatch(n.setNodeAttribute(e.from, "src",
|
|
903
|
+
if (r?.type.name !== "whiteboard" || r.attrs.sceneData !== v) throw Error();
|
|
904
|
+
s.view.dispatch(n.setNodeAttribute(e.from, "src", y).setNodeAttribute(e.from, "sceneData", p));
|
|
899
905
|
} else if (!l?.complete({
|
|
900
|
-
src:
|
|
906
|
+
src: y,
|
|
901
907
|
sceneData: p
|
|
902
908
|
})) throw Error();
|
|
903
|
-
|
|
909
|
+
T.current = !0, S.current(), s.commands.focus();
|
|
904
910
|
} catch {
|
|
905
911
|
r.aborted || g(c("whiteboard.saveFailed"));
|
|
906
912
|
} finally {
|
|
907
|
-
|
|
913
|
+
C.current = !1, r.aborted || m(!1);
|
|
908
914
|
}
|
|
909
915
|
}
|
|
910
|
-
return /* @__PURE__ */ U(
|
|
916
|
+
return /* @__PURE__ */ U(_n, {
|
|
911
917
|
value: e?.button,
|
|
912
918
|
children: /* @__PURE__ */ U(o.Root, {
|
|
913
919
|
open: !0,
|
|
@@ -926,18 +932,24 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
926
932
|
},
|
|
927
933
|
onOpenAutoFocus: () => {
|
|
928
934
|
let e = r.ownerDocument.activeElement;
|
|
929
|
-
e instanceof HTMLElement && (
|
|
935
|
+
e instanceof HTMLElement && (w.current = e);
|
|
930
936
|
},
|
|
931
937
|
onCloseAutoFocus: (e) => {
|
|
932
|
-
if (e.preventDefault(), !
|
|
933
|
-
let e =
|
|
938
|
+
if (e.preventDefault(), !T.current && !s.isDestroyed) {
|
|
939
|
+
let e = w.current;
|
|
934
940
|
(e && r.parentElement?.contains(e) ? e : s.view.dom).focus();
|
|
935
941
|
}
|
|
936
942
|
},
|
|
937
943
|
children: [/* @__PURE__ */ W("header", {
|
|
938
944
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
939
945
|
children: [
|
|
940
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ W(o.Title, {
|
|
947
|
+
className: "vibe-shadcn-tiptap__whiteboard-title",
|
|
948
|
+
children: [/* @__PURE__ */ U(Et, {
|
|
949
|
+
size: 16,
|
|
950
|
+
"aria-hidden": "true"
|
|
951
|
+
}), /* @__PURE__ */ U("span", { children: b })]
|
|
952
|
+
}),
|
|
941
953
|
h && /* @__PURE__ */ U("span", {
|
|
942
954
|
role: "alert",
|
|
943
955
|
children: h
|
|
@@ -958,8 +970,8 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
958
970
|
className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__whiteboard-save",
|
|
959
971
|
disabled: !d || p,
|
|
960
972
|
"aria-busy": p || void 0,
|
|
961
|
-
onClick: () => void
|
|
962
|
-
children: [p && /* @__PURE__ */ U(
|
|
973
|
+
onClick: () => void E(),
|
|
974
|
+
children: [p && /* @__PURE__ */ U(vt, {
|
|
963
975
|
"aria-hidden": "true",
|
|
964
976
|
className: "vibe-shadcn-tiptap__spinner",
|
|
965
977
|
size: 16
|
|
@@ -976,133 +988,133 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
976
988
|
});
|
|
977
989
|
}
|
|
978
990
|
// src/shadcn-tiptap-toolbar.tsx
|
|
979
|
-
var
|
|
980
|
-
undo:
|
|
981
|
-
redo:
|
|
982
|
-
bold:
|
|
983
|
-
italic:
|
|
984
|
-
underline:
|
|
985
|
-
strike:
|
|
986
|
-
code:
|
|
987
|
-
superscript:
|
|
988
|
-
subscript:
|
|
989
|
-
color:
|
|
990
|
-
highlight:
|
|
991
|
-
clearFormat:
|
|
992
|
-
align:
|
|
993
|
-
decreaseIndent:
|
|
994
|
-
increaseIndent:
|
|
995
|
-
firstLineIndent:
|
|
996
|
-
bulletList:
|
|
997
|
-
orderedList:
|
|
998
|
-
taskList:
|
|
999
|
-
blockquote:
|
|
1000
|
-
codeBlock:
|
|
1001
|
-
link:
|
|
1002
|
-
image:
|
|
1003
|
-
video:
|
|
1004
|
-
audio:
|
|
1005
|
-
attachment:
|
|
1006
|
-
table:
|
|
1007
|
-
whiteboard:
|
|
1008
|
-
hr:
|
|
1009
|
-
findReplace:
|
|
1010
|
-
markdown:
|
|
1011
|
-
print:
|
|
1012
|
-
preview:
|
|
1013
|
-
fullscreen:
|
|
1014
|
-
},
|
|
1015
|
-
left:
|
|
1016
|
-
center:
|
|
1017
|
-
right:
|
|
1018
|
-
justify:
|
|
1019
|
-
},
|
|
1020
|
-
0:
|
|
1021
|
-
1:
|
|
1022
|
-
2:
|
|
1023
|
-
3:
|
|
1024
|
-
4:
|
|
1025
|
-
5:
|
|
1026
|
-
6:
|
|
991
|
+
var Hn = {
|
|
992
|
+
undo: Gt,
|
|
993
|
+
redo: jt,
|
|
994
|
+
bold: Le,
|
|
995
|
+
italic: pt,
|
|
996
|
+
underline: Wt,
|
|
997
|
+
strike: Lt,
|
|
998
|
+
code: We,
|
|
999
|
+
superscript: zt,
|
|
1000
|
+
subscript: Rt,
|
|
1001
|
+
color: Ct,
|
|
1002
|
+
highlight: ot,
|
|
1003
|
+
clearFormat: Xe,
|
|
1004
|
+
align: je,
|
|
1005
|
+
decreaseIndent: dt,
|
|
1006
|
+
increaseIndent: ft,
|
|
1007
|
+
firstLineIndent: Gn,
|
|
1008
|
+
bulletList: ht,
|
|
1009
|
+
orderedList: _t,
|
|
1010
|
+
taskList: gt,
|
|
1011
|
+
blockquote: At,
|
|
1012
|
+
codeBlock: Ge,
|
|
1013
|
+
link: mt,
|
|
1014
|
+
image: st,
|
|
1015
|
+
video: $e,
|
|
1016
|
+
audio: St,
|
|
1017
|
+
attachment: wt,
|
|
1018
|
+
table: Bt,
|
|
1019
|
+
whiteboard: Et,
|
|
1020
|
+
hr: xt,
|
|
1021
|
+
findReplace: It,
|
|
1022
|
+
markdown: Kn,
|
|
1023
|
+
print: kt,
|
|
1024
|
+
preview: Qe,
|
|
1025
|
+
fullscreen: yt
|
|
1026
|
+
}, Un = {
|
|
1027
|
+
left: je,
|
|
1028
|
+
center: ke,
|
|
1029
|
+
right: Me,
|
|
1030
|
+
justify: Ae
|
|
1031
|
+
}, Wn = {
|
|
1032
|
+
0: Dt,
|
|
1033
|
+
1: et,
|
|
1034
|
+
2: tt,
|
|
1035
|
+
3: nt,
|
|
1036
|
+
4: rt,
|
|
1037
|
+
5: it,
|
|
1038
|
+
6: at
|
|
1027
1039
|
};
|
|
1028
|
-
function
|
|
1040
|
+
function Gn({ size: e }) {
|
|
1029
1041
|
return /* @__PURE__ */ U("svg", {
|
|
1030
1042
|
width: e,
|
|
1031
1043
|
height: e,
|
|
1032
|
-
viewBox:
|
|
1044
|
+
viewBox: nn,
|
|
1033
1045
|
fill: "none",
|
|
1034
1046
|
stroke: "currentColor",
|
|
1035
|
-
strokeWidth:
|
|
1047
|
+
strokeWidth: Qt.strokeWidth,
|
|
1036
1048
|
strokeLinecap: "round",
|
|
1037
1049
|
strokeLinejoin: "round",
|
|
1038
1050
|
"aria-hidden": "true",
|
|
1039
1051
|
focusable: "false",
|
|
1040
|
-
children:
|
|
1052
|
+
children: Qt.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1041
1053
|
});
|
|
1042
1054
|
}
|
|
1043
|
-
function
|
|
1055
|
+
function Kn({ size: e, action: t }) {
|
|
1044
1056
|
return /* @__PURE__ */ W("svg", {
|
|
1045
1057
|
width: e,
|
|
1046
1058
|
height: e,
|
|
1047
|
-
viewBox:
|
|
1059
|
+
viewBox: nn,
|
|
1048
1060
|
fill: "none",
|
|
1049
1061
|
stroke: "currentColor",
|
|
1050
|
-
strokeWidth:
|
|
1062
|
+
strokeWidth: tn.strokeWidth,
|
|
1051
1063
|
strokeLinecap: "round",
|
|
1052
1064
|
strokeLinejoin: "round",
|
|
1053
1065
|
"aria-hidden": "true",
|
|
1054
1066
|
focusable: "false",
|
|
1055
1067
|
children: [/* @__PURE__ */ U("g", {
|
|
1056
|
-
transform: t ?
|
|
1057
|
-
children:
|
|
1058
|
-
}), t &&
|
|
1068
|
+
transform: t ? en : void 0,
|
|
1069
|
+
children: tn.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1070
|
+
}), t && $t[t].map((e) => /* @__PURE__ */ U("path", { d: e }, e))]
|
|
1059
1071
|
});
|
|
1060
1072
|
}
|
|
1061
|
-
function
|
|
1073
|
+
function qn(e) {
|
|
1062
1074
|
let { components: t, showWordCount: n, ...r } = {
|
|
1063
1075
|
...e,
|
|
1064
|
-
...
|
|
1076
|
+
...Bn(e)
|
|
1065
1077
|
}, { Tooltip: i } = t;
|
|
1066
|
-
return /* @__PURE__ */ U(
|
|
1078
|
+
return /* @__PURE__ */ U(pn, {
|
|
1067
1079
|
value: t,
|
|
1068
1080
|
children: /* @__PURE__ */ U(i.Provider, {
|
|
1069
1081
|
delayDuration: 500,
|
|
1070
1082
|
skipDelayDuration: 0,
|
|
1071
|
-
children: /* @__PURE__ */ U(
|
|
1083
|
+
children: /* @__PURE__ */ U(Jn, { ...r }, r.context.editor.instanceId)
|
|
1072
1084
|
})
|
|
1073
1085
|
});
|
|
1074
1086
|
}
|
|
1075
|
-
function
|
|
1087
|
+
function Jn(e) {
|
|
1076
1088
|
let { DropdownMenu: t, Select: n } = X(), i = e.bubble ? void 0 : e.ui?.toolbar, { context: a, preview: o, fullscreen: c, uploadAsset: u } = e, { editor: f, commands: h, t: _ } = a;
|
|
1077
1089
|
H(a, (e) => e.getToolbarRevision());
|
|
1078
|
-
let [v, y] = J(null), [b, S] = J(), [w, T] = J(!1), [D, O] = J(!1), k = q(null), A = e.overlayTarget ?? v ?? void 0, j = f.isEditable, te =
|
|
1079
|
-
let t = e.join(" "), n =
|
|
1080
|
-
return
|
|
1090
|
+
let [v, y] = J(null), [b, S] = J(), [w, T] = J(!1), [D, O] = J(!1), k = q(null), A = e.overlayTarget ?? v ?? void 0, j = f.isEditable, te = z(e.editorBehaviorOptions), ne = ee(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), M = Ee(() => r(e.colors, e.highlights), [e.colors, e.highlights]), P = oe(f), ae = m(e.markdownOptions), F = /* @__PURE__ */ new Map(), I = E(e.toolbar).map((e) => {
|
|
1091
|
+
let t = e.join(" "), n = F.get(t) ?? 0;
|
|
1092
|
+
return F.set(t, n + 1), {
|
|
1081
1093
|
id: `${t}:${n}`,
|
|
1082
|
-
buttons: e.filter(
|
|
1094
|
+
buttons: e.filter(ce)
|
|
1083
1095
|
};
|
|
1084
1096
|
}).filter(({ buttons: e }) => e.length > 0);
|
|
1085
1097
|
G(() => {
|
|
1086
1098
|
j || (S(void 0), O(!1));
|
|
1087
1099
|
}, [j]);
|
|
1088
|
-
function
|
|
1089
|
-
return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!
|
|
1100
|
+
function ce(e) {
|
|
1101
|
+
return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!P : e === "preview" ? o !== void 0 : e === "fullscreen" ? c !== void 0 : o ? e === "print" : e === "whiteboard" ? !!(u && f.schema.nodes.whiteboard) : e === "image" && !u && !te.image.allowUrl ? !1 : e === "image" || e === "video" || e === "audio" || e === "attachment" ? !!f.schema.nodes[ie(e === "attachment" ? "file" : e)] : !0;
|
|
1090
1102
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !
|
|
1103
|
+
function R(e, t) {
|
|
1104
|
+
return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !L(a, e, t);
|
|
1093
1105
|
}
|
|
1094
|
-
function
|
|
1106
|
+
function le(e, t) {
|
|
1095
1107
|
if (e === "preview") return o;
|
|
1096
1108
|
if (e === "fullscreen") return c;
|
|
1097
|
-
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return
|
|
1109
|
+
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return se(a, e, t);
|
|
1098
1110
|
}
|
|
1099
|
-
function
|
|
1100
|
-
|
|
1111
|
+
function B(t, n) {
|
|
1112
|
+
R(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
|
|
1101
1113
|
...e.printOptions,
|
|
1102
1114
|
t: _
|
|
1103
|
-
}) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : O(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" &&
|
|
1115
|
+
}) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : O(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" && de(a, t, n));
|
|
1104
1116
|
}
|
|
1105
|
-
function
|
|
1117
|
+
function ue(t, n, r) {
|
|
1106
1118
|
let i = {
|
|
1107
1119
|
link: e.openLinkPopover,
|
|
1108
1120
|
image: e.openImagePopover,
|
|
@@ -1111,7 +1123,7 @@ function Kn(e) {
|
|
|
1111
1123
|
attachment: void 0
|
|
1112
1124
|
};
|
|
1113
1125
|
if (t === "link" || t === "image" || t === "video" || t === "audio" || t === "attachment") {
|
|
1114
|
-
if (
|
|
1126
|
+
if (R(t)) return;
|
|
1115
1127
|
let e = i[t];
|
|
1116
1128
|
e ? e() : S((e) => e?.triggerId === r ? void 0 : {
|
|
1117
1129
|
triggerId: r,
|
|
@@ -1120,23 +1132,23 @@ function Kn(e) {
|
|
|
1120
1132
|
anchor: n
|
|
1121
1133
|
}
|
|
1122
1134
|
});
|
|
1123
|
-
} else
|
|
1135
|
+
} else B(t);
|
|
1124
1136
|
}
|
|
1125
1137
|
function V(r, u) {
|
|
1126
1138
|
let p = `${u}:${r}`;
|
|
1127
|
-
if (r === "color" || r === "highlight") return /* @__PURE__ */ U(
|
|
1139
|
+
if (r === "color" || r === "highlight") return /* @__PURE__ */ U(Dn, {
|
|
1128
1140
|
appearance: e.ui?.colorPicker,
|
|
1129
1141
|
context: a,
|
|
1130
1142
|
kind: r,
|
|
1131
|
-
disabled:
|
|
1132
|
-
colors: r === "color" ?
|
|
1143
|
+
disabled: R(r),
|
|
1144
|
+
colors: r === "color" ? M.colors : M.highlights,
|
|
1133
1145
|
overlayTarget: A,
|
|
1134
1146
|
bubble: e.bubble,
|
|
1135
1147
|
open: e.bubble ? e.openPalette === r : void 0,
|
|
1136
1148
|
onOpenChange: (t) => e.onPaletteOpenChange?.(r, t)
|
|
1137
1149
|
}, r);
|
|
1138
1150
|
if (r === "heading") {
|
|
1139
|
-
let t = i?.heading, o =
|
|
1151
|
+
let t = i?.heading, o = N(a), s = Wn[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ W("span", {
|
|
1140
1152
|
className: Y("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
|
|
1141
1153
|
children: [/* @__PURE__ */ U(s, {
|
|
1142
1154
|
size: 16,
|
|
@@ -1145,8 +1157,8 @@ function Kn(e) {
|
|
|
1145
1157
|
});
|
|
1146
1158
|
return /* @__PURE__ */ W(n.Root, {
|
|
1147
1159
|
value: c,
|
|
1148
|
-
disabled:
|
|
1149
|
-
onValueChange: (e) =>
|
|
1160
|
+
disabled: R(r),
|
|
1161
|
+
onValueChange: (e) => B(r, Number(e)),
|
|
1150
1162
|
children: [/* @__PURE__ */ U(n.Trigger, {
|
|
1151
1163
|
asChild: !0,
|
|
1152
1164
|
children: /* @__PURE__ */ W(Q, {
|
|
@@ -1159,7 +1171,7 @@ function Kn(e) {
|
|
|
1159
1171
|
children: [/* @__PURE__ */ U(n.Value, {
|
|
1160
1172
|
placeholder: u,
|
|
1161
1173
|
children: u
|
|
1162
|
-
}), /* @__PURE__ */ U(
|
|
1174
|
+
}), /* @__PURE__ */ U(Be, { size: 12 })]
|
|
1163
1175
|
})
|
|
1164
1176
|
}), A && /* @__PURE__ */ U(n.Content, {
|
|
1165
1177
|
container: A,
|
|
@@ -1169,11 +1181,11 @@ function Kn(e) {
|
|
|
1169
1181
|
f.isFocused && e.preventDefault();
|
|
1170
1182
|
},
|
|
1171
1183
|
children: C.map(({ level: e }) => {
|
|
1172
|
-
let i =
|
|
1184
|
+
let i = Wn[e], a = String(e) === c;
|
|
1173
1185
|
return /* @__PURE__ */ W(n.Item, {
|
|
1174
1186
|
value: String(e),
|
|
1175
1187
|
className: Y("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
|
|
1176
|
-
disabled: !a &&
|
|
1188
|
+
disabled: !a && R(r, e),
|
|
1177
1189
|
"data-active": a || void 0,
|
|
1178
1190
|
children: [/* @__PURE__ */ U(i, {
|
|
1179
1191
|
size: 16,
|
|
@@ -1184,13 +1196,13 @@ function Kn(e) {
|
|
|
1184
1196
|
})]
|
|
1185
1197
|
}, r);
|
|
1186
1198
|
}
|
|
1187
|
-
let m = r === "preview" && o ?
|
|
1199
|
+
let m = r === "preview" && o ? Tt : r === "fullscreen" && c ? bt : r === "align" ? Un[re(a)] : Hn[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ U($, {
|
|
1188
1200
|
size: "icon",
|
|
1189
1201
|
label: h,
|
|
1190
1202
|
overlayTarget: A,
|
|
1191
1203
|
"data-toolbar-key": e.bubble ? void 0 : r,
|
|
1192
|
-
disabled:
|
|
1193
|
-
"aria-pressed": r === "findReplace" ? void 0 :
|
|
1204
|
+
disabled: R(r),
|
|
1205
|
+
"aria-pressed": r === "findReplace" ? void 0 : le(r),
|
|
1194
1206
|
"aria-expanded": r === "findReplace" ? a.findReplaceState.open : r === "link" || r === "image" || r === "video" || r === "audio" || r === "attachment" ? b?.triggerId === p : void 0,
|
|
1195
1207
|
onMouseDown: (e) => e.preventDefault(),
|
|
1196
1208
|
children: /* @__PURE__ */ U(m, {
|
|
@@ -1198,13 +1210,13 @@ function Kn(e) {
|
|
|
1198
1210
|
"aria-hidden": !0
|
|
1199
1211
|
})
|
|
1200
1212
|
});
|
|
1201
|
-
if (r === "table") return /* @__PURE__ */ U(
|
|
1213
|
+
if (r === "table") return /* @__PURE__ */ U(Fn, {
|
|
1202
1214
|
appearance: e.ui?.tablePicker,
|
|
1203
1215
|
context: a,
|
|
1204
1216
|
trigger: g,
|
|
1205
1217
|
overlayTarget: A,
|
|
1206
|
-
options:
|
|
1207
|
-
disabled:
|
|
1218
|
+
options: ne.tableGrid,
|
|
1219
|
+
disabled: R(r)
|
|
1208
1220
|
}, r);
|
|
1209
1221
|
if (r === "markdown") return /* @__PURE__ */ W(t.Root, {
|
|
1210
1222
|
modal: !1,
|
|
@@ -1218,14 +1230,14 @@ function Kn(e) {
|
|
|
1218
1230
|
align: "start",
|
|
1219
1231
|
children: s.map(({ value: e }) => /* @__PURE__ */ W(t.Item, {
|
|
1220
1232
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1221
|
-
disabled: e === "import" ? o || !j || w || !
|
|
1233
|
+
disabled: e === "import" ? o || !j || w || !P?.parse : !P?.serialize,
|
|
1222
1234
|
onSelect: () => {
|
|
1223
1235
|
e === "import" ? k.current?.click() : e === "export" ? d(a, {
|
|
1224
|
-
filename:
|
|
1236
|
+
filename: ae.exportFilename,
|
|
1225
1237
|
t: _
|
|
1226
1238
|
}) : l(a, { t: _ });
|
|
1227
1239
|
},
|
|
1228
|
-
children: [/* @__PURE__ */ U(
|
|
1240
|
+
children: [/* @__PURE__ */ U(Kn, {
|
|
1229
1241
|
size: 16,
|
|
1230
1242
|
action: e
|
|
1231
1243
|
}), _(`toolbar.markdown.${e}`)]
|
|
@@ -1234,7 +1246,7 @@ function Kn(e) {
|
|
|
1234
1246
|
}, r);
|
|
1235
1247
|
let v = (() => {
|
|
1236
1248
|
if (r === "align") return x.map(({ value: e }) => {
|
|
1237
|
-
let t =
|
|
1249
|
+
let t = Un[e];
|
|
1238
1250
|
return {
|
|
1239
1251
|
value: e,
|
|
1240
1252
|
label: _(`toolbar.align.${e}`),
|
|
@@ -1244,8 +1256,8 @@ function Kn(e) {
|
|
|
1244
1256
|
})
|
|
1245
1257
|
};
|
|
1246
1258
|
});
|
|
1247
|
-
if (r === "codeBlock") return
|
|
1248
|
-
if (r === "hr") return
|
|
1259
|
+
if (r === "codeBlock") return ne.codeBlockLanguages;
|
|
1260
|
+
if (r === "hr") return ne.horizontalRules.map((e) => ({
|
|
1249
1261
|
...e,
|
|
1250
1262
|
icon: /* @__PURE__ */ U("span", {
|
|
1251
1263
|
className: "vibe-shadcn-tiptap__divider-icon",
|
|
@@ -1269,19 +1281,19 @@ function Kn(e) {
|
|
|
1269
1281
|
},
|
|
1270
1282
|
children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ W(t.Item, {
|
|
1271
1283
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1272
|
-
disabled:
|
|
1273
|
-
"data-active":
|
|
1274
|
-
onSelect: () =>
|
|
1284
|
+
disabled: R(r, e),
|
|
1285
|
+
"data-active": le(r, e) || void 0,
|
|
1286
|
+
onSelect: () => B(r, e),
|
|
1275
1287
|
children: [i, n]
|
|
1276
1288
|
}, e))
|
|
1277
1289
|
})]
|
|
1278
|
-
}, r) : /* @__PURE__ */
|
|
1290
|
+
}, r) : /* @__PURE__ */ be($, {
|
|
1279
1291
|
...g.props,
|
|
1280
1292
|
key: r,
|
|
1281
|
-
onClick: (e) =>
|
|
1293
|
+
onClick: (e) => ue(r, e.currentTarget, p)
|
|
1282
1294
|
});
|
|
1283
1295
|
}
|
|
1284
|
-
return /* @__PURE__ */ U(
|
|
1296
|
+
return /* @__PURE__ */ U(_n, {
|
|
1285
1297
|
value: e.bubble ? e.ui?.bubble?.button : i?.button,
|
|
1286
1298
|
children: /* @__PURE__ */ W("div", {
|
|
1287
1299
|
ref: y,
|
|
@@ -1289,18 +1301,18 @@ function Kn(e) {
|
|
|
1289
1301
|
role: "toolbar",
|
|
1290
1302
|
"aria-label": e.bubble ? void 0 : "Editor toolbar",
|
|
1291
1303
|
children: [
|
|
1292
|
-
|
|
1304
|
+
P && !e.bubble && /* @__PURE__ */ U("input", {
|
|
1293
1305
|
ref: k,
|
|
1294
1306
|
type: "file",
|
|
1295
1307
|
hidden: !0,
|
|
1296
|
-
accept:
|
|
1308
|
+
accept: ae.importAccept,
|
|
1297
1309
|
onChange: async (e) => {
|
|
1298
1310
|
let t = e.currentTarget, n = t.files?.[0];
|
|
1299
|
-
if (t.value = "", n && j &&
|
|
1311
|
+
if (t.value = "", n && j && P?.parse && !w) {
|
|
1300
1312
|
T(!0);
|
|
1301
1313
|
try {
|
|
1302
1314
|
await p(a, n, {
|
|
1303
|
-
strict:
|
|
1315
|
+
strict: ae.importStrict,
|
|
1304
1316
|
t: _,
|
|
1305
1317
|
canImport: () => k.current === t && f.isEditable && !f.isDestroyed
|
|
1306
1318
|
});
|
|
@@ -1310,11 +1322,11 @@ function Kn(e) {
|
|
|
1310
1322
|
}
|
|
1311
1323
|
}
|
|
1312
1324
|
}),
|
|
1313
|
-
|
|
1325
|
+
I.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ U("div", {
|
|
1314
1326
|
className: Y("vibe-shadcn-tiptap__toolbar-group", Z, n > 0 && "border-s border-border ps-1", i?.groupClassName),
|
|
1315
1327
|
children: t.map((t) => V(t, e))
|
|
1316
1328
|
}, e)),
|
|
1317
|
-
j && b && A && /* @__PURE__ */ U(
|
|
1329
|
+
j && b && A && /* @__PURE__ */ U(On, {
|
|
1318
1330
|
appearance: e.ui?.insertionPopover,
|
|
1319
1331
|
context: a,
|
|
1320
1332
|
request: b.request,
|
|
@@ -1323,7 +1335,7 @@ function Kn(e) {
|
|
|
1323
1335
|
behaviorOptions: e.editorBehaviorOptions,
|
|
1324
1336
|
onClose: () => S(void 0)
|
|
1325
1337
|
}, b.triggerId),
|
|
1326
|
-
j && D && u && A && /* @__PURE__ */ U(
|
|
1338
|
+
j && D && u && A && /* @__PURE__ */ U(Vn, {
|
|
1327
1339
|
appearance: e.ui?.whiteboard,
|
|
1328
1340
|
context: a,
|
|
1329
1341
|
uploadAsset: u,
|
|
@@ -1335,7 +1347,7 @@ function Kn(e) {
|
|
|
1335
1347
|
});
|
|
1336
1348
|
}
|
|
1337
1349
|
// src/editor-bubble.tsx
|
|
1338
|
-
var
|
|
1350
|
+
var Yn = "vibeRadixBubble", Xn = 8, Zn = [
|
|
1339
1351
|
"bold",
|
|
1340
1352
|
"italic",
|
|
1341
1353
|
"underline",
|
|
@@ -1344,19 +1356,19 @@ var qn = "vibeRadixBubble", Jn = 8, Yn = [
|
|
|
1344
1356
|
"color",
|
|
1345
1357
|
"highlight",
|
|
1346
1358
|
"clearFormat"
|
|
1347
|
-
],
|
|
1359
|
+
], Qn = /* @__PURE__ */ new Set([
|
|
1348
1360
|
"image",
|
|
1349
1361
|
"video",
|
|
1350
1362
|
"audio",
|
|
1351
1363
|
"fileAttachment",
|
|
1352
1364
|
"whiteboard"
|
|
1353
1365
|
]);
|
|
1354
|
-
function
|
|
1366
|
+
function $n(e) {
|
|
1355
1367
|
let { selection: t, schema: n, doc: r } = e.state, i = n.marks.link;
|
|
1356
|
-
if (!(t instanceof
|
|
1368
|
+
if (!(t instanceof Oe) || !i) return;
|
|
1357
1369
|
let a = i.isInSet(t.$from.nodeAfter?.marks ?? []), o = a?.attrs.href, s = a?.attrs.target;
|
|
1358
1370
|
if (!a || typeof o != "string" || !o) return;
|
|
1359
|
-
let c =
|
|
1371
|
+
let c = _e(t.$from, i, a.attrs);
|
|
1360
1372
|
if (!(!c || t.to > c.to || t.from < c.from)) return {
|
|
1361
1373
|
...c,
|
|
1362
1374
|
href: o,
|
|
@@ -1364,16 +1376,16 @@ function Zn(e) {
|
|
|
1364
1376
|
target: typeof s == "string" ? s : void 0
|
|
1365
1377
|
};
|
|
1366
1378
|
}
|
|
1367
|
-
function
|
|
1379
|
+
function er({ editor: e, element: t }) {
|
|
1368
1380
|
if (e.isDestroyed || !e.isEditable) return !1;
|
|
1369
1381
|
let { view: n, state: { selection: r } } = e, i = n.dom.ownerDocument.activeElement;
|
|
1370
|
-
return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof
|
|
1382
|
+
return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof De ? Qn.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!$n(e) || tr(e);
|
|
1371
1383
|
}
|
|
1372
|
-
function
|
|
1384
|
+
function tr(e) {
|
|
1373
1385
|
let { selection: t, doc: n } = e.state;
|
|
1374
|
-
return t instanceof
|
|
1386
|
+
return t instanceof Oe && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
|
|
1375
1387
|
}
|
|
1376
|
-
async function
|
|
1388
|
+
async function nr(e, t, n = !1) {
|
|
1377
1389
|
let { editor: r, notify: i, t: a } = e;
|
|
1378
1390
|
try {
|
|
1379
1391
|
let e = r.view.dom.ownerDocument.defaultView?.navigator.clipboard;
|
|
@@ -1383,7 +1395,7 @@ async function er(e, t, n = !1) {
|
|
|
1383
1395
|
i(a("notify.clipboardUnavailable"), "warning");
|
|
1384
1396
|
}
|
|
1385
1397
|
}
|
|
1386
|
-
function
|
|
1398
|
+
function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
|
|
1387
1399
|
let { editor: u, t: d, commands: f, notify: p } = t;
|
|
1388
1400
|
H(t, (e) => e.getToolbarRevision());
|
|
1389
1401
|
let [m, h] = J(), [g, _] = J(null), v = q(null);
|
|
@@ -1393,7 +1405,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1393
1405
|
let e = v.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
|
|
1394
1406
|
if (!g || !e) return;
|
|
1395
1407
|
let n = () => {
|
|
1396
|
-
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(
|
|
1408
|
+
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(Yn, "updatePosition"));
|
|
1397
1409
|
}, r = t && new t(n);
|
|
1398
1410
|
r?.observe(e), r?.observe(g);
|
|
1399
1411
|
let i = g.ownerDocument, a = ({ target: e }) => {
|
|
@@ -1403,14 +1415,14 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1403
1415
|
r?.disconnect(), i.removeEventListener("scroll", a, !0);
|
|
1404
1416
|
};
|
|
1405
1417
|
}, [u, g]);
|
|
1406
|
-
let y =
|
|
1418
|
+
let y = Ee(() => {
|
|
1407
1419
|
if (!g) return;
|
|
1408
1420
|
let e = {
|
|
1409
1421
|
boundary: g,
|
|
1410
|
-
padding:
|
|
1422
|
+
padding: Xn
|
|
1411
1423
|
};
|
|
1412
1424
|
return {
|
|
1413
|
-
offset:
|
|
1425
|
+
offset: Xn,
|
|
1414
1426
|
flip: e,
|
|
1415
1427
|
shift: {
|
|
1416
1428
|
...e,
|
|
@@ -1428,7 +1440,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1428
1440
|
},
|
|
1429
1441
|
scrollTarget: g
|
|
1430
1442
|
};
|
|
1431
|
-
}, [g, l]), { selection: b } = u.state, x =
|
|
1443
|
+
}, [g, l]), { selection: b } = u.state, x = $n(u), S = !x && tr(u);
|
|
1432
1444
|
K(() => {
|
|
1433
1445
|
!S && m && (h(void 0), l(!1));
|
|
1434
1446
|
}, [
|
|
@@ -1436,7 +1448,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1436
1448
|
m,
|
|
1437
1449
|
l
|
|
1438
1450
|
]);
|
|
1439
|
-
let C =
|
|
1451
|
+
let C = Zn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
|
|
1440
1452
|
if (x) try {
|
|
1441
1453
|
let e = new URL(x.href, u.view.dom.ownerDocument.baseURI);
|
|
1442
1454
|
[
|
|
@@ -1449,31 +1461,31 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1449
1461
|
} catch {
|
|
1450
1462
|
w = void 0;
|
|
1451
1463
|
}
|
|
1452
|
-
return g ? /* @__PURE__ */ U(
|
|
1464
|
+
return g ? /* @__PURE__ */ U(_n, {
|
|
1453
1465
|
value: e?.bubble?.button,
|
|
1454
1466
|
children: /* @__PURE__ */ U(D, {
|
|
1455
1467
|
editor: u,
|
|
1456
|
-
pluginKey:
|
|
1468
|
+
pluginKey: Yn,
|
|
1457
1469
|
appendTo: n,
|
|
1458
1470
|
updateDelay: 0,
|
|
1459
1471
|
resizeDelay: 0,
|
|
1460
1472
|
options: y,
|
|
1461
|
-
shouldShow:
|
|
1473
|
+
shouldShow: er,
|
|
1462
1474
|
className: "vibe-shadcn-tiptap__bubble-host",
|
|
1463
1475
|
children: /* @__PURE__ */ U("div", {
|
|
1464
1476
|
ref: v,
|
|
1465
1477
|
role: "toolbar",
|
|
1466
1478
|
"aria-label": "Selection toolbar",
|
|
1467
|
-
className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5",
|
|
1479
|
+
className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5", mn, e?.bubble?.className),
|
|
1468
1480
|
onMouseDown: (e) => e.preventDefault(),
|
|
1469
|
-
children: b instanceof
|
|
1481
|
+
children: b instanceof De ? /* @__PURE__ */ U(Tn, {
|
|
1470
1482
|
context: t,
|
|
1471
1483
|
selection: b,
|
|
1472
1484
|
overlayTarget: n,
|
|
1473
1485
|
uploadAsset: a,
|
|
1474
1486
|
behaviorOptions: o,
|
|
1475
|
-
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(
|
|
1476
|
-
onCopyUrl: (e, n) => void
|
|
1487
|
+
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(Yn, "hide")),
|
|
1488
|
+
onCopyUrl: (e, n) => void nr(t, e, n),
|
|
1477
1489
|
onWhiteboardEdit: c
|
|
1478
1490
|
}) : x ? /* @__PURE__ */ W("div", {
|
|
1479
1491
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
@@ -1485,7 +1497,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1485
1497
|
kind: "link",
|
|
1486
1498
|
link: x
|
|
1487
1499
|
}),
|
|
1488
|
-
children: /* @__PURE__ */ U(
|
|
1500
|
+
children: /* @__PURE__ */ U(Tt, {
|
|
1489
1501
|
size: 16,
|
|
1490
1502
|
"aria-hidden": !0
|
|
1491
1503
|
})
|
|
@@ -1499,7 +1511,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1499
1511
|
"aria-disabled": !w || void 0,
|
|
1500
1512
|
target: x.target || "_blank",
|
|
1501
1513
|
rel: "noopener noreferrer",
|
|
1502
|
-
children: /* @__PURE__ */ U(
|
|
1514
|
+
children: /* @__PURE__ */ U(Ze, {
|
|
1503
1515
|
size: 16,
|
|
1504
1516
|
"aria-hidden": !0
|
|
1505
1517
|
})
|
|
@@ -1508,8 +1520,8 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1508
1520
|
/* @__PURE__ */ U($, {
|
|
1509
1521
|
label: d("toolbar.link.copy"),
|
|
1510
1522
|
overlayTarget: n,
|
|
1511
|
-
onClick: () => void
|
|
1512
|
-
children: /* @__PURE__ */ U(
|
|
1523
|
+
onClick: () => void nr(t, x.href),
|
|
1524
|
+
children: /* @__PURE__ */ U(Ke, {
|
|
1513
1525
|
size: 16,
|
|
1514
1526
|
"aria-hidden": !0
|
|
1515
1527
|
})
|
|
@@ -1520,13 +1532,13 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1520
1532
|
onClick: () => {
|
|
1521
1533
|
f.setLink("", { range: x }), p(d("notify.linkRemoved"), "success");
|
|
1522
1534
|
},
|
|
1523
|
-
children: /* @__PURE__ */ U(
|
|
1535
|
+
children: /* @__PURE__ */ U(Kt, {
|
|
1524
1536
|
size: 16,
|
|
1525
1537
|
"aria-hidden": !0
|
|
1526
1538
|
})
|
|
1527
1539
|
})
|
|
1528
1540
|
]
|
|
1529
|
-
}) : S ? /* @__PURE__ */ U(
|
|
1541
|
+
}) : S ? /* @__PURE__ */ U(Jn, {
|
|
1530
1542
|
context: t,
|
|
1531
1543
|
ui: e,
|
|
1532
1544
|
toolbar: [C],
|
|
@@ -1545,11 +1557,11 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1545
1557
|
}) : null;
|
|
1546
1558
|
}
|
|
1547
1559
|
// src/find-replace.tsx
|
|
1548
|
-
function
|
|
1560
|
+
function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
1549
1561
|
let { InputGroup: i } = X(), { editor: a, commands: o, t: s } = t, c = H(t, (e) => e.findReplaceState), l = q(null), u = q(null), [d, f] = J(0);
|
|
1550
1562
|
if (G(() => {
|
|
1551
1563
|
let e = ({ transaction: e }) => {
|
|
1552
|
-
|
|
1564
|
+
I(e) && f((e) => e + 1);
|
|
1553
1565
|
};
|
|
1554
1566
|
return a.on("transaction", e), () => {
|
|
1555
1567
|
a.off("transaction", e);
|
|
@@ -1565,11 +1577,11 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1565
1577
|
function p(e, t) {
|
|
1566
1578
|
e ? o.findReplacePrevious() : o.findReplaceNext(), t.focus({ preventScroll: !0 });
|
|
1567
1579
|
}
|
|
1568
|
-
let m = c.matches.length > 0, h = Y("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1",
|
|
1569
|
-
return /* @__PURE__ */ U(
|
|
1580
|
+
let m = c.matches.length > 0, h = Y("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", hn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = Y("h-full", e?.input?.className);
|
|
1581
|
+
return /* @__PURE__ */ U(_n, {
|
|
1570
1582
|
value: e?.button,
|
|
1571
1583
|
children: /* @__PURE__ */ W("div", {
|
|
1572
|
-
className: Y("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5",
|
|
1584
|
+
className: Y("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5", mn, e?.className),
|
|
1573
1585
|
role: "search",
|
|
1574
1586
|
"aria-label": s("command.findReplace"),
|
|
1575
1587
|
onKeyDown: (e) => {
|
|
@@ -1584,7 +1596,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1584
1596
|
/* @__PURE__ */ U(i.Addon, {
|
|
1585
1597
|
align: "inline-start",
|
|
1586
1598
|
"aria-hidden": !0,
|
|
1587
|
-
children: /* @__PURE__ */ U(
|
|
1599
|
+
children: /* @__PURE__ */ U(It, { size: 16 })
|
|
1588
1600
|
}),
|
|
1589
1601
|
/* @__PURE__ */ U(i.Input, {
|
|
1590
1602
|
className: g,
|
|
@@ -1605,7 +1617,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1605
1617
|
overlayTarget: r,
|
|
1606
1618
|
"aria-pressed": c.caseSensitive,
|
|
1607
1619
|
onClick: () => o.setFindReplaceCaseSensitive(!c.caseSensitive),
|
|
1608
|
-
children: /* @__PURE__ */ U(
|
|
1620
|
+
children: /* @__PURE__ */ U(ze, {
|
|
1609
1621
|
size: 16,
|
|
1610
1622
|
"aria-hidden": !0
|
|
1611
1623
|
})
|
|
@@ -1626,7 +1638,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1626
1638
|
overlayTarget: r,
|
|
1627
1639
|
disabled: !m,
|
|
1628
1640
|
onClick: (e) => p(!0, e.currentTarget),
|
|
1629
|
-
children: /* @__PURE__ */ U(
|
|
1641
|
+
children: /* @__PURE__ */ U(Ue, {
|
|
1630
1642
|
size: 16,
|
|
1631
1643
|
"aria-hidden": !0
|
|
1632
1644
|
})
|
|
@@ -1637,7 +1649,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1637
1649
|
overlayTarget: r,
|
|
1638
1650
|
disabled: !m,
|
|
1639
1651
|
onClick: (e) => p(!1, e.currentTarget),
|
|
1640
|
-
children: /* @__PURE__ */ U(
|
|
1652
|
+
children: /* @__PURE__ */ U(Be, {
|
|
1641
1653
|
size: 16,
|
|
1642
1654
|
"aria-hidden": !0
|
|
1643
1655
|
})
|
|
@@ -1647,7 +1659,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1647
1659
|
label: s("findReplace.close"),
|
|
1648
1660
|
overlayTarget: r,
|
|
1649
1661
|
onClick: () => o.closeFindReplace(),
|
|
1650
|
-
children: /* @__PURE__ */ U(
|
|
1662
|
+
children: /* @__PURE__ */ U(Yt, {
|
|
1651
1663
|
size: 16,
|
|
1652
1664
|
"aria-hidden": !0
|
|
1653
1665
|
})
|
|
@@ -1661,7 +1673,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1661
1673
|
children: [/* @__PURE__ */ U(i.Addon, {
|
|
1662
1674
|
align: "inline-start",
|
|
1663
1675
|
"aria-hidden": !0,
|
|
1664
|
-
children: /* @__PURE__ */ U(
|
|
1676
|
+
children: /* @__PURE__ */ U(Mt, { size: 16 })
|
|
1665
1677
|
}), /* @__PURE__ */ U(i.Input, {
|
|
1666
1678
|
className: g,
|
|
1667
1679
|
"aria-label": s("findReplace.replacement"),
|
|
@@ -1679,7 +1691,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1679
1691
|
overlayTarget: r,
|
|
1680
1692
|
disabled: !m,
|
|
1681
1693
|
onClick: () => o.replaceFindReplaceCurrent(),
|
|
1682
|
-
children: /* @__PURE__ */ U(
|
|
1694
|
+
children: /* @__PURE__ */ U(Mt, {
|
|
1683
1695
|
size: 16,
|
|
1684
1696
|
"aria-hidden": !0
|
|
1685
1697
|
})
|
|
@@ -1690,7 +1702,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1690
1702
|
overlayTarget: r,
|
|
1691
1703
|
disabled: !m,
|
|
1692
1704
|
onClick: () => o.replaceFindReplaceAll(),
|
|
1693
|
-
children: /* @__PURE__ */ U(
|
|
1705
|
+
children: /* @__PURE__ */ U(Nt, {
|
|
1694
1706
|
size: 16,
|
|
1695
1707
|
"aria-hidden": !0
|
|
1696
1708
|
})
|
|
@@ -1701,7 +1713,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1701
1713
|
});
|
|
1702
1714
|
}
|
|
1703
1715
|
// src/image-preview-dialog.tsx
|
|
1704
|
-
function
|
|
1716
|
+
function ar(e, t) {
|
|
1705
1717
|
if (!e) return {};
|
|
1706
1718
|
let n;
|
|
1707
1719
|
try {
|
|
@@ -1722,8 +1734,8 @@ function rr(e, t) {
|
|
|
1722
1734
|
name: i
|
|
1723
1735
|
};
|
|
1724
1736
|
}
|
|
1725
|
-
function
|
|
1726
|
-
let { Dialog: o } = X(), { urls: s } = i, [c, l] = J(i.index), [u, d] = J(0), [f, p] = J(100), m = q(null), h = q(null), g = q(null), _ = q(null), v = s.length > 1, y = s[c], { href: b, name: x } =
|
|
1737
|
+
function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
|
|
1738
|
+
let { Dialog: o } = X(), { urls: s } = i, [c, l] = J(i.index), [u, d] = J(0), [f, p] = J(100), m = q(null), h = q(null), g = q(null), _ = q(null), v = s.length > 1, y = s[c], { href: b, name: x } = ar(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
|
|
1727
1739
|
function w(e) {
|
|
1728
1740
|
v && (m.current = null, d(0), p(100), l((t) => (t + e + s.length) % s.length));
|
|
1729
1741
|
}
|
|
@@ -1749,7 +1761,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1749
1761
|
},
|
|
1750
1762
|
children: [/* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", {
|
|
1751
1763
|
className: "vibe-shadcn-tiptap__image-title",
|
|
1752
|
-
children: [/* @__PURE__ */ U(
|
|
1764
|
+
children: [/* @__PURE__ */ U(ct, {
|
|
1753
1765
|
size: 16,
|
|
1754
1766
|
"aria-hidden": "true"
|
|
1755
1767
|
}), /* @__PURE__ */ U(o.Title, {
|
|
@@ -1768,7 +1780,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1768
1780
|
label: n("image.preview.previous"),
|
|
1769
1781
|
overlayTarget: r,
|
|
1770
1782
|
onClick: () => w(-1),
|
|
1771
|
-
children: /* @__PURE__ */ U(
|
|
1783
|
+
children: /* @__PURE__ */ U(Ve, {
|
|
1772
1784
|
size: 16,
|
|
1773
1785
|
"aria-hidden": "true"
|
|
1774
1786
|
})
|
|
@@ -1787,7 +1799,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1787
1799
|
label: n("image.preview.next"),
|
|
1788
1800
|
overlayTarget: r,
|
|
1789
1801
|
onClick: () => w(1),
|
|
1790
|
-
children: /* @__PURE__ */ U(
|
|
1802
|
+
children: /* @__PURE__ */ U(He, {
|
|
1791
1803
|
size: 16,
|
|
1792
1804
|
"aria-hidden": "true"
|
|
1793
1805
|
})
|
|
@@ -1803,7 +1815,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1803
1815
|
label: n("image.preview.zoomOut"),
|
|
1804
1816
|
overlayTarget: r,
|
|
1805
1817
|
onClick: () => void h.current?.zoomOut(.1),
|
|
1806
|
-
children: /* @__PURE__ */ U(
|
|
1818
|
+
children: /* @__PURE__ */ U(Zt, {
|
|
1807
1819
|
size: 16,
|
|
1808
1820
|
"aria-hidden": "true"
|
|
1809
1821
|
})
|
|
@@ -1824,7 +1836,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1824
1836
|
label: n("image.preview.zoomIn"),
|
|
1825
1837
|
overlayTarget: r,
|
|
1826
1838
|
onClick: () => void h.current?.zoomIn(.1),
|
|
1827
|
-
children: /* @__PURE__ */ U(
|
|
1839
|
+
children: /* @__PURE__ */ U(Xt, {
|
|
1828
1840
|
size: 16,
|
|
1829
1841
|
"aria-hidden": "true"
|
|
1830
1842
|
})
|
|
@@ -1840,7 +1852,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1840
1852
|
label: n("image.preview.rotateLeft"),
|
|
1841
1853
|
overlayTarget: r,
|
|
1842
1854
|
onClick: () => d((e) => (e - 90) % 360),
|
|
1843
|
-
children: /* @__PURE__ */ U(
|
|
1855
|
+
children: /* @__PURE__ */ U(Pt, {
|
|
1844
1856
|
size: 16,
|
|
1845
1857
|
"aria-hidden": "true"
|
|
1846
1858
|
})
|
|
@@ -1851,7 +1863,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1851
1863
|
label: n("image.preview.rotateRight"),
|
|
1852
1864
|
overlayTarget: r,
|
|
1853
1865
|
onClick: () => d((e) => (e + 90) % 360),
|
|
1854
|
-
children: /* @__PURE__ */ U(
|
|
1866
|
+
children: /* @__PURE__ */ U(Ft, {
|
|
1855
1867
|
size: 16,
|
|
1856
1868
|
"aria-hidden": "true"
|
|
1857
1869
|
})
|
|
@@ -1866,7 +1878,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1866
1878
|
"aria-disabled": !b || void 0,
|
|
1867
1879
|
target: "_blank",
|
|
1868
1880
|
rel: "noreferrer",
|
|
1869
|
-
children: [/* @__PURE__ */ U(
|
|
1881
|
+
children: [/* @__PURE__ */ U(qe, {
|
|
1870
1882
|
size: 16,
|
|
1871
1883
|
"aria-hidden": "true"
|
|
1872
1884
|
}), n("image.preview.download")]
|
|
@@ -1880,7 +1892,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1880
1892
|
size: "icon",
|
|
1881
1893
|
label: n("image.preview.close"),
|
|
1882
1894
|
overlayTarget: r,
|
|
1883
|
-
children: /* @__PURE__ */ U(
|
|
1895
|
+
children: /* @__PURE__ */ U(Yt, {
|
|
1884
1896
|
size: 16,
|
|
1885
1897
|
"aria-hidden": "true"
|
|
1886
1898
|
})
|
|
@@ -1905,7 +1917,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1905
1917
|
onLostPointerCapture: (e) => {
|
|
1906
1918
|
m.current?.pointerId === e.pointerId && (m.current = null);
|
|
1907
1919
|
},
|
|
1908
|
-
children: /* @__PURE__ */ U(
|
|
1920
|
+
children: /* @__PURE__ */ U(an, {
|
|
1909
1921
|
ref: h,
|
|
1910
1922
|
centerOnInit: !0,
|
|
1911
1923
|
centerZoomedOut: !0,
|
|
@@ -1920,7 +1932,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1920
1932
|
activationKeys: (e) => !e.includes("Shift")
|
|
1921
1933
|
},
|
|
1922
1934
|
onTransform: (e, { scale: t }) => p(Math.round(t * 100)),
|
|
1923
|
-
children: /* @__PURE__ */ U(
|
|
1935
|
+
children: /* @__PURE__ */ U(rn, {
|
|
1924
1936
|
wrapperClass: "vibe-shadcn-tiptap__image-viewport",
|
|
1925
1937
|
contentClass: "vibe-shadcn-tiptap__image-plane",
|
|
1926
1938
|
children: /* @__PURE__ */ U("img", {
|
|
@@ -1936,62 +1948,73 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1936
1948
|
});
|
|
1937
1949
|
}
|
|
1938
1950
|
// src/mention-menu.tsx
|
|
1939
|
-
function
|
|
1940
|
-
let { editor:
|
|
1951
|
+
function sr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
|
|
1952
|
+
let { editor: a, items: o, groups: s, selectedIndex: c, mount: l, loading: u } = t, d = `vibe-tiptap-mention-${a.instanceId}`, f = q(null);
|
|
1941
1953
|
return K(() => {
|
|
1942
|
-
let e =
|
|
1943
|
-
if (e) return
|
|
1944
|
-
}, [
|
|
1945
|
-
let e =
|
|
1946
|
-
if (!
|
|
1947
|
-
let n = e.getAttribute("aria-activedescendant"),
|
|
1948
|
-
e.setAttribute("aria-activedescendant",
|
|
1949
|
-
let
|
|
1950
|
-
return
|
|
1951
|
-
|
|
1954
|
+
let e = f.current;
|
|
1955
|
+
if (e) return l(e);
|
|
1956
|
+
}, [l, n]), K(() => {
|
|
1957
|
+
let e = a.view.dom, t = f.current;
|
|
1958
|
+
if (!o[c] || !t) return;
|
|
1959
|
+
let n = `${d}-${c}`, r = e.getAttribute("aria-activedescendant"), i = e.getAttribute("aria-controls");
|
|
1960
|
+
e.setAttribute("aria-activedescendant", n), e.setAttribute("aria-controls", d);
|
|
1961
|
+
let s = e.ownerDocument.getElementById(n);
|
|
1962
|
+
return s && s.offsetTop < t.scrollTop && (t.scrollTop = s.offsetTop), s && s.offsetTop + s.offsetHeight > t.scrollTop + t.clientHeight && (t.scrollTop = s.offsetTop + s.offsetHeight - t.clientHeight), () => {
|
|
1963
|
+
r === null ? e.removeAttribute("aria-activedescendant") : e.setAttribute("aria-activedescendant", r), i === null ? e.removeAttribute("aria-controls") : e.setAttribute("aria-controls", i);
|
|
1952
1964
|
};
|
|
1953
1965
|
}, [
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1966
|
+
a,
|
|
1967
|
+
d,
|
|
1968
|
+
o,
|
|
1969
|
+
c
|
|
1970
|
+
]), on(/* @__PURE__ */ U("div", {
|
|
1971
|
+
ref: f,
|
|
1972
|
+
className: Y("z-3 vibe-shadcn-tiptap__mention", e?.className),
|
|
1973
|
+
children: o.length ? /* @__PURE__ */ U("div", {
|
|
1974
|
+
id: d,
|
|
1962
1975
|
role: "listbox",
|
|
1963
|
-
"aria-label":
|
|
1964
|
-
children:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1976
|
+
"aria-label": r("mention.label"),
|
|
1977
|
+
children: s.map(({ name: n, label: r, items: a, startIndex: o }) => /* @__PURE__ */ W("div", {
|
|
1978
|
+
className: n === void 0 ? void 0 : e?.groupClassName,
|
|
1979
|
+
...r ? {
|
|
1980
|
+
role: "group",
|
|
1981
|
+
"aria-label": r
|
|
1982
|
+
} : {},
|
|
1983
|
+
children: [r && /* @__PURE__ */ U("div", {
|
|
1984
|
+
className: Y("px-3 py-1 text-xs font-medium text-muted-foreground", e?.groupLabelClassName),
|
|
1985
|
+
children: r
|
|
1986
|
+
}), a.map((n, r) => /* @__PURE__ */ U("button", {
|
|
1987
|
+
id: `${d}-${o + r}`,
|
|
1988
|
+
type: "button",
|
|
1989
|
+
role: "option",
|
|
1990
|
+
tabIndex: -1,
|
|
1991
|
+
"aria-label": n.label,
|
|
1992
|
+
"aria-selected": o + r === c,
|
|
1993
|
+
className: Y("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground", e?.button?.className),
|
|
1994
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1995
|
+
onClick: () => t.command(n),
|
|
1996
|
+
children: i ? i(n) : /* @__PURE__ */ W(ge, { children: [n.avatar && /* @__PURE__ */ U("img", {
|
|
1997
|
+
src: n.avatar,
|
|
1998
|
+
alt: "",
|
|
1999
|
+
className: "vibe-tiptap-mention-avatar"
|
|
2000
|
+
}), /* @__PURE__ */ U("span", { children: n.label })] })
|
|
2001
|
+
}, n.id))]
|
|
2002
|
+
}, n === void 0 ? "ungrouped" : `group-${n}`))
|
|
1980
2003
|
}) : /* @__PURE__ */ U("div", {
|
|
1981
|
-
className: "px-3 py-1 text-sm",
|
|
2004
|
+
className: Y("px-3 py-1 text-sm", e?.statusClassName),
|
|
1982
2005
|
role: "status",
|
|
1983
|
-
children:
|
|
2006
|
+
children: r(u ? "mention.loading" : "mention.empty")
|
|
1984
2007
|
})
|
|
1985
|
-
}),
|
|
2008
|
+
}), n);
|
|
1986
2009
|
}
|
|
1987
2010
|
// src/mention-popover.tsx
|
|
1988
|
-
function
|
|
1989
|
-
let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c =
|
|
2011
|
+
function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
2012
|
+
let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c = Ee(() => ({ current: {
|
|
1990
2013
|
contextElement: e,
|
|
1991
2014
|
getBoundingClientRect: () => a?.element.getBoundingClientRect() ?? new DOMRect()
|
|
1992
2015
|
} }), [e, a]);
|
|
1993
2016
|
return G(() => {
|
|
1994
|
-
let t =
|
|
2017
|
+
let t = sn(e, o, r);
|
|
1995
2018
|
return s.current = t, () => {
|
|
1996
2019
|
t.destroy(), s.current = void 0;
|
|
1997
2020
|
};
|
|
@@ -2011,7 +2034,7 @@ function or({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
|
2011
2034
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2012
2035
|
onFocusOutside: (e) => e.preventDefault(),
|
|
2013
2036
|
onPointerDownOutside: (t) => {
|
|
2014
|
-
|
|
2037
|
+
ae(e, t.target) && t.preventDefault();
|
|
2015
2038
|
},
|
|
2016
2039
|
onMouseEnter: () => s.current?.keepOpen(),
|
|
2017
2040
|
onMouseLeave: () => s.current?.leave(),
|
|
@@ -2020,32 +2043,32 @@ function or({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
|
2020
2043
|
});
|
|
2021
2044
|
}
|
|
2022
2045
|
// src/slash-menu.tsx
|
|
2023
|
-
var
|
|
2024
|
-
heading1:
|
|
2025
|
-
heading:
|
|
2026
|
-
heading3:
|
|
2027
|
-
heading4:
|
|
2028
|
-
todo:
|
|
2029
|
-
bulletList:
|
|
2030
|
-
orderedList:
|
|
2031
|
-
blockquote:
|
|
2032
|
-
table:
|
|
2033
|
-
image:
|
|
2034
|
-
imageUrl:
|
|
2035
|
-
whiteboard:
|
|
2036
|
-
video:
|
|
2037
|
-
videoUrl:
|
|
2038
|
-
audio:
|
|
2039
|
-
audioUrl:
|
|
2040
|
-
upload:
|
|
2041
|
-
link:
|
|
2042
|
-
codeBlock:
|
|
2043
|
-
mermaid:
|
|
2046
|
+
var lr = {
|
|
2047
|
+
heading1: et,
|
|
2048
|
+
heading: tt,
|
|
2049
|
+
heading3: nt,
|
|
2050
|
+
heading4: rt,
|
|
2051
|
+
todo: gt,
|
|
2052
|
+
bulletList: ht,
|
|
2053
|
+
orderedList: _t,
|
|
2054
|
+
blockquote: At,
|
|
2055
|
+
table: Bt,
|
|
2056
|
+
image: ut,
|
|
2057
|
+
imageUrl: lt,
|
|
2058
|
+
whiteboard: Et,
|
|
2059
|
+
video: qt,
|
|
2060
|
+
videoUrl: Ut,
|
|
2061
|
+
audio: St,
|
|
2062
|
+
audioUrl: St,
|
|
2063
|
+
upload: wt,
|
|
2064
|
+
link: mt,
|
|
2065
|
+
codeBlock: We,
|
|
2066
|
+
mermaid: Jt,
|
|
2044
2067
|
divider: "solid",
|
|
2045
2068
|
dividerThick: "thick",
|
|
2046
2069
|
dividerDashed: "dashed",
|
|
2047
2070
|
dividerDotted: "dotted"
|
|
2048
|
-
},
|
|
2071
|
+
}, ur = {
|
|
2049
2072
|
heading1: "slashCommand.group.headings",
|
|
2050
2073
|
heading: "slashCommand.group.headings",
|
|
2051
2074
|
heading3: "slashCommand.group.headings",
|
|
@@ -2071,7 +2094,7 @@ var sr = {
|
|
|
2071
2094
|
dividerDashed: "slashCommand.group.dividers",
|
|
2072
2095
|
dividerDotted: "slashCommand.group.dividers"
|
|
2073
2096
|
};
|
|
2074
|
-
function
|
|
2097
|
+
function dr({ appearance: e, state: t, target: n, t: r }) {
|
|
2075
2098
|
let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u = q(null), d = a[s], f = d && !d.disabledReason ? `${l}-${d.id}` : void 0;
|
|
2076
2099
|
K(() => {
|
|
2077
2100
|
let e = u.current;
|
|
@@ -2098,15 +2121,15 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2098
2121
|
l
|
|
2099
2122
|
]);
|
|
2100
2123
|
let p = [];
|
|
2101
|
-
if (
|
|
2124
|
+
if (R(o)) p.push({ items: a });
|
|
2102
2125
|
else for (let e of a) {
|
|
2103
|
-
let t = e.disabledReason ? "slashCommand.group.unavailable" :
|
|
2126
|
+
let t = e.disabledReason ? "slashCommand.group.unavailable" : ur[e.id], n = p.at(-1);
|
|
2104
2127
|
n?.label === t ? n.items.push(e) : p.push({
|
|
2105
2128
|
label: t,
|
|
2106
2129
|
items: [e]
|
|
2107
2130
|
});
|
|
2108
2131
|
}
|
|
2109
|
-
return
|
|
2132
|
+
return on(/* @__PURE__ */ U("div", {
|
|
2110
2133
|
ref: u,
|
|
2111
2134
|
className: Y("z-3 vibe-shadcn-tiptap__slash", e?.className),
|
|
2112
2135
|
children: a.length ? /* @__PURE__ */ U("div", {
|
|
@@ -2134,7 +2157,7 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2134
2157
|
onMouseDown: (e) => e.preventDefault(),
|
|
2135
2158
|
onClick: () => t.command(n),
|
|
2136
2159
|
children: [
|
|
2137
|
-
/* @__PURE__ */ U(
|
|
2160
|
+
/* @__PURE__ */ U(fr, { command: n.id }),
|
|
2138
2161
|
n.label,
|
|
2139
2162
|
(n.disabledReason || n.hint) && /* @__PURE__ */ U("small", {
|
|
2140
2163
|
id: `${l}-${n.id}-hint`,
|
|
@@ -2149,8 +2172,8 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2149
2172
|
})
|
|
2150
2173
|
}), n);
|
|
2151
2174
|
}
|
|
2152
|
-
function
|
|
2153
|
-
let t =
|
|
2175
|
+
function fr({ command: e }) {
|
|
2176
|
+
let t = lr[e];
|
|
2154
2177
|
return /* @__PURE__ */ U("span", {
|
|
2155
2178
|
className: "vibe-shadcn-tiptap__slash-icon",
|
|
2156
2179
|
"aria-hidden": !0,
|
|
@@ -2161,57 +2184,57 @@ function ur({ command: e }) {
|
|
|
2161
2184
|
});
|
|
2162
2185
|
}
|
|
2163
2186
|
// src/table-grips.tsx
|
|
2164
|
-
var
|
|
2187
|
+
var pr = ["row", "column"], mr = {
|
|
2165
2188
|
row: [
|
|
2166
2189
|
[
|
|
2167
2190
|
"addRowBefore",
|
|
2168
2191
|
"table.insertAbove",
|
|
2169
|
-
|
|
2192
|
+
Ot
|
|
2170
2193
|
],
|
|
2171
2194
|
[
|
|
2172
2195
|
"addRowAfter",
|
|
2173
2196
|
"table.insertBelow",
|
|
2174
|
-
|
|
2197
|
+
Ot
|
|
2175
2198
|
],
|
|
2176
2199
|
[
|
|
2177
2200
|
"moveRowUp",
|
|
2178
2201
|
"table.moveUp",
|
|
2179
|
-
|
|
2202
|
+
Ie
|
|
2180
2203
|
],
|
|
2181
2204
|
[
|
|
2182
2205
|
"moveRowDown",
|
|
2183
2206
|
"table.moveDown",
|
|
2184
|
-
|
|
2207
|
+
Ne
|
|
2185
2208
|
]
|
|
2186
2209
|
],
|
|
2187
2210
|
column: [
|
|
2188
2211
|
[
|
|
2189
2212
|
"addColumnBefore",
|
|
2190
2213
|
"table.insertLeft",
|
|
2191
|
-
|
|
2214
|
+
Ot
|
|
2192
2215
|
],
|
|
2193
2216
|
[
|
|
2194
2217
|
"addColumnAfter",
|
|
2195
2218
|
"table.insertRight",
|
|
2196
|
-
|
|
2219
|
+
Ot
|
|
2197
2220
|
],
|
|
2198
2221
|
[
|
|
2199
2222
|
"moveColumnLeft",
|
|
2200
2223
|
"table.moveLeft",
|
|
2201
|
-
|
|
2224
|
+
Pe
|
|
2202
2225
|
],
|
|
2203
2226
|
[
|
|
2204
2227
|
"moveColumnRight",
|
|
2205
2228
|
"table.moveRight",
|
|
2206
|
-
|
|
2229
|
+
Fe
|
|
2207
2230
|
]
|
|
2208
2231
|
]
|
|
2209
2232
|
};
|
|
2210
|
-
function
|
|
2233
|
+
function hr({ appearance: e, context: t, overlayTarget: n }) {
|
|
2211
2234
|
let { DropdownMenu: r } = X(), { editor: i, commands: a, t: o } = t, s = H(t, (e) => e.getToolbarRevision()), [c, l] = J(), [u, d] = J(), [f, p] = J(), m = q(void 0), h = q(!1);
|
|
2212
2235
|
function g(e) {
|
|
2213
2236
|
let { view: t, state: n } = i;
|
|
2214
|
-
if (t.dom.contains(e)) return
|
|
2237
|
+
if (t.dom.contains(e)) return ln(n.doc.resolve(t.posAtDOM(e, 0)));
|
|
2215
2238
|
}
|
|
2216
2239
|
function _(e, t) {
|
|
2217
2240
|
let n = g(t.cell);
|
|
@@ -2241,10 +2264,10 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2241
2264
|
}
|
|
2242
2265
|
let o = a.closest("table");
|
|
2243
2266
|
if (!o || !e?.contains(o) || i.isDestroyed) return;
|
|
2244
|
-
let s =
|
|
2267
|
+
let s = ln(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
|
|
2245
2268
|
if (!s) return;
|
|
2246
2269
|
n();
|
|
2247
|
-
let { left: c, right: d, top: f } =
|
|
2270
|
+
let { left: c, right: d, top: f } = cn.get(s.node(-1)).findCell(s.pos - s.start(-1)), p = o.querySelectorAll(":scope > colgroup > col"), m = a.getBoundingClientRect(), h = m.width > 0 ? (t.clientX - m.left) / m.width : 0, g = Math.min(d - 1, Math.max(c, c + Math.floor(h * (d - c))));
|
|
2248
2271
|
for (let e = c; e < d; e += 1) {
|
|
2249
2272
|
let n = p[e]?.getBoundingClientRect();
|
|
2250
2273
|
if (n && n.width > 0 && t.clientX < n.right) {
|
|
@@ -2271,7 +2294,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2271
2294
|
let r = t, a = e, o = c;
|
|
2272
2295
|
function s() {
|
|
2273
2296
|
if (i.isDestroyed) return;
|
|
2274
|
-
let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ?
|
|
2297
|
+
let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ? ln(i.state.doc.resolve(i.view.posAtDOM(e, 0))) : void 0;
|
|
2275
2298
|
if (!c || !u) {
|
|
2276
2299
|
l(void 0), d(void 0);
|
|
2277
2300
|
return;
|
|
@@ -2281,7 +2304,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2281
2304
|
l(void 0), d(void 0);
|
|
2282
2305
|
return;
|
|
2283
2306
|
}
|
|
2284
|
-
let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } =
|
|
2307
|
+
let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } = cn.get(u.node(-1)).findCell(u.pos - u.start(-1)), x = _ && _.width > 0 ? _.left + _.width / 2 : v.left + (s - y + .5) * v.width / (b - y);
|
|
2285
2308
|
p({
|
|
2286
2309
|
row: {
|
|
2287
2310
|
left: Math.max(m.left + 11, h.left - 11) - f.left,
|
|
@@ -2304,7 +2327,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2304
2327
|
function v(e, t) {
|
|
2305
2328
|
let n = g(t.cell);
|
|
2306
2329
|
if (!n) return !1;
|
|
2307
|
-
let r = n.node(-1), i =
|
|
2330
|
+
let r = n.node(-1), i = cn.get(r);
|
|
2308
2331
|
return i.cellsInRect({
|
|
2309
2332
|
left: 0,
|
|
2310
2333
|
top: 0,
|
|
@@ -2312,8 +2335,8 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2312
2335
|
bottom: e === "column" ? i.height : 1
|
|
2313
2336
|
}).every((e) => r.nodeAt(e)?.type.spec.tableRole === "header_cell");
|
|
2314
2337
|
}
|
|
2315
|
-
return
|
|
2316
|
-
let s = t === "row" ?
|
|
2338
|
+
return pr.map((t) => {
|
|
2339
|
+
let s = t === "row" ? Ye : Je, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
|
|
2317
2340
|
function m(e) {
|
|
2318
2341
|
c && i.isEditable && _(t, c) && (h.current = !0, e(), l(void 0), d(void 0));
|
|
2319
2342
|
}
|
|
@@ -2347,7 +2370,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2347
2370
|
h.current && e.preventDefault();
|
|
2348
2371
|
},
|
|
2349
2372
|
children: [
|
|
2350
|
-
|
|
2373
|
+
mr[t].map(([e, t, n]) => /* @__PURE__ */ W(r.Item, {
|
|
2351
2374
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2352
2375
|
onSelect: () => m(a[e]),
|
|
2353
2376
|
children: [/* @__PURE__ */ U(n, {
|
|
@@ -2358,7 +2381,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2358
2381
|
c[t] === 0 && /* @__PURE__ */ W(r.Item, {
|
|
2359
2382
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2360
2383
|
onSelect: () => m(t === "row" ? a.toggleHeaderRow : a.toggleHeaderColumn),
|
|
2361
|
-
children: [/* @__PURE__ */ U(
|
|
2384
|
+
children: [/* @__PURE__ */ U(Vt, {
|
|
2362
2385
|
size: 15,
|
|
2363
2386
|
"aria-hidden": !0
|
|
2364
2387
|
}), o(v(t, c) ? "table.unsetHeader" : "table.setHeader")]
|
|
@@ -2366,7 +2389,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2366
2389
|
/* @__PURE__ */ W(r.Item, {
|
|
2367
2390
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2368
2391
|
onSelect: () => m(() => t === "row" ? a.deleteRow(c.row) : a.deleteColumn(c.column)),
|
|
2369
|
-
children: [/* @__PURE__ */ U(
|
|
2392
|
+
children: [/* @__PURE__ */ U(Ht, {
|
|
2370
2393
|
size: 15,
|
|
2371
2394
|
"aria-hidden": !0
|
|
2372
2395
|
}), o("table.deleteLine")]
|
|
@@ -2377,167 +2400,170 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2377
2400
|
});
|
|
2378
2401
|
}
|
|
2379
2402
|
// src/use-vibe-tiptap.ts
|
|
2380
|
-
var
|
|
2381
|
-
function
|
|
2382
|
-
let
|
|
2403
|
+
var gr = Symbol();
|
|
2404
|
+
function _r(e = {}) {
|
|
2405
|
+
let t = zn(), [n] = J(() => ({
|
|
2406
|
+
...e,
|
|
2407
|
+
mediaResources: e.mediaResources ?? t
|
|
2408
|
+
})), [r, i] = J(!1), a = q(void 0), o = q(e), s = q(void 0), c = q(void 0), l = q(void 0), [u] = J(() => {
|
|
2383
2409
|
function e() {
|
|
2384
|
-
let e =
|
|
2385
|
-
|
|
2410
|
+
let e = c.current;
|
|
2411
|
+
c.current = void 0, a.current?.onSlash(void 0), e && !e.editor.isDestroyed && ne(e.editor.view, (n.slashCommand || void 0)?.pluginKey ?? V);
|
|
2386
2412
|
}
|
|
2387
|
-
function
|
|
2388
|
-
|
|
2413
|
+
function t() {
|
|
2414
|
+
l.current && te(l.current.editor);
|
|
2389
2415
|
}
|
|
2390
2416
|
return {
|
|
2391
|
-
bind(
|
|
2392
|
-
if (
|
|
2393
|
-
return e(),
|
|
2394
|
-
|
|
2417
|
+
bind(n) {
|
|
2418
|
+
if (a.current) throw Error("useVibeTiptap already has a mounted editor view");
|
|
2419
|
+
return e(), t(), a.current = n, () => {
|
|
2420
|
+
a.current = void 0, e(), t(), i(!1);
|
|
2395
2421
|
};
|
|
2396
2422
|
},
|
|
2397
2423
|
closeSlashMenu: e
|
|
2398
2424
|
};
|
|
2399
|
-
}),
|
|
2400
|
-
onOpen:
|
|
2401
|
-
onUpdate:
|
|
2402
|
-
onClose: () =>
|
|
2403
|
-
onExecute: (e) =>
|
|
2425
|
+
}), d = {
|
|
2426
|
+
onOpen: f,
|
|
2427
|
+
onUpdate: f,
|
|
2428
|
+
onClose: () => f(void 0),
|
|
2429
|
+
onExecute: (e) => a.current?.onExecute(e)
|
|
2404
2430
|
};
|
|
2405
|
-
function d(e) {
|
|
2406
|
-
s.current = e, i.current?.onSlash(e);
|
|
2407
|
-
}
|
|
2408
2431
|
function f(e) {
|
|
2409
|
-
c.current = e,
|
|
2432
|
+
c.current = e, a.current?.onSlash(e);
|
|
2433
|
+
}
|
|
2434
|
+
function p(e) {
|
|
2435
|
+
l.current = e, a.current?.onMention(e);
|
|
2410
2436
|
}
|
|
2411
|
-
let
|
|
2412
|
-
...
|
|
2437
|
+
let m = n.mention || void 0, h = m && {
|
|
2438
|
+
...m,
|
|
2413
2439
|
onOpen(e) {
|
|
2414
|
-
|
|
2440
|
+
p(e), m.onOpen?.(e);
|
|
2415
2441
|
},
|
|
2416
2442
|
onUpdate(e) {
|
|
2417
|
-
|
|
2443
|
+
p(e), m.onUpdate?.(e);
|
|
2418
2444
|
},
|
|
2419
2445
|
onClose() {
|
|
2420
|
-
|
|
2446
|
+
p(void 0), m.onClose?.();
|
|
2421
2447
|
}
|
|
2422
2448
|
};
|
|
2423
|
-
function
|
|
2424
|
-
let e =
|
|
2425
|
-
if (e?.editor.schema.nodes.image) return A(e, () =>
|
|
2449
|
+
function g() {
|
|
2450
|
+
let e = s.current;
|
|
2451
|
+
if (e?.editor.schema.nodes.image) return A(e, () => o.current.uploadAsset, () => o.current.editorBehaviorOptions);
|
|
2426
2452
|
}
|
|
2427
2453
|
G(() => {
|
|
2428
|
-
|
|
2454
|
+
o.current = e;
|
|
2429
2455
|
}, [e]);
|
|
2430
|
-
let
|
|
2431
|
-
...
|
|
2432
|
-
content:
|
|
2433
|
-
editable: (e.editable ?? !0) && !
|
|
2456
|
+
let _ = me({
|
|
2457
|
+
...n,
|
|
2458
|
+
content: n.initialContent,
|
|
2459
|
+
editable: (e.editable ?? !0) && !r,
|
|
2434
2460
|
uploadAsset: e.uploadAsset,
|
|
2435
2461
|
editorBehaviorOptions: e.editorBehaviorOptions,
|
|
2436
|
-
slashCommand:
|
|
2437
|
-
mention:
|
|
2462
|
+
slashCommand: n.slashCommand ?? {},
|
|
2463
|
+
mention: h,
|
|
2438
2464
|
editorProps: {
|
|
2439
|
-
...
|
|
2465
|
+
...n.editorProps,
|
|
2440
2466
|
handleDOMEvents: {
|
|
2441
|
-
...
|
|
2467
|
+
...n.editorProps?.handleDOMEvents,
|
|
2442
2468
|
paste(e, t) {
|
|
2443
|
-
return
|
|
2469
|
+
return o.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (g()?.onPaste(t), t.defaultPrevented);
|
|
2444
2470
|
},
|
|
2445
2471
|
drop(e, t) {
|
|
2446
|
-
return
|
|
2472
|
+
return o.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (g()?.onDrop(t), t.defaultPrevented);
|
|
2447
2473
|
}
|
|
2448
2474
|
}
|
|
2449
2475
|
},
|
|
2450
2476
|
onUpdate: e.onUpdate,
|
|
2451
2477
|
onImagePreview(t) {
|
|
2452
|
-
|
|
2478
|
+
a.current?.onImagePreview(t), e.onImagePreview?.(t);
|
|
2453
2479
|
},
|
|
2454
2480
|
notify(t, n = "info") {
|
|
2455
|
-
(e.notify ??
|
|
2481
|
+
(e.notify ?? a.current?.notify)?.(t, n);
|
|
2456
2482
|
}
|
|
2457
|
-
},
|
|
2458
|
-
return G(() => (
|
|
2459
|
-
|
|
2460
|
-
}), [
|
|
2461
|
-
context:
|
|
2462
|
-
[
|
|
2463
|
-
bridge:
|
|
2464
|
-
preview:
|
|
2465
|
-
setPreview:
|
|
2483
|
+
}, n.slashCommand === !1 ? void 0 : d);
|
|
2484
|
+
return G(() => (s.current = _, () => {
|
|
2485
|
+
s.current = void 0;
|
|
2486
|
+
}), [_]), {
|
|
2487
|
+
context: _,
|
|
2488
|
+
[gr]: {
|
|
2489
|
+
bridge: u,
|
|
2490
|
+
preview: r,
|
|
2491
|
+
setPreview: i,
|
|
2466
2492
|
editable: e.editable ?? !0,
|
|
2467
|
-
mentionHoverDelay:
|
|
2468
|
-
codeBlockLanguages:
|
|
2469
|
-
horizontalRules:
|
|
2493
|
+
mentionHoverDelay: m?.hoverDelay,
|
|
2494
|
+
codeBlockLanguages: n.codeBlockLanguages,
|
|
2495
|
+
horizontalRules: n.horizontalRules,
|
|
2470
2496
|
uploadAsset: e.uploadAsset,
|
|
2471
2497
|
editorBehaviorOptions: e.editorBehaviorOptions
|
|
2472
2498
|
}
|
|
2473
2499
|
};
|
|
2474
2500
|
}
|
|
2475
2501
|
// src/shadcn-tiptap-editor.tsx
|
|
2476
|
-
function
|
|
2477
|
-
let t =
|
|
2502
|
+
function vr(e) {
|
|
2503
|
+
let t = Bn(e), { components: n, editor: r, showWordCount: i = !0, toolbar: a, toolbarOptions: o, colors: s, highlights: c, ui: l, markdownOptions: u, renderMentionItem: d, renderMentionPopover: f, printOptions: p, className: m, onKeyDown: h, ...g } = {
|
|
2478
2504
|
...e,
|
|
2479
2505
|
...t
|
|
2480
|
-
}, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[
|
|
2506
|
+
}, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[gr], { Tooltip: ee } = n, [D, O] = J(null), [k, A] = J(null), [j, te] = J(!1), [ne, M] = J(), [N, P] = J(), [re, ie] = J(), [ae, oe] = J(!1), [F, I] = J(), [se, L] = J(), [ce, R] = J([]), le = q(0), z = q(/* @__PURE__ */ new Map()), B = q(!1), de = E(a).some((e) => e.includes("preview")), V = H(_, (e) => e.editor.isEditable) ?? v, fe = D?.ownerDocument.fullscreenEnabled && typeof D.requestFullscreen == "function";
|
|
2481
2507
|
G(() => {
|
|
2482
2508
|
let e = T.bind({
|
|
2483
|
-
onSlash:
|
|
2484
|
-
onMention:
|
|
2509
|
+
onSlash: P,
|
|
2510
|
+
onMention: ie,
|
|
2485
2511
|
onExecute: ({ item: e }) => {
|
|
2486
|
-
_ &&
|
|
2487
|
-
onImage: () =>
|
|
2512
|
+
_ && ue(_, e, {
|
|
2513
|
+
onImage: () => I({
|
|
2488
2514
|
kind: "image",
|
|
2489
2515
|
tab: "upload"
|
|
2490
2516
|
}),
|
|
2491
|
-
onImageUrl: () =>
|
|
2517
|
+
onImageUrl: () => I({
|
|
2492
2518
|
kind: "image",
|
|
2493
2519
|
tab: "url"
|
|
2494
2520
|
}),
|
|
2495
|
-
onVideo: () =>
|
|
2521
|
+
onVideo: () => I({
|
|
2496
2522
|
kind: "video",
|
|
2497
2523
|
tab: "upload"
|
|
2498
2524
|
}),
|
|
2499
|
-
onVideoUrl: () =>
|
|
2525
|
+
onVideoUrl: () => I({
|
|
2500
2526
|
kind: "video",
|
|
2501
2527
|
tab: "url"
|
|
2502
2528
|
}),
|
|
2503
|
-
onAudio: () =>
|
|
2529
|
+
onAudio: () => I({
|
|
2504
2530
|
kind: "audio",
|
|
2505
2531
|
tab: "upload"
|
|
2506
2532
|
}),
|
|
2507
|
-
onAudioUrl: () =>
|
|
2533
|
+
onAudioUrl: () => I({
|
|
2508
2534
|
kind: "audio",
|
|
2509
2535
|
tab: "url"
|
|
2510
2536
|
}),
|
|
2511
|
-
onUpload: () =>
|
|
2537
|
+
onUpload: () => I({
|
|
2512
2538
|
kind: "attachment",
|
|
2513
2539
|
tab: "upload"
|
|
2514
2540
|
}),
|
|
2515
|
-
onLink: () =>
|
|
2516
|
-
onWhiteboard: () =>
|
|
2541
|
+
onLink: () => I({ kind: "link" }),
|
|
2542
|
+
onWhiteboard: () => L("new")
|
|
2517
2543
|
});
|
|
2518
2544
|
},
|
|
2519
2545
|
onImagePreview(e) {
|
|
2520
|
-
|
|
2546
|
+
M({
|
|
2521
2547
|
...e,
|
|
2522
2548
|
urls: [...e.urls],
|
|
2523
2549
|
names: e.names?.slice()
|
|
2524
2550
|
});
|
|
2525
2551
|
},
|
|
2526
2552
|
notify(e, t = "info") {
|
|
2527
|
-
let n = ++
|
|
2528
|
-
|
|
2553
|
+
let n = ++le.current;
|
|
2554
|
+
R((r) => [...r, {
|
|
2529
2555
|
id: n,
|
|
2530
2556
|
message: e,
|
|
2531
2557
|
type: t
|
|
2532
|
-
}]),
|
|
2533
|
-
|
|
2558
|
+
}]), z.current.set(n, setTimeout(() => {
|
|
2559
|
+
z.current.delete(n), R((e) => e.filter((e) => e.id !== n));
|
|
2534
2560
|
}, 3e3));
|
|
2535
2561
|
}
|
|
2536
|
-
}), t =
|
|
2562
|
+
}), t = z.current;
|
|
2537
2563
|
return () => {
|
|
2538
2564
|
e();
|
|
2539
2565
|
for (let e of t.values()) clearTimeout(e);
|
|
2540
|
-
t.clear(),
|
|
2566
|
+
t.clear(), R([]), P(void 0), ie(void 0), M(void 0), I(void 0), L(void 0), oe(!1);
|
|
2541
2567
|
};
|
|
2542
2568
|
}, [T, _]), G(() => {
|
|
2543
2569
|
de || b(!1);
|
|
@@ -2546,21 +2572,21 @@ function gr(e) {
|
|
|
2546
2572
|
let e = D.ownerDocument, t = () => te(e.fullscreenElement === D);
|
|
2547
2573
|
return e.addEventListener("fullscreenchange", t), () => e.removeEventListener("fullscreenchange", t);
|
|
2548
2574
|
}, [D]), G(() => {
|
|
2549
|
-
V || (
|
|
2575
|
+
V || (I(void 0), L(void 0), oe(!1)), !V && N && T.closeSlashMenu();
|
|
2550
2576
|
}, [
|
|
2551
2577
|
T,
|
|
2552
2578
|
V,
|
|
2553
|
-
|
|
2579
|
+
N
|
|
2554
2580
|
]);
|
|
2555
2581
|
async function pe(e) {
|
|
2556
|
-
if (D && !
|
|
2557
|
-
|
|
2582
|
+
if (D && !B.current && e !== j) {
|
|
2583
|
+
B.current = !0;
|
|
2558
2584
|
try {
|
|
2559
2585
|
e ? await D.requestFullscreen() : await D.ownerDocument.exitFullscreen();
|
|
2560
2586
|
} catch {
|
|
2561
2587
|
_ && !_.editor.isDestroyed && _.notify(_.t("notify.fullscreenFailed"), "warning");
|
|
2562
2588
|
} finally {
|
|
2563
|
-
|
|
2589
|
+
B.current = !1;
|
|
2564
2590
|
}
|
|
2565
2591
|
}
|
|
2566
2592
|
}
|
|
@@ -2573,13 +2599,13 @@ function gr(e) {
|
|
|
2573
2599
|
if (!o.nodeAfter?.isText) return;
|
|
2574
2600
|
let s = a.isInSet(o.nodeAfter.marks);
|
|
2575
2601
|
if (!s || s.attrs.href !== n.getAttribute("href")) return;
|
|
2576
|
-
let c =
|
|
2602
|
+
let c = _e(o, a, s.attrs);
|
|
2577
2603
|
if (!c) return;
|
|
2578
2604
|
e.preventDefault();
|
|
2579
2605
|
let { from: l, to: u } = i.selection;
|
|
2580
2606
|
(l < c.from || l >= c.to || u > c.to) && t.commands.setTextSelection(c), r.focus();
|
|
2581
2607
|
}
|
|
2582
|
-
return /* @__PURE__ */ U(
|
|
2608
|
+
return /* @__PURE__ */ U(pn, {
|
|
2583
2609
|
value: n,
|
|
2584
2610
|
children: /* @__PURE__ */ U(ee.Provider, {
|
|
2585
2611
|
delayDuration: 500,
|
|
@@ -2588,7 +2614,7 @@ function gr(e) {
|
|
|
2588
2614
|
...g,
|
|
2589
2615
|
ref: O,
|
|
2590
2616
|
className: ["vibe-shadcn-tiptap", m].filter(Boolean).join(" "),
|
|
2591
|
-
"data-scroll-locked": V && !!(
|
|
2617
|
+
"data-scroll-locked": V && !!(N || re || F || ae) || void 0,
|
|
2592
2618
|
onKeyDown: (e) => {
|
|
2593
2619
|
if (h?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.shiftKey || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "f" || typeof _?.editor.commands.openFindReplace != "function")) {
|
|
2594
2620
|
if (e.preventDefault(), e.target instanceof Element && e.target.closest(".vibe-shadcn-tiptap__find")) {
|
|
@@ -2597,8 +2623,8 @@ function gr(e) {
|
|
|
2597
2623
|
} else _.commands.openFindReplace();
|
|
2598
2624
|
}
|
|
2599
2625
|
},
|
|
2600
|
-
children: [_ && /* @__PURE__ */ W(
|
|
2601
|
-
a !== !1 && /* @__PURE__ */ U(
|
|
2626
|
+
children: [_ && /* @__PURE__ */ W(ge, { children: [
|
|
2627
|
+
a !== !1 && /* @__PURE__ */ U(Jn, {
|
|
2602
2628
|
context: _,
|
|
2603
2629
|
toolbar: a,
|
|
2604
2630
|
toolbarOptions: o,
|
|
@@ -2610,7 +2636,7 @@ function gr(e) {
|
|
|
2610
2636
|
markdownOptions: u,
|
|
2611
2637
|
printOptions: p,
|
|
2612
2638
|
uploadAsset: C,
|
|
2613
|
-
openWhiteboard: () =>
|
|
2639
|
+
openWhiteboard: () => L("new"),
|
|
2614
2640
|
editorBehaviorOptions: w,
|
|
2615
2641
|
preview: y,
|
|
2616
2642
|
onPreviewChange: b,
|
|
@@ -2621,29 +2647,29 @@ function gr(e) {
|
|
|
2621
2647
|
/* @__PURE__ */ W("div", {
|
|
2622
2648
|
className: "vibe-shadcn-tiptap__body",
|
|
2623
2649
|
children: [
|
|
2624
|
-
/* @__PURE__ */ U(
|
|
2650
|
+
/* @__PURE__ */ U(ir, {
|
|
2625
2651
|
context: _,
|
|
2626
2652
|
appearance: l?.findReplace,
|
|
2627
2653
|
editable: V,
|
|
2628
2654
|
overlayTarget: k ?? void 0
|
|
2629
2655
|
}),
|
|
2630
|
-
/* @__PURE__ */ U(
|
|
2656
|
+
/* @__PURE__ */ U(un, {
|
|
2631
2657
|
context: _,
|
|
2632
2658
|
tabIndex: !V && typeof _.editor.commands.openFindReplace == "function" ? 0 : void 0,
|
|
2633
2659
|
onClick: me,
|
|
2634
2660
|
onBlur: (e) => {
|
|
2635
|
-
!e.currentTarget.contains(e.relatedTarget) &&
|
|
2661
|
+
!e.currentTarget.contains(e.relatedTarget) && N && !_.editor.isDestroyed && T.closeSlashMenu();
|
|
2636
2662
|
}
|
|
2637
2663
|
}),
|
|
2638
|
-
V && k && /* @__PURE__ */ U(
|
|
2664
|
+
V && k && /* @__PURE__ */ U(hr, {
|
|
2639
2665
|
appearance: l?.tableGrips,
|
|
2640
2666
|
context: _,
|
|
2641
2667
|
overlayTarget: k
|
|
2642
2668
|
})
|
|
2643
2669
|
]
|
|
2644
2670
|
}),
|
|
2645
|
-
i && /* @__PURE__ */ U(
|
|
2646
|
-
V && k && /* @__PURE__ */ U(
|
|
2671
|
+
i && /* @__PURE__ */ U(dn, { context: _ }),
|
|
2672
|
+
V && k && /* @__PURE__ */ U(rr, {
|
|
2647
2673
|
context: _,
|
|
2648
2674
|
ui: l,
|
|
2649
2675
|
overlayTarget: k,
|
|
@@ -2651,51 +2677,52 @@ function gr(e) {
|
|
|
2651
2677
|
highlights: c,
|
|
2652
2678
|
uploadAsset: C,
|
|
2653
2679
|
behaviorOptions: w,
|
|
2654
|
-
onLink:
|
|
2655
|
-
onWhiteboardEdit: () =>
|
|
2656
|
-
onPaletteOpenChange:
|
|
2680
|
+
onLink: I,
|
|
2681
|
+
onWhiteboardEdit: () => L("edit"),
|
|
2682
|
+
onPaletteOpenChange: oe
|
|
2657
2683
|
}),
|
|
2658
|
-
V && k && C &&
|
|
2684
|
+
V && k && C && se && /* @__PURE__ */ U(Vn, {
|
|
2659
2685
|
appearance: l?.whiteboard,
|
|
2660
2686
|
context: _,
|
|
2661
2687
|
uploadAsset: C,
|
|
2662
2688
|
overlayTarget: k,
|
|
2663
|
-
edit:
|
|
2664
|
-
onClose: () =>
|
|
2689
|
+
edit: se === "edit",
|
|
2690
|
+
onClose: () => L(void 0)
|
|
2665
2691
|
}),
|
|
2666
|
-
V &&
|
|
2692
|
+
V && N && k && /* @__PURE__ */ U(dr, {
|
|
2667
2693
|
appearance: l?.slashMenu,
|
|
2668
|
-
state:
|
|
2694
|
+
state: N,
|
|
2669
2695
|
target: k,
|
|
2670
2696
|
t: _.t
|
|
2671
2697
|
}),
|
|
2672
|
-
V &&
|
|
2673
|
-
|
|
2698
|
+
V && re && k && /* @__PURE__ */ U(sr, {
|
|
2699
|
+
appearance: l?.mentionMenu,
|
|
2700
|
+
state: re,
|
|
2674
2701
|
target: k,
|
|
2675
2702
|
t: _.t,
|
|
2676
2703
|
renderItem: d
|
|
2677
2704
|
}),
|
|
2678
|
-
f && k && /* @__PURE__ */ U(
|
|
2705
|
+
f && k && /* @__PURE__ */ U(cr, {
|
|
2679
2706
|
editor: _.editor.view.dom,
|
|
2680
2707
|
container: k,
|
|
2681
|
-
hoverDelay: r[
|
|
2708
|
+
hoverDelay: r[gr].mentionHoverDelay,
|
|
2682
2709
|
render: f
|
|
2683
2710
|
}, _.editor.instanceId),
|
|
2684
|
-
V &&
|
|
2711
|
+
V && F && k && /* @__PURE__ */ U(On, {
|
|
2685
2712
|
appearance: l?.insertionPopover,
|
|
2686
2713
|
context: _,
|
|
2687
|
-
request:
|
|
2714
|
+
request: F,
|
|
2688
2715
|
overlayTarget: k,
|
|
2689
2716
|
canUpload: !!C,
|
|
2690
2717
|
behaviorOptions: w,
|
|
2691
|
-
onClose: () =>
|
|
2692
|
-
},
|
|
2693
|
-
k &&
|
|
2718
|
+
onClose: () => I(void 0)
|
|
2719
|
+
}, F.kind),
|
|
2720
|
+
k && ne && /* @__PURE__ */ U(or, {
|
|
2694
2721
|
appearance: l?.imagePreview,
|
|
2695
2722
|
context: _,
|
|
2696
2723
|
overlayTarget: k,
|
|
2697
|
-
imagePreview:
|
|
2698
|
-
onClose: () =>
|
|
2724
|
+
imagePreview: ne,
|
|
2725
|
+
onClose: () => M(void 0)
|
|
2699
2726
|
})
|
|
2700
2727
|
] }), /* @__PURE__ */ U("div", {
|
|
2701
2728
|
ref: A,
|
|
@@ -2703,7 +2730,7 @@ function gr(e) {
|
|
|
2703
2730
|
children: /* @__PURE__ */ U("div", {
|
|
2704
2731
|
className: "vibe-shadcn-tiptap__notices",
|
|
2705
2732
|
"aria-live": "polite",
|
|
2706
|
-
children:
|
|
2733
|
+
children: ce.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ U("div", {
|
|
2707
2734
|
role: n === "error" ? "alert" : "status",
|
|
2708
2735
|
"data-type": n,
|
|
2709
2736
|
children: t
|
|
@@ -2714,4 +2741,4 @@ function gr(e) {
|
|
|
2714
2741
|
})
|
|
2715
2742
|
});
|
|
2716
2743
|
}
|
|
2717
|
-
export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR,
|
|
2744
|
+
export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR, un as ShadcnTiptapContent, vr as ShadcnTiptapEditor, vr as VibeTiptap, dn as ShadcnTiptapStatusBar, qn as ShadcnTiptapToolbar, b as TOOLBAR_ALIGN_OPTIONS, S as TOOLBAR_HEADING_OPTIONS, n as TOOLBAR_HEADING_PREVIEW_STYLES, a as TOOLBAR_MARKDOWN_IMPORT_ACCEPT, o as TOOLBAR_MARKDOWN_OPTIONS, w as TOOLBAR_TABLE_GRID, Rn as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, _r as useVibeTiptap };
|