@vibe-tiptap/shadcn-ui 1.1.0 → 1.1.3
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 +550 -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,17 +139,18 @@ 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: [
|
|
151
151
|
n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ U(Q, {
|
|
152
152
|
asChild: !0,
|
|
153
|
+
variant: "ghost",
|
|
153
154
|
className: "vibe-shadcn-tiptap__button",
|
|
154
155
|
children: /* @__PURE__ */ U("a", {
|
|
155
156
|
href: n,
|
|
@@ -160,7 +161,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
160
161
|
children: a
|
|
161
162
|
})
|
|
162
163
|
}),
|
|
163
|
-
n && w("file.action.copy", /* @__PURE__ */ U(
|
|
164
|
+
n && w("file.action.copy", /* @__PURE__ */ U(Ke, {
|
|
164
165
|
size: 16,
|
|
165
166
|
"aria-hidden": !0
|
|
166
167
|
}), () => s(n, !0)),
|
|
@@ -176,7 +177,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
176
177
|
audio: () => l.setAudioDisplay("player"),
|
|
177
178
|
video: () => l.setVideoDisplay("player")
|
|
178
179
|
}[o]),
|
|
179
|
-
w("file.action.delete", /* @__PURE__ */ U(
|
|
180
|
+
w("file.action.delete", /* @__PURE__ */ U(Ht, {
|
|
180
181
|
size: 16,
|
|
181
182
|
"aria-hidden": !0
|
|
182
183
|
}), T)
|
|
@@ -198,12 +199,13 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
198
199
|
function ee(e) {
|
|
199
200
|
_ ? l.setImageAlign(e) : v ? c.chain().focus().updateAttributes("whiteboard", { align: e }).run() : y ? l.setAudioAlign(e) : l.setVideoAlign(e);
|
|
200
201
|
}
|
|
201
|
-
let D = y || b ? d.attrs.size :
|
|
202
|
+
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
203
|
return /* @__PURE__ */ W("div", {
|
|
203
204
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
204
205
|
children: [
|
|
205
|
-
|
|
206
|
+
bn.map(([e, t]) => /* @__PURE__ */ U(Q, {
|
|
206
207
|
type: "button",
|
|
208
|
+
variant: "ghost",
|
|
207
209
|
className: "vibe-shadcn-tiptap__button",
|
|
208
210
|
title: u(`image.size.${e}Tooltip`),
|
|
209
211
|
"aria-pressed": D === e,
|
|
@@ -214,8 +216,8 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
214
216
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
215
217
|
"aria-hidden": "true"
|
|
216
218
|
}),
|
|
217
|
-
|
|
218
|
-
let t =
|
|
219
|
+
Sn.map((e) => {
|
|
220
|
+
let t = xn[e];
|
|
219
221
|
return /* @__PURE__ */ U($, {
|
|
220
222
|
label: u(`image.align.${e}`),
|
|
221
223
|
"aria-pressed": (d.attrs.align ?? "center") === e,
|
|
@@ -231,21 +233,21 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
231
233
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
232
234
|
"aria-hidden": "true"
|
|
233
235
|
}),
|
|
234
|
-
C && w("image.caption", /* @__PURE__ */ U(
|
|
236
|
+
C && w("image.caption", /* @__PURE__ */ U(Re, {
|
|
235
237
|
size: 16,
|
|
236
238
|
"aria-hidden": !0
|
|
237
239
|
}), () => {
|
|
238
240
|
C.readOnly || (C.hidden = !1, C.focus(), o());
|
|
239
241
|
}),
|
|
240
|
-
v && r && w("whiteboard.edit", /* @__PURE__ */ U(
|
|
242
|
+
v && r && w("whiteboard.edit", /* @__PURE__ */ U(Et, {
|
|
241
243
|
size: 16,
|
|
242
244
|
"aria-hidden": !0
|
|
243
245
|
}), i),
|
|
244
|
-
_ && r && /* @__PURE__ */ W(
|
|
246
|
+
_ && r && /* @__PURE__ */ W(ge, { children: [/* @__PURE__ */ U("input", {
|
|
245
247
|
ref: m,
|
|
246
248
|
type: "file",
|
|
247
249
|
hidden: !0,
|
|
248
|
-
accept:
|
|
250
|
+
accept: z(a).image.accept,
|
|
249
251
|
onChange: async (t) => {
|
|
250
252
|
let n = t.currentTarget.files?.[0];
|
|
251
253
|
if (t.currentTarget.value = "", n && !h) {
|
|
@@ -253,21 +255,21 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
253
255
|
try {
|
|
254
256
|
await l.uploadAndReplaceImage(n);
|
|
255
257
|
} catch {
|
|
256
|
-
c.isDestroyed ||
|
|
258
|
+
c.isDestroyed || le(e.notify, u, "image");
|
|
257
259
|
} finally {
|
|
258
260
|
g(!1);
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
|
-
}), w("image.replace", /* @__PURE__ */ U(
|
|
264
|
+
}), w("image.replace", /* @__PURE__ */ U(ut, {
|
|
263
265
|
size: 16,
|
|
264
266
|
"aria-hidden": !0
|
|
265
267
|
}), () => m.current?.click(), { disabled: h })] }),
|
|
266
|
-
x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(
|
|
268
|
+
x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(Ke, {
|
|
267
269
|
size: 16,
|
|
268
270
|
"aria-hidden": !0
|
|
269
271
|
}), () => s(x)),
|
|
270
|
-
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(
|
|
272
|
+
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(wt, {
|
|
271
273
|
size: 16,
|
|
272
274
|
"aria-hidden": !0
|
|
273
275
|
}), () => {
|
|
@@ -277,7 +279,7 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
277
279
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
278
280
|
"aria-hidden": "true"
|
|
279
281
|
}),
|
|
280
|
-
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(
|
|
282
|
+
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(Ht, {
|
|
281
283
|
size: 16,
|
|
282
284
|
"aria-hidden": !0
|
|
283
285
|
}), _ ? l.removeImage : y ? l.removeAudio : b ? l.removeVideo : T)
|
|
@@ -285,26 +287,26 @@ function wn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
285
287
|
});
|
|
286
288
|
}
|
|
287
289
|
// src/color-picker.tsx
|
|
288
|
-
var
|
|
289
|
-
function
|
|
290
|
-
let { Popover: u } = X(), d =
|
|
290
|
+
var En = /^(#[\da-f]{6})ff$/;
|
|
291
|
+
function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
|
|
292
|
+
let { Popover: u } = X(), d = vn(), f = {
|
|
291
293
|
size: e?.button?.size ?? d?.size,
|
|
292
294
|
variant: e?.button?.variant ?? d?.variant,
|
|
293
295
|
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(
|
|
296
|
+
}, { 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
297
|
let e = /* @__PURE__ */ new Set();
|
|
296
298
|
return n.flatMap((t) => {
|
|
297
|
-
let n = i(t, g)?.replace(
|
|
299
|
+
let n = i(t, g)?.replace(En, "$1"), r = n ?? t.trim();
|
|
298
300
|
return e.has(r) ? [] : (e.add(r), [{
|
|
299
301
|
value: t,
|
|
300
302
|
canonical: n
|
|
301
303
|
}]);
|
|
302
304
|
});
|
|
303
|
-
}, [n, g]), T = r === "color" ?
|
|
305
|
+
}, [n, g]), T = r === "color" ? Ct : ot;
|
|
304
306
|
function E(e) {
|
|
305
|
-
!o &&
|
|
307
|
+
!o && L(t, r, e) && de(t, r, e);
|
|
306
308
|
}
|
|
307
|
-
return /* @__PURE__ */ U(
|
|
309
|
+
return /* @__PURE__ */ U(_n, {
|
|
308
310
|
value: f,
|
|
309
311
|
children: /* @__PURE__ */ W(u.Root, {
|
|
310
312
|
open: c,
|
|
@@ -371,7 +373,7 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
371
373
|
h(m("notify.clipboardUnavailable"), "warning");
|
|
372
374
|
}
|
|
373
375
|
},
|
|
374
|
-
children: [/* @__PURE__ */ U(
|
|
376
|
+
children: [/* @__PURE__ */ U(Ke, {
|
|
375
377
|
size: 14,
|
|
376
378
|
"aria-hidden": !0
|
|
377
379
|
}), S]
|
|
@@ -379,7 +381,7 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
379
381
|
type: "button",
|
|
380
382
|
size: "sm",
|
|
381
383
|
className: "vibe-shadcn-tiptap__button",
|
|
382
|
-
disabled: o || !
|
|
384
|
+
disabled: o || !L(t, r, ""),
|
|
383
385
|
onClick: () => E(""),
|
|
384
386
|
children: m(r === "color" ? "toolbar.color.clear" : "toolbar.highlight.clear")
|
|
385
387
|
})]
|
|
@@ -389,20 +391,20 @@ function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
389
391
|
});
|
|
390
392
|
}
|
|
391
393
|
// src/insertion-popover.tsx
|
|
392
|
-
function
|
|
393
|
-
return /* @__PURE__ */ U(
|
|
394
|
+
function On(e) {
|
|
395
|
+
return /* @__PURE__ */ U(_n, {
|
|
394
396
|
value: e.appearance?.button,
|
|
395
|
-
children: e.request.kind === "link" ? /* @__PURE__ */ U(
|
|
397
|
+
children: e.request.kind === "link" ? /* @__PURE__ */ U(An, {
|
|
396
398
|
...e,
|
|
397
399
|
request: e.request
|
|
398
|
-
}) : /* @__PURE__ */ U(
|
|
400
|
+
}) : /* @__PURE__ */ U(Nn, {
|
|
399
401
|
...e,
|
|
400
402
|
request: e.request
|
|
401
403
|
})
|
|
402
404
|
});
|
|
403
405
|
}
|
|
404
|
-
function
|
|
405
|
-
let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u =
|
|
406
|
+
function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
|
|
407
|
+
let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u = Ee(() => ({ current: {
|
|
406
408
|
contextElement: n ?? c.view.dom,
|
|
407
409
|
getBoundingClientRect() {
|
|
408
410
|
if (n) return n.getBoundingClientRect();
|
|
@@ -448,8 +450,8 @@ function On({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
|
|
|
448
450
|
})]
|
|
449
451
|
});
|
|
450
452
|
}
|
|
451
|
-
function
|
|
452
|
-
let { Input: a, Checkbox: o } = X(), s = Y(
|
|
453
|
+
function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
|
|
454
|
+
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
455
|
from: h.from,
|
|
454
456
|
to: h.to
|
|
455
457
|
} : {
|
|
@@ -466,13 +468,13 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
466
468
|
}, [c, i]);
|
|
467
469
|
function w() {
|
|
468
470
|
if (!c.isEditable) return;
|
|
469
|
-
let e =
|
|
471
|
+
let e = ce(b);
|
|
470
472
|
e ? (l.insertLinkText(e, _, {
|
|
471
473
|
target: S ? "_blank" : "_self",
|
|
472
474
|
range: g
|
|
473
475
|
}), i()) : d(u(b.trim() ? "notify.linkInvalid" : "notify.linkEmpty"), "warning");
|
|
474
476
|
}
|
|
475
|
-
return /* @__PURE__ */ U(
|
|
477
|
+
return /* @__PURE__ */ U(kn, {
|
|
476
478
|
className: e?.className,
|
|
477
479
|
context: t,
|
|
478
480
|
anchor: r.anchor,
|
|
@@ -510,7 +512,7 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
510
512
|
}),
|
|
511
513
|
/* @__PURE__ */ W("div", {
|
|
512
514
|
className: "vibe-shadcn-tiptap__checkbox-field flex items-center gap-1.5",
|
|
513
|
-
children: [/* @__PURE__ */ U(
|
|
515
|
+
children: [/* @__PURE__ */ U(yn, {
|
|
514
516
|
appearance: e?.checkbox,
|
|
515
517
|
children: /* @__PURE__ */ U(o, {
|
|
516
518
|
id: f,
|
|
@@ -534,6 +536,7 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
534
536
|
}),
|
|
535
537
|
/* @__PURE__ */ U(Q, {
|
|
536
538
|
type: "button",
|
|
539
|
+
variant: "ghost",
|
|
537
540
|
className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
|
|
538
541
|
onClick: () => {
|
|
539
542
|
i(), (r.anchor ?? c.view.dom).focus({ preventScroll: !0 });
|
|
@@ -550,19 +553,19 @@ function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
550
553
|
})
|
|
551
554
|
});
|
|
552
555
|
}
|
|
553
|
-
var
|
|
556
|
+
var jn = {
|
|
554
557
|
image: "notify.invalidImageUrl",
|
|
555
558
|
video: "notify.invalidVideoUrl",
|
|
556
559
|
audio: "notify.invalidAudioUrl",
|
|
557
560
|
attachment: "notify.invalidFileUrl"
|
|
558
|
-
},
|
|
559
|
-
image:
|
|
560
|
-
video:
|
|
561
|
-
audio:
|
|
562
|
-
attachment:
|
|
561
|
+
}, Mn = {
|
|
562
|
+
image: st,
|
|
563
|
+
video: $e,
|
|
564
|
+
audio: St,
|
|
565
|
+
attachment: wt
|
|
563
566
|
};
|
|
564
|
-
function
|
|
565
|
-
let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h =
|
|
567
|
+
function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
|
|
568
|
+
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
569
|
K(() => {
|
|
567
570
|
k.current = o;
|
|
568
571
|
}, [o]), K(() => {
|
|
@@ -570,7 +573,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
570
573
|
k.current();
|
|
571
574
|
return;
|
|
572
575
|
}
|
|
573
|
-
let e =
|
|
576
|
+
let e = pe(l, () => k.current());
|
|
574
577
|
return O.current = e, () => {
|
|
575
578
|
e.dispose(), O.current = void 0;
|
|
576
579
|
};
|
|
@@ -585,25 +588,25 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
585
588
|
attachment: u.uploadAndInsertFile
|
|
586
589
|
}[p];
|
|
587
590
|
o(), n(y.multiple ? e : e.slice(0, 1), t).catch(() => {
|
|
588
|
-
l.isDestroyed ||
|
|
591
|
+
l.isDestroyed || le(f, d, _);
|
|
589
592
|
});
|
|
590
593
|
}
|
|
591
594
|
function j() {
|
|
592
595
|
let e = O.current?.range;
|
|
593
596
|
if (!e || !l.isEditable || !S) return;
|
|
594
|
-
let t =
|
|
595
|
-
if (!t) f(d(
|
|
597
|
+
let t = ce(ee);
|
|
598
|
+
if (!t) f(d(jn[p]), "warning");
|
|
596
599
|
else {
|
|
597
600
|
if (p === "video" || p === "audio") {
|
|
598
601
|
if (!(p === "video" ? u.insertVideoUrl : u.insertAudioUrl)(t, e)) {
|
|
599
|
-
f(d(
|
|
602
|
+
f(d(jn[p]), "warning");
|
|
600
603
|
return;
|
|
601
604
|
}
|
|
602
605
|
} else l.commands.setTextSelection(e), p === "image" ? u.setImage(t) : u.insertFile(t);
|
|
603
606
|
o();
|
|
604
607
|
}
|
|
605
608
|
}
|
|
606
|
-
return C ? /* @__PURE__ */ W(
|
|
609
|
+
return C ? /* @__PURE__ */ W(kn, {
|
|
607
610
|
className: e?.className,
|
|
608
611
|
context: t,
|
|
609
612
|
anchor: m,
|
|
@@ -620,13 +623,13 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
620
623
|
x && S && /* @__PURE__ */ W(c.List, {
|
|
621
624
|
className: Y("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
|
|
622
625
|
"aria-label": d(`command.${p}`),
|
|
623
|
-
children: [/* @__PURE__ */ U(
|
|
626
|
+
children: [/* @__PURE__ */ U(yn, {
|
|
624
627
|
appearance: e?.tabs?.trigger,
|
|
625
628
|
children: /* @__PURE__ */ U(c.Trigger, {
|
|
626
629
|
value: "upload",
|
|
627
630
|
children: d(`toolbar.${p}.upload`)
|
|
628
631
|
})
|
|
629
|
-
}), /* @__PURE__ */ U(
|
|
632
|
+
}), /* @__PURE__ */ U(yn, {
|
|
630
633
|
appearance: e?.tabs?.trigger,
|
|
631
634
|
children: /* @__PURE__ */ U(c.Trigger, {
|
|
632
635
|
value: "url",
|
|
@@ -671,7 +674,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
671
674
|
e.preventDefault(), j();
|
|
672
675
|
},
|
|
673
676
|
children: /* @__PURE__ */ U(s, {
|
|
674
|
-
className: Y(
|
|
677
|
+
className: Y(hn[e?.input?.variant ?? "default"], e?.input?.className),
|
|
675
678
|
"data-initial-focus": !0,
|
|
676
679
|
"aria-label": d(`toolbar.${p}.url`),
|
|
677
680
|
placeholder: d(`toolbar.${p}.urlPlaceholder`),
|
|
@@ -685,6 +688,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
685
688
|
className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", Z),
|
|
686
689
|
children: [/* @__PURE__ */ U(Q, {
|
|
687
690
|
type: "button",
|
|
691
|
+
variant: "ghost",
|
|
688
692
|
className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
|
|
689
693
|
onClick: () => {
|
|
690
694
|
o(), (m ?? l.view.dom).focus({ preventScroll: !0 });
|
|
@@ -699,7 +703,7 @@ function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
699
703
|
}) : null;
|
|
700
704
|
}
|
|
701
705
|
// src/table-picker.tsx
|
|
702
|
-
var
|
|
706
|
+
var Pn = Se(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
|
|
703
707
|
return /* @__PURE__ */ U("button", {
|
|
704
708
|
type: "button",
|
|
705
709
|
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 +720,14 @@ var Nn = xe(function({ row: e, col: t, active: n, current: r, className: i, grid
|
|
|
716
720
|
}
|
|
717
721
|
});
|
|
718
722
|
});
|
|
719
|
-
function
|
|
723
|
+
function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
|
|
720
724
|
let { Popover: o } = X(), { editor: s, commands: c, t: l } = t, [u, d] = J(!1), [f, p] = J({
|
|
721
725
|
row: 1,
|
|
722
726
|
col: 1
|
|
723
727
|
}), m = q(void 0), h = q(!1), g = q(null), { maxRows: _, maxCols: v } = i;
|
|
724
728
|
K(() => {
|
|
725
729
|
if (!u || a) return;
|
|
726
|
-
let e =
|
|
730
|
+
let e = pe(s, () => d(!1));
|
|
727
731
|
return m.current = e, () => {
|
|
728
732
|
e.dispose(), m.current = void 0;
|
|
729
733
|
};
|
|
@@ -732,12 +736,12 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
732
736
|
s,
|
|
733
737
|
u
|
|
734
738
|
]);
|
|
735
|
-
let y =
|
|
739
|
+
let y = Ce((e, t) => {
|
|
736
740
|
p((n) => n.row === e && n.col === t ? n : {
|
|
737
741
|
row: e,
|
|
738
742
|
col: t
|
|
739
743
|
});
|
|
740
|
-
}, []), b =
|
|
744
|
+
}, []), b = Ce((e, t) => {
|
|
741
745
|
let n = m.current?.range;
|
|
742
746
|
n && s.isEditable && !a && (h.current = !0, s.commands.setTextSelection(n), c.insertTable(e, t), d(!1));
|
|
743
747
|
}, [
|
|
@@ -778,7 +782,7 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
778
782
|
style: { gridTemplateColumns: `repeat(${v}, max-content)` },
|
|
779
783
|
children: Array.from({ length: _ * v }, (t, n) => {
|
|
780
784
|
let r = Math.floor(n / v) + 1, i = n % v + 1;
|
|
781
|
-
return /* @__PURE__ */ U(
|
|
785
|
+
return /* @__PURE__ */ U(Pn, {
|
|
782
786
|
row: r,
|
|
783
787
|
col: i,
|
|
784
788
|
active: r <= f.row && i <= f.col,
|
|
@@ -794,8 +798,8 @@ function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
794
798
|
});
|
|
795
799
|
}
|
|
796
800
|
// src/vibe-tiptap-provider.tsx
|
|
797
|
-
var
|
|
798
|
-
function
|
|
801
|
+
var In = ye({});
|
|
802
|
+
function Ln(e, t) {
|
|
799
803
|
return {
|
|
800
804
|
components: t.components ?? e.components,
|
|
801
805
|
ui: t.ui ?? e.ui,
|
|
@@ -808,15 +812,21 @@ function In(e, t) {
|
|
|
808
812
|
showWordCount: t.showWordCount ?? e.showWordCount
|
|
809
813
|
};
|
|
810
814
|
}
|
|
811
|
-
function
|
|
812
|
-
let
|
|
813
|
-
|
|
814
|
-
|
|
815
|
+
function Rn({ children: e, mediaResources: t, ...n }) {
|
|
816
|
+
let r = we(In), i = {
|
|
817
|
+
...Ln(r, n),
|
|
818
|
+
mediaResources: t ?? r.mediaResources
|
|
819
|
+
};
|
|
820
|
+
return /* @__PURE__ */ U(In.Provider, {
|
|
821
|
+
value: i,
|
|
815
822
|
children: e
|
|
816
823
|
});
|
|
817
824
|
}
|
|
818
|
-
function
|
|
819
|
-
|
|
825
|
+
function zn() {
|
|
826
|
+
return we(In).mediaResources;
|
|
827
|
+
}
|
|
828
|
+
function Bn(e) {
|
|
829
|
+
let { components: t, ...n } = Ln(we(In), e);
|
|
820
830
|
if (!t) throw Error("Pass a components mapping to VibeTiptapProvider or directly to the editor or toolbar.");
|
|
821
831
|
return {
|
|
822
832
|
components: t,
|
|
@@ -824,20 +834,20 @@ function Rn(e) {
|
|
|
824
834
|
};
|
|
825
835
|
}
|
|
826
836
|
// 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
|
|
837
|
+
function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
|
|
838
|
+
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
839
|
K(() => {
|
|
830
|
-
|
|
840
|
+
S.current = a;
|
|
831
841
|
}, [a]), G(() => {
|
|
832
842
|
if (!l) return;
|
|
833
843
|
let e = l, n = new AbortController(), r = /* @__PURE__ */ new Map(), a, o;
|
|
834
844
|
async function u() {
|
|
835
845
|
if (n.signal.aborted) return;
|
|
836
846
|
o = t.holdWhiteboardSession();
|
|
837
|
-
let l = () =>
|
|
847
|
+
let l = () => S.current(), u = i ? pe(s, l) : void 0, d = i ? void 0 : fe(s, l);
|
|
838
848
|
if (!(u?.range || d?.active)) l();
|
|
839
849
|
else {
|
|
840
|
-
|
|
850
|
+
x.current = {
|
|
841
851
|
requests: n,
|
|
842
852
|
imageUrls: r,
|
|
843
853
|
target: u,
|
|
@@ -846,8 +856,8 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
846
856
|
try {
|
|
847
857
|
let { mountWhiteboard: t } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
|
|
848
858
|
if (n.signal.aborted) return;
|
|
849
|
-
if (i && typeof
|
|
850
|
-
let o = await t(e, typeof
|
|
859
|
+
if (i && typeof v != "string") throw Error();
|
|
860
|
+
let o = await t(e, typeof v == "string" ? v : void 0, r, n.signal, (e) => {
|
|
851
861
|
n.signal.aborted || f(e);
|
|
852
862
|
});
|
|
853
863
|
n.signal.aborted ? o?.() : a = o;
|
|
@@ -858,56 +868,56 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
858
868
|
}
|
|
859
869
|
return queueMicrotask(() => void u()), () => {
|
|
860
870
|
n.abort();
|
|
861
|
-
let e =
|
|
862
|
-
e?.requests === n && (
|
|
871
|
+
let e = x.current;
|
|
872
|
+
e?.requests === n && (x.current = void 0, e.target?.dispose(), e.draft?.cancel()), a && queueMicrotask(a), o?.();
|
|
863
873
|
};
|
|
864
874
|
}, [
|
|
865
875
|
l,
|
|
866
876
|
t,
|
|
867
877
|
i,
|
|
868
878
|
s,
|
|
869
|
-
|
|
879
|
+
v,
|
|
870
880
|
c
|
|
871
881
|
]);
|
|
872
|
-
async function
|
|
873
|
-
let e =
|
|
874
|
-
if (!e || !d ||
|
|
882
|
+
async function E() {
|
|
883
|
+
let e = x.current;
|
|
884
|
+
if (!e || !d || C.current || !s.isEditable) return;
|
|
875
885
|
let { requests: { signal: r }, imageUrls: a, target: o, draft: l } = e, u = () => !r.aborted && !s.isDestroyed && s.isEditable && !!(i ? o?.range : l?.active);
|
|
876
|
-
|
|
886
|
+
C.current = !0, m(!0), g("");
|
|
877
887
|
try {
|
|
878
888
|
let { exportWhiteboard: e } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
|
|
879
889
|
if (!u()) return;
|
|
880
890
|
let f = s.view.dom.ownerDocument.baseURI, { sceneData: p, file: m } = await e(d, a, n, f, r);
|
|
881
891
|
if (!u()) return;
|
|
882
|
-
let h =
|
|
892
|
+
let h = he(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
|
|
883
893
|
if (h?.reason === "too-large") {
|
|
884
894
|
g(c("notify.assetFileTooLarge", {
|
|
885
|
-
size:
|
|
886
|
-
limit:
|
|
895
|
+
size: M(h.size),
|
|
896
|
+
limit: M(h.maxSize)
|
|
887
897
|
}));
|
|
888
898
|
return;
|
|
889
899
|
}
|
|
890
|
-
let
|
|
900
|
+
let _ = await n(m, "whiteboard"), y = (typeof _ == "string" ? _ : _?.url)?.trim();
|
|
891
901
|
if (!u()) return;
|
|
892
|
-
if (!
|
|
902
|
+
if (!y || new URL(y, f).protocol === "data:") throw Error();
|
|
893
903
|
if (i) {
|
|
894
904
|
let e = o?.range;
|
|
895
905
|
if (!e) return;
|
|
896
906
|
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",
|
|
907
|
+
if (r?.type.name !== "whiteboard" || r.attrs.sceneData !== v) throw Error();
|
|
908
|
+
s.view.dispatch(n.setNodeAttribute(e.from, "src", y).setNodeAttribute(e.from, "sceneData", p));
|
|
899
909
|
} else if (!l?.complete({
|
|
900
|
-
src:
|
|
910
|
+
src: y,
|
|
901
911
|
sceneData: p
|
|
902
912
|
})) throw Error();
|
|
903
|
-
|
|
913
|
+
T.current = !0, S.current(), s.commands.focus();
|
|
904
914
|
} catch {
|
|
905
915
|
r.aborted || g(c("whiteboard.saveFailed"));
|
|
906
916
|
} finally {
|
|
907
|
-
|
|
917
|
+
C.current = !1, r.aborted || m(!1);
|
|
908
918
|
}
|
|
909
919
|
}
|
|
910
|
-
return /* @__PURE__ */ U(
|
|
920
|
+
return /* @__PURE__ */ U(_n, {
|
|
911
921
|
value: e?.button,
|
|
912
922
|
children: /* @__PURE__ */ U(o.Root, {
|
|
913
923
|
open: !0,
|
|
@@ -926,18 +936,24 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
926
936
|
},
|
|
927
937
|
onOpenAutoFocus: () => {
|
|
928
938
|
let e = r.ownerDocument.activeElement;
|
|
929
|
-
e instanceof HTMLElement && (
|
|
939
|
+
e instanceof HTMLElement && (w.current = e);
|
|
930
940
|
},
|
|
931
941
|
onCloseAutoFocus: (e) => {
|
|
932
|
-
if (e.preventDefault(), !
|
|
933
|
-
let e =
|
|
942
|
+
if (e.preventDefault(), !T.current && !s.isDestroyed) {
|
|
943
|
+
let e = w.current;
|
|
934
944
|
(e && r.parentElement?.contains(e) ? e : s.view.dom).focus();
|
|
935
945
|
}
|
|
936
946
|
},
|
|
937
947
|
children: [/* @__PURE__ */ W("header", {
|
|
938
948
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
939
949
|
children: [
|
|
940
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ W(o.Title, {
|
|
951
|
+
className: "vibe-shadcn-tiptap__whiteboard-title",
|
|
952
|
+
children: [/* @__PURE__ */ U(Et, {
|
|
953
|
+
size: 16,
|
|
954
|
+
"aria-hidden": "true"
|
|
955
|
+
}), /* @__PURE__ */ U("span", { children: b })]
|
|
956
|
+
}),
|
|
941
957
|
h && /* @__PURE__ */ U("span", {
|
|
942
958
|
role: "alert",
|
|
943
959
|
children: h
|
|
@@ -946,6 +962,7 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
946
962
|
asChild: !0,
|
|
947
963
|
children: /* @__PURE__ */ U(Q, {
|
|
948
964
|
type: "button",
|
|
965
|
+
variant: "ghost",
|
|
949
966
|
className: "vibe-shadcn-tiptap__button",
|
|
950
967
|
defaultSizeClassName: "px-2 py-1",
|
|
951
968
|
disabled: p,
|
|
@@ -958,8 +975,8 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
958
975
|
className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__whiteboard-save",
|
|
959
976
|
disabled: !d || p,
|
|
960
977
|
"aria-busy": p || void 0,
|
|
961
|
-
onClick: () => void
|
|
962
|
-
children: [p && /* @__PURE__ */ U(
|
|
978
|
+
onClick: () => void E(),
|
|
979
|
+
children: [p && /* @__PURE__ */ U(vt, {
|
|
963
980
|
"aria-hidden": "true",
|
|
964
981
|
className: "vibe-shadcn-tiptap__spinner",
|
|
965
982
|
size: 16
|
|
@@ -976,133 +993,133 @@ function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
976
993
|
});
|
|
977
994
|
}
|
|
978
995
|
// 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:
|
|
996
|
+
var Hn = {
|
|
997
|
+
undo: Gt,
|
|
998
|
+
redo: jt,
|
|
999
|
+
bold: Le,
|
|
1000
|
+
italic: pt,
|
|
1001
|
+
underline: Wt,
|
|
1002
|
+
strike: Lt,
|
|
1003
|
+
code: We,
|
|
1004
|
+
superscript: zt,
|
|
1005
|
+
subscript: Rt,
|
|
1006
|
+
color: Ct,
|
|
1007
|
+
highlight: ot,
|
|
1008
|
+
clearFormat: Xe,
|
|
1009
|
+
align: je,
|
|
1010
|
+
decreaseIndent: dt,
|
|
1011
|
+
increaseIndent: ft,
|
|
1012
|
+
firstLineIndent: Gn,
|
|
1013
|
+
bulletList: ht,
|
|
1014
|
+
orderedList: _t,
|
|
1015
|
+
taskList: gt,
|
|
1016
|
+
blockquote: At,
|
|
1017
|
+
codeBlock: Ge,
|
|
1018
|
+
link: mt,
|
|
1019
|
+
image: st,
|
|
1020
|
+
video: $e,
|
|
1021
|
+
audio: St,
|
|
1022
|
+
attachment: wt,
|
|
1023
|
+
table: Bt,
|
|
1024
|
+
whiteboard: Et,
|
|
1025
|
+
hr: xt,
|
|
1026
|
+
findReplace: It,
|
|
1027
|
+
markdown: Kn,
|
|
1028
|
+
print: kt,
|
|
1029
|
+
preview: Qe,
|
|
1030
|
+
fullscreen: yt
|
|
1031
|
+
}, Un = {
|
|
1032
|
+
left: je,
|
|
1033
|
+
center: ke,
|
|
1034
|
+
right: Me,
|
|
1035
|
+
justify: Ae
|
|
1036
|
+
}, Wn = {
|
|
1037
|
+
0: Dt,
|
|
1038
|
+
1: et,
|
|
1039
|
+
2: tt,
|
|
1040
|
+
3: nt,
|
|
1041
|
+
4: rt,
|
|
1042
|
+
5: it,
|
|
1043
|
+
6: at
|
|
1027
1044
|
};
|
|
1028
|
-
function
|
|
1045
|
+
function Gn({ size: e }) {
|
|
1029
1046
|
return /* @__PURE__ */ U("svg", {
|
|
1030
1047
|
width: e,
|
|
1031
1048
|
height: e,
|
|
1032
|
-
viewBox:
|
|
1049
|
+
viewBox: nn,
|
|
1033
1050
|
fill: "none",
|
|
1034
1051
|
stroke: "currentColor",
|
|
1035
|
-
strokeWidth:
|
|
1052
|
+
strokeWidth: Qt.strokeWidth,
|
|
1036
1053
|
strokeLinecap: "round",
|
|
1037
1054
|
strokeLinejoin: "round",
|
|
1038
1055
|
"aria-hidden": "true",
|
|
1039
1056
|
focusable: "false",
|
|
1040
|
-
children:
|
|
1057
|
+
children: Qt.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1041
1058
|
});
|
|
1042
1059
|
}
|
|
1043
|
-
function
|
|
1060
|
+
function Kn({ size: e, action: t }) {
|
|
1044
1061
|
return /* @__PURE__ */ W("svg", {
|
|
1045
1062
|
width: e,
|
|
1046
1063
|
height: e,
|
|
1047
|
-
viewBox:
|
|
1064
|
+
viewBox: nn,
|
|
1048
1065
|
fill: "none",
|
|
1049
1066
|
stroke: "currentColor",
|
|
1050
|
-
strokeWidth:
|
|
1067
|
+
strokeWidth: tn.strokeWidth,
|
|
1051
1068
|
strokeLinecap: "round",
|
|
1052
1069
|
strokeLinejoin: "round",
|
|
1053
1070
|
"aria-hidden": "true",
|
|
1054
1071
|
focusable: "false",
|
|
1055
1072
|
children: [/* @__PURE__ */ U("g", {
|
|
1056
|
-
transform: t ?
|
|
1057
|
-
children:
|
|
1058
|
-
}), t &&
|
|
1073
|
+
transform: t ? en : void 0,
|
|
1074
|
+
children: tn.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1075
|
+
}), t && $t[t].map((e) => /* @__PURE__ */ U("path", { d: e }, e))]
|
|
1059
1076
|
});
|
|
1060
1077
|
}
|
|
1061
|
-
function
|
|
1078
|
+
function qn(e) {
|
|
1062
1079
|
let { components: t, showWordCount: n, ...r } = {
|
|
1063
1080
|
...e,
|
|
1064
|
-
...
|
|
1081
|
+
...Bn(e)
|
|
1065
1082
|
}, { Tooltip: i } = t;
|
|
1066
|
-
return /* @__PURE__ */ U(
|
|
1083
|
+
return /* @__PURE__ */ U(pn, {
|
|
1067
1084
|
value: t,
|
|
1068
1085
|
children: /* @__PURE__ */ U(i.Provider, {
|
|
1069
1086
|
delayDuration: 500,
|
|
1070
1087
|
skipDelayDuration: 0,
|
|
1071
|
-
children: /* @__PURE__ */ U(
|
|
1088
|
+
children: /* @__PURE__ */ U(Jn, { ...r }, r.context.editor.instanceId)
|
|
1072
1089
|
})
|
|
1073
1090
|
});
|
|
1074
1091
|
}
|
|
1075
|
-
function
|
|
1092
|
+
function Jn(e) {
|
|
1076
1093
|
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
1094
|
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
|
|
1095
|
+
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) => {
|
|
1096
|
+
let t = e.join(" "), n = F.get(t) ?? 0;
|
|
1097
|
+
return F.set(t, n + 1), {
|
|
1081
1098
|
id: `${t}:${n}`,
|
|
1082
|
-
buttons: e.filter(
|
|
1099
|
+
buttons: e.filter(ce)
|
|
1083
1100
|
};
|
|
1084
1101
|
}).filter(({ buttons: e }) => e.length > 0);
|
|
1085
1102
|
G(() => {
|
|
1086
1103
|
j || (S(void 0), O(!1));
|
|
1087
1104
|
}, [j]);
|
|
1088
|
-
function
|
|
1089
|
-
return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!
|
|
1105
|
+
function ce(e) {
|
|
1106
|
+
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
1107
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !
|
|
1108
|
+
function R(e, t) {
|
|
1109
|
+
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
1110
|
}
|
|
1094
|
-
function
|
|
1111
|
+
function le(e, t) {
|
|
1095
1112
|
if (e === "preview") return o;
|
|
1096
1113
|
if (e === "fullscreen") return c;
|
|
1097
|
-
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return
|
|
1114
|
+
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return se(a, e, t);
|
|
1098
1115
|
}
|
|
1099
|
-
function
|
|
1100
|
-
|
|
1116
|
+
function B(t, n) {
|
|
1117
|
+
R(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
|
|
1101
1118
|
...e.printOptions,
|
|
1102
1119
|
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" &&
|
|
1120
|
+
}) : 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
1121
|
}
|
|
1105
|
-
function
|
|
1122
|
+
function ue(t, n, r) {
|
|
1106
1123
|
let i = {
|
|
1107
1124
|
link: e.openLinkPopover,
|
|
1108
1125
|
image: e.openImagePopover,
|
|
@@ -1111,7 +1128,7 @@ function Kn(e) {
|
|
|
1111
1128
|
attachment: void 0
|
|
1112
1129
|
};
|
|
1113
1130
|
if (t === "link" || t === "image" || t === "video" || t === "audio" || t === "attachment") {
|
|
1114
|
-
if (
|
|
1131
|
+
if (R(t)) return;
|
|
1115
1132
|
let e = i[t];
|
|
1116
1133
|
e ? e() : S((e) => e?.triggerId === r ? void 0 : {
|
|
1117
1134
|
triggerId: r,
|
|
@@ -1120,23 +1137,23 @@ function Kn(e) {
|
|
|
1120
1137
|
anchor: n
|
|
1121
1138
|
}
|
|
1122
1139
|
});
|
|
1123
|
-
} else
|
|
1140
|
+
} else B(t);
|
|
1124
1141
|
}
|
|
1125
1142
|
function V(r, u) {
|
|
1126
1143
|
let p = `${u}:${r}`;
|
|
1127
|
-
if (r === "color" || r === "highlight") return /* @__PURE__ */ U(
|
|
1144
|
+
if (r === "color" || r === "highlight") return /* @__PURE__ */ U(Dn, {
|
|
1128
1145
|
appearance: e.ui?.colorPicker,
|
|
1129
1146
|
context: a,
|
|
1130
1147
|
kind: r,
|
|
1131
|
-
disabled:
|
|
1132
|
-
colors: r === "color" ?
|
|
1148
|
+
disabled: R(r),
|
|
1149
|
+
colors: r === "color" ? M.colors : M.highlights,
|
|
1133
1150
|
overlayTarget: A,
|
|
1134
1151
|
bubble: e.bubble,
|
|
1135
1152
|
open: e.bubble ? e.openPalette === r : void 0,
|
|
1136
1153
|
onOpenChange: (t) => e.onPaletteOpenChange?.(r, t)
|
|
1137
1154
|
}, r);
|
|
1138
1155
|
if (r === "heading") {
|
|
1139
|
-
let t = i?.heading, o =
|
|
1156
|
+
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
1157
|
className: Y("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
|
|
1141
1158
|
children: [/* @__PURE__ */ U(s, {
|
|
1142
1159
|
size: 16,
|
|
@@ -1145,8 +1162,8 @@ function Kn(e) {
|
|
|
1145
1162
|
});
|
|
1146
1163
|
return /* @__PURE__ */ W(n.Root, {
|
|
1147
1164
|
value: c,
|
|
1148
|
-
disabled:
|
|
1149
|
-
onValueChange: (e) =>
|
|
1165
|
+
disabled: R(r),
|
|
1166
|
+
onValueChange: (e) => B(r, Number(e)),
|
|
1150
1167
|
children: [/* @__PURE__ */ U(n.Trigger, {
|
|
1151
1168
|
asChild: !0,
|
|
1152
1169
|
children: /* @__PURE__ */ W(Q, {
|
|
@@ -1159,7 +1176,7 @@ function Kn(e) {
|
|
|
1159
1176
|
children: [/* @__PURE__ */ U(n.Value, {
|
|
1160
1177
|
placeholder: u,
|
|
1161
1178
|
children: u
|
|
1162
|
-
}), /* @__PURE__ */ U(
|
|
1179
|
+
}), /* @__PURE__ */ U(Be, { size: 12 })]
|
|
1163
1180
|
})
|
|
1164
1181
|
}), A && /* @__PURE__ */ U(n.Content, {
|
|
1165
1182
|
container: A,
|
|
@@ -1169,11 +1186,11 @@ function Kn(e) {
|
|
|
1169
1186
|
f.isFocused && e.preventDefault();
|
|
1170
1187
|
},
|
|
1171
1188
|
children: C.map(({ level: e }) => {
|
|
1172
|
-
let i =
|
|
1189
|
+
let i = Wn[e], a = String(e) === c;
|
|
1173
1190
|
return /* @__PURE__ */ W(n.Item, {
|
|
1174
1191
|
value: String(e),
|
|
1175
1192
|
className: Y("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
|
|
1176
|
-
disabled: !a &&
|
|
1193
|
+
disabled: !a && R(r, e),
|
|
1177
1194
|
"data-active": a || void 0,
|
|
1178
1195
|
children: [/* @__PURE__ */ U(i, {
|
|
1179
1196
|
size: 16,
|
|
@@ -1184,13 +1201,13 @@ function Kn(e) {
|
|
|
1184
1201
|
})]
|
|
1185
1202
|
}, r);
|
|
1186
1203
|
}
|
|
1187
|
-
let m = r === "preview" && o ?
|
|
1204
|
+
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
1205
|
size: "icon",
|
|
1189
1206
|
label: h,
|
|
1190
1207
|
overlayTarget: A,
|
|
1191
1208
|
"data-toolbar-key": e.bubble ? void 0 : r,
|
|
1192
|
-
disabled:
|
|
1193
|
-
"aria-pressed": r === "findReplace" ? void 0 :
|
|
1209
|
+
disabled: R(r),
|
|
1210
|
+
"aria-pressed": r === "findReplace" ? void 0 : le(r),
|
|
1194
1211
|
"aria-expanded": r === "findReplace" ? a.findReplaceState.open : r === "link" || r === "image" || r === "video" || r === "audio" || r === "attachment" ? b?.triggerId === p : void 0,
|
|
1195
1212
|
onMouseDown: (e) => e.preventDefault(),
|
|
1196
1213
|
children: /* @__PURE__ */ U(m, {
|
|
@@ -1198,13 +1215,13 @@ function Kn(e) {
|
|
|
1198
1215
|
"aria-hidden": !0
|
|
1199
1216
|
})
|
|
1200
1217
|
});
|
|
1201
|
-
if (r === "table") return /* @__PURE__ */ U(
|
|
1218
|
+
if (r === "table") return /* @__PURE__ */ U(Fn, {
|
|
1202
1219
|
appearance: e.ui?.tablePicker,
|
|
1203
1220
|
context: a,
|
|
1204
1221
|
trigger: g,
|
|
1205
1222
|
overlayTarget: A,
|
|
1206
|
-
options:
|
|
1207
|
-
disabled:
|
|
1223
|
+
options: ne.tableGrid,
|
|
1224
|
+
disabled: R(r)
|
|
1208
1225
|
}, r);
|
|
1209
1226
|
if (r === "markdown") return /* @__PURE__ */ W(t.Root, {
|
|
1210
1227
|
modal: !1,
|
|
@@ -1218,14 +1235,14 @@ function Kn(e) {
|
|
|
1218
1235
|
align: "start",
|
|
1219
1236
|
children: s.map(({ value: e }) => /* @__PURE__ */ W(t.Item, {
|
|
1220
1237
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1221
|
-
disabled: e === "import" ? o || !j || w || !
|
|
1238
|
+
disabled: e === "import" ? o || !j || w || !P?.parse : !P?.serialize,
|
|
1222
1239
|
onSelect: () => {
|
|
1223
1240
|
e === "import" ? k.current?.click() : e === "export" ? d(a, {
|
|
1224
|
-
filename:
|
|
1241
|
+
filename: ae.exportFilename,
|
|
1225
1242
|
t: _
|
|
1226
1243
|
}) : l(a, { t: _ });
|
|
1227
1244
|
},
|
|
1228
|
-
children: [/* @__PURE__ */ U(
|
|
1245
|
+
children: [/* @__PURE__ */ U(Kn, {
|
|
1229
1246
|
size: 16,
|
|
1230
1247
|
action: e
|
|
1231
1248
|
}), _(`toolbar.markdown.${e}`)]
|
|
@@ -1234,7 +1251,7 @@ function Kn(e) {
|
|
|
1234
1251
|
}, r);
|
|
1235
1252
|
let v = (() => {
|
|
1236
1253
|
if (r === "align") return x.map(({ value: e }) => {
|
|
1237
|
-
let t =
|
|
1254
|
+
let t = Un[e];
|
|
1238
1255
|
return {
|
|
1239
1256
|
value: e,
|
|
1240
1257
|
label: _(`toolbar.align.${e}`),
|
|
@@ -1244,8 +1261,8 @@ function Kn(e) {
|
|
|
1244
1261
|
})
|
|
1245
1262
|
};
|
|
1246
1263
|
});
|
|
1247
|
-
if (r === "codeBlock") return
|
|
1248
|
-
if (r === "hr") return
|
|
1264
|
+
if (r === "codeBlock") return ne.codeBlockLanguages;
|
|
1265
|
+
if (r === "hr") return ne.horizontalRules.map((e) => ({
|
|
1249
1266
|
...e,
|
|
1250
1267
|
icon: /* @__PURE__ */ U("span", {
|
|
1251
1268
|
className: "vibe-shadcn-tiptap__divider-icon",
|
|
@@ -1269,19 +1286,19 @@ function Kn(e) {
|
|
|
1269
1286
|
},
|
|
1270
1287
|
children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ W(t.Item, {
|
|
1271
1288
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1272
|
-
disabled:
|
|
1273
|
-
"data-active":
|
|
1274
|
-
onSelect: () =>
|
|
1289
|
+
disabled: R(r, e),
|
|
1290
|
+
"data-active": le(r, e) || void 0,
|
|
1291
|
+
onSelect: () => B(r, e),
|
|
1275
1292
|
children: [i, n]
|
|
1276
1293
|
}, e))
|
|
1277
1294
|
})]
|
|
1278
|
-
}, r) : /* @__PURE__ */
|
|
1295
|
+
}, r) : /* @__PURE__ */ be($, {
|
|
1279
1296
|
...g.props,
|
|
1280
1297
|
key: r,
|
|
1281
|
-
onClick: (e) =>
|
|
1298
|
+
onClick: (e) => ue(r, e.currentTarget, p)
|
|
1282
1299
|
});
|
|
1283
1300
|
}
|
|
1284
|
-
return /* @__PURE__ */ U(
|
|
1301
|
+
return /* @__PURE__ */ U(_n, {
|
|
1285
1302
|
value: e.bubble ? e.ui?.bubble?.button : i?.button,
|
|
1286
1303
|
children: /* @__PURE__ */ W("div", {
|
|
1287
1304
|
ref: y,
|
|
@@ -1289,18 +1306,18 @@ function Kn(e) {
|
|
|
1289
1306
|
role: "toolbar",
|
|
1290
1307
|
"aria-label": e.bubble ? void 0 : "Editor toolbar",
|
|
1291
1308
|
children: [
|
|
1292
|
-
|
|
1309
|
+
P && !e.bubble && /* @__PURE__ */ U("input", {
|
|
1293
1310
|
ref: k,
|
|
1294
1311
|
type: "file",
|
|
1295
1312
|
hidden: !0,
|
|
1296
|
-
accept:
|
|
1313
|
+
accept: ae.importAccept,
|
|
1297
1314
|
onChange: async (e) => {
|
|
1298
1315
|
let t = e.currentTarget, n = t.files?.[0];
|
|
1299
|
-
if (t.value = "", n && j &&
|
|
1316
|
+
if (t.value = "", n && j && P?.parse && !w) {
|
|
1300
1317
|
T(!0);
|
|
1301
1318
|
try {
|
|
1302
1319
|
await p(a, n, {
|
|
1303
|
-
strict:
|
|
1320
|
+
strict: ae.importStrict,
|
|
1304
1321
|
t: _,
|
|
1305
1322
|
canImport: () => k.current === t && f.isEditable && !f.isDestroyed
|
|
1306
1323
|
});
|
|
@@ -1310,11 +1327,11 @@ function Kn(e) {
|
|
|
1310
1327
|
}
|
|
1311
1328
|
}
|
|
1312
1329
|
}),
|
|
1313
|
-
|
|
1330
|
+
I.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ U("div", {
|
|
1314
1331
|
className: Y("vibe-shadcn-tiptap__toolbar-group", Z, n > 0 && "border-s border-border ps-1", i?.groupClassName),
|
|
1315
1332
|
children: t.map((t) => V(t, e))
|
|
1316
1333
|
}, e)),
|
|
1317
|
-
j && b && A && /* @__PURE__ */ U(
|
|
1334
|
+
j && b && A && /* @__PURE__ */ U(On, {
|
|
1318
1335
|
appearance: e.ui?.insertionPopover,
|
|
1319
1336
|
context: a,
|
|
1320
1337
|
request: b.request,
|
|
@@ -1323,7 +1340,7 @@ function Kn(e) {
|
|
|
1323
1340
|
behaviorOptions: e.editorBehaviorOptions,
|
|
1324
1341
|
onClose: () => S(void 0)
|
|
1325
1342
|
}, b.triggerId),
|
|
1326
|
-
j && D && u && A && /* @__PURE__ */ U(
|
|
1343
|
+
j && D && u && A && /* @__PURE__ */ U(Vn, {
|
|
1327
1344
|
appearance: e.ui?.whiteboard,
|
|
1328
1345
|
context: a,
|
|
1329
1346
|
uploadAsset: u,
|
|
@@ -1335,7 +1352,7 @@ function Kn(e) {
|
|
|
1335
1352
|
});
|
|
1336
1353
|
}
|
|
1337
1354
|
// src/editor-bubble.tsx
|
|
1338
|
-
var
|
|
1355
|
+
var Yn = "vibeRadixBubble", Xn = 8, Zn = [
|
|
1339
1356
|
"bold",
|
|
1340
1357
|
"italic",
|
|
1341
1358
|
"underline",
|
|
@@ -1344,19 +1361,19 @@ var qn = "vibeRadixBubble", Jn = 8, Yn = [
|
|
|
1344
1361
|
"color",
|
|
1345
1362
|
"highlight",
|
|
1346
1363
|
"clearFormat"
|
|
1347
|
-
],
|
|
1364
|
+
], Qn = /* @__PURE__ */ new Set([
|
|
1348
1365
|
"image",
|
|
1349
1366
|
"video",
|
|
1350
1367
|
"audio",
|
|
1351
1368
|
"fileAttachment",
|
|
1352
1369
|
"whiteboard"
|
|
1353
1370
|
]);
|
|
1354
|
-
function
|
|
1371
|
+
function $n(e) {
|
|
1355
1372
|
let { selection: t, schema: n, doc: r } = e.state, i = n.marks.link;
|
|
1356
|
-
if (!(t instanceof
|
|
1373
|
+
if (!(t instanceof Oe) || !i) return;
|
|
1357
1374
|
let a = i.isInSet(t.$from.nodeAfter?.marks ?? []), o = a?.attrs.href, s = a?.attrs.target;
|
|
1358
1375
|
if (!a || typeof o != "string" || !o) return;
|
|
1359
|
-
let c =
|
|
1376
|
+
let c = _e(t.$from, i, a.attrs);
|
|
1360
1377
|
if (!(!c || t.to > c.to || t.from < c.from)) return {
|
|
1361
1378
|
...c,
|
|
1362
1379
|
href: o,
|
|
@@ -1364,16 +1381,16 @@ function Zn(e) {
|
|
|
1364
1381
|
target: typeof s == "string" ? s : void 0
|
|
1365
1382
|
};
|
|
1366
1383
|
}
|
|
1367
|
-
function
|
|
1384
|
+
function er({ editor: e, element: t }) {
|
|
1368
1385
|
if (e.isDestroyed || !e.isEditable) return !1;
|
|
1369
1386
|
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
|
|
1387
|
+
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
1388
|
}
|
|
1372
|
-
function
|
|
1389
|
+
function tr(e) {
|
|
1373
1390
|
let { selection: t, doc: n } = e.state;
|
|
1374
|
-
return t instanceof
|
|
1391
|
+
return t instanceof Oe && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
|
|
1375
1392
|
}
|
|
1376
|
-
async function
|
|
1393
|
+
async function nr(e, t, n = !1) {
|
|
1377
1394
|
let { editor: r, notify: i, t: a } = e;
|
|
1378
1395
|
try {
|
|
1379
1396
|
let e = r.view.dom.ownerDocument.defaultView?.navigator.clipboard;
|
|
@@ -1383,7 +1400,7 @@ async function er(e, t, n = !1) {
|
|
|
1383
1400
|
i(a("notify.clipboardUnavailable"), "warning");
|
|
1384
1401
|
}
|
|
1385
1402
|
}
|
|
1386
|
-
function
|
|
1403
|
+
function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
|
|
1387
1404
|
let { editor: u, t: d, commands: f, notify: p } = t;
|
|
1388
1405
|
H(t, (e) => e.getToolbarRevision());
|
|
1389
1406
|
let [m, h] = J(), [g, _] = J(null), v = q(null);
|
|
@@ -1393,7 +1410,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1393
1410
|
let e = v.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
|
|
1394
1411
|
if (!g || !e) return;
|
|
1395
1412
|
let n = () => {
|
|
1396
|
-
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(
|
|
1413
|
+
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(Yn, "updatePosition"));
|
|
1397
1414
|
}, r = t && new t(n);
|
|
1398
1415
|
r?.observe(e), r?.observe(g);
|
|
1399
1416
|
let i = g.ownerDocument, a = ({ target: e }) => {
|
|
@@ -1403,14 +1420,14 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1403
1420
|
r?.disconnect(), i.removeEventListener("scroll", a, !0);
|
|
1404
1421
|
};
|
|
1405
1422
|
}, [u, g]);
|
|
1406
|
-
let y =
|
|
1423
|
+
let y = Ee(() => {
|
|
1407
1424
|
if (!g) return;
|
|
1408
1425
|
let e = {
|
|
1409
1426
|
boundary: g,
|
|
1410
|
-
padding:
|
|
1427
|
+
padding: Xn
|
|
1411
1428
|
};
|
|
1412
1429
|
return {
|
|
1413
|
-
offset:
|
|
1430
|
+
offset: Xn,
|
|
1414
1431
|
flip: e,
|
|
1415
1432
|
shift: {
|
|
1416
1433
|
...e,
|
|
@@ -1428,7 +1445,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1428
1445
|
},
|
|
1429
1446
|
scrollTarget: g
|
|
1430
1447
|
};
|
|
1431
|
-
}, [g, l]), { selection: b } = u.state, x =
|
|
1448
|
+
}, [g, l]), { selection: b } = u.state, x = $n(u), S = !x && tr(u);
|
|
1432
1449
|
K(() => {
|
|
1433
1450
|
!S && m && (h(void 0), l(!1));
|
|
1434
1451
|
}, [
|
|
@@ -1436,7 +1453,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1436
1453
|
m,
|
|
1437
1454
|
l
|
|
1438
1455
|
]);
|
|
1439
|
-
let C =
|
|
1456
|
+
let C = Zn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
|
|
1440
1457
|
if (x) try {
|
|
1441
1458
|
let e = new URL(x.href, u.view.dom.ownerDocument.baseURI);
|
|
1442
1459
|
[
|
|
@@ -1449,31 +1466,31 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1449
1466
|
} catch {
|
|
1450
1467
|
w = void 0;
|
|
1451
1468
|
}
|
|
1452
|
-
return g ? /* @__PURE__ */ U(
|
|
1469
|
+
return g ? /* @__PURE__ */ U(_n, {
|
|
1453
1470
|
value: e?.bubble?.button,
|
|
1454
1471
|
children: /* @__PURE__ */ U(D, {
|
|
1455
1472
|
editor: u,
|
|
1456
|
-
pluginKey:
|
|
1473
|
+
pluginKey: Yn,
|
|
1457
1474
|
appendTo: n,
|
|
1458
1475
|
updateDelay: 0,
|
|
1459
1476
|
resizeDelay: 0,
|
|
1460
1477
|
options: y,
|
|
1461
|
-
shouldShow:
|
|
1478
|
+
shouldShow: er,
|
|
1462
1479
|
className: "vibe-shadcn-tiptap__bubble-host",
|
|
1463
1480
|
children: /* @__PURE__ */ U("div", {
|
|
1464
1481
|
ref: v,
|
|
1465
1482
|
role: "toolbar",
|
|
1466
1483
|
"aria-label": "Selection toolbar",
|
|
1467
|
-
className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5",
|
|
1484
|
+
className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5", mn, e?.bubble?.className),
|
|
1468
1485
|
onMouseDown: (e) => e.preventDefault(),
|
|
1469
|
-
children: b instanceof
|
|
1486
|
+
children: b instanceof De ? /* @__PURE__ */ U(Tn, {
|
|
1470
1487
|
context: t,
|
|
1471
1488
|
selection: b,
|
|
1472
1489
|
overlayTarget: n,
|
|
1473
1490
|
uploadAsset: a,
|
|
1474
1491
|
behaviorOptions: o,
|
|
1475
|
-
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(
|
|
1476
|
-
onCopyUrl: (e, n) => void
|
|
1492
|
+
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(Yn, "hide")),
|
|
1493
|
+
onCopyUrl: (e, n) => void nr(t, e, n),
|
|
1477
1494
|
onWhiteboardEdit: c
|
|
1478
1495
|
}) : x ? /* @__PURE__ */ W("div", {
|
|
1479
1496
|
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
@@ -1485,13 +1502,14 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1485
1502
|
kind: "link",
|
|
1486
1503
|
link: x
|
|
1487
1504
|
}),
|
|
1488
|
-
children: /* @__PURE__ */ U(
|
|
1505
|
+
children: /* @__PURE__ */ U(Tt, {
|
|
1489
1506
|
size: 16,
|
|
1490
1507
|
"aria-hidden": !0
|
|
1491
1508
|
})
|
|
1492
1509
|
}),
|
|
1493
1510
|
/* @__PURE__ */ U(Q, {
|
|
1494
1511
|
asChild: !0,
|
|
1512
|
+
variant: "ghost",
|
|
1495
1513
|
className: "vibe-shadcn-tiptap__button",
|
|
1496
1514
|
children: /* @__PURE__ */ U("a", {
|
|
1497
1515
|
"aria-label": d("toolbar.link.open"),
|
|
@@ -1499,7 +1517,7 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1499
1517
|
"aria-disabled": !w || void 0,
|
|
1500
1518
|
target: x.target || "_blank",
|
|
1501
1519
|
rel: "noopener noreferrer",
|
|
1502
|
-
children: /* @__PURE__ */ U(
|
|
1520
|
+
children: /* @__PURE__ */ U(Ze, {
|
|
1503
1521
|
size: 16,
|
|
1504
1522
|
"aria-hidden": !0
|
|
1505
1523
|
})
|
|
@@ -1508,8 +1526,8 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1508
1526
|
/* @__PURE__ */ U($, {
|
|
1509
1527
|
label: d("toolbar.link.copy"),
|
|
1510
1528
|
overlayTarget: n,
|
|
1511
|
-
onClick: () => void
|
|
1512
|
-
children: /* @__PURE__ */ U(
|
|
1529
|
+
onClick: () => void nr(t, x.href),
|
|
1530
|
+
children: /* @__PURE__ */ U(Ke, {
|
|
1513
1531
|
size: 16,
|
|
1514
1532
|
"aria-hidden": !0
|
|
1515
1533
|
})
|
|
@@ -1520,13 +1538,13 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1520
1538
|
onClick: () => {
|
|
1521
1539
|
f.setLink("", { range: x }), p(d("notify.linkRemoved"), "success");
|
|
1522
1540
|
},
|
|
1523
|
-
children: /* @__PURE__ */ U(
|
|
1541
|
+
children: /* @__PURE__ */ U(Kt, {
|
|
1524
1542
|
size: 16,
|
|
1525
1543
|
"aria-hidden": !0
|
|
1526
1544
|
})
|
|
1527
1545
|
})
|
|
1528
1546
|
]
|
|
1529
|
-
}) : S ? /* @__PURE__ */ U(
|
|
1547
|
+
}) : S ? /* @__PURE__ */ U(Jn, {
|
|
1530
1548
|
context: t,
|
|
1531
1549
|
ui: e,
|
|
1532
1550
|
toolbar: [C],
|
|
@@ -1545,11 +1563,11 @@ function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1545
1563
|
}) : null;
|
|
1546
1564
|
}
|
|
1547
1565
|
// src/find-replace.tsx
|
|
1548
|
-
function
|
|
1566
|
+
function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
1549
1567
|
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
1568
|
if (G(() => {
|
|
1551
1569
|
let e = ({ transaction: e }) => {
|
|
1552
|
-
|
|
1570
|
+
I(e) && f((e) => e + 1);
|
|
1553
1571
|
};
|
|
1554
1572
|
return a.on("transaction", e), () => {
|
|
1555
1573
|
a.off("transaction", e);
|
|
@@ -1565,11 +1583,11 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1565
1583
|
function p(e, t) {
|
|
1566
1584
|
e ? o.findReplacePrevious() : o.findReplaceNext(), t.focus({ preventScroll: !0 });
|
|
1567
1585
|
}
|
|
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(
|
|
1586
|
+
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);
|
|
1587
|
+
return /* @__PURE__ */ U(_n, {
|
|
1570
1588
|
value: e?.button,
|
|
1571
1589
|
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",
|
|
1590
|
+
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
1591
|
role: "search",
|
|
1574
1592
|
"aria-label": s("command.findReplace"),
|
|
1575
1593
|
onKeyDown: (e) => {
|
|
@@ -1584,7 +1602,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1584
1602
|
/* @__PURE__ */ U(i.Addon, {
|
|
1585
1603
|
align: "inline-start",
|
|
1586
1604
|
"aria-hidden": !0,
|
|
1587
|
-
children: /* @__PURE__ */ U(
|
|
1605
|
+
children: /* @__PURE__ */ U(It, { size: 16 })
|
|
1588
1606
|
}),
|
|
1589
1607
|
/* @__PURE__ */ U(i.Input, {
|
|
1590
1608
|
className: g,
|
|
@@ -1605,7 +1623,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1605
1623
|
overlayTarget: r,
|
|
1606
1624
|
"aria-pressed": c.caseSensitive,
|
|
1607
1625
|
onClick: () => o.setFindReplaceCaseSensitive(!c.caseSensitive),
|
|
1608
|
-
children: /* @__PURE__ */ U(
|
|
1626
|
+
children: /* @__PURE__ */ U(ze, {
|
|
1609
1627
|
size: 16,
|
|
1610
1628
|
"aria-hidden": !0
|
|
1611
1629
|
})
|
|
@@ -1626,7 +1644,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1626
1644
|
overlayTarget: r,
|
|
1627
1645
|
disabled: !m,
|
|
1628
1646
|
onClick: (e) => p(!0, e.currentTarget),
|
|
1629
|
-
children: /* @__PURE__ */ U(
|
|
1647
|
+
children: /* @__PURE__ */ U(Ue, {
|
|
1630
1648
|
size: 16,
|
|
1631
1649
|
"aria-hidden": !0
|
|
1632
1650
|
})
|
|
@@ -1637,7 +1655,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1637
1655
|
overlayTarget: r,
|
|
1638
1656
|
disabled: !m,
|
|
1639
1657
|
onClick: (e) => p(!1, e.currentTarget),
|
|
1640
|
-
children: /* @__PURE__ */ U(
|
|
1658
|
+
children: /* @__PURE__ */ U(Be, {
|
|
1641
1659
|
size: 16,
|
|
1642
1660
|
"aria-hidden": !0
|
|
1643
1661
|
})
|
|
@@ -1647,7 +1665,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1647
1665
|
label: s("findReplace.close"),
|
|
1648
1666
|
overlayTarget: r,
|
|
1649
1667
|
onClick: () => o.closeFindReplace(),
|
|
1650
|
-
children: /* @__PURE__ */ U(
|
|
1668
|
+
children: /* @__PURE__ */ U(Yt, {
|
|
1651
1669
|
size: 16,
|
|
1652
1670
|
"aria-hidden": !0
|
|
1653
1671
|
})
|
|
@@ -1661,7 +1679,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1661
1679
|
children: [/* @__PURE__ */ U(i.Addon, {
|
|
1662
1680
|
align: "inline-start",
|
|
1663
1681
|
"aria-hidden": !0,
|
|
1664
|
-
children: /* @__PURE__ */ U(
|
|
1682
|
+
children: /* @__PURE__ */ U(Mt, { size: 16 })
|
|
1665
1683
|
}), /* @__PURE__ */ U(i.Input, {
|
|
1666
1684
|
className: g,
|
|
1667
1685
|
"aria-label": s("findReplace.replacement"),
|
|
@@ -1679,7 +1697,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1679
1697
|
overlayTarget: r,
|
|
1680
1698
|
disabled: !m,
|
|
1681
1699
|
onClick: () => o.replaceFindReplaceCurrent(),
|
|
1682
|
-
children: /* @__PURE__ */ U(
|
|
1700
|
+
children: /* @__PURE__ */ U(Mt, {
|
|
1683
1701
|
size: 16,
|
|
1684
1702
|
"aria-hidden": !0
|
|
1685
1703
|
})
|
|
@@ -1690,7 +1708,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1690
1708
|
overlayTarget: r,
|
|
1691
1709
|
disabled: !m,
|
|
1692
1710
|
onClick: () => o.replaceFindReplaceAll(),
|
|
1693
|
-
children: /* @__PURE__ */ U(
|
|
1711
|
+
children: /* @__PURE__ */ U(Nt, {
|
|
1694
1712
|
size: 16,
|
|
1695
1713
|
"aria-hidden": !0
|
|
1696
1714
|
})
|
|
@@ -1701,7 +1719,7 @@ function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1701
1719
|
});
|
|
1702
1720
|
}
|
|
1703
1721
|
// src/image-preview-dialog.tsx
|
|
1704
|
-
function
|
|
1722
|
+
function ar(e, t) {
|
|
1705
1723
|
if (!e) return {};
|
|
1706
1724
|
let n;
|
|
1707
1725
|
try {
|
|
@@ -1722,8 +1740,8 @@ function rr(e, t) {
|
|
|
1722
1740
|
name: i
|
|
1723
1741
|
};
|
|
1724
1742
|
}
|
|
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 } =
|
|
1743
|
+
function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
|
|
1744
|
+
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
1745
|
function w(e) {
|
|
1728
1746
|
v && (m.current = null, d(0), p(100), l((t) => (t + e + s.length) % s.length));
|
|
1729
1747
|
}
|
|
@@ -1749,7 +1767,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1749
1767
|
},
|
|
1750
1768
|
children: [/* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", {
|
|
1751
1769
|
className: "vibe-shadcn-tiptap__image-title",
|
|
1752
|
-
children: [/* @__PURE__ */ U(
|
|
1770
|
+
children: [/* @__PURE__ */ U(ct, {
|
|
1753
1771
|
size: 16,
|
|
1754
1772
|
"aria-hidden": "true"
|
|
1755
1773
|
}), /* @__PURE__ */ U(o.Title, {
|
|
@@ -1768,7 +1786,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1768
1786
|
label: n("image.preview.previous"),
|
|
1769
1787
|
overlayTarget: r,
|
|
1770
1788
|
onClick: () => w(-1),
|
|
1771
|
-
children: /* @__PURE__ */ U(
|
|
1789
|
+
children: /* @__PURE__ */ U(Ve, {
|
|
1772
1790
|
size: 16,
|
|
1773
1791
|
"aria-hidden": "true"
|
|
1774
1792
|
})
|
|
@@ -1787,7 +1805,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1787
1805
|
label: n("image.preview.next"),
|
|
1788
1806
|
overlayTarget: r,
|
|
1789
1807
|
onClick: () => w(1),
|
|
1790
|
-
children: /* @__PURE__ */ U(
|
|
1808
|
+
children: /* @__PURE__ */ U(He, {
|
|
1791
1809
|
size: 16,
|
|
1792
1810
|
"aria-hidden": "true"
|
|
1793
1811
|
})
|
|
@@ -1803,7 +1821,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1803
1821
|
label: n("image.preview.zoomOut"),
|
|
1804
1822
|
overlayTarget: r,
|
|
1805
1823
|
onClick: () => void h.current?.zoomOut(.1),
|
|
1806
|
-
children: /* @__PURE__ */ U(
|
|
1824
|
+
children: /* @__PURE__ */ U(Zt, {
|
|
1807
1825
|
size: 16,
|
|
1808
1826
|
"aria-hidden": "true"
|
|
1809
1827
|
})
|
|
@@ -1824,7 +1842,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1824
1842
|
label: n("image.preview.zoomIn"),
|
|
1825
1843
|
overlayTarget: r,
|
|
1826
1844
|
onClick: () => void h.current?.zoomIn(.1),
|
|
1827
|
-
children: /* @__PURE__ */ U(
|
|
1845
|
+
children: /* @__PURE__ */ U(Xt, {
|
|
1828
1846
|
size: 16,
|
|
1829
1847
|
"aria-hidden": "true"
|
|
1830
1848
|
})
|
|
@@ -1840,7 +1858,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1840
1858
|
label: n("image.preview.rotateLeft"),
|
|
1841
1859
|
overlayTarget: r,
|
|
1842
1860
|
onClick: () => d((e) => (e - 90) % 360),
|
|
1843
|
-
children: /* @__PURE__ */ U(
|
|
1861
|
+
children: /* @__PURE__ */ U(Pt, {
|
|
1844
1862
|
size: 16,
|
|
1845
1863
|
"aria-hidden": "true"
|
|
1846
1864
|
})
|
|
@@ -1851,7 +1869,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1851
1869
|
label: n("image.preview.rotateRight"),
|
|
1852
1870
|
overlayTarget: r,
|
|
1853
1871
|
onClick: () => d((e) => (e + 90) % 360),
|
|
1854
|
-
children: /* @__PURE__ */ U(
|
|
1872
|
+
children: /* @__PURE__ */ U(Ft, {
|
|
1855
1873
|
size: 16,
|
|
1856
1874
|
"aria-hidden": "true"
|
|
1857
1875
|
})
|
|
@@ -1859,6 +1877,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1859
1877
|
/* @__PURE__ */ U(Q, {
|
|
1860
1878
|
appearance: e?.button,
|
|
1861
1879
|
asChild: !0,
|
|
1880
|
+
variant: "ghost",
|
|
1862
1881
|
className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__image-download",
|
|
1863
1882
|
children: /* @__PURE__ */ W("a", {
|
|
1864
1883
|
href: b,
|
|
@@ -1866,7 +1885,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1866
1885
|
"aria-disabled": !b || void 0,
|
|
1867
1886
|
target: "_blank",
|
|
1868
1887
|
rel: "noreferrer",
|
|
1869
|
-
children: [/* @__PURE__ */ U(
|
|
1888
|
+
children: [/* @__PURE__ */ U(qe, {
|
|
1870
1889
|
size: 16,
|
|
1871
1890
|
"aria-hidden": "true"
|
|
1872
1891
|
}), n("image.preview.download")]
|
|
@@ -1880,7 +1899,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1880
1899
|
size: "icon",
|
|
1881
1900
|
label: n("image.preview.close"),
|
|
1882
1901
|
overlayTarget: r,
|
|
1883
|
-
children: /* @__PURE__ */ U(
|
|
1902
|
+
children: /* @__PURE__ */ U(Yt, {
|
|
1884
1903
|
size: 16,
|
|
1885
1904
|
"aria-hidden": "true"
|
|
1886
1905
|
})
|
|
@@ -1905,7 +1924,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1905
1924
|
onLostPointerCapture: (e) => {
|
|
1906
1925
|
m.current?.pointerId === e.pointerId && (m.current = null);
|
|
1907
1926
|
},
|
|
1908
|
-
children: /* @__PURE__ */ U(
|
|
1927
|
+
children: /* @__PURE__ */ U(an, {
|
|
1909
1928
|
ref: h,
|
|
1910
1929
|
centerOnInit: !0,
|
|
1911
1930
|
centerZoomedOut: !0,
|
|
@@ -1920,7 +1939,7 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1920
1939
|
activationKeys: (e) => !e.includes("Shift")
|
|
1921
1940
|
},
|
|
1922
1941
|
onTransform: (e, { scale: t }) => p(Math.round(t * 100)),
|
|
1923
|
-
children: /* @__PURE__ */ U(
|
|
1942
|
+
children: /* @__PURE__ */ U(rn, {
|
|
1924
1943
|
wrapperClass: "vibe-shadcn-tiptap__image-viewport",
|
|
1925
1944
|
contentClass: "vibe-shadcn-tiptap__image-plane",
|
|
1926
1945
|
children: /* @__PURE__ */ U("img", {
|
|
@@ -1936,62 +1955,73 @@ function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1936
1955
|
});
|
|
1937
1956
|
}
|
|
1938
1957
|
// src/mention-menu.tsx
|
|
1939
|
-
function
|
|
1940
|
-
let { editor:
|
|
1958
|
+
function sr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
|
|
1959
|
+
let { editor: a, items: o, groups: s, selectedIndex: c, mount: l, loading: u } = t, d = `vibe-tiptap-mention-${a.instanceId}`, f = q(null);
|
|
1941
1960
|
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
|
-
|
|
1961
|
+
let e = f.current;
|
|
1962
|
+
if (e) return l(e);
|
|
1963
|
+
}, [l, n]), K(() => {
|
|
1964
|
+
let e = a.view.dom, t = f.current;
|
|
1965
|
+
if (!o[c] || !t) return;
|
|
1966
|
+
let n = `${d}-${c}`, r = e.getAttribute("aria-activedescendant"), i = e.getAttribute("aria-controls");
|
|
1967
|
+
e.setAttribute("aria-activedescendant", n), e.setAttribute("aria-controls", d);
|
|
1968
|
+
let s = e.ownerDocument.getElementById(n);
|
|
1969
|
+
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), () => {
|
|
1970
|
+
r === null ? e.removeAttribute("aria-activedescendant") : e.setAttribute("aria-activedescendant", r), i === null ? e.removeAttribute("aria-controls") : e.setAttribute("aria-controls", i);
|
|
1952
1971
|
};
|
|
1953
1972
|
}, [
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1973
|
+
a,
|
|
1974
|
+
d,
|
|
1975
|
+
o,
|
|
1976
|
+
c
|
|
1977
|
+
]), on(/* @__PURE__ */ U("div", {
|
|
1978
|
+
ref: f,
|
|
1979
|
+
className: Y("z-3 vibe-shadcn-tiptap__mention", e?.className),
|
|
1980
|
+
children: o.length ? /* @__PURE__ */ U("div", {
|
|
1981
|
+
id: d,
|
|
1962
1982
|
role: "listbox",
|
|
1963
|
-
"aria-label":
|
|
1964
|
-
children:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1983
|
+
"aria-label": r("mention.label"),
|
|
1984
|
+
children: s.map(({ name: n, label: r, items: a, startIndex: o }) => /* @__PURE__ */ W("div", {
|
|
1985
|
+
className: n === void 0 ? void 0 : e?.groupClassName,
|
|
1986
|
+
...r ? {
|
|
1987
|
+
role: "group",
|
|
1988
|
+
"aria-label": r
|
|
1989
|
+
} : {},
|
|
1990
|
+
children: [r && /* @__PURE__ */ U("div", {
|
|
1991
|
+
className: Y("px-3 py-1 text-xs font-medium text-muted-foreground", e?.groupLabelClassName),
|
|
1992
|
+
children: r
|
|
1993
|
+
}), a.map((n, r) => /* @__PURE__ */ U("button", {
|
|
1994
|
+
id: `${d}-${o + r}`,
|
|
1995
|
+
type: "button",
|
|
1996
|
+
role: "option",
|
|
1997
|
+
tabIndex: -1,
|
|
1998
|
+
"aria-label": n.label,
|
|
1999
|
+
"aria-selected": o + r === c,
|
|
2000
|
+
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),
|
|
2001
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2002
|
+
onClick: () => t.command(n),
|
|
2003
|
+
children: i ? i(n) : /* @__PURE__ */ W(ge, { children: [n.avatar && /* @__PURE__ */ U("img", {
|
|
2004
|
+
src: n.avatar,
|
|
2005
|
+
alt: "",
|
|
2006
|
+
className: "vibe-tiptap-mention-avatar"
|
|
2007
|
+
}), /* @__PURE__ */ U("span", { children: n.label })] })
|
|
2008
|
+
}, n.id))]
|
|
2009
|
+
}, n === void 0 ? "ungrouped" : `group-${n}`))
|
|
1980
2010
|
}) : /* @__PURE__ */ U("div", {
|
|
1981
|
-
className: "px-3 py-1 text-sm",
|
|
2011
|
+
className: Y("px-3 py-1 text-sm", e?.statusClassName),
|
|
1982
2012
|
role: "status",
|
|
1983
|
-
children:
|
|
2013
|
+
children: r(u ? "mention.loading" : "mention.empty")
|
|
1984
2014
|
})
|
|
1985
|
-
}),
|
|
2015
|
+
}), n);
|
|
1986
2016
|
}
|
|
1987
2017
|
// src/mention-popover.tsx
|
|
1988
|
-
function
|
|
1989
|
-
let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c =
|
|
2018
|
+
function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
2019
|
+
let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c = Ee(() => ({ current: {
|
|
1990
2020
|
contextElement: e,
|
|
1991
2021
|
getBoundingClientRect: () => a?.element.getBoundingClientRect() ?? new DOMRect()
|
|
1992
2022
|
} }), [e, a]);
|
|
1993
2023
|
return G(() => {
|
|
1994
|
-
let t =
|
|
2024
|
+
let t = sn(e, o, r);
|
|
1995
2025
|
return s.current = t, () => {
|
|
1996
2026
|
t.destroy(), s.current = void 0;
|
|
1997
2027
|
};
|
|
@@ -2011,7 +2041,7 @@ function or({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
|
2011
2041
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2012
2042
|
onFocusOutside: (e) => e.preventDefault(),
|
|
2013
2043
|
onPointerDownOutside: (t) => {
|
|
2014
|
-
|
|
2044
|
+
ae(e, t.target) && t.preventDefault();
|
|
2015
2045
|
},
|
|
2016
2046
|
onMouseEnter: () => s.current?.keepOpen(),
|
|
2017
2047
|
onMouseLeave: () => s.current?.leave(),
|
|
@@ -2020,32 +2050,32 @@ function or({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
|
2020
2050
|
});
|
|
2021
2051
|
}
|
|
2022
2052
|
// 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:
|
|
2053
|
+
var lr = {
|
|
2054
|
+
heading1: et,
|
|
2055
|
+
heading: tt,
|
|
2056
|
+
heading3: nt,
|
|
2057
|
+
heading4: rt,
|
|
2058
|
+
todo: gt,
|
|
2059
|
+
bulletList: ht,
|
|
2060
|
+
orderedList: _t,
|
|
2061
|
+
blockquote: At,
|
|
2062
|
+
table: Bt,
|
|
2063
|
+
image: ut,
|
|
2064
|
+
imageUrl: lt,
|
|
2065
|
+
whiteboard: Et,
|
|
2066
|
+
video: qt,
|
|
2067
|
+
videoUrl: Ut,
|
|
2068
|
+
audio: St,
|
|
2069
|
+
audioUrl: St,
|
|
2070
|
+
upload: wt,
|
|
2071
|
+
link: mt,
|
|
2072
|
+
codeBlock: We,
|
|
2073
|
+
mermaid: Jt,
|
|
2044
2074
|
divider: "solid",
|
|
2045
2075
|
dividerThick: "thick",
|
|
2046
2076
|
dividerDashed: "dashed",
|
|
2047
2077
|
dividerDotted: "dotted"
|
|
2048
|
-
},
|
|
2078
|
+
}, ur = {
|
|
2049
2079
|
heading1: "slashCommand.group.headings",
|
|
2050
2080
|
heading: "slashCommand.group.headings",
|
|
2051
2081
|
heading3: "slashCommand.group.headings",
|
|
@@ -2071,7 +2101,7 @@ var sr = {
|
|
|
2071
2101
|
dividerDashed: "slashCommand.group.dividers",
|
|
2072
2102
|
dividerDotted: "slashCommand.group.dividers"
|
|
2073
2103
|
};
|
|
2074
|
-
function
|
|
2104
|
+
function dr({ appearance: e, state: t, target: n, t: r }) {
|
|
2075
2105
|
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
2106
|
K(() => {
|
|
2077
2107
|
let e = u.current;
|
|
@@ -2098,15 +2128,15 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2098
2128
|
l
|
|
2099
2129
|
]);
|
|
2100
2130
|
let p = [];
|
|
2101
|
-
if (
|
|
2131
|
+
if (R(o)) p.push({ items: a });
|
|
2102
2132
|
else for (let e of a) {
|
|
2103
|
-
let t = e.disabledReason ? "slashCommand.group.unavailable" :
|
|
2133
|
+
let t = e.disabledReason ? "slashCommand.group.unavailable" : ur[e.id], n = p.at(-1);
|
|
2104
2134
|
n?.label === t ? n.items.push(e) : p.push({
|
|
2105
2135
|
label: t,
|
|
2106
2136
|
items: [e]
|
|
2107
2137
|
});
|
|
2108
2138
|
}
|
|
2109
|
-
return
|
|
2139
|
+
return on(/* @__PURE__ */ U("div", {
|
|
2110
2140
|
ref: u,
|
|
2111
2141
|
className: Y("z-3 vibe-shadcn-tiptap__slash", e?.className),
|
|
2112
2142
|
children: a.length ? /* @__PURE__ */ U("div", {
|
|
@@ -2134,7 +2164,7 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2134
2164
|
onMouseDown: (e) => e.preventDefault(),
|
|
2135
2165
|
onClick: () => t.command(n),
|
|
2136
2166
|
children: [
|
|
2137
|
-
/* @__PURE__ */ U(
|
|
2167
|
+
/* @__PURE__ */ U(fr, { command: n.id }),
|
|
2138
2168
|
n.label,
|
|
2139
2169
|
(n.disabledReason || n.hint) && /* @__PURE__ */ U("small", {
|
|
2140
2170
|
id: `${l}-${n.id}-hint`,
|
|
@@ -2149,8 +2179,8 @@ function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2149
2179
|
})
|
|
2150
2180
|
}), n);
|
|
2151
2181
|
}
|
|
2152
|
-
function
|
|
2153
|
-
let t =
|
|
2182
|
+
function fr({ command: e }) {
|
|
2183
|
+
let t = lr[e];
|
|
2154
2184
|
return /* @__PURE__ */ U("span", {
|
|
2155
2185
|
className: "vibe-shadcn-tiptap__slash-icon",
|
|
2156
2186
|
"aria-hidden": !0,
|
|
@@ -2161,57 +2191,57 @@ function ur({ command: e }) {
|
|
|
2161
2191
|
});
|
|
2162
2192
|
}
|
|
2163
2193
|
// src/table-grips.tsx
|
|
2164
|
-
var
|
|
2194
|
+
var pr = ["row", "column"], mr = {
|
|
2165
2195
|
row: [
|
|
2166
2196
|
[
|
|
2167
2197
|
"addRowBefore",
|
|
2168
2198
|
"table.insertAbove",
|
|
2169
|
-
|
|
2199
|
+
Ot
|
|
2170
2200
|
],
|
|
2171
2201
|
[
|
|
2172
2202
|
"addRowAfter",
|
|
2173
2203
|
"table.insertBelow",
|
|
2174
|
-
|
|
2204
|
+
Ot
|
|
2175
2205
|
],
|
|
2176
2206
|
[
|
|
2177
2207
|
"moveRowUp",
|
|
2178
2208
|
"table.moveUp",
|
|
2179
|
-
|
|
2209
|
+
Ie
|
|
2180
2210
|
],
|
|
2181
2211
|
[
|
|
2182
2212
|
"moveRowDown",
|
|
2183
2213
|
"table.moveDown",
|
|
2184
|
-
|
|
2214
|
+
Ne
|
|
2185
2215
|
]
|
|
2186
2216
|
],
|
|
2187
2217
|
column: [
|
|
2188
2218
|
[
|
|
2189
2219
|
"addColumnBefore",
|
|
2190
2220
|
"table.insertLeft",
|
|
2191
|
-
|
|
2221
|
+
Ot
|
|
2192
2222
|
],
|
|
2193
2223
|
[
|
|
2194
2224
|
"addColumnAfter",
|
|
2195
2225
|
"table.insertRight",
|
|
2196
|
-
|
|
2226
|
+
Ot
|
|
2197
2227
|
],
|
|
2198
2228
|
[
|
|
2199
2229
|
"moveColumnLeft",
|
|
2200
2230
|
"table.moveLeft",
|
|
2201
|
-
|
|
2231
|
+
Pe
|
|
2202
2232
|
],
|
|
2203
2233
|
[
|
|
2204
2234
|
"moveColumnRight",
|
|
2205
2235
|
"table.moveRight",
|
|
2206
|
-
|
|
2236
|
+
Fe
|
|
2207
2237
|
]
|
|
2208
2238
|
]
|
|
2209
2239
|
};
|
|
2210
|
-
function
|
|
2240
|
+
function hr({ appearance: e, context: t, overlayTarget: n }) {
|
|
2211
2241
|
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
2242
|
function g(e) {
|
|
2213
2243
|
let { view: t, state: n } = i;
|
|
2214
|
-
if (t.dom.contains(e)) return
|
|
2244
|
+
if (t.dom.contains(e)) return ln(n.doc.resolve(t.posAtDOM(e, 0)));
|
|
2215
2245
|
}
|
|
2216
2246
|
function _(e, t) {
|
|
2217
2247
|
let n = g(t.cell);
|
|
@@ -2241,10 +2271,10 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2241
2271
|
}
|
|
2242
2272
|
let o = a.closest("table");
|
|
2243
2273
|
if (!o || !e?.contains(o) || i.isDestroyed) return;
|
|
2244
|
-
let s =
|
|
2274
|
+
let s = ln(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
|
|
2245
2275
|
if (!s) return;
|
|
2246
2276
|
n();
|
|
2247
|
-
let { left: c, right: d, top: f } =
|
|
2277
|
+
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
2278
|
for (let e = c; e < d; e += 1) {
|
|
2249
2279
|
let n = p[e]?.getBoundingClientRect();
|
|
2250
2280
|
if (n && n.width > 0 && t.clientX < n.right) {
|
|
@@ -2271,7 +2301,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2271
2301
|
let r = t, a = e, o = c;
|
|
2272
2302
|
function s() {
|
|
2273
2303
|
if (i.isDestroyed) return;
|
|
2274
|
-
let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ?
|
|
2304
|
+
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
2305
|
if (!c || !u) {
|
|
2276
2306
|
l(void 0), d(void 0);
|
|
2277
2307
|
return;
|
|
@@ -2281,7 +2311,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2281
2311
|
l(void 0), d(void 0);
|
|
2282
2312
|
return;
|
|
2283
2313
|
}
|
|
2284
|
-
let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } =
|
|
2314
|
+
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
2315
|
p({
|
|
2286
2316
|
row: {
|
|
2287
2317
|
left: Math.max(m.left + 11, h.left - 11) - f.left,
|
|
@@ -2304,7 +2334,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2304
2334
|
function v(e, t) {
|
|
2305
2335
|
let n = g(t.cell);
|
|
2306
2336
|
if (!n) return !1;
|
|
2307
|
-
let r = n.node(-1), i =
|
|
2337
|
+
let r = n.node(-1), i = cn.get(r);
|
|
2308
2338
|
return i.cellsInRect({
|
|
2309
2339
|
left: 0,
|
|
2310
2340
|
top: 0,
|
|
@@ -2312,8 +2342,8 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2312
2342
|
bottom: e === "column" ? i.height : 1
|
|
2313
2343
|
}).every((e) => r.nodeAt(e)?.type.spec.tableRole === "header_cell");
|
|
2314
2344
|
}
|
|
2315
|
-
return
|
|
2316
|
-
let s = t === "row" ?
|
|
2345
|
+
return pr.map((t) => {
|
|
2346
|
+
let s = t === "row" ? Ye : Je, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
|
|
2317
2347
|
function m(e) {
|
|
2318
2348
|
c && i.isEditable && _(t, c) && (h.current = !0, e(), l(void 0), d(void 0));
|
|
2319
2349
|
}
|
|
@@ -2347,7 +2377,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2347
2377
|
h.current && e.preventDefault();
|
|
2348
2378
|
},
|
|
2349
2379
|
children: [
|
|
2350
|
-
|
|
2380
|
+
mr[t].map(([e, t, n]) => /* @__PURE__ */ W(r.Item, {
|
|
2351
2381
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2352
2382
|
onSelect: () => m(a[e]),
|
|
2353
2383
|
children: [/* @__PURE__ */ U(n, {
|
|
@@ -2358,7 +2388,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2358
2388
|
c[t] === 0 && /* @__PURE__ */ W(r.Item, {
|
|
2359
2389
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2360
2390
|
onSelect: () => m(t === "row" ? a.toggleHeaderRow : a.toggleHeaderColumn),
|
|
2361
|
-
children: [/* @__PURE__ */ U(
|
|
2391
|
+
children: [/* @__PURE__ */ U(Vt, {
|
|
2362
2392
|
size: 15,
|
|
2363
2393
|
"aria-hidden": !0
|
|
2364
2394
|
}), o(v(t, c) ? "table.unsetHeader" : "table.setHeader")]
|
|
@@ -2366,7 +2396,7 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2366
2396
|
/* @__PURE__ */ W(r.Item, {
|
|
2367
2397
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2368
2398
|
onSelect: () => m(() => t === "row" ? a.deleteRow(c.row) : a.deleteColumn(c.column)),
|
|
2369
|
-
children: [/* @__PURE__ */ U(
|
|
2399
|
+
children: [/* @__PURE__ */ U(Ht, {
|
|
2370
2400
|
size: 15,
|
|
2371
2401
|
"aria-hidden": !0
|
|
2372
2402
|
}), o("table.deleteLine")]
|
|
@@ -2377,167 +2407,170 @@ function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2377
2407
|
});
|
|
2378
2408
|
}
|
|
2379
2409
|
// src/use-vibe-tiptap.ts
|
|
2380
|
-
var
|
|
2381
|
-
function
|
|
2382
|
-
let
|
|
2410
|
+
var gr = Symbol();
|
|
2411
|
+
function _r(e = {}) {
|
|
2412
|
+
let t = zn(), [n] = J(() => ({
|
|
2413
|
+
...e,
|
|
2414
|
+
mediaResources: e.mediaResources ?? t
|
|
2415
|
+
})), [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
2416
|
function e() {
|
|
2384
|
-
let e =
|
|
2385
|
-
|
|
2417
|
+
let e = c.current;
|
|
2418
|
+
c.current = void 0, a.current?.onSlash(void 0), e && !e.editor.isDestroyed && ne(e.editor.view, (n.slashCommand || void 0)?.pluginKey ?? V);
|
|
2386
2419
|
}
|
|
2387
|
-
function
|
|
2388
|
-
|
|
2420
|
+
function t() {
|
|
2421
|
+
l.current && te(l.current.editor);
|
|
2389
2422
|
}
|
|
2390
2423
|
return {
|
|
2391
|
-
bind(
|
|
2392
|
-
if (
|
|
2393
|
-
return e(),
|
|
2394
|
-
|
|
2424
|
+
bind(n) {
|
|
2425
|
+
if (a.current) throw Error("useVibeTiptap already has a mounted editor view");
|
|
2426
|
+
return e(), t(), a.current = n, () => {
|
|
2427
|
+
a.current = void 0, e(), t(), i(!1);
|
|
2395
2428
|
};
|
|
2396
2429
|
},
|
|
2397
2430
|
closeSlashMenu: e
|
|
2398
2431
|
};
|
|
2399
|
-
}),
|
|
2400
|
-
onOpen:
|
|
2401
|
-
onUpdate:
|
|
2402
|
-
onClose: () =>
|
|
2403
|
-
onExecute: (e) =>
|
|
2432
|
+
}), d = {
|
|
2433
|
+
onOpen: f,
|
|
2434
|
+
onUpdate: f,
|
|
2435
|
+
onClose: () => f(void 0),
|
|
2436
|
+
onExecute: (e) => a.current?.onExecute(e)
|
|
2404
2437
|
};
|
|
2405
|
-
function d(e) {
|
|
2406
|
-
s.current = e, i.current?.onSlash(e);
|
|
2407
|
-
}
|
|
2408
2438
|
function f(e) {
|
|
2409
|
-
c.current = e,
|
|
2439
|
+
c.current = e, a.current?.onSlash(e);
|
|
2440
|
+
}
|
|
2441
|
+
function p(e) {
|
|
2442
|
+
l.current = e, a.current?.onMention(e);
|
|
2410
2443
|
}
|
|
2411
|
-
let
|
|
2412
|
-
...
|
|
2444
|
+
let m = n.mention || void 0, h = m && {
|
|
2445
|
+
...m,
|
|
2413
2446
|
onOpen(e) {
|
|
2414
|
-
|
|
2447
|
+
p(e), m.onOpen?.(e);
|
|
2415
2448
|
},
|
|
2416
2449
|
onUpdate(e) {
|
|
2417
|
-
|
|
2450
|
+
p(e), m.onUpdate?.(e);
|
|
2418
2451
|
},
|
|
2419
2452
|
onClose() {
|
|
2420
|
-
|
|
2453
|
+
p(void 0), m.onClose?.();
|
|
2421
2454
|
}
|
|
2422
2455
|
};
|
|
2423
|
-
function
|
|
2424
|
-
let e =
|
|
2425
|
-
if (e?.editor.schema.nodes.image) return A(e, () =>
|
|
2456
|
+
function g() {
|
|
2457
|
+
let e = s.current;
|
|
2458
|
+
if (e?.editor.schema.nodes.image) return A(e, () => o.current.uploadAsset, () => o.current.editorBehaviorOptions);
|
|
2426
2459
|
}
|
|
2427
2460
|
G(() => {
|
|
2428
|
-
|
|
2461
|
+
o.current = e;
|
|
2429
2462
|
}, [e]);
|
|
2430
|
-
let
|
|
2431
|
-
...
|
|
2432
|
-
content:
|
|
2433
|
-
editable: (e.editable ?? !0) && !
|
|
2463
|
+
let _ = me({
|
|
2464
|
+
...n,
|
|
2465
|
+
content: n.initialContent,
|
|
2466
|
+
editable: (e.editable ?? !0) && !r,
|
|
2434
2467
|
uploadAsset: e.uploadAsset,
|
|
2435
2468
|
editorBehaviorOptions: e.editorBehaviorOptions,
|
|
2436
|
-
slashCommand:
|
|
2437
|
-
mention:
|
|
2469
|
+
slashCommand: n.slashCommand ?? {},
|
|
2470
|
+
mention: h,
|
|
2438
2471
|
editorProps: {
|
|
2439
|
-
...
|
|
2472
|
+
...n.editorProps,
|
|
2440
2473
|
handleDOMEvents: {
|
|
2441
|
-
...
|
|
2474
|
+
...n.editorProps?.handleDOMEvents,
|
|
2442
2475
|
paste(e, t) {
|
|
2443
|
-
return
|
|
2476
|
+
return o.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (g()?.onPaste(t), t.defaultPrevented);
|
|
2444
2477
|
},
|
|
2445
2478
|
drop(e, t) {
|
|
2446
|
-
return
|
|
2479
|
+
return o.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (g()?.onDrop(t), t.defaultPrevented);
|
|
2447
2480
|
}
|
|
2448
2481
|
}
|
|
2449
2482
|
},
|
|
2450
2483
|
onUpdate: e.onUpdate,
|
|
2451
2484
|
onImagePreview(t) {
|
|
2452
|
-
|
|
2485
|
+
a.current?.onImagePreview(t), e.onImagePreview?.(t);
|
|
2453
2486
|
},
|
|
2454
2487
|
notify(t, n = "info") {
|
|
2455
|
-
(e.notify ??
|
|
2488
|
+
(e.notify ?? a.current?.notify)?.(t, n);
|
|
2456
2489
|
}
|
|
2457
|
-
},
|
|
2458
|
-
return G(() => (
|
|
2459
|
-
|
|
2460
|
-
}), [
|
|
2461
|
-
context:
|
|
2462
|
-
[
|
|
2463
|
-
bridge:
|
|
2464
|
-
preview:
|
|
2465
|
-
setPreview:
|
|
2490
|
+
}, n.slashCommand === !1 ? void 0 : d);
|
|
2491
|
+
return G(() => (s.current = _, () => {
|
|
2492
|
+
s.current = void 0;
|
|
2493
|
+
}), [_]), {
|
|
2494
|
+
context: _,
|
|
2495
|
+
[gr]: {
|
|
2496
|
+
bridge: u,
|
|
2497
|
+
preview: r,
|
|
2498
|
+
setPreview: i,
|
|
2466
2499
|
editable: e.editable ?? !0,
|
|
2467
|
-
mentionHoverDelay:
|
|
2468
|
-
codeBlockLanguages:
|
|
2469
|
-
horizontalRules:
|
|
2500
|
+
mentionHoverDelay: m?.hoverDelay,
|
|
2501
|
+
codeBlockLanguages: n.codeBlockLanguages,
|
|
2502
|
+
horizontalRules: n.horizontalRules,
|
|
2470
2503
|
uploadAsset: e.uploadAsset,
|
|
2471
2504
|
editorBehaviorOptions: e.editorBehaviorOptions
|
|
2472
2505
|
}
|
|
2473
2506
|
};
|
|
2474
2507
|
}
|
|
2475
2508
|
// src/shadcn-tiptap-editor.tsx
|
|
2476
|
-
function
|
|
2477
|
-
let t =
|
|
2509
|
+
function vr(e) {
|
|
2510
|
+
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
2511
|
...e,
|
|
2479
2512
|
...t
|
|
2480
|
-
}, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[
|
|
2513
|
+
}, { 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
2514
|
G(() => {
|
|
2482
2515
|
let e = T.bind({
|
|
2483
|
-
onSlash:
|
|
2484
|
-
onMention:
|
|
2516
|
+
onSlash: P,
|
|
2517
|
+
onMention: ie,
|
|
2485
2518
|
onExecute: ({ item: e }) => {
|
|
2486
|
-
_ &&
|
|
2487
|
-
onImage: () =>
|
|
2519
|
+
_ && ue(_, e, {
|
|
2520
|
+
onImage: () => I({
|
|
2488
2521
|
kind: "image",
|
|
2489
2522
|
tab: "upload"
|
|
2490
2523
|
}),
|
|
2491
|
-
onImageUrl: () =>
|
|
2524
|
+
onImageUrl: () => I({
|
|
2492
2525
|
kind: "image",
|
|
2493
2526
|
tab: "url"
|
|
2494
2527
|
}),
|
|
2495
|
-
onVideo: () =>
|
|
2528
|
+
onVideo: () => I({
|
|
2496
2529
|
kind: "video",
|
|
2497
2530
|
tab: "upload"
|
|
2498
2531
|
}),
|
|
2499
|
-
onVideoUrl: () =>
|
|
2532
|
+
onVideoUrl: () => I({
|
|
2500
2533
|
kind: "video",
|
|
2501
2534
|
tab: "url"
|
|
2502
2535
|
}),
|
|
2503
|
-
onAudio: () =>
|
|
2536
|
+
onAudio: () => I({
|
|
2504
2537
|
kind: "audio",
|
|
2505
2538
|
tab: "upload"
|
|
2506
2539
|
}),
|
|
2507
|
-
onAudioUrl: () =>
|
|
2540
|
+
onAudioUrl: () => I({
|
|
2508
2541
|
kind: "audio",
|
|
2509
2542
|
tab: "url"
|
|
2510
2543
|
}),
|
|
2511
|
-
onUpload: () =>
|
|
2544
|
+
onUpload: () => I({
|
|
2512
2545
|
kind: "attachment",
|
|
2513
2546
|
tab: "upload"
|
|
2514
2547
|
}),
|
|
2515
|
-
onLink: () =>
|
|
2516
|
-
onWhiteboard: () =>
|
|
2548
|
+
onLink: () => I({ kind: "link" }),
|
|
2549
|
+
onWhiteboard: () => L("new")
|
|
2517
2550
|
});
|
|
2518
2551
|
},
|
|
2519
2552
|
onImagePreview(e) {
|
|
2520
|
-
|
|
2553
|
+
M({
|
|
2521
2554
|
...e,
|
|
2522
2555
|
urls: [...e.urls],
|
|
2523
2556
|
names: e.names?.slice()
|
|
2524
2557
|
});
|
|
2525
2558
|
},
|
|
2526
2559
|
notify(e, t = "info") {
|
|
2527
|
-
let n = ++
|
|
2528
|
-
|
|
2560
|
+
let n = ++le.current;
|
|
2561
|
+
R((r) => [...r, {
|
|
2529
2562
|
id: n,
|
|
2530
2563
|
message: e,
|
|
2531
2564
|
type: t
|
|
2532
|
-
}]),
|
|
2533
|
-
|
|
2565
|
+
}]), z.current.set(n, setTimeout(() => {
|
|
2566
|
+
z.current.delete(n), R((e) => e.filter((e) => e.id !== n));
|
|
2534
2567
|
}, 3e3));
|
|
2535
2568
|
}
|
|
2536
|
-
}), t =
|
|
2569
|
+
}), t = z.current;
|
|
2537
2570
|
return () => {
|
|
2538
2571
|
e();
|
|
2539
2572
|
for (let e of t.values()) clearTimeout(e);
|
|
2540
|
-
t.clear(),
|
|
2573
|
+
t.clear(), R([]), P(void 0), ie(void 0), M(void 0), I(void 0), L(void 0), oe(!1);
|
|
2541
2574
|
};
|
|
2542
2575
|
}, [T, _]), G(() => {
|
|
2543
2576
|
de || b(!1);
|
|
@@ -2546,21 +2579,21 @@ function gr(e) {
|
|
|
2546
2579
|
let e = D.ownerDocument, t = () => te(e.fullscreenElement === D);
|
|
2547
2580
|
return e.addEventListener("fullscreenchange", t), () => e.removeEventListener("fullscreenchange", t);
|
|
2548
2581
|
}, [D]), G(() => {
|
|
2549
|
-
V || (
|
|
2582
|
+
V || (I(void 0), L(void 0), oe(!1)), !V && N && T.closeSlashMenu();
|
|
2550
2583
|
}, [
|
|
2551
2584
|
T,
|
|
2552
2585
|
V,
|
|
2553
|
-
|
|
2586
|
+
N
|
|
2554
2587
|
]);
|
|
2555
2588
|
async function pe(e) {
|
|
2556
|
-
if (D && !
|
|
2557
|
-
|
|
2589
|
+
if (D && !B.current && e !== j) {
|
|
2590
|
+
B.current = !0;
|
|
2558
2591
|
try {
|
|
2559
2592
|
e ? await D.requestFullscreen() : await D.ownerDocument.exitFullscreen();
|
|
2560
2593
|
} catch {
|
|
2561
2594
|
_ && !_.editor.isDestroyed && _.notify(_.t("notify.fullscreenFailed"), "warning");
|
|
2562
2595
|
} finally {
|
|
2563
|
-
|
|
2596
|
+
B.current = !1;
|
|
2564
2597
|
}
|
|
2565
2598
|
}
|
|
2566
2599
|
}
|
|
@@ -2573,13 +2606,13 @@ function gr(e) {
|
|
|
2573
2606
|
if (!o.nodeAfter?.isText) return;
|
|
2574
2607
|
let s = a.isInSet(o.nodeAfter.marks);
|
|
2575
2608
|
if (!s || s.attrs.href !== n.getAttribute("href")) return;
|
|
2576
|
-
let c =
|
|
2609
|
+
let c = _e(o, a, s.attrs);
|
|
2577
2610
|
if (!c) return;
|
|
2578
2611
|
e.preventDefault();
|
|
2579
2612
|
let { from: l, to: u } = i.selection;
|
|
2580
2613
|
(l < c.from || l >= c.to || u > c.to) && t.commands.setTextSelection(c), r.focus();
|
|
2581
2614
|
}
|
|
2582
|
-
return /* @__PURE__ */ U(
|
|
2615
|
+
return /* @__PURE__ */ U(pn, {
|
|
2583
2616
|
value: n,
|
|
2584
2617
|
children: /* @__PURE__ */ U(ee.Provider, {
|
|
2585
2618
|
delayDuration: 500,
|
|
@@ -2588,7 +2621,7 @@ function gr(e) {
|
|
|
2588
2621
|
...g,
|
|
2589
2622
|
ref: O,
|
|
2590
2623
|
className: ["vibe-shadcn-tiptap", m].filter(Boolean).join(" "),
|
|
2591
|
-
"data-scroll-locked": V && !!(
|
|
2624
|
+
"data-scroll-locked": V && !!(N || re || F || ae) || void 0,
|
|
2592
2625
|
onKeyDown: (e) => {
|
|
2593
2626
|
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
2627
|
if (e.preventDefault(), e.target instanceof Element && e.target.closest(".vibe-shadcn-tiptap__find")) {
|
|
@@ -2597,8 +2630,8 @@ function gr(e) {
|
|
|
2597
2630
|
} else _.commands.openFindReplace();
|
|
2598
2631
|
}
|
|
2599
2632
|
},
|
|
2600
|
-
children: [_ && /* @__PURE__ */ W(
|
|
2601
|
-
a !== !1 && /* @__PURE__ */ U(
|
|
2633
|
+
children: [_ && /* @__PURE__ */ W(ge, { children: [
|
|
2634
|
+
a !== !1 && /* @__PURE__ */ U(Jn, {
|
|
2602
2635
|
context: _,
|
|
2603
2636
|
toolbar: a,
|
|
2604
2637
|
toolbarOptions: o,
|
|
@@ -2610,7 +2643,7 @@ function gr(e) {
|
|
|
2610
2643
|
markdownOptions: u,
|
|
2611
2644
|
printOptions: p,
|
|
2612
2645
|
uploadAsset: C,
|
|
2613
|
-
openWhiteboard: () =>
|
|
2646
|
+
openWhiteboard: () => L("new"),
|
|
2614
2647
|
editorBehaviorOptions: w,
|
|
2615
2648
|
preview: y,
|
|
2616
2649
|
onPreviewChange: b,
|
|
@@ -2621,29 +2654,29 @@ function gr(e) {
|
|
|
2621
2654
|
/* @__PURE__ */ W("div", {
|
|
2622
2655
|
className: "vibe-shadcn-tiptap__body",
|
|
2623
2656
|
children: [
|
|
2624
|
-
/* @__PURE__ */ U(
|
|
2657
|
+
/* @__PURE__ */ U(ir, {
|
|
2625
2658
|
context: _,
|
|
2626
2659
|
appearance: l?.findReplace,
|
|
2627
2660
|
editable: V,
|
|
2628
2661
|
overlayTarget: k ?? void 0
|
|
2629
2662
|
}),
|
|
2630
|
-
/* @__PURE__ */ U(
|
|
2663
|
+
/* @__PURE__ */ U(un, {
|
|
2631
2664
|
context: _,
|
|
2632
2665
|
tabIndex: !V && typeof _.editor.commands.openFindReplace == "function" ? 0 : void 0,
|
|
2633
2666
|
onClick: me,
|
|
2634
2667
|
onBlur: (e) => {
|
|
2635
|
-
!e.currentTarget.contains(e.relatedTarget) &&
|
|
2668
|
+
!e.currentTarget.contains(e.relatedTarget) && N && !_.editor.isDestroyed && T.closeSlashMenu();
|
|
2636
2669
|
}
|
|
2637
2670
|
}),
|
|
2638
|
-
V && k && /* @__PURE__ */ U(
|
|
2671
|
+
V && k && /* @__PURE__ */ U(hr, {
|
|
2639
2672
|
appearance: l?.tableGrips,
|
|
2640
2673
|
context: _,
|
|
2641
2674
|
overlayTarget: k
|
|
2642
2675
|
})
|
|
2643
2676
|
]
|
|
2644
2677
|
}),
|
|
2645
|
-
i && /* @__PURE__ */ U(
|
|
2646
|
-
V && k && /* @__PURE__ */ U(
|
|
2678
|
+
i && /* @__PURE__ */ U(dn, { context: _ }),
|
|
2679
|
+
V && k && /* @__PURE__ */ U(rr, {
|
|
2647
2680
|
context: _,
|
|
2648
2681
|
ui: l,
|
|
2649
2682
|
overlayTarget: k,
|
|
@@ -2651,51 +2684,52 @@ function gr(e) {
|
|
|
2651
2684
|
highlights: c,
|
|
2652
2685
|
uploadAsset: C,
|
|
2653
2686
|
behaviorOptions: w,
|
|
2654
|
-
onLink:
|
|
2655
|
-
onWhiteboardEdit: () =>
|
|
2656
|
-
onPaletteOpenChange:
|
|
2687
|
+
onLink: I,
|
|
2688
|
+
onWhiteboardEdit: () => L("edit"),
|
|
2689
|
+
onPaletteOpenChange: oe
|
|
2657
2690
|
}),
|
|
2658
|
-
V && k && C &&
|
|
2691
|
+
V && k && C && se && /* @__PURE__ */ U(Vn, {
|
|
2659
2692
|
appearance: l?.whiteboard,
|
|
2660
2693
|
context: _,
|
|
2661
2694
|
uploadAsset: C,
|
|
2662
2695
|
overlayTarget: k,
|
|
2663
|
-
edit:
|
|
2664
|
-
onClose: () =>
|
|
2696
|
+
edit: se === "edit",
|
|
2697
|
+
onClose: () => L(void 0)
|
|
2665
2698
|
}),
|
|
2666
|
-
V &&
|
|
2699
|
+
V && N && k && /* @__PURE__ */ U(dr, {
|
|
2667
2700
|
appearance: l?.slashMenu,
|
|
2668
|
-
state:
|
|
2701
|
+
state: N,
|
|
2669
2702
|
target: k,
|
|
2670
2703
|
t: _.t
|
|
2671
2704
|
}),
|
|
2672
|
-
V &&
|
|
2673
|
-
|
|
2705
|
+
V && re && k && /* @__PURE__ */ U(sr, {
|
|
2706
|
+
appearance: l?.mentionMenu,
|
|
2707
|
+
state: re,
|
|
2674
2708
|
target: k,
|
|
2675
2709
|
t: _.t,
|
|
2676
2710
|
renderItem: d
|
|
2677
2711
|
}),
|
|
2678
|
-
f && k && /* @__PURE__ */ U(
|
|
2712
|
+
f && k && /* @__PURE__ */ U(cr, {
|
|
2679
2713
|
editor: _.editor.view.dom,
|
|
2680
2714
|
container: k,
|
|
2681
|
-
hoverDelay: r[
|
|
2715
|
+
hoverDelay: r[gr].mentionHoverDelay,
|
|
2682
2716
|
render: f
|
|
2683
2717
|
}, _.editor.instanceId),
|
|
2684
|
-
V &&
|
|
2718
|
+
V && F && k && /* @__PURE__ */ U(On, {
|
|
2685
2719
|
appearance: l?.insertionPopover,
|
|
2686
2720
|
context: _,
|
|
2687
|
-
request:
|
|
2721
|
+
request: F,
|
|
2688
2722
|
overlayTarget: k,
|
|
2689
2723
|
canUpload: !!C,
|
|
2690
2724
|
behaviorOptions: w,
|
|
2691
|
-
onClose: () =>
|
|
2692
|
-
},
|
|
2693
|
-
k &&
|
|
2725
|
+
onClose: () => I(void 0)
|
|
2726
|
+
}, F.kind),
|
|
2727
|
+
k && ne && /* @__PURE__ */ U(or, {
|
|
2694
2728
|
appearance: l?.imagePreview,
|
|
2695
2729
|
context: _,
|
|
2696
2730
|
overlayTarget: k,
|
|
2697
|
-
imagePreview:
|
|
2698
|
-
onClose: () =>
|
|
2731
|
+
imagePreview: ne,
|
|
2732
|
+
onClose: () => M(void 0)
|
|
2699
2733
|
})
|
|
2700
2734
|
] }), /* @__PURE__ */ U("div", {
|
|
2701
2735
|
ref: A,
|
|
@@ -2703,7 +2737,7 @@ function gr(e) {
|
|
|
2703
2737
|
children: /* @__PURE__ */ U("div", {
|
|
2704
2738
|
className: "vibe-shadcn-tiptap__notices",
|
|
2705
2739
|
"aria-live": "polite",
|
|
2706
|
-
children:
|
|
2740
|
+
children: ce.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ U("div", {
|
|
2707
2741
|
role: n === "error" ? "alert" : "status",
|
|
2708
2742
|
"data-type": n,
|
|
2709
2743
|
children: t
|
|
@@ -2714,4 +2748,4 @@ function gr(e) {
|
|
|
2714
2748
|
})
|
|
2715
2749
|
});
|
|
2716
2750
|
}
|
|
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,
|
|
2751
|
+
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 };
|