@vibe-tiptap/shadcn-ui 1.0.0 → 1.1.0
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 +0 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +800 -682
- package/dist/mention-menu.d.ts +10 -0
- package/dist/mention-popover.d.ts +10 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/use-vibe-tiptap.d.ts +3 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,113 +4,114 @@ 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,
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { getMarkRange as
|
|
10
|
-
import { cloneElement as
|
|
11
|
-
import { NodeSelection as
|
|
12
|
-
import { AlignCenter as
|
|
13
|
-
import { twMerge as
|
|
14
|
-
import { FIRST_LINE_INDENT_ICON as
|
|
15
|
-
import { TransformComponent as
|
|
16
|
-
import { createPortal as
|
|
17
|
-
import {
|
|
7
|
+
import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitMention as te, exitSlashCommand as M, formatFileSize as N, getActiveHeadingLevel as P, getActiveLinkRange as F, getActiveTextAlign as ne, getMediaInsertionNodeType as re, getMentionTarget as ie, getNativeMarkdownManager as ae, getSelectedFileAttachment as I, isFindReplaceOpenTransaction as L, isToolbarCommandActive as oe, isToolbarCommandEnabled as R, normalizeHttpUrl as se, normalizeSlashCommandInput as z, notifyAssetUploadFailure as ce, resolveEditorBehaviorOptions as B, runSlashCommandItem as le, runToolbarCommand as ue, slashCommandPluginKey as de, startWhiteboardDrawing as V, trackUploadRange as fe, useReactEditor as pe, useReactEditorState as H, validateAssetFile as me } from "@vibe-tiptap/react-adapter";
|
|
8
|
+
import { Fragment as he, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
9
|
+
import { getMarkRange as ge } from "@tiptap/core";
|
|
10
|
+
import { cloneElement as _e, createContext as ve, createElement as ye, forwardRef as be, memo as xe, useCallback as Se, useContext as Ce, useEffect as G, useId as we, useLayoutEffect as K, useMemo as Te, useRef as q, useState as J } from "react";
|
|
11
|
+
import { NodeSelection as Ee, TextSelection as De } from "@tiptap/pm/state";
|
|
12
|
+
import { AlignCenter as Oe, AlignJustify as ke, AlignLeft as Ae, AlignRight as je, ArrowDown as Me, ArrowLeft as Ne, ArrowRight as Pe, ArrowUp as Fe, Bold as Ie, Captions as Le, CaseSensitive as Re, ChevronDown as ze, ChevronLeft as Be, ChevronRight as Ve, ChevronUp as He, Code as Ue, CodeXml as We, Copy as Ge, Download as Ke, Ellipsis as qe, EllipsisVertical as Je, Eraser as Ye, ExternalLink as Xe, Eye as Ze, Film as Qe, Heading1 as $e, Heading2 as et, Heading3 as tt, Heading4 as nt, Heading5 as rt, Heading6 as it, Highlighter as at, Image as ot, ImagePlay as st, ImagePlus as ct, ImageUp as lt, IndentDecrease as ut, IndentIncrease as dt, Italic as ft, Link as pt, List as mt, ListChecks as ht, ListOrdered as gt, LoaderCircle as _t, Maximize2 as vt, Minimize2 as yt, Minus as bt, Music as xt, Palette as St, Paperclip as Ct, Pencil as wt, PencilRuler as Tt, Pilcrow as Et, Plus as Dt, Printer as Ot, Quote as kt, Redo2 as At, Replace as jt, ReplaceAll as Mt, RotateCcw as Nt, RotateCw as Pt, Search as Ft, Strikethrough as It, Subscript as Lt, Superscript as Rt, Table as zt, TableProperties as Bt, Trash2 as Vt, TvMinimalPlay as Ht, Underline as Ut, Undo2 as Wt, Unlink as Gt, Video as Kt, Workflow as qt, X as Jt, ZoomIn as Yt, ZoomOut as Xt } from "lucide-react";
|
|
13
|
+
import { twMerge as Y } from "tailwind-merge";
|
|
14
|
+
import { FIRST_LINE_INDENT_ICON as Zt, MARKDOWN_ACTION_ICON_PATHS as Qt, MARKDOWN_ACTION_ICON_TRANSFORM as $t, MARKDOWN_ICON as en, TOOLBAR_ICON_VIEW_BOX as tn } from "@vibe-tiptap/editor-ui/custom-icons";
|
|
15
|
+
import { TransformComponent as nn, TransformWrapper as rn } from "react-zoom-pan-pinch";
|
|
16
|
+
import { createPortal as an } from "react-dom";
|
|
17
|
+
import { bindMentionHover as on } from "@vibe-tiptap/editor-ui/mention-hover";
|
|
18
|
+
import { TableMap as sn, cellAround as cn } from "@tiptap/pm/tables";
|
|
18
19
|
// src/editor-content.tsx
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
function ln({ context: e, className: t, ...n }) {
|
|
21
|
+
return /* @__PURE__ */ U(O, {
|
|
21
22
|
...n,
|
|
22
23
|
editor: e.editor,
|
|
23
24
|
className: ["vibe-shadcn-tiptap__content", t].filter(Boolean).join(" ")
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
let t =
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
function un({ context: e }) {
|
|
28
|
+
let t = H(e, (e) => e.wordCount.characters) ?? 0;
|
|
29
|
+
return /* @__PURE__ */ U("div", {
|
|
29
30
|
className: "vibe-shadcn-tiptap__status",
|
|
30
31
|
"aria-live": "polite",
|
|
31
32
|
children: e.t("wordCount.characters", { count: t })
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
// src/components.ts
|
|
35
|
-
var
|
|
36
|
-
function
|
|
37
|
-
let e =
|
|
36
|
+
var dn = ve(void 0), fn = dn.Provider;
|
|
37
|
+
function X() {
|
|
38
|
+
let e = Ce(dn);
|
|
38
39
|
if (!e) throw Error("ShadcnTiptap requires a components mapping.");
|
|
39
40
|
return e;
|
|
40
41
|
}
|
|
41
42
|
// src/ui-styles.ts
|
|
42
|
-
var
|
|
43
|
+
var Z = "flex flex-wrap items-center gap-1", pn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", mn = {
|
|
43
44
|
default: void 0,
|
|
44
45
|
outline: "border border-input bg-background dark:bg-background",
|
|
45
46
|
ghost: "border-transparent bg-transparent shadow-none dark:bg-transparent"
|
|
46
|
-
},
|
|
47
|
-
function
|
|
48
|
-
let t =
|
|
47
|
+
}, hn = ve(void 0), gn = hn.Provider;
|
|
48
|
+
function _n(e) {
|
|
49
|
+
let t = Ce(hn);
|
|
49
50
|
return {
|
|
50
51
|
size: e?.size ?? t?.size,
|
|
51
52
|
variant: e?.variant ?? t?.variant,
|
|
52
|
-
className:
|
|
53
|
+
className: Y(t?.className, e?.className)
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
|
-
var Q =
|
|
56
|
-
let { Button: s } =
|
|
57
|
-
return /* @__PURE__ */
|
|
56
|
+
var Q = be(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
|
|
57
|
+
let { Button: s } = X(), c = _n(e);
|
|
58
|
+
return /* @__PURE__ */ U(s, {
|
|
58
59
|
...a,
|
|
59
60
|
ref: o,
|
|
60
61
|
size: c.size ?? r,
|
|
61
62
|
variant: c.variant ?? i,
|
|
62
|
-
className:
|
|
63
|
+
className: Y(t, c.size === void 0 && n, c.className)
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
|
-
function
|
|
66
|
-
let { className: n, size: r, variant: i } =
|
|
67
|
-
return r === void 0 && i === void 0 ?
|
|
66
|
+
function vn({ appearance: e, children: t }) {
|
|
67
|
+
let { className: n, size: r, variant: i } = _n(e);
|
|
68
|
+
return r === void 0 && i === void 0 ? _e(t, { className: Y(t.props.className, n) }) : /* @__PURE__ */ U(Q, {
|
|
68
69
|
asChild: !0,
|
|
69
70
|
appearance: e,
|
|
70
71
|
children: t
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
var $ =
|
|
74
|
-
let { Tooltip: s } =
|
|
75
|
-
return /* @__PURE__ */
|
|
74
|
+
var $ = be(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
|
|
75
|
+
let { Tooltip: s } = X();
|
|
76
|
+
return /* @__PURE__ */ W(s.Root, {
|
|
76
77
|
disableHoverableContent: !0,
|
|
77
|
-
children: [/* @__PURE__ */
|
|
78
|
+
children: [/* @__PURE__ */ U(s.Trigger, {
|
|
78
79
|
asChild: !0,
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
+
children: /* @__PURE__ */ U(Q, {
|
|
80
81
|
type: "button",
|
|
81
82
|
size: r,
|
|
82
83
|
variant: i,
|
|
83
84
|
...a,
|
|
84
85
|
ref: o,
|
|
85
86
|
"aria-label": e,
|
|
86
|
-
className:
|
|
87
|
+
className: Y("vibe-shadcn-tiptap__button", n)
|
|
87
88
|
})
|
|
88
|
-
}), t && /* @__PURE__ */
|
|
89
|
+
}), t && /* @__PURE__ */ U(s.Content, {
|
|
89
90
|
container: t,
|
|
90
91
|
className: "vibe-shadcn-tiptap__tooltip",
|
|
91
92
|
sideOffset: 5,
|
|
92
93
|
children: e
|
|
93
94
|
})]
|
|
94
95
|
});
|
|
95
|
-
}),
|
|
96
|
+
}), yn = [
|
|
96
97
|
["small", .25],
|
|
97
98
|
["medium", .5],
|
|
98
99
|
["large", .75],
|
|
99
100
|
["original", null]
|
|
100
|
-
],
|
|
101
|
-
left:
|
|
102
|
-
center:
|
|
103
|
-
right:
|
|
104
|
-
},
|
|
101
|
+
], bn = {
|
|
102
|
+
left: Ae,
|
|
103
|
+
center: Oe,
|
|
104
|
+
right: je
|
|
105
|
+
}, xn = [
|
|
105
106
|
"left",
|
|
106
107
|
"center",
|
|
107
108
|
"right"
|
|
108
|
-
],
|
|
109
|
-
image:
|
|
110
|
-
audio:
|
|
111
|
-
video:
|
|
109
|
+
], Sn = {
|
|
110
|
+
image: ot,
|
|
111
|
+
audio: xt,
|
|
112
|
+
video: Qe
|
|
112
113
|
};
|
|
113
|
-
function
|
|
114
|
+
function Cn(e, t) {
|
|
114
115
|
if (typeof e == "string" && e) try {
|
|
115
116
|
let n = new URL(e, t);
|
|
116
117
|
if ([
|
|
@@ -123,10 +124,10 @@ function bn(e, t) {
|
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m =
|
|
127
|
+
function wn({ 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 = Cn(d.attrs.src, p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
|
|
128
129
|
function w(e, t, r, i) {
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ U($, {
|
|
130
131
|
...i,
|
|
131
132
|
label: u(e),
|
|
132
133
|
overlayTarget: n,
|
|
@@ -138,19 +139,19 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
138
139
|
c.isEditable && c.chain().focus().deleteSelection().run();
|
|
139
140
|
}
|
|
140
141
|
if (f === "fileAttachment") {
|
|
141
|
-
let t =
|
|
142
|
+
let t = I(c);
|
|
142
143
|
if (!t) return null;
|
|
143
|
-
let n =
|
|
144
|
+
let n = Cn(t.href, p), r = j(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = U(i ? Xe : Ke, {
|
|
144
145
|
size: 16,
|
|
145
146
|
"aria-hidden": !0
|
|
146
|
-
}), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o &&
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
className:
|
|
147
|
+
}), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && Sn[o];
|
|
148
|
+
return /* @__PURE__ */ W("div", {
|
|
149
|
+
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
149
150
|
children: [
|
|
150
|
-
n && (i || e.fileAttachmentDownload) && /* @__PURE__ */
|
|
151
|
+
n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ U(Q, {
|
|
151
152
|
asChild: !0,
|
|
152
153
|
className: "vibe-shadcn-tiptap__button",
|
|
153
|
-
children: /* @__PURE__ */
|
|
154
|
+
children: /* @__PURE__ */ U("a", {
|
|
154
155
|
href: n,
|
|
155
156
|
"aria-label": u(i ? "file.action.open" : "file.action.download"),
|
|
156
157
|
download: i ? void 0 : t.attrs.name ? t.name : "",
|
|
@@ -159,7 +160,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
159
160
|
children: a
|
|
160
161
|
})
|
|
161
162
|
}),
|
|
162
|
-
n && w("file.action.copy", /* @__PURE__ */
|
|
163
|
+
n && w("file.action.copy", /* @__PURE__ */ U(Ge, {
|
|
163
164
|
size: 16,
|
|
164
165
|
"aria-hidden": !0
|
|
165
166
|
}), () => s(n, !0)),
|
|
@@ -167,7 +168,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
167
168
|
image: "file.action.showAsImage",
|
|
168
169
|
audio: "file.action.showAsAudio",
|
|
169
170
|
video: "file.action.showAsVideo"
|
|
170
|
-
}[o], /* @__PURE__ */
|
|
171
|
+
}[o], /* @__PURE__ */ U(d, {
|
|
171
172
|
size: 16,
|
|
172
173
|
"aria-hidden": !0
|
|
173
174
|
}), {
|
|
@@ -175,7 +176,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
175
176
|
audio: () => l.setAudioDisplay("player"),
|
|
176
177
|
video: () => l.setVideoDisplay("player")
|
|
177
178
|
}[o]),
|
|
178
|
-
w("file.action.delete", /* @__PURE__ */
|
|
179
|
+
w("file.action.delete", /* @__PURE__ */ U(Vt, {
|
|
179
180
|
size: 16,
|
|
180
181
|
"aria-hidden": !0
|
|
181
182
|
}), T)
|
|
@@ -197,11 +198,11 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
197
198
|
function ee(e) {
|
|
198
199
|
_ ? l.setImageAlign(e) : v ? c.chain().focus().updateAttributes("whiteboard", { align: e }).run() : y ? l.setAudioAlign(e) : l.setVideoAlign(e);
|
|
199
200
|
}
|
|
200
|
-
let D = y || b ? d.attrs.size :
|
|
201
|
-
return /* @__PURE__ */
|
|
202
|
-
className:
|
|
201
|
+
let D = y || b ? d.attrs.size : yn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
|
|
202
|
+
return /* @__PURE__ */ W("div", {
|
|
203
|
+
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
203
204
|
children: [
|
|
204
|
-
|
|
205
|
+
yn.map(([e, t]) => /* @__PURE__ */ U(Q, {
|
|
205
206
|
type: "button",
|
|
206
207
|
className: "vibe-shadcn-tiptap__button",
|
|
207
208
|
title: u(`image.size.${e}Tooltip`),
|
|
@@ -209,42 +210,42 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
209
210
|
onClick: () => E(e, t),
|
|
210
211
|
children: u(`image.size.${e}`)
|
|
211
212
|
}, e)),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ U("span", {
|
|
213
214
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
214
215
|
"aria-hidden": "true"
|
|
215
216
|
}),
|
|
216
|
-
|
|
217
|
-
let t =
|
|
218
|
-
return /* @__PURE__ */
|
|
217
|
+
xn.map((e) => {
|
|
218
|
+
let t = bn[e];
|
|
219
|
+
return /* @__PURE__ */ U($, {
|
|
219
220
|
label: u(`image.align.${e}`),
|
|
220
221
|
"aria-pressed": (d.attrs.align ?? "center") === e,
|
|
221
222
|
overlayTarget: n,
|
|
222
223
|
onClick: () => ee(e),
|
|
223
|
-
children: /* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ U(t, {
|
|
224
225
|
size: 16,
|
|
225
226
|
"aria-hidden": !0
|
|
226
227
|
})
|
|
227
228
|
}, e);
|
|
228
229
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ U("span", {
|
|
230
231
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
231
232
|
"aria-hidden": "true"
|
|
232
233
|
}),
|
|
233
|
-
C && w("image.caption", /* @__PURE__ */
|
|
234
|
+
C && w("image.caption", /* @__PURE__ */ U(Le, {
|
|
234
235
|
size: 16,
|
|
235
236
|
"aria-hidden": !0
|
|
236
237
|
}), () => {
|
|
237
238
|
C.readOnly || (C.hidden = !1, C.focus(), o());
|
|
238
239
|
}),
|
|
239
|
-
v && r && w("whiteboard.edit", /* @__PURE__ */
|
|
240
|
+
v && r && w("whiteboard.edit", /* @__PURE__ */ U(Tt, {
|
|
240
241
|
size: 16,
|
|
241
242
|
"aria-hidden": !0
|
|
242
243
|
}), i),
|
|
243
|
-
_ && r && /* @__PURE__ */
|
|
244
|
+
_ && r && /* @__PURE__ */ W(he, { children: [/* @__PURE__ */ U("input", {
|
|
244
245
|
ref: m,
|
|
245
246
|
type: "file",
|
|
246
247
|
hidden: !0,
|
|
247
|
-
accept:
|
|
248
|
+
accept: B(a).image.accept,
|
|
248
249
|
onChange: async (t) => {
|
|
249
250
|
let n = t.currentTarget.files?.[0];
|
|
250
251
|
if (t.currentTarget.value = "", n && !h) {
|
|
@@ -252,31 +253,31 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
252
253
|
try {
|
|
253
254
|
await l.uploadAndReplaceImage(n);
|
|
254
255
|
} catch {
|
|
255
|
-
c.isDestroyed ||
|
|
256
|
+
c.isDestroyed || ce(e.notify, u, "image");
|
|
256
257
|
} finally {
|
|
257
258
|
g(!1);
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
|
-
}), w("image.replace", /* @__PURE__ */
|
|
262
|
+
}), w("image.replace", /* @__PURE__ */ U(lt, {
|
|
262
263
|
size: 16,
|
|
263
264
|
"aria-hidden": !0
|
|
264
265
|
}), () => m.current?.click(), { disabled: h })] }),
|
|
265
|
-
x && !v && w("toolbar.link.copy", /* @__PURE__ */
|
|
266
|
+
x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(Ge, {
|
|
266
267
|
size: 16,
|
|
267
268
|
"aria-hidden": !0
|
|
268
269
|
}), () => s(x)),
|
|
269
|
-
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */
|
|
270
|
+
x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(Ct, {
|
|
270
271
|
size: 16,
|
|
271
272
|
"aria-hidden": !0
|
|
272
273
|
}), () => {
|
|
273
274
|
_ ? l.setImageDisplay("file") : y ? l.setAudioDisplay("file") : l.setVideoDisplay("file");
|
|
274
275
|
}),
|
|
275
|
-
(y || b) && x && /* @__PURE__ */
|
|
276
|
+
(y || b) && x && /* @__PURE__ */ U("span", {
|
|
276
277
|
className: "vibe-shadcn-tiptap__bubble-divider",
|
|
277
278
|
"aria-hidden": "true"
|
|
278
279
|
}),
|
|
279
|
-
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */
|
|
280
|
+
w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(Vt, {
|
|
280
281
|
size: 16,
|
|
281
282
|
"aria-hidden": !0
|
|
282
283
|
}), _ ? l.removeImage : y ? l.removeAudio : b ? l.removeVideo : T)
|
|
@@ -284,50 +285,50 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
|
|
|
284
285
|
});
|
|
285
286
|
}
|
|
286
287
|
// src/color-picker.tsx
|
|
287
|
-
var
|
|
288
|
-
function
|
|
289
|
-
let { Popover: u } =
|
|
288
|
+
var Tn = /^(#[\da-f]{6})ff$/;
|
|
289
|
+
function En({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
|
|
290
|
+
let { Popover: u } = X(), d = _n(), f = {
|
|
290
291
|
size: e?.button?.size ?? d?.size,
|
|
291
292
|
variant: e?.button?.variant ?? d?.variant,
|
|
292
|
-
className:
|
|
293
|
-
}, { 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(
|
|
293
|
+
className: Y(d?.className, e?.button?.className)
|
|
294
|
+
}, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(Tn, "$1"), w = Te(() => {
|
|
294
295
|
let e = /* @__PURE__ */ new Set();
|
|
295
296
|
return n.flatMap((t) => {
|
|
296
|
-
let n = i(t, g)?.replace(
|
|
297
|
+
let n = i(t, g)?.replace(Tn, "$1"), r = n ?? t.trim();
|
|
297
298
|
return e.has(r) ? [] : (e.add(r), [{
|
|
298
299
|
value: t,
|
|
299
300
|
canonical: n
|
|
300
301
|
}]);
|
|
301
302
|
});
|
|
302
|
-
}, [n, g]), T = r === "color" ?
|
|
303
|
+
}, [n, g]), T = r === "color" ? St : at;
|
|
303
304
|
function E(e) {
|
|
304
|
-
!o &&
|
|
305
|
+
!o && R(t, r, e) && ue(t, r, e);
|
|
305
306
|
}
|
|
306
|
-
return /* @__PURE__ */
|
|
307
|
+
return /* @__PURE__ */ U(gn, {
|
|
307
308
|
value: f,
|
|
308
|
-
children: /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ W(u.Root, {
|
|
309
310
|
open: c,
|
|
310
311
|
onOpenChange: l,
|
|
311
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ U(u.Trigger, {
|
|
312
313
|
asChild: !0,
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
+
children: /* @__PURE__ */ U($, {
|
|
314
315
|
size: "icon",
|
|
315
316
|
label: m(`command.${r}`),
|
|
316
317
|
overlayTarget: a,
|
|
317
318
|
"data-toolbar-key": s ? void 0 : r,
|
|
318
319
|
disabled: o,
|
|
319
320
|
onMouseDown: (e) => e.preventDefault(),
|
|
320
|
-
children: /* @__PURE__ */
|
|
321
|
+
children: /* @__PURE__ */ W("span", {
|
|
321
322
|
className: "vibe-shadcn-tiptap__color-icon",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
323
|
+
children: [/* @__PURE__ */ U(T, {
|
|
323
324
|
size: 16,
|
|
324
325
|
"aria-hidden": !0
|
|
325
|
-
}), x && /* @__PURE__ */
|
|
326
|
+
}), x && /* @__PURE__ */ U("span", { style: { backgroundColor: x } })]
|
|
326
327
|
})
|
|
327
328
|
})
|
|
328
|
-
}), a && /* @__PURE__ */
|
|
329
|
+
}), a && /* @__PURE__ */ W(u.Content, {
|
|
329
330
|
container: a,
|
|
330
|
-
className:
|
|
331
|
+
className: Y("z-3", e?.className),
|
|
331
332
|
align: "start",
|
|
332
333
|
sideOffset: 4,
|
|
333
334
|
"aria-label": m(`command.${r}`),
|
|
@@ -339,13 +340,13 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
339
340
|
e.target === p.view.dom && e.preventDefault();
|
|
340
341
|
},
|
|
341
342
|
onMouseDown: (e) => e.preventDefault(),
|
|
342
|
-
children: [/* @__PURE__ */
|
|
343
|
-
className:
|
|
344
|
-
children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */
|
|
343
|
+
children: [/* @__PURE__ */ U("div", {
|
|
344
|
+
className: Y("vibe-shadcn-tiptap__color-grid grid grid-cols-[repeat(8,max-content)] justify-between gap-1.5 px-2 py-2", e?.gridClassName),
|
|
345
|
+
children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */ U(Q, {
|
|
345
346
|
type: "button",
|
|
346
347
|
appearance: {
|
|
347
348
|
...e?.swatch,
|
|
348
|
-
className:
|
|
349
|
+
className: Y(e?.swatchClassName, e?.swatch?.className)
|
|
349
350
|
},
|
|
350
351
|
defaultSizeClassName: "size-5 p-0",
|
|
351
352
|
className: "vibe-shadcn-tiptap__swatch rounded-sm border border-border aria-pressed:outline-2 aria-pressed:outline-solid aria-pressed:outline-ring",
|
|
@@ -355,9 +356,9 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
355
356
|
"aria-pressed": x === t || C !== void 0 && C === n,
|
|
356
357
|
onClick: () => E(t)
|
|
357
358
|
}, t))
|
|
358
|
-
}), /* @__PURE__ */
|
|
359
|
-
className:
|
|
360
|
-
children: [S ? /* @__PURE__ */
|
|
359
|
+
}), /* @__PURE__ */ W("div", {
|
|
360
|
+
className: Y("vibe-shadcn-tiptap__color-footer flex items-center justify-between gap-2 px-2 text-muted-foreground", e?.footerClassName),
|
|
361
|
+
children: [S ? /* @__PURE__ */ W($, {
|
|
361
362
|
size: "sm",
|
|
362
363
|
label: m("toolbar.color.copyHex", { hex: S }),
|
|
363
364
|
overlayTarget: a,
|
|
@@ -370,15 +371,15 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
370
371
|
h(m("notify.clipboardUnavailable"), "warning");
|
|
371
372
|
}
|
|
372
373
|
},
|
|
373
|
-
children: [/* @__PURE__ */
|
|
374
|
+
children: [/* @__PURE__ */ U(Ge, {
|
|
374
375
|
size: 14,
|
|
375
376
|
"aria-hidden": !0
|
|
376
377
|
}), S]
|
|
377
|
-
}) : /* @__PURE__ */
|
|
378
|
+
}) : /* @__PURE__ */ U("span", { children: m(r === "color" ? "toolbar.color.default" : "toolbar.highlight.none") }), /* @__PURE__ */ U(Q, {
|
|
378
379
|
type: "button",
|
|
379
380
|
size: "sm",
|
|
380
381
|
className: "vibe-shadcn-tiptap__button",
|
|
381
|
-
disabled: o || !
|
|
382
|
+
disabled: o || !R(t, r, ""),
|
|
382
383
|
onClick: () => E(""),
|
|
383
384
|
children: m(r === "color" ? "toolbar.color.clear" : "toolbar.highlight.clear")
|
|
384
385
|
})]
|
|
@@ -388,20 +389,20 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
|
|
|
388
389
|
});
|
|
389
390
|
}
|
|
390
391
|
// src/insertion-popover.tsx
|
|
391
|
-
function
|
|
392
|
-
return /* @__PURE__ */
|
|
392
|
+
function Dn(e) {
|
|
393
|
+
return /* @__PURE__ */ U(gn, {
|
|
393
394
|
value: e.appearance?.button,
|
|
394
|
-
children: e.request.kind === "link" ? /* @__PURE__ */
|
|
395
|
+
children: e.request.kind === "link" ? /* @__PURE__ */ U(kn, {
|
|
395
396
|
...e,
|
|
396
397
|
request: e.request
|
|
397
|
-
}) : /* @__PURE__ */
|
|
398
|
+
}) : /* @__PURE__ */ U(Mn, {
|
|
398
399
|
...e,
|
|
399
400
|
request: e.request
|
|
400
401
|
})
|
|
401
402
|
});
|
|
402
403
|
}
|
|
403
|
-
function
|
|
404
|
-
let { Popover: s } =
|
|
404
|
+
function On({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
|
|
405
|
+
let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u = Te(() => ({ current: {
|
|
405
406
|
contextElement: n ?? c.view.dom,
|
|
406
407
|
getBoundingClientRect() {
|
|
407
408
|
if (n) return n.getBoundingClientRect();
|
|
@@ -412,14 +413,14 @@ function Tn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
|
|
|
412
413
|
function d() {
|
|
413
414
|
a(), (n ?? c.view.dom).focus({ preventScroll: !0 });
|
|
414
415
|
}
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ W(s.Root, {
|
|
416
417
|
open: !0,
|
|
417
418
|
onOpenChange: (e) => {
|
|
418
419
|
e || a();
|
|
419
420
|
},
|
|
420
|
-
children: [/* @__PURE__ */
|
|
421
|
+
children: [/* @__PURE__ */ U(s.Anchor, { virtualRef: u }), /* @__PURE__ */ U(s.Content, {
|
|
421
422
|
container: r,
|
|
422
|
-
className:
|
|
423
|
+
className: Y("z-3 vibe-shadcn-tiptap__insertion w-[min(22rem,calc(100vw-2rem))] p-3", e),
|
|
423
424
|
"aria-label": i,
|
|
424
425
|
side: n ? "top" : "bottom",
|
|
425
426
|
align: "start",
|
|
@@ -447,15 +448,15 @@ function Tn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
|
|
|
447
448
|
})]
|
|
448
449
|
});
|
|
449
450
|
}
|
|
450
|
-
function
|
|
451
|
-
let { Input: a, Checkbox: o } =
|
|
451
|
+
function kn({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
|
|
452
|
+
let { Input: a, Checkbox: o } = X(), s = Y(mn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = we(), p = we(), m = we(), [h] = J(() => r.link ?? F(c)), [g] = J(() => h ? {
|
|
452
453
|
from: h.from,
|
|
453
454
|
to: h.to
|
|
454
455
|
} : {
|
|
455
456
|
from: c.state.selection.from,
|
|
456
457
|
to: c.state.selection.to
|
|
457
|
-
}), [_, v] =
|
|
458
|
-
|
|
458
|
+
}), [_, v] = J(() => h?.text ?? c.state.doc.textBetween(g.from, g.to)), [y] = J(() => !!(h || _)), [b, x] = J(h?.href ?? ""), [S, C] = J((h ? h.target : t.defaultLinkTarget) !== "_self");
|
|
459
|
+
K(() => {
|
|
459
460
|
let e = ({ transaction: e, appendedTransactions: t }) => {
|
|
460
461
|
(e.docChanged || t.some(({ docChanged: e }) => e)) && i();
|
|
461
462
|
};
|
|
@@ -465,29 +466,29 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
465
466
|
}, [c, i]);
|
|
466
467
|
function w() {
|
|
467
468
|
if (!c.isEditable) return;
|
|
468
|
-
let e =
|
|
469
|
+
let e = se(b);
|
|
469
470
|
e ? (l.insertLinkText(e, _, {
|
|
470
471
|
target: S ? "_blank" : "_self",
|
|
471
472
|
range: g
|
|
472
473
|
}), i()) : d(u(b.trim() ? "notify.linkInvalid" : "notify.linkEmpty"), "warning");
|
|
473
474
|
}
|
|
474
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ U(On, {
|
|
475
476
|
className: e?.className,
|
|
476
477
|
context: t,
|
|
477
478
|
anchor: r.anchor,
|
|
478
479
|
overlayTarget: n,
|
|
479
480
|
title: u(y ? "command.link" : "toolbar.link.popoverLabel"),
|
|
480
481
|
onClose: i,
|
|
481
|
-
children: /* @__PURE__ */
|
|
482
|
+
children: /* @__PURE__ */ W("form", {
|
|
482
483
|
className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
|
|
483
484
|
onSubmit: (e) => {
|
|
484
485
|
e.preventDefault(), w();
|
|
485
486
|
},
|
|
486
487
|
children: [
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ W("label", {
|
|
488
489
|
htmlFor: p,
|
|
489
490
|
className: "grid gap-1.5",
|
|
490
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.textLabel") }), /* @__PURE__ */ U(a, {
|
|
491
492
|
className: s,
|
|
492
493
|
id: p,
|
|
493
494
|
value: _,
|
|
@@ -495,10 +496,10 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
495
496
|
onChange: (e) => v(e.currentTarget.value)
|
|
496
497
|
})]
|
|
497
498
|
}),
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ W("label", {
|
|
499
500
|
htmlFor: m,
|
|
500
501
|
className: "grid gap-1.5",
|
|
501
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.hrefLabel") }), /* @__PURE__ */ U(a, {
|
|
502
503
|
className: s,
|
|
503
504
|
id: m,
|
|
504
505
|
"data-initial-focus": !0,
|
|
@@ -507,31 +508,31 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
507
508
|
onChange: (e) => x(e.currentTarget.value)
|
|
508
509
|
})]
|
|
509
510
|
}),
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
+
/* @__PURE__ */ W("div", {
|
|
511
512
|
className: "vibe-shadcn-tiptap__checkbox-field flex items-center gap-1.5",
|
|
512
|
-
children: [/* @__PURE__ */
|
|
513
|
+
children: [/* @__PURE__ */ U(vn, {
|
|
513
514
|
appearance: e?.checkbox,
|
|
514
|
-
children: /* @__PURE__ */
|
|
515
|
+
children: /* @__PURE__ */ U(o, {
|
|
515
516
|
id: f,
|
|
516
517
|
checked: S,
|
|
517
518
|
onCheckedChange: (e) => C(e === !0)
|
|
518
519
|
})
|
|
519
|
-
}), /* @__PURE__ */
|
|
520
|
+
}), /* @__PURE__ */ U("label", {
|
|
520
521
|
htmlFor: f,
|
|
521
522
|
children: u("toolbar.link.openInNewWindow")
|
|
522
523
|
})]
|
|
523
524
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
className:
|
|
525
|
+
/* @__PURE__ */ W("div", {
|
|
526
|
+
className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions justify-end", Z),
|
|
526
527
|
children: [
|
|
527
|
-
h && /* @__PURE__ */
|
|
528
|
+
h && /* @__PURE__ */ U(Q, {
|
|
528
529
|
type: "button",
|
|
529
530
|
onClick: () => {
|
|
530
531
|
c.isEditable && (l.setLink("", { range: g }), d(u("notify.linkRemoved"), "success"), i());
|
|
531
532
|
},
|
|
532
533
|
children: u("toolbar.link.remove")
|
|
533
534
|
}),
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ U(Q, {
|
|
535
536
|
type: "button",
|
|
536
537
|
className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
|
|
537
538
|
onClick: () => {
|
|
@@ -539,7 +540,7 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
539
540
|
},
|
|
540
541
|
children: u("toolbar.action.cancel")
|
|
541
542
|
}),
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ U(Q, {
|
|
543
544
|
type: "submit",
|
|
544
545
|
children: u("toolbar.action.confirm")
|
|
545
546
|
})
|
|
@@ -549,27 +550,27 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
|
|
|
549
550
|
})
|
|
550
551
|
});
|
|
551
552
|
}
|
|
552
|
-
var
|
|
553
|
+
var An = {
|
|
553
554
|
image: "notify.invalidImageUrl",
|
|
554
555
|
video: "notify.invalidVideoUrl",
|
|
555
556
|
audio: "notify.invalidAudioUrl",
|
|
556
557
|
attachment: "notify.invalidFileUrl"
|
|
557
|
-
},
|
|
558
|
-
image:
|
|
559
|
-
video:
|
|
560
|
-
audio:
|
|
561
|
-
attachment:
|
|
558
|
+
}, jn = {
|
|
559
|
+
image: ot,
|
|
560
|
+
video: Qe,
|
|
561
|
+
audio: xt,
|
|
562
|
+
attachment: Ct
|
|
562
563
|
};
|
|
563
|
-
function
|
|
564
|
-
let { Input: s, Tabs: c } =
|
|
565
|
-
|
|
564
|
+
function Mn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
|
|
565
|
+
let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = jn[p], g = we(), _ = p === "attachment" ? "file" : p, v = B(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[re(_)], 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
|
+
K(() => {
|
|
566
567
|
k.current = o;
|
|
567
|
-
}, [o]),
|
|
568
|
+
}, [o]), K(() => {
|
|
568
569
|
if (!C) {
|
|
569
570
|
k.current();
|
|
570
571
|
return;
|
|
571
572
|
}
|
|
572
|
-
let e =
|
|
573
|
+
let e = fe(l, () => k.current());
|
|
573
574
|
return O.current = e, () => {
|
|
574
575
|
e.dispose(), O.current = void 0;
|
|
575
576
|
};
|
|
@@ -584,66 +585,66 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
584
585
|
attachment: u.uploadAndInsertFile
|
|
585
586
|
}[p];
|
|
586
587
|
o(), n(y.multiple ? e : e.slice(0, 1), t).catch(() => {
|
|
587
|
-
l.isDestroyed ||
|
|
588
|
+
l.isDestroyed || ce(f, d, _);
|
|
588
589
|
});
|
|
589
590
|
}
|
|
590
591
|
function j() {
|
|
591
592
|
let e = O.current?.range;
|
|
592
593
|
if (!e || !l.isEditable || !S) return;
|
|
593
|
-
let t =
|
|
594
|
-
if (!t) f(d(
|
|
594
|
+
let t = se(ee);
|
|
595
|
+
if (!t) f(d(An[p]), "warning");
|
|
595
596
|
else {
|
|
596
597
|
if (p === "video" || p === "audio") {
|
|
597
598
|
if (!(p === "video" ? u.insertVideoUrl : u.insertAudioUrl)(t, e)) {
|
|
598
|
-
f(d(
|
|
599
|
+
f(d(An[p]), "warning");
|
|
599
600
|
return;
|
|
600
601
|
}
|
|
601
602
|
} else l.commands.setTextSelection(e), p === "image" ? u.setImage(t) : u.insertFile(t);
|
|
602
603
|
o();
|
|
603
604
|
}
|
|
604
605
|
}
|
|
605
|
-
return C ? /* @__PURE__ */
|
|
606
|
+
return C ? /* @__PURE__ */ W(On, {
|
|
606
607
|
className: e?.className,
|
|
607
608
|
context: t,
|
|
608
609
|
anchor: m,
|
|
609
610
|
overlayTarget: r,
|
|
610
611
|
title: d(`toolbar.${p}.${E}`),
|
|
611
612
|
onClose: o,
|
|
612
|
-
children: [/* @__PURE__ */
|
|
613
|
+
children: [/* @__PURE__ */ W(c.Root, {
|
|
613
614
|
className: e?.tabs?.className,
|
|
614
615
|
value: E,
|
|
615
616
|
onValueChange: (e) => {
|
|
616
617
|
(e === "upload" || e === "url") && T(e);
|
|
617
618
|
},
|
|
618
619
|
children: [
|
|
619
|
-
x && S && /* @__PURE__ */
|
|
620
|
-
className:
|
|
620
|
+
x && S && /* @__PURE__ */ W(c.List, {
|
|
621
|
+
className: Y("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
|
|
621
622
|
"aria-label": d(`command.${p}`),
|
|
622
|
-
children: [/* @__PURE__ */
|
|
623
|
+
children: [/* @__PURE__ */ U(vn, {
|
|
623
624
|
appearance: e?.tabs?.trigger,
|
|
624
|
-
children: /* @__PURE__ */
|
|
625
|
+
children: /* @__PURE__ */ U(c.Trigger, {
|
|
625
626
|
value: "upload",
|
|
626
627
|
children: d(`toolbar.${p}.upload`)
|
|
627
628
|
})
|
|
628
|
-
}), /* @__PURE__ */
|
|
629
|
+
}), /* @__PURE__ */ U(vn, {
|
|
629
630
|
appearance: e?.tabs?.trigger,
|
|
630
|
-
children: /* @__PURE__ */
|
|
631
|
+
children: /* @__PURE__ */ U(c.Trigger, {
|
|
631
632
|
value: "url",
|
|
632
633
|
children: d(`toolbar.${p}.url`)
|
|
633
634
|
})
|
|
634
635
|
})]
|
|
635
636
|
}),
|
|
636
|
-
x && E === "upload" && /* @__PURE__ */
|
|
637
|
+
x && E === "upload" && /* @__PURE__ */ U(c.Content, {
|
|
637
638
|
value: "upload",
|
|
638
639
|
className: e?.tabs?.contentClassName,
|
|
639
|
-
children: /* @__PURE__ */
|
|
640
|
-
className:
|
|
640
|
+
children: /* @__PURE__ */ W("label", {
|
|
641
|
+
className: Y("vibe-shadcn-tiptap__drop relative my-2 grid justify-items-center gap-2 rounded-md border-2 border-dashed border-muted-foreground bg-muted p-4 text-center text-foreground hover:border-primary hover:bg-accent has-[:focus-visible]:border-ring", e?.uploadClassName),
|
|
641
642
|
onDragOver: (e) => e.preventDefault(),
|
|
642
643
|
onDrop: (e) => {
|
|
643
644
|
e.preventDefault(), A(Array.from(e.dataTransfer.files));
|
|
644
645
|
},
|
|
645
646
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ U("input", {
|
|
647
648
|
className: "absolute inset-0 size-full cursor-pointer opacity-0",
|
|
648
649
|
type: "file",
|
|
649
650
|
"data-initial-focus": !0,
|
|
@@ -651,26 +652,26 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
651
652
|
multiple: y.multiple,
|
|
652
653
|
onChange: (e) => A(Array.from(e.currentTarget.files ?? []))
|
|
653
654
|
}),
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ U(h, {
|
|
655
656
|
size: 28,
|
|
656
657
|
className: "text-muted-foreground",
|
|
657
658
|
"aria-hidden": "true"
|
|
658
659
|
}),
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ U("span", { children: d(`toolbar.${p}.dropHint`) })
|
|
660
661
|
]
|
|
661
662
|
})
|
|
662
663
|
}),
|
|
663
|
-
S && E === "url" && /* @__PURE__ */
|
|
664
|
+
S && E === "url" && /* @__PURE__ */ U(c.Content, {
|
|
664
665
|
value: "url",
|
|
665
666
|
className: e?.tabs?.contentClassName,
|
|
666
|
-
children: /* @__PURE__ */
|
|
667
|
+
children: /* @__PURE__ */ U("form", {
|
|
667
668
|
id: g,
|
|
668
669
|
className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
|
|
669
670
|
onSubmit: (e) => {
|
|
670
671
|
e.preventDefault(), j();
|
|
671
672
|
},
|
|
672
|
-
children: /* @__PURE__ */
|
|
673
|
-
className:
|
|
673
|
+
children: /* @__PURE__ */ U(s, {
|
|
674
|
+
className: Y(mn[e?.input?.variant ?? "default"], e?.input?.className),
|
|
674
675
|
"data-initial-focus": !0,
|
|
675
676
|
"aria-label": d(`toolbar.${p}.url`),
|
|
676
677
|
placeholder: d(`toolbar.${p}.urlPlaceholder`),
|
|
@@ -680,16 +681,16 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
680
681
|
})
|
|
681
682
|
})
|
|
682
683
|
]
|
|
683
|
-
}), /* @__PURE__ */
|
|
684
|
-
className:
|
|
685
|
-
children: [/* @__PURE__ */
|
|
684
|
+
}), /* @__PURE__ */ W("div", {
|
|
685
|
+
className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", Z),
|
|
686
|
+
children: [/* @__PURE__ */ U(Q, {
|
|
686
687
|
type: "button",
|
|
687
688
|
className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
|
|
688
689
|
onClick: () => {
|
|
689
690
|
o(), (m ?? l.view.dom).focus({ preventScroll: !0 });
|
|
690
691
|
},
|
|
691
692
|
children: d("toolbar.action.cancel")
|
|
692
|
-
}), E === "url" && /* @__PURE__ */
|
|
693
|
+
}), E === "url" && /* @__PURE__ */ U(Q, {
|
|
693
694
|
type: "submit",
|
|
694
695
|
form: g,
|
|
695
696
|
children: d("toolbar.action.confirm")
|
|
@@ -698,10 +699,10 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
|
|
|
698
699
|
}) : null;
|
|
699
700
|
}
|
|
700
701
|
// src/table-picker.tsx
|
|
701
|
-
var
|
|
702
|
-
return /* @__PURE__ */
|
|
702
|
+
var Nn = xe(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
|
|
703
|
+
return /* @__PURE__ */ U("button", {
|
|
703
704
|
type: "button",
|
|
704
|
-
className:
|
|
705
|
+
className: Y("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
|
|
705
706
|
"aria-label": `${e} × ${t}`,
|
|
706
707
|
"data-cell": `${e}-${t}`,
|
|
707
708
|
"data-active": n || void 0,
|
|
@@ -715,14 +716,14 @@ var An = be(function({ row: e, col: t, active: n, current: r, className: i, grid
|
|
|
715
716
|
}
|
|
716
717
|
});
|
|
717
718
|
});
|
|
718
|
-
function
|
|
719
|
-
let { Popover: o } =
|
|
719
|
+
function Pn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
|
|
720
|
+
let { Popover: o } = X(), { editor: s, commands: c, t: l } = t, [u, d] = J(!1), [f, p] = J({
|
|
720
721
|
row: 1,
|
|
721
722
|
col: 1
|
|
722
|
-
}), m =
|
|
723
|
-
|
|
723
|
+
}), m = q(void 0), h = q(!1), g = q(null), { maxRows: _, maxCols: v } = i;
|
|
724
|
+
K(() => {
|
|
724
725
|
if (!u || a) return;
|
|
725
|
-
let e =
|
|
726
|
+
let e = fe(s, () => d(!1));
|
|
726
727
|
return m.current = e, () => {
|
|
727
728
|
e.dispose(), m.current = void 0;
|
|
728
729
|
};
|
|
@@ -731,12 +732,12 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
731
732
|
s,
|
|
732
733
|
u
|
|
733
734
|
]);
|
|
734
|
-
let y =
|
|
735
|
+
let y = Se((e, t) => {
|
|
735
736
|
p((n) => n.row === e && n.col === t ? n : {
|
|
736
737
|
row: e,
|
|
737
738
|
col: t
|
|
738
739
|
});
|
|
739
|
-
}, []), b =
|
|
740
|
+
}, []), b = Se((e, t) => {
|
|
740
741
|
let n = m.current?.range;
|
|
741
742
|
n && s.isEditable && !a && (h.current = !0, s.commands.setTextSelection(n), c.insertTable(e, t), d(!1));
|
|
742
743
|
}, [
|
|
@@ -744,7 +745,7 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
744
745
|
a,
|
|
745
746
|
s
|
|
746
747
|
]);
|
|
747
|
-
return /* @__PURE__ */
|
|
748
|
+
return /* @__PURE__ */ W(o.Root, {
|
|
748
749
|
open: u && !a,
|
|
749
750
|
onOpenChange: (e) => {
|
|
750
751
|
e && (h.current = !1, p({
|
|
@@ -752,32 +753,32 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
752
753
|
col: 1
|
|
753
754
|
})), d(e);
|
|
754
755
|
},
|
|
755
|
-
children: [/* @__PURE__ */
|
|
756
|
+
children: [/* @__PURE__ */ U(o.Trigger, {
|
|
756
757
|
asChild: !0,
|
|
757
758
|
children: n
|
|
758
|
-
}), r && /* @__PURE__ */
|
|
759
|
+
}), r && /* @__PURE__ */ W(o.Content, {
|
|
759
760
|
container: r,
|
|
760
|
-
className:
|
|
761
|
+
className: Y("z-3 box-border max-w-[calc(100dvw-1rem)]", e?.className),
|
|
761
762
|
"aria-label": l("command.table"),
|
|
762
763
|
align: "start",
|
|
763
764
|
sideOffset: 4,
|
|
764
765
|
onCloseAutoFocus: (e) => {
|
|
765
766
|
h.current && e.preventDefault();
|
|
766
767
|
},
|
|
767
|
-
children: [/* @__PURE__ */
|
|
768
|
+
children: [/* @__PURE__ */ W("div", {
|
|
768
769
|
"aria-live": "polite",
|
|
769
770
|
children: [
|
|
770
771
|
f.row,
|
|
771
772
|
" × ",
|
|
772
773
|
f.col
|
|
773
774
|
]
|
|
774
|
-
}), /* @__PURE__ */
|
|
775
|
+
}), /* @__PURE__ */ U("div", {
|
|
775
776
|
ref: g,
|
|
776
777
|
className: "vibe-shadcn-tiptap__table-picker grid min-w-0 gap-1 overflow-x-auto p-1",
|
|
777
778
|
style: { gridTemplateColumns: `repeat(${v}, max-content)` },
|
|
778
779
|
children: Array.from({ length: _ * v }, (t, n) => {
|
|
779
780
|
let r = Math.floor(n / v) + 1, i = n % v + 1;
|
|
780
|
-
return /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ U(Nn, {
|
|
781
782
|
row: r,
|
|
782
783
|
col: i,
|
|
783
784
|
active: r <= f.row && i <= f.col,
|
|
@@ -793,8 +794,8 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
|
|
|
793
794
|
});
|
|
794
795
|
}
|
|
795
796
|
// src/vibe-tiptap-provider.tsx
|
|
796
|
-
var
|
|
797
|
-
function
|
|
797
|
+
var Fn = ve({});
|
|
798
|
+
function In(e, t) {
|
|
798
799
|
return {
|
|
799
800
|
components: t.components ?? e.components,
|
|
800
801
|
ui: t.ui ?? e.ui,
|
|
@@ -807,15 +808,15 @@ function Nn(e, t) {
|
|
|
807
808
|
showWordCount: t.showWordCount ?? e.showWordCount
|
|
808
809
|
};
|
|
809
810
|
}
|
|
810
|
-
function
|
|
811
|
-
let n =
|
|
812
|
-
return /* @__PURE__ */
|
|
811
|
+
function Ln({ children: e, ...t }) {
|
|
812
|
+
let n = In(Ce(Fn), t);
|
|
813
|
+
return /* @__PURE__ */ U(Fn.Provider, {
|
|
813
814
|
value: n,
|
|
814
815
|
children: e
|
|
815
816
|
});
|
|
816
817
|
}
|
|
817
|
-
function
|
|
818
|
-
let { components: t, ...n } =
|
|
818
|
+
function Rn(e) {
|
|
819
|
+
let { components: t, ...n } = In(Ce(Fn), e);
|
|
819
820
|
if (!t) throw Error("Pass a components mapping to VibeTiptapProvider or directly to the editor or toolbar.");
|
|
820
821
|
return {
|
|
821
822
|
components: t,
|
|
@@ -823,17 +824,17 @@ function Fn(e) {
|
|
|
823
824
|
};
|
|
824
825
|
}
|
|
825
826
|
// src/whiteboard-dialog.tsx
|
|
826
|
-
function
|
|
827
|
-
let { Dialog: o } =
|
|
828
|
-
|
|
827
|
+
function zn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
|
|
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.sceneData : void 0), v = q(void 0), y = q(a), b = q(!1), x = q(null), S = q(!1);
|
|
829
|
+
K(() => {
|
|
829
830
|
y.current = a;
|
|
830
|
-
}, [a]),
|
|
831
|
+
}, [a]), G(() => {
|
|
831
832
|
if (!l) return;
|
|
832
833
|
let e = l, n = new AbortController(), r = /* @__PURE__ */ new Map(), a, o;
|
|
833
834
|
async function u() {
|
|
834
835
|
if (n.signal.aborted) return;
|
|
835
836
|
o = t.holdWhiteboardSession();
|
|
836
|
-
let l = () => y.current(), u = i ?
|
|
837
|
+
let l = () => y.current(), u = i ? fe(s, l) : void 0, d = i ? void 0 : V(s, l);
|
|
837
838
|
if (!(u?.range || d?.active)) l();
|
|
838
839
|
else {
|
|
839
840
|
v.current = {
|
|
@@ -878,11 +879,11 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
878
879
|
if (!u()) return;
|
|
879
880
|
let f = s.view.dom.ownerDocument.baseURI, { sceneData: p, file: m } = await e(d, a, n, f, r);
|
|
880
881
|
if (!u()) return;
|
|
881
|
-
let h =
|
|
882
|
+
let h = me(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
|
|
882
883
|
if (h?.reason === "too-large") {
|
|
883
884
|
g(c("notify.assetFileTooLarge", {
|
|
884
|
-
size:
|
|
885
|
-
limit:
|
|
885
|
+
size: N(h.size),
|
|
886
|
+
limit: N(h.maxSize)
|
|
886
887
|
}));
|
|
887
888
|
return;
|
|
888
889
|
}
|
|
@@ -906,17 +907,17 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
906
907
|
b.current = !1, r.aborted || m(!1);
|
|
907
908
|
}
|
|
908
909
|
}
|
|
909
|
-
return /* @__PURE__ */
|
|
910
|
+
return /* @__PURE__ */ U(gn, {
|
|
910
911
|
value: e?.button,
|
|
911
|
-
children: /* @__PURE__ */
|
|
912
|
+
children: /* @__PURE__ */ U(o.Root, {
|
|
912
913
|
open: !0,
|
|
913
914
|
onOpenChange: (e) => {
|
|
914
915
|
!e && !p && a();
|
|
915
916
|
},
|
|
916
|
-
children: /* @__PURE__ */
|
|
917
|
+
children: /* @__PURE__ */ W(o.Content, {
|
|
917
918
|
container: r,
|
|
918
919
|
overlayClassName: "vibe-shadcn-tiptap__backdrop",
|
|
919
|
-
className:
|
|
920
|
+
className: Y("vibe-shadcn-tiptap__whiteboard", e?.className),
|
|
920
921
|
"data-excalidraw-modal-root": !0,
|
|
921
922
|
"aria-describedby": void 0,
|
|
922
923
|
onInteractOutside: (e) => e.preventDefault(),
|
|
@@ -933,17 +934,17 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
933
934
|
(e && r.parentElement?.contains(e) ? e : s.view.dom).focus();
|
|
934
935
|
}
|
|
935
936
|
},
|
|
936
|
-
children: [/* @__PURE__ */
|
|
937
|
-
className:
|
|
937
|
+
children: [/* @__PURE__ */ W("header", {
|
|
938
|
+
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
938
939
|
children: [
|
|
939
|
-
/* @__PURE__ */
|
|
940
|
-
h && /* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ U(o.Title, { children: c("command.whiteboard") }),
|
|
941
|
+
h && /* @__PURE__ */ U("span", {
|
|
941
942
|
role: "alert",
|
|
942
943
|
children: h
|
|
943
944
|
}),
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ U(o.Close, {
|
|
945
946
|
asChild: !0,
|
|
946
|
-
children: /* @__PURE__ */
|
|
947
|
+
children: /* @__PURE__ */ U(Q, {
|
|
947
948
|
type: "button",
|
|
948
949
|
className: "vibe-shadcn-tiptap__button",
|
|
949
950
|
defaultSizeClassName: "px-2 py-1",
|
|
@@ -951,21 +952,21 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
951
952
|
children: c("toolbar.action.cancel")
|
|
952
953
|
})
|
|
953
954
|
}),
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
+
/* @__PURE__ */ W(Q, {
|
|
955
956
|
type: "button",
|
|
956
957
|
variant: "default",
|
|
957
958
|
className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__whiteboard-save",
|
|
958
959
|
disabled: !d || p,
|
|
959
960
|
"aria-busy": p || void 0,
|
|
960
961
|
onClick: () => void C(),
|
|
961
|
-
children: [p && /* @__PURE__ */
|
|
962
|
+
children: [p && /* @__PURE__ */ U(_t, {
|
|
962
963
|
"aria-hidden": "true",
|
|
963
964
|
className: "vibe-shadcn-tiptap__spinner",
|
|
964
965
|
size: 16
|
|
965
966
|
}), c("whiteboard.save")]
|
|
966
967
|
})
|
|
967
968
|
]
|
|
968
|
-
}), /* @__PURE__ */
|
|
969
|
+
}), /* @__PURE__ */ U("div", {
|
|
969
970
|
ref: u,
|
|
970
971
|
className: "vibe-shadcn-tiptap__whiteboard-canvas",
|
|
971
972
|
inert: p
|
|
@@ -975,131 +976,131 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
|
|
|
975
976
|
});
|
|
976
977
|
}
|
|
977
978
|
// src/shadcn-tiptap-toolbar.tsx
|
|
978
|
-
var
|
|
979
|
-
undo:
|
|
980
|
-
redo:
|
|
981
|
-
bold:
|
|
982
|
-
italic:
|
|
983
|
-
underline:
|
|
984
|
-
strike:
|
|
985
|
-
code:
|
|
986
|
-
superscript:
|
|
987
|
-
subscript:
|
|
988
|
-
color:
|
|
989
|
-
highlight:
|
|
990
|
-
clearFormat:
|
|
991
|
-
align:
|
|
992
|
-
decreaseIndent:
|
|
993
|
-
increaseIndent:
|
|
994
|
-
firstLineIndent:
|
|
995
|
-
bulletList:
|
|
996
|
-
orderedList:
|
|
997
|
-
taskList:
|
|
998
|
-
blockquote:
|
|
999
|
-
codeBlock:
|
|
1000
|
-
link:
|
|
1001
|
-
image:
|
|
1002
|
-
video:
|
|
1003
|
-
audio:
|
|
1004
|
-
attachment:
|
|
1005
|
-
table:
|
|
1006
|
-
whiteboard:
|
|
1007
|
-
hr:
|
|
1008
|
-
findReplace:
|
|
1009
|
-
markdown:
|
|
1010
|
-
print:
|
|
1011
|
-
preview:
|
|
1012
|
-
fullscreen:
|
|
1013
|
-
},
|
|
1014
|
-
left:
|
|
1015
|
-
center:
|
|
1016
|
-
right:
|
|
1017
|
-
justify:
|
|
1018
|
-
},
|
|
1019
|
-
0:
|
|
1020
|
-
1:
|
|
1021
|
-
2:
|
|
1022
|
-
3:
|
|
1023
|
-
4:
|
|
1024
|
-
5:
|
|
1025
|
-
6:
|
|
979
|
+
var Bn = {
|
|
980
|
+
undo: Wt,
|
|
981
|
+
redo: At,
|
|
982
|
+
bold: Ie,
|
|
983
|
+
italic: ft,
|
|
984
|
+
underline: Ut,
|
|
985
|
+
strike: It,
|
|
986
|
+
code: Ue,
|
|
987
|
+
superscript: Rt,
|
|
988
|
+
subscript: Lt,
|
|
989
|
+
color: St,
|
|
990
|
+
highlight: at,
|
|
991
|
+
clearFormat: Ye,
|
|
992
|
+
align: Ae,
|
|
993
|
+
decreaseIndent: ut,
|
|
994
|
+
increaseIndent: dt,
|
|
995
|
+
firstLineIndent: Un,
|
|
996
|
+
bulletList: mt,
|
|
997
|
+
orderedList: gt,
|
|
998
|
+
taskList: ht,
|
|
999
|
+
blockquote: kt,
|
|
1000
|
+
codeBlock: We,
|
|
1001
|
+
link: pt,
|
|
1002
|
+
image: ot,
|
|
1003
|
+
video: Qe,
|
|
1004
|
+
audio: xt,
|
|
1005
|
+
attachment: Ct,
|
|
1006
|
+
table: zt,
|
|
1007
|
+
whiteboard: Tt,
|
|
1008
|
+
hr: bt,
|
|
1009
|
+
findReplace: Ft,
|
|
1010
|
+
markdown: Wn,
|
|
1011
|
+
print: Ot,
|
|
1012
|
+
preview: Ze,
|
|
1013
|
+
fullscreen: vt
|
|
1014
|
+
}, Vn = {
|
|
1015
|
+
left: Ae,
|
|
1016
|
+
center: Oe,
|
|
1017
|
+
right: je,
|
|
1018
|
+
justify: ke
|
|
1019
|
+
}, Hn = {
|
|
1020
|
+
0: Et,
|
|
1021
|
+
1: $e,
|
|
1022
|
+
2: et,
|
|
1023
|
+
3: tt,
|
|
1024
|
+
4: nt,
|
|
1025
|
+
5: rt,
|
|
1026
|
+
6: it
|
|
1026
1027
|
};
|
|
1027
|
-
function
|
|
1028
|
-
return /* @__PURE__ */
|
|
1028
|
+
function Un({ size: e }) {
|
|
1029
|
+
return /* @__PURE__ */ U("svg", {
|
|
1029
1030
|
width: e,
|
|
1030
1031
|
height: e,
|
|
1031
|
-
viewBox:
|
|
1032
|
+
viewBox: tn,
|
|
1032
1033
|
fill: "none",
|
|
1033
1034
|
stroke: "currentColor",
|
|
1034
|
-
strokeWidth:
|
|
1035
|
+
strokeWidth: Zt.strokeWidth,
|
|
1035
1036
|
strokeLinecap: "round",
|
|
1036
1037
|
strokeLinejoin: "round",
|
|
1037
1038
|
"aria-hidden": "true",
|
|
1038
1039
|
focusable: "false",
|
|
1039
|
-
children:
|
|
1040
|
+
children: Zt.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1040
1041
|
});
|
|
1041
1042
|
}
|
|
1042
|
-
function
|
|
1043
|
-
return /* @__PURE__ */
|
|
1043
|
+
function Wn({ size: e, action: t }) {
|
|
1044
|
+
return /* @__PURE__ */ W("svg", {
|
|
1044
1045
|
width: e,
|
|
1045
1046
|
height: e,
|
|
1046
|
-
viewBox:
|
|
1047
|
+
viewBox: tn,
|
|
1047
1048
|
fill: "none",
|
|
1048
1049
|
stroke: "currentColor",
|
|
1049
|
-
strokeWidth:
|
|
1050
|
+
strokeWidth: en.strokeWidth,
|
|
1050
1051
|
strokeLinecap: "round",
|
|
1051
1052
|
strokeLinejoin: "round",
|
|
1052
1053
|
"aria-hidden": "true",
|
|
1053
1054
|
focusable: "false",
|
|
1054
|
-
children: [/* @__PURE__ */
|
|
1055
|
-
transform: t ?
|
|
1056
|
-
children:
|
|
1057
|
-
}), t &&
|
|
1055
|
+
children: [/* @__PURE__ */ U("g", {
|
|
1056
|
+
transform: t ? $t : void 0,
|
|
1057
|
+
children: en.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
|
|
1058
|
+
}), t && Qt[t].map((e) => /* @__PURE__ */ U("path", { d: e }, e))]
|
|
1058
1059
|
});
|
|
1059
1060
|
}
|
|
1060
|
-
function
|
|
1061
|
+
function Gn(e) {
|
|
1061
1062
|
let { components: t, showWordCount: n, ...r } = {
|
|
1062
1063
|
...e,
|
|
1063
|
-
...
|
|
1064
|
+
...Rn(e)
|
|
1064
1065
|
}, { Tooltip: i } = t;
|
|
1065
|
-
return /* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ U(fn, {
|
|
1066
1067
|
value: t,
|
|
1067
|
-
children: /* @__PURE__ */
|
|
1068
|
+
children: /* @__PURE__ */ U(i.Provider, {
|
|
1068
1069
|
delayDuration: 500,
|
|
1069
1070
|
skipDelayDuration: 0,
|
|
1070
|
-
children: /* @__PURE__ */
|
|
1071
|
+
children: /* @__PURE__ */ U(Kn, { ...r }, r.context.editor.instanceId)
|
|
1071
1072
|
})
|
|
1072
1073
|
});
|
|
1073
1074
|
}
|
|
1074
|
-
function
|
|
1075
|
-
let { DropdownMenu: t, Select: n } =
|
|
1076
|
-
|
|
1077
|
-
let [v, y] =
|
|
1078
|
-
let t = e.join(" "), n =
|
|
1079
|
-
return
|
|
1075
|
+
function Kn(e) {
|
|
1076
|
+
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
|
+
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 = B(e.editorBehaviorOptions), M = ee(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), N = Te(() => r(e.colors, e.highlights), [e.colors, e.highlights]), F = ae(f), ie = m(e.markdownOptions), I = /* @__PURE__ */ new Map(), L = E(e.toolbar).map((e) => {
|
|
1079
|
+
let t = e.join(" "), n = I.get(t) ?? 0;
|
|
1080
|
+
return I.set(t, n + 1), {
|
|
1080
1081
|
id: `${t}:${n}`,
|
|
1081
|
-
buttons: e.filter(
|
|
1082
|
+
buttons: e.filter(se)
|
|
1082
1083
|
};
|
|
1083
1084
|
}).filter(({ buttons: e }) => e.length > 0);
|
|
1084
|
-
|
|
1085
|
+
G(() => {
|
|
1085
1086
|
j || (S(void 0), O(!1));
|
|
1086
1087
|
}, [j]);
|
|
1087
|
-
function
|
|
1088
|
-
return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!F : 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[
|
|
1088
|
+
function se(e) {
|
|
1089
|
+
return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!F : 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[re(e === "attachment" ? "file" : e)] : !0;
|
|
1089
1090
|
}
|
|
1090
1091
|
function z(e, t) {
|
|
1091
|
-
return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !
|
|
1092
|
+
return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !R(a, e, t);
|
|
1092
1093
|
}
|
|
1093
|
-
function
|
|
1094
|
+
function ce(e, t) {
|
|
1094
1095
|
if (e === "preview") return o;
|
|
1095
1096
|
if (e === "fullscreen") return c;
|
|
1096
|
-
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return
|
|
1097
|
+
if (e !== "print" && e !== "markdown" && e !== "whiteboard") return oe(a, e, t);
|
|
1097
1098
|
}
|
|
1098
|
-
function
|
|
1099
|
+
function le(t, n) {
|
|
1099
1100
|
z(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
|
|
1100
1101
|
...e.printOptions,
|
|
1101
1102
|
t: _
|
|
1102
|
-
}) : 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" &&
|
|
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" && ue(a, t, n));
|
|
1103
1104
|
}
|
|
1104
1105
|
function de(t, n, r) {
|
|
1105
1106
|
let i = {
|
|
@@ -1119,62 +1120,62 @@ function Un(e) {
|
|
|
1119
1120
|
anchor: n
|
|
1120
1121
|
}
|
|
1121
1122
|
});
|
|
1122
|
-
} else
|
|
1123
|
+
} else le(t);
|
|
1123
1124
|
}
|
|
1124
|
-
function
|
|
1125
|
+
function V(r, u) {
|
|
1125
1126
|
let p = `${u}:${r}`;
|
|
1126
|
-
if (r === "color" || r === "highlight") return /* @__PURE__ */
|
|
1127
|
+
if (r === "color" || r === "highlight") return /* @__PURE__ */ U(En, {
|
|
1127
1128
|
appearance: e.ui?.colorPicker,
|
|
1128
1129
|
context: a,
|
|
1129
1130
|
kind: r,
|
|
1130
1131
|
disabled: z(r),
|
|
1131
|
-
colors: r === "color" ?
|
|
1132
|
+
colors: r === "color" ? N.colors : N.highlights,
|
|
1132
1133
|
overlayTarget: A,
|
|
1133
1134
|
bubble: e.bubble,
|
|
1134
1135
|
open: e.bubble ? e.openPalette === r : void 0,
|
|
1135
1136
|
onOpenChange: (t) => e.onPaletteOpenChange?.(r, t)
|
|
1136
1137
|
}, r);
|
|
1137
1138
|
if (r === "heading") {
|
|
1138
|
-
let t = i?.heading, o =
|
|
1139
|
-
className:
|
|
1140
|
-
children: [/* @__PURE__ */
|
|
1139
|
+
let t = i?.heading, o = P(a), s = Hn[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ W("span", {
|
|
1140
|
+
className: Y("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
|
|
1141
|
+
children: [/* @__PURE__ */ U(s, {
|
|
1141
1142
|
size: 16,
|
|
1142
1143
|
"aria-hidden": !0
|
|
1143
1144
|
}), l(o)]
|
|
1144
1145
|
});
|
|
1145
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ W(n.Root, {
|
|
1146
1147
|
value: c,
|
|
1147
1148
|
disabled: z(r),
|
|
1148
|
-
onValueChange: (e) =>
|
|
1149
|
-
children: [/* @__PURE__ */
|
|
1149
|
+
onValueChange: (e) => le(r, Number(e)),
|
|
1150
|
+
children: [/* @__PURE__ */ U(n.Trigger, {
|
|
1150
1151
|
asChild: !0,
|
|
1151
|
-
children: /* @__PURE__ */
|
|
1152
|
+
children: /* @__PURE__ */ W(Q, {
|
|
1152
1153
|
appearance: t?.button,
|
|
1153
1154
|
type: "button",
|
|
1154
1155
|
className: "vibe-shadcn-tiptap__button",
|
|
1155
1156
|
"aria-label": _("command.heading"),
|
|
1156
1157
|
"data-toolbar-key": e.bubble ? void 0 : r,
|
|
1157
1158
|
onMouseDown: (e) => e.preventDefault(),
|
|
1158
|
-
children: [/* @__PURE__ */
|
|
1159
|
+
children: [/* @__PURE__ */ U(n.Value, {
|
|
1159
1160
|
placeholder: u,
|
|
1160
1161
|
children: u
|
|
1161
|
-
}), /* @__PURE__ */
|
|
1162
|
+
}), /* @__PURE__ */ U(ze, { size: 12 })]
|
|
1162
1163
|
})
|
|
1163
|
-
}), A && /* @__PURE__ */
|
|
1164
|
+
}), A && /* @__PURE__ */ U(n.Content, {
|
|
1164
1165
|
container: A,
|
|
1165
1166
|
position: "item-aligned",
|
|
1166
|
-
className:
|
|
1167
|
+
className: Y("z-3", t?.contentClassName),
|
|
1167
1168
|
onCloseAutoFocus: (e) => {
|
|
1168
1169
|
f.isFocused && e.preventDefault();
|
|
1169
1170
|
},
|
|
1170
1171
|
children: C.map(({ level: e }) => {
|
|
1171
|
-
let i =
|
|
1172
|
-
return /* @__PURE__ */
|
|
1172
|
+
let i = Hn[e], a = String(e) === c;
|
|
1173
|
+
return /* @__PURE__ */ W(n.Item, {
|
|
1173
1174
|
value: String(e),
|
|
1174
|
-
className:
|
|
1175
|
+
className: Y("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
|
|
1175
1176
|
disabled: !a && z(r, e),
|
|
1176
1177
|
"data-active": a || void 0,
|
|
1177
|
-
children: [/* @__PURE__ */
|
|
1178
|
+
children: [/* @__PURE__ */ U(i, {
|
|
1178
1179
|
size: 16,
|
|
1179
1180
|
"aria-hidden": !0
|
|
1180
1181
|
}), l(e)]
|
|
@@ -1183,21 +1184,21 @@ function Un(e) {
|
|
|
1183
1184
|
})]
|
|
1184
1185
|
}, r);
|
|
1185
1186
|
}
|
|
1186
|
-
let m = r === "preview" && o ?
|
|
1187
|
+
let m = r === "preview" && o ? wt : r === "fullscreen" && c ? yt : r === "align" ? Vn[ne(a)] : Bn[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ U($, {
|
|
1187
1188
|
size: "icon",
|
|
1188
1189
|
label: h,
|
|
1189
1190
|
overlayTarget: A,
|
|
1190
1191
|
"data-toolbar-key": e.bubble ? void 0 : r,
|
|
1191
1192
|
disabled: z(r),
|
|
1192
|
-
"aria-pressed": r === "findReplace" ? void 0 :
|
|
1193
|
+
"aria-pressed": r === "findReplace" ? void 0 : ce(r),
|
|
1193
1194
|
"aria-expanded": r === "findReplace" ? a.findReplaceState.open : r === "link" || r === "image" || r === "video" || r === "audio" || r === "attachment" ? b?.triggerId === p : void 0,
|
|
1194
1195
|
onMouseDown: (e) => e.preventDefault(),
|
|
1195
|
-
children: /* @__PURE__ */
|
|
1196
|
+
children: /* @__PURE__ */ U(m, {
|
|
1196
1197
|
size: 16,
|
|
1197
1198
|
"aria-hidden": !0
|
|
1198
1199
|
})
|
|
1199
1200
|
});
|
|
1200
|
-
if (r === "table") return /* @__PURE__ */
|
|
1201
|
+
if (r === "table") return /* @__PURE__ */ U(Pn, {
|
|
1201
1202
|
appearance: e.ui?.tablePicker,
|
|
1202
1203
|
context: a,
|
|
1203
1204
|
trigger: g,
|
|
@@ -1205,26 +1206,26 @@ function Un(e) {
|
|
|
1205
1206
|
options: M.tableGrid,
|
|
1206
1207
|
disabled: z(r)
|
|
1207
1208
|
}, r);
|
|
1208
|
-
if (r === "markdown") return /* @__PURE__ */
|
|
1209
|
+
if (r === "markdown") return /* @__PURE__ */ W(t.Root, {
|
|
1209
1210
|
modal: !1,
|
|
1210
|
-
children: [/* @__PURE__ */
|
|
1211
|
+
children: [/* @__PURE__ */ U(t.Trigger, {
|
|
1211
1212
|
asChild: !0,
|
|
1212
1213
|
children: g
|
|
1213
|
-
}), A && /* @__PURE__ */
|
|
1214
|
+
}), A && /* @__PURE__ */ U(t.Content, {
|
|
1214
1215
|
container: A,
|
|
1215
1216
|
className: "z-3",
|
|
1216
1217
|
sideOffset: 4,
|
|
1217
1218
|
align: "start",
|
|
1218
|
-
children: s.map(({ value: e }) => /* @__PURE__ */
|
|
1219
|
+
children: s.map(({ value: e }) => /* @__PURE__ */ W(t.Item, {
|
|
1219
1220
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1220
1221
|
disabled: e === "import" ? o || !j || w || !F?.parse : !F?.serialize,
|
|
1221
1222
|
onSelect: () => {
|
|
1222
1223
|
e === "import" ? k.current?.click() : e === "export" ? d(a, {
|
|
1223
|
-
filename:
|
|
1224
|
+
filename: ie.exportFilename,
|
|
1224
1225
|
t: _
|
|
1225
1226
|
}) : l(a, { t: _ });
|
|
1226
1227
|
},
|
|
1227
|
-
children: [/* @__PURE__ */
|
|
1228
|
+
children: [/* @__PURE__ */ U(Wn, {
|
|
1228
1229
|
size: 16,
|
|
1229
1230
|
action: e
|
|
1230
1231
|
}), _(`toolbar.markdown.${e}`)]
|
|
@@ -1233,11 +1234,11 @@ function Un(e) {
|
|
|
1233
1234
|
}, r);
|
|
1234
1235
|
let v = (() => {
|
|
1235
1236
|
if (r === "align") return x.map(({ value: e }) => {
|
|
1236
|
-
let t =
|
|
1237
|
+
let t = Vn[e];
|
|
1237
1238
|
return {
|
|
1238
1239
|
value: e,
|
|
1239
1240
|
label: _(`toolbar.align.${e}`),
|
|
1240
|
-
icon: /* @__PURE__ */
|
|
1241
|
+
icon: /* @__PURE__ */ U(t, {
|
|
1241
1242
|
size: 16,
|
|
1242
1243
|
"aria-hidden": !0
|
|
1243
1244
|
})
|
|
@@ -1246,19 +1247,19 @@ function Un(e) {
|
|
|
1246
1247
|
if (r === "codeBlock") return M.codeBlockLanguages;
|
|
1247
1248
|
if (r === "hr") return M.horizontalRules.map((e) => ({
|
|
1248
1249
|
...e,
|
|
1249
|
-
icon: /* @__PURE__ */
|
|
1250
|
+
icon: /* @__PURE__ */ U("span", {
|
|
1250
1251
|
className: "vibe-shadcn-tiptap__divider-icon",
|
|
1251
1252
|
"data-style": e.value,
|
|
1252
1253
|
"aria-hidden": !0
|
|
1253
1254
|
})
|
|
1254
1255
|
}));
|
|
1255
1256
|
})();
|
|
1256
|
-
return v ? /* @__PURE__ */
|
|
1257
|
+
return v ? /* @__PURE__ */ W(t.Root, {
|
|
1257
1258
|
modal: !1,
|
|
1258
|
-
children: [/* @__PURE__ */
|
|
1259
|
+
children: [/* @__PURE__ */ U(t.Trigger, {
|
|
1259
1260
|
asChild: !0,
|
|
1260
1261
|
children: g
|
|
1261
|
-
}), A && /* @__PURE__ */
|
|
1262
|
+
}), A && /* @__PURE__ */ U(t.Content, {
|
|
1262
1263
|
container: A,
|
|
1263
1264
|
align: "start",
|
|
1264
1265
|
sideOffset: 4,
|
|
@@ -1266,40 +1267,40 @@ function Un(e) {
|
|
|
1266
1267
|
onCloseAutoFocus: (e) => {
|
|
1267
1268
|
f.isFocused && e.preventDefault();
|
|
1268
1269
|
},
|
|
1269
|
-
children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */
|
|
1270
|
+
children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ W(t.Item, {
|
|
1270
1271
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
1271
1272
|
disabled: z(r, e),
|
|
1272
|
-
"data-active":
|
|
1273
|
-
onSelect: () =>
|
|
1273
|
+
"data-active": ce(r, e) || void 0,
|
|
1274
|
+
onSelect: () => le(r, e),
|
|
1274
1275
|
children: [i, n]
|
|
1275
1276
|
}, e))
|
|
1276
1277
|
})]
|
|
1277
|
-
}, r) : /* @__PURE__ */
|
|
1278
|
+
}, r) : /* @__PURE__ */ ye($, {
|
|
1278
1279
|
...g.props,
|
|
1279
1280
|
key: r,
|
|
1280
1281
|
onClick: (e) => de(r, e.currentTarget, p)
|
|
1281
1282
|
});
|
|
1282
1283
|
}
|
|
1283
|
-
return /* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ U(gn, {
|
|
1284
1285
|
value: e.bubble ? e.ui?.bubble?.button : i?.button,
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1286
|
+
children: /* @__PURE__ */ W("div", {
|
|
1286
1287
|
ref: y,
|
|
1287
|
-
className:
|
|
1288
|
+
className: Y("vibe-shadcn-tiptap__toolbar", Z, !e.bubble && "border-b border-border p-1.5", i?.className),
|
|
1288
1289
|
role: "toolbar",
|
|
1289
1290
|
"aria-label": e.bubble ? void 0 : "Editor toolbar",
|
|
1290
1291
|
children: [
|
|
1291
|
-
F && !e.bubble && /* @__PURE__ */
|
|
1292
|
+
F && !e.bubble && /* @__PURE__ */ U("input", {
|
|
1292
1293
|
ref: k,
|
|
1293
1294
|
type: "file",
|
|
1294
1295
|
hidden: !0,
|
|
1295
|
-
accept:
|
|
1296
|
+
accept: ie.importAccept,
|
|
1296
1297
|
onChange: async (e) => {
|
|
1297
1298
|
let t = e.currentTarget, n = t.files?.[0];
|
|
1298
1299
|
if (t.value = "", n && j && F?.parse && !w) {
|
|
1299
1300
|
T(!0);
|
|
1300
1301
|
try {
|
|
1301
1302
|
await p(a, n, {
|
|
1302
|
-
strict:
|
|
1303
|
+
strict: ie.importStrict,
|
|
1303
1304
|
t: _,
|
|
1304
1305
|
canImport: () => k.current === t && f.isEditable && !f.isDestroyed
|
|
1305
1306
|
});
|
|
@@ -1309,11 +1310,11 @@ function Un(e) {
|
|
|
1309
1310
|
}
|
|
1310
1311
|
}
|
|
1311
1312
|
}),
|
|
1312
|
-
|
|
1313
|
-
className:
|
|
1314
|
-
children: t.map((t) =>
|
|
1313
|
+
L.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ U("div", {
|
|
1314
|
+
className: Y("vibe-shadcn-tiptap__toolbar-group", Z, n > 0 && "border-s border-border ps-1", i?.groupClassName),
|
|
1315
|
+
children: t.map((t) => V(t, e))
|
|
1315
1316
|
}, e)),
|
|
1316
|
-
j && b && A && /* @__PURE__ */
|
|
1317
|
+
j && b && A && /* @__PURE__ */ U(Dn, {
|
|
1317
1318
|
appearance: e.ui?.insertionPopover,
|
|
1318
1319
|
context: a,
|
|
1319
1320
|
request: b.request,
|
|
@@ -1322,7 +1323,7 @@ function Un(e) {
|
|
|
1322
1323
|
behaviorOptions: e.editorBehaviorOptions,
|
|
1323
1324
|
onClose: () => S(void 0)
|
|
1324
1325
|
}, b.triggerId),
|
|
1325
|
-
j && D && u && A && /* @__PURE__ */
|
|
1326
|
+
j && D && u && A && /* @__PURE__ */ U(zn, {
|
|
1326
1327
|
appearance: e.ui?.whiteboard,
|
|
1327
1328
|
context: a,
|
|
1328
1329
|
uploadAsset: u,
|
|
@@ -1334,7 +1335,7 @@ function Un(e) {
|
|
|
1334
1335
|
});
|
|
1335
1336
|
}
|
|
1336
1337
|
// src/editor-bubble.tsx
|
|
1337
|
-
var
|
|
1338
|
+
var qn = "vibeRadixBubble", Jn = 8, Yn = [
|
|
1338
1339
|
"bold",
|
|
1339
1340
|
"italic",
|
|
1340
1341
|
"underline",
|
|
@@ -1343,19 +1344,19 @@ var Wn = "vibeRadixBubble", Gn = 8, Kn = [
|
|
|
1343
1344
|
"color",
|
|
1344
1345
|
"highlight",
|
|
1345
1346
|
"clearFormat"
|
|
1346
|
-
],
|
|
1347
|
+
], Xn = /* @__PURE__ */ new Set([
|
|
1347
1348
|
"image",
|
|
1348
1349
|
"video",
|
|
1349
1350
|
"audio",
|
|
1350
1351
|
"fileAttachment",
|
|
1351
1352
|
"whiteboard"
|
|
1352
1353
|
]);
|
|
1353
|
-
function
|
|
1354
|
+
function Zn(e) {
|
|
1354
1355
|
let { selection: t, schema: n, doc: r } = e.state, i = n.marks.link;
|
|
1355
|
-
if (!(t instanceof
|
|
1356
|
+
if (!(t instanceof De) || !i) return;
|
|
1356
1357
|
let a = i.isInSet(t.$from.nodeAfter?.marks ?? []), o = a?.attrs.href, s = a?.attrs.target;
|
|
1357
1358
|
if (!a || typeof o != "string" || !o) return;
|
|
1358
|
-
let c =
|
|
1359
|
+
let c = ge(t.$from, i, a.attrs);
|
|
1359
1360
|
if (!(!c || t.to > c.to || t.from < c.from)) return {
|
|
1360
1361
|
...c,
|
|
1361
1362
|
href: o,
|
|
@@ -1363,16 +1364,16 @@ function Jn(e) {
|
|
|
1363
1364
|
target: typeof s == "string" ? s : void 0
|
|
1364
1365
|
};
|
|
1365
1366
|
}
|
|
1366
|
-
function
|
|
1367
|
+
function Qn({ editor: e, element: t }) {
|
|
1367
1368
|
if (e.isDestroyed || !e.isEditable) return !1;
|
|
1368
1369
|
let { view: n, state: { selection: r } } = e, i = n.dom.ownerDocument.activeElement;
|
|
1369
|
-
return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof
|
|
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 Ee ? Xn.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!Zn(e) || $n(e);
|
|
1370
1371
|
}
|
|
1371
|
-
function
|
|
1372
|
+
function $n(e) {
|
|
1372
1373
|
let { selection: t, doc: n } = e.state;
|
|
1373
|
-
return t instanceof
|
|
1374
|
+
return t instanceof De && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
|
|
1374
1375
|
}
|
|
1375
|
-
async function
|
|
1376
|
+
async function er(e, t, n = !1) {
|
|
1376
1377
|
let { editor: r, notify: i, t: a } = e;
|
|
1377
1378
|
try {
|
|
1378
1379
|
let e = r.view.dom.ownerDocument.defaultView?.navigator.clipboard;
|
|
@@ -1382,17 +1383,17 @@ async function Zn(e, t, n = !1) {
|
|
|
1382
1383
|
i(a("notify.clipboardUnavailable"), "warning");
|
|
1383
1384
|
}
|
|
1384
1385
|
}
|
|
1385
|
-
function
|
|
1386
|
+
function tr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
|
|
1386
1387
|
let { editor: u, t: d, commands: f, notify: p } = t;
|
|
1387
|
-
|
|
1388
|
-
let [m, h] =
|
|
1389
|
-
|
|
1388
|
+
H(t, (e) => e.getToolbarRevision());
|
|
1389
|
+
let [m, h] = J(), [g, _] = J(null), v = q(null);
|
|
1390
|
+
K(() => {
|
|
1390
1391
|
_(u.view.dom.parentElement);
|
|
1391
|
-
}, [u]),
|
|
1392
|
+
}, [u]), K(() => {
|
|
1392
1393
|
let e = v.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
|
|
1393
1394
|
if (!g || !e) return;
|
|
1394
1395
|
let n = () => {
|
|
1395
|
-
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(
|
|
1396
|
+
e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(qn, "updatePosition"));
|
|
1396
1397
|
}, r = t && new t(n);
|
|
1397
1398
|
r?.observe(e), r?.observe(g);
|
|
1398
1399
|
let i = g.ownerDocument, a = ({ target: e }) => {
|
|
@@ -1402,14 +1403,14 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1402
1403
|
r?.disconnect(), i.removeEventListener("scroll", a, !0);
|
|
1403
1404
|
};
|
|
1404
1405
|
}, [u, g]);
|
|
1405
|
-
let y =
|
|
1406
|
+
let y = Te(() => {
|
|
1406
1407
|
if (!g) return;
|
|
1407
1408
|
let e = {
|
|
1408
1409
|
boundary: g,
|
|
1409
|
-
padding:
|
|
1410
|
+
padding: Jn
|
|
1410
1411
|
};
|
|
1411
1412
|
return {
|
|
1412
|
-
offset:
|
|
1413
|
+
offset: Jn,
|
|
1413
1414
|
flip: e,
|
|
1414
1415
|
shift: {
|
|
1415
1416
|
...e,
|
|
@@ -1427,15 +1428,15 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1427
1428
|
},
|
|
1428
1429
|
scrollTarget: g
|
|
1429
1430
|
};
|
|
1430
|
-
}, [g, l]), { selection: b } = u.state, x =
|
|
1431
|
-
|
|
1431
|
+
}, [g, l]), { selection: b } = u.state, x = Zn(u), S = !x && $n(u);
|
|
1432
|
+
K(() => {
|
|
1432
1433
|
!S && m && (h(void 0), l(!1));
|
|
1433
1434
|
}, [
|
|
1434
1435
|
S,
|
|
1435
1436
|
m,
|
|
1436
1437
|
l
|
|
1437
1438
|
]);
|
|
1438
|
-
let C =
|
|
1439
|
+
let C = Yn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
|
|
1439
1440
|
if (x) try {
|
|
1440
1441
|
let e = new URL(x.href, u.view.dom.ownerDocument.baseURI);
|
|
1441
1442
|
[
|
|
@@ -1448,84 +1449,84 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1448
1449
|
} catch {
|
|
1449
1450
|
w = void 0;
|
|
1450
1451
|
}
|
|
1451
|
-
return g ? /* @__PURE__ */
|
|
1452
|
+
return g ? /* @__PURE__ */ U(gn, {
|
|
1452
1453
|
value: e?.bubble?.button,
|
|
1453
|
-
children: /* @__PURE__ */
|
|
1454
|
+
children: /* @__PURE__ */ U(D, {
|
|
1454
1455
|
editor: u,
|
|
1455
|
-
pluginKey:
|
|
1456
|
+
pluginKey: qn,
|
|
1456
1457
|
appendTo: n,
|
|
1457
1458
|
updateDelay: 0,
|
|
1458
1459
|
resizeDelay: 0,
|
|
1459
1460
|
options: y,
|
|
1460
|
-
shouldShow:
|
|
1461
|
+
shouldShow: Qn,
|
|
1461
1462
|
className: "vibe-shadcn-tiptap__bubble-host",
|
|
1462
|
-
children: /* @__PURE__ */
|
|
1463
|
+
children: /* @__PURE__ */ U("div", {
|
|
1463
1464
|
ref: v,
|
|
1464
1465
|
role: "toolbar",
|
|
1465
1466
|
"aria-label": "Selection toolbar",
|
|
1466
|
-
className:
|
|
1467
|
+
className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5", pn, e?.bubble?.className),
|
|
1467
1468
|
onMouseDown: (e) => e.preventDefault(),
|
|
1468
|
-
children: b instanceof
|
|
1469
|
+
children: b instanceof Ee ? /* @__PURE__ */ U(wn, {
|
|
1469
1470
|
context: t,
|
|
1470
1471
|
selection: b,
|
|
1471
1472
|
overlayTarget: n,
|
|
1472
1473
|
uploadAsset: a,
|
|
1473
1474
|
behaviorOptions: o,
|
|
1474
|
-
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(
|
|
1475
|
-
onCopyUrl: (e, n) => void
|
|
1475
|
+
onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(qn, "hide")),
|
|
1476
|
+
onCopyUrl: (e, n) => void er(t, e, n),
|
|
1476
1477
|
onWhiteboardEdit: c
|
|
1477
|
-
}) : x ? /* @__PURE__ */
|
|
1478
|
-
className:
|
|
1478
|
+
}) : x ? /* @__PURE__ */ W("div", {
|
|
1479
|
+
className: Y("vibe-shadcn-tiptap__actions", Z),
|
|
1479
1480
|
children: [
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ U($, {
|
|
1481
1482
|
label: d("toolbar.link.edit"),
|
|
1482
1483
|
overlayTarget: n,
|
|
1483
1484
|
onClick: () => s({
|
|
1484
1485
|
kind: "link",
|
|
1485
1486
|
link: x
|
|
1486
1487
|
}),
|
|
1487
|
-
children: /* @__PURE__ */
|
|
1488
|
+
children: /* @__PURE__ */ U(wt, {
|
|
1488
1489
|
size: 16,
|
|
1489
1490
|
"aria-hidden": !0
|
|
1490
1491
|
})
|
|
1491
1492
|
}),
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ U(Q, {
|
|
1493
1494
|
asChild: !0,
|
|
1494
1495
|
className: "vibe-shadcn-tiptap__button",
|
|
1495
|
-
children: /* @__PURE__ */
|
|
1496
|
+
children: /* @__PURE__ */ U("a", {
|
|
1496
1497
|
"aria-label": d("toolbar.link.open"),
|
|
1497
1498
|
href: w,
|
|
1498
1499
|
"aria-disabled": !w || void 0,
|
|
1499
1500
|
target: x.target || "_blank",
|
|
1500
1501
|
rel: "noopener noreferrer",
|
|
1501
|
-
children: /* @__PURE__ */
|
|
1502
|
+
children: /* @__PURE__ */ U(Xe, {
|
|
1502
1503
|
size: 16,
|
|
1503
1504
|
"aria-hidden": !0
|
|
1504
1505
|
})
|
|
1505
1506
|
})
|
|
1506
1507
|
}),
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
+
/* @__PURE__ */ U($, {
|
|
1508
1509
|
label: d("toolbar.link.copy"),
|
|
1509
1510
|
overlayTarget: n,
|
|
1510
|
-
onClick: () => void
|
|
1511
|
-
children: /* @__PURE__ */
|
|
1511
|
+
onClick: () => void er(t, x.href),
|
|
1512
|
+
children: /* @__PURE__ */ U(Ge, {
|
|
1512
1513
|
size: 16,
|
|
1513
1514
|
"aria-hidden": !0
|
|
1514
1515
|
})
|
|
1515
1516
|
}),
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ U($, {
|
|
1517
1518
|
label: d("toolbar.link.remove"),
|
|
1518
1519
|
overlayTarget: n,
|
|
1519
1520
|
onClick: () => {
|
|
1520
1521
|
f.setLink("", { range: x }), p(d("notify.linkRemoved"), "success");
|
|
1521
1522
|
},
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1523
|
+
children: /* @__PURE__ */ U(Gt, {
|
|
1523
1524
|
size: 16,
|
|
1524
1525
|
"aria-hidden": !0
|
|
1525
1526
|
})
|
|
1526
1527
|
})
|
|
1527
1528
|
]
|
|
1528
|
-
}) : S ? /* @__PURE__ */
|
|
1529
|
+
}) : S ? /* @__PURE__ */ U(Kn, {
|
|
1529
1530
|
context: t,
|
|
1530
1531
|
ui: e,
|
|
1531
1532
|
toolbar: [C],
|
|
@@ -1544,16 +1545,16 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
|
|
|
1544
1545
|
}) : null;
|
|
1545
1546
|
}
|
|
1546
1547
|
// src/find-replace.tsx
|
|
1547
|
-
function
|
|
1548
|
-
let { InputGroup: i } =
|
|
1549
|
-
if (
|
|
1548
|
+
function nr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
1549
|
+
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
|
+
if (G(() => {
|
|
1550
1551
|
let e = ({ transaction: e }) => {
|
|
1551
|
-
|
|
1552
|
+
L(e) && f((e) => e + 1);
|
|
1552
1553
|
};
|
|
1553
1554
|
return a.on("transaction", e), () => {
|
|
1554
1555
|
a.off("transaction", e);
|
|
1555
1556
|
};
|
|
1556
|
-
}, [a]),
|
|
1557
|
+
}, [a]), K(() => {
|
|
1557
1558
|
if (!c?.open) {
|
|
1558
1559
|
u.current?.focus({ preventScroll: !0 }), u.current = null;
|
|
1559
1560
|
return;
|
|
@@ -1564,28 +1565,28 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1564
1565
|
function p(e, t) {
|
|
1565
1566
|
e ? o.findReplacePrevious() : o.findReplaceNext(), t.focus({ preventScroll: !0 });
|
|
1566
1567
|
}
|
|
1567
|
-
let m = c.matches.length > 0, h =
|
|
1568
|
-
return /* @__PURE__ */
|
|
1568
|
+
let m = c.matches.length > 0, h = Y("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", mn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = Y("h-full", e?.input?.className);
|
|
1569
|
+
return /* @__PURE__ */ U(gn, {
|
|
1569
1570
|
value: e?.button,
|
|
1570
|
-
children: /* @__PURE__ */
|
|
1571
|
-
className:
|
|
1571
|
+
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", pn, e?.className),
|
|
1572
1573
|
role: "search",
|
|
1573
1574
|
"aria-label": s("command.findReplace"),
|
|
1574
1575
|
onKeyDown: (e) => {
|
|
1575
1576
|
!e.nativeEvent.isComposing && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), o.closeFindReplace());
|
|
1576
1577
|
},
|
|
1577
|
-
children: [/* @__PURE__ */
|
|
1578
|
-
className:
|
|
1578
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1579
|
+
className: Y("vibe-shadcn-tiptap__find-row", Z),
|
|
1579
1580
|
children: [
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
+
/* @__PURE__ */ W(i.Root, {
|
|
1581
1582
|
className: h,
|
|
1582
1583
|
children: [
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
+
/* @__PURE__ */ U(i.Addon, {
|
|
1584
1585
|
align: "inline-start",
|
|
1585
1586
|
"aria-hidden": !0,
|
|
1586
|
-
children: /* @__PURE__ */
|
|
1587
|
+
children: /* @__PURE__ */ U(Ft, { size: 16 })
|
|
1587
1588
|
}),
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
+
/* @__PURE__ */ U(i.Input, {
|
|
1589
1590
|
className: g,
|
|
1590
1591
|
ref: l,
|
|
1591
1592
|
"aria-label": s("findReplace.query"),
|
|
@@ -1596,15 +1597,15 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1596
1597
|
e.key !== "Enter" || e.nativeEvent.isComposing || (e.preventDefault(), m && p(e.shiftKey, e.currentTarget));
|
|
1597
1598
|
}
|
|
1598
1599
|
}),
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ U(i.Addon, {
|
|
1600
1601
|
align: "inline-end",
|
|
1601
|
-
children: /* @__PURE__ */
|
|
1602
|
+
children: /* @__PURE__ */ U($, {
|
|
1602
1603
|
size: "icon-sm",
|
|
1603
1604
|
label: s("findReplace.caseSensitive"),
|
|
1604
1605
|
overlayTarget: r,
|
|
1605
1606
|
"aria-pressed": c.caseSensitive,
|
|
1606
1607
|
onClick: () => o.setFindReplaceCaseSensitive(!c.caseSensitive),
|
|
1607
|
-
children: /* @__PURE__ */
|
|
1608
|
+
children: /* @__PURE__ */ U(Re, {
|
|
1608
1609
|
size: 16,
|
|
1609
1610
|
"aria-hidden": !0
|
|
1610
1611
|
})
|
|
@@ -1612,56 +1613,56 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1612
1613
|
})
|
|
1613
1614
|
]
|
|
1614
1615
|
}),
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ U("span", {
|
|
1616
1617
|
role: "status",
|
|
1617
1618
|
children: s("findReplace.count", {
|
|
1618
1619
|
current: m ? c.activeIndex + 1 : 0,
|
|
1619
1620
|
total: c.matches.length
|
|
1620
1621
|
})
|
|
1621
1622
|
}),
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ U($, {
|
|
1623
1624
|
size: "icon-sm",
|
|
1624
1625
|
label: s("findReplace.previous"),
|
|
1625
1626
|
overlayTarget: r,
|
|
1626
1627
|
disabled: !m,
|
|
1627
1628
|
onClick: (e) => p(!0, e.currentTarget),
|
|
1628
|
-
children: /* @__PURE__ */
|
|
1629
|
+
children: /* @__PURE__ */ U(He, {
|
|
1629
1630
|
size: 16,
|
|
1630
1631
|
"aria-hidden": !0
|
|
1631
1632
|
})
|
|
1632
1633
|
}),
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ U($, {
|
|
1634
1635
|
size: "icon-sm",
|
|
1635
1636
|
label: s("findReplace.next"),
|
|
1636
1637
|
overlayTarget: r,
|
|
1637
1638
|
disabled: !m,
|
|
1638
1639
|
onClick: (e) => p(!1, e.currentTarget),
|
|
1639
|
-
children: /* @__PURE__ */
|
|
1640
|
+
children: /* @__PURE__ */ U(ze, {
|
|
1640
1641
|
size: 16,
|
|
1641
1642
|
"aria-hidden": !0
|
|
1642
1643
|
})
|
|
1643
1644
|
}),
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ U($, {
|
|
1645
1646
|
size: "icon-sm",
|
|
1646
1647
|
label: s("findReplace.close"),
|
|
1647
1648
|
overlayTarget: r,
|
|
1648
1649
|
onClick: () => o.closeFindReplace(),
|
|
1649
|
-
children: /* @__PURE__ */
|
|
1650
|
+
children: /* @__PURE__ */ U(Jt, {
|
|
1650
1651
|
size: 16,
|
|
1651
1652
|
"aria-hidden": !0
|
|
1652
1653
|
})
|
|
1653
1654
|
})
|
|
1654
1655
|
]
|
|
1655
|
-
}), n && /* @__PURE__ */
|
|
1656
|
-
className:
|
|
1656
|
+
}), n && /* @__PURE__ */ W("div", {
|
|
1657
|
+
className: Y("vibe-shadcn-tiptap__find-row", "flex flex-wrap items-center gap-1"),
|
|
1657
1658
|
children: [
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ W(i.Root, {
|
|
1659
1660
|
className: h,
|
|
1660
|
-
children: [/* @__PURE__ */
|
|
1661
|
+
children: [/* @__PURE__ */ U(i.Addon, {
|
|
1661
1662
|
align: "inline-start",
|
|
1662
1663
|
"aria-hidden": !0,
|
|
1663
|
-
children: /* @__PURE__ */
|
|
1664
|
-
}), /* @__PURE__ */
|
|
1664
|
+
children: /* @__PURE__ */ U(jt, { size: 16 })
|
|
1665
|
+
}), /* @__PURE__ */ U(i.Input, {
|
|
1665
1666
|
className: g,
|
|
1666
1667
|
"aria-label": s("findReplace.replacement"),
|
|
1667
1668
|
placeholder: s("findReplace.replacement"),
|
|
@@ -1672,24 +1673,24 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1672
1673
|
}
|
|
1673
1674
|
})]
|
|
1674
1675
|
}),
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ U($, {
|
|
1676
1677
|
size: "icon-sm",
|
|
1677
1678
|
label: s("findReplace.replace"),
|
|
1678
1679
|
overlayTarget: r,
|
|
1679
1680
|
disabled: !m,
|
|
1680
1681
|
onClick: () => o.replaceFindReplaceCurrent(),
|
|
1681
|
-
children: /* @__PURE__ */
|
|
1682
|
+
children: /* @__PURE__ */ U(jt, {
|
|
1682
1683
|
size: 16,
|
|
1683
1684
|
"aria-hidden": !0
|
|
1684
1685
|
})
|
|
1685
1686
|
}),
|
|
1686
|
-
/* @__PURE__ */
|
|
1687
|
+
/* @__PURE__ */ U($, {
|
|
1687
1688
|
size: "icon-sm",
|
|
1688
1689
|
label: s("findReplace.replaceAll"),
|
|
1689
1690
|
overlayTarget: r,
|
|
1690
1691
|
disabled: !m,
|
|
1691
1692
|
onClick: () => o.replaceFindReplaceAll(),
|
|
1692
|
-
children: /* @__PURE__ */
|
|
1693
|
+
children: /* @__PURE__ */ U(Mt, {
|
|
1693
1694
|
size: 16,
|
|
1694
1695
|
"aria-hidden": !0
|
|
1695
1696
|
})
|
|
@@ -1700,7 +1701,7 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
|
|
|
1700
1701
|
});
|
|
1701
1702
|
}
|
|
1702
1703
|
// src/image-preview-dialog.tsx
|
|
1703
|
-
function
|
|
1704
|
+
function rr(e, t) {
|
|
1704
1705
|
if (!e) return {};
|
|
1705
1706
|
let n;
|
|
1706
1707
|
try {
|
|
@@ -1721,18 +1722,18 @@ function er(e, t) {
|
|
|
1721
1722
|
name: i
|
|
1722
1723
|
};
|
|
1723
1724
|
}
|
|
1724
|
-
function
|
|
1725
|
-
let { Dialog: o } =
|
|
1725
|
+
function ir({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
|
|
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 } = rr(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
|
|
1726
1727
|
function w(e) {
|
|
1727
1728
|
v && (m.current = null, d(0), p(100), l((t) => (t + e + s.length) % s.length));
|
|
1728
1729
|
}
|
|
1729
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ U(o.Root, {
|
|
1730
1731
|
open: !0,
|
|
1731
1732
|
onOpenChange: (e) => !e && a(),
|
|
1732
|
-
children: /* @__PURE__ */
|
|
1733
|
+
children: /* @__PURE__ */ W(o.Content, {
|
|
1733
1734
|
container: r,
|
|
1734
1735
|
overlayClassName: "vibe-shadcn-tiptap__backdrop",
|
|
1735
|
-
className:
|
|
1736
|
+
className: Y("vibe-shadcn-tiptap__image-preview", e?.className),
|
|
1736
1737
|
"aria-describedby": void 0,
|
|
1737
1738
|
onOpenAutoFocus: (e) => {
|
|
1738
1739
|
let t = r.ownerDocument.activeElement;
|
|
@@ -1746,33 +1747,33 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1746
1747
|
onKeyDown: (e) => {
|
|
1747
1748
|
(e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), w(e.key === "ArrowLeft" ? -1 : 1));
|
|
1748
1749
|
},
|
|
1749
|
-
children: [/* @__PURE__ */
|
|
1750
|
+
children: [/* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", {
|
|
1750
1751
|
className: "vibe-shadcn-tiptap__image-title",
|
|
1751
|
-
children: [/* @__PURE__ */
|
|
1752
|
+
children: [/* @__PURE__ */ U(st, {
|
|
1752
1753
|
size: 16,
|
|
1753
1754
|
"aria-hidden": "true"
|
|
1754
|
-
}), /* @__PURE__ */
|
|
1755
|
+
}), /* @__PURE__ */ U(o.Title, {
|
|
1755
1756
|
title: C,
|
|
1756
1757
|
children: C
|
|
1757
1758
|
})]
|
|
1758
|
-
}), /* @__PURE__ */
|
|
1759
|
+
}), /* @__PURE__ */ W("div", {
|
|
1759
1760
|
className: "vibe-shadcn-tiptap__image-controls",
|
|
1760
1761
|
children: [
|
|
1761
|
-
v && /* @__PURE__ */
|
|
1762
|
+
v && /* @__PURE__ */ W("div", {
|
|
1762
1763
|
className: "vibe-shadcn-tiptap__image-controls-group",
|
|
1763
1764
|
children: [
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
+
/* @__PURE__ */ U($, {
|
|
1765
1766
|
appearance: e?.iconButton,
|
|
1766
1767
|
size: "icon",
|
|
1767
1768
|
label: n("image.preview.previous"),
|
|
1768
1769
|
overlayTarget: r,
|
|
1769
1770
|
onClick: () => w(-1),
|
|
1770
|
-
children: /* @__PURE__ */
|
|
1771
|
+
children: /* @__PURE__ */ U(Be, {
|
|
1771
1772
|
size: 16,
|
|
1772
1773
|
"aria-hidden": "true"
|
|
1773
1774
|
})
|
|
1774
1775
|
}),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ W("span", {
|
|
1776
1777
|
"aria-live": "polite",
|
|
1777
1778
|
children: [
|
|
1778
1779
|
c + 1,
|
|
@@ -1780,34 +1781,34 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1780
1781
|
s.length
|
|
1781
1782
|
]
|
|
1782
1783
|
}),
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ U($, {
|
|
1784
1785
|
appearance: e?.iconButton,
|
|
1785
1786
|
size: "icon",
|
|
1786
1787
|
label: n("image.preview.next"),
|
|
1787
1788
|
overlayTarget: r,
|
|
1788
1789
|
onClick: () => w(1),
|
|
1789
|
-
children: /* @__PURE__ */
|
|
1790
|
+
children: /* @__PURE__ */ U(Ve, {
|
|
1790
1791
|
size: 16,
|
|
1791
1792
|
"aria-hidden": "true"
|
|
1792
1793
|
})
|
|
1793
1794
|
})
|
|
1794
1795
|
]
|
|
1795
1796
|
}),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ W("div", {
|
|
1797
1798
|
className: "vibe-shadcn-tiptap__image-controls-group",
|
|
1798
1799
|
children: [
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ U($, {
|
|
1800
1801
|
appearance: e?.iconButton,
|
|
1801
1802
|
size: "icon",
|
|
1802
1803
|
label: n("image.preview.zoomOut"),
|
|
1803
1804
|
overlayTarget: r,
|
|
1804
1805
|
onClick: () => void h.current?.zoomOut(.1),
|
|
1805
|
-
children: /* @__PURE__ */
|
|
1806
|
+
children: /* @__PURE__ */ U(Xt, {
|
|
1806
1807
|
size: 16,
|
|
1807
1808
|
"aria-hidden": "true"
|
|
1808
1809
|
})
|
|
1809
1810
|
}),
|
|
1810
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ W($, {
|
|
1811
1812
|
appearance: e?.button,
|
|
1812
1813
|
size: "sm",
|
|
1813
1814
|
label: `${f}% · ${n("image.preview.reset")}`,
|
|
@@ -1817,69 +1818,69 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1817
1818
|
onClick: () => void h.current?.centerView(1),
|
|
1818
1819
|
children: [f, "%"]
|
|
1819
1820
|
}),
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ U($, {
|
|
1821
1822
|
appearance: e?.iconButton,
|
|
1822
1823
|
size: "icon",
|
|
1823
1824
|
label: n("image.preview.zoomIn"),
|
|
1824
1825
|
overlayTarget: r,
|
|
1825
1826
|
onClick: () => void h.current?.zoomIn(.1),
|
|
1826
|
-
children: /* @__PURE__ */
|
|
1827
|
+
children: /* @__PURE__ */ U(Yt, {
|
|
1827
1828
|
size: 16,
|
|
1828
1829
|
"aria-hidden": "true"
|
|
1829
1830
|
})
|
|
1830
1831
|
})
|
|
1831
1832
|
]
|
|
1832
1833
|
}),
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ W("div", {
|
|
1834
1835
|
className: "vibe-shadcn-tiptap__image-controls-group",
|
|
1835
1836
|
children: [
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ U($, {
|
|
1837
1838
|
appearance: e?.iconButton,
|
|
1838
1839
|
size: "icon",
|
|
1839
1840
|
label: n("image.preview.rotateLeft"),
|
|
1840
1841
|
overlayTarget: r,
|
|
1841
1842
|
onClick: () => d((e) => (e - 90) % 360),
|
|
1842
|
-
children: /* @__PURE__ */
|
|
1843
|
+
children: /* @__PURE__ */ U(Nt, {
|
|
1843
1844
|
size: 16,
|
|
1844
1845
|
"aria-hidden": "true"
|
|
1845
1846
|
})
|
|
1846
1847
|
}),
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ U($, {
|
|
1848
1849
|
appearance: e?.iconButton,
|
|
1849
1850
|
size: "icon",
|
|
1850
1851
|
label: n("image.preview.rotateRight"),
|
|
1851
1852
|
overlayTarget: r,
|
|
1852
1853
|
onClick: () => d((e) => (e + 90) % 360),
|
|
1853
|
-
children: /* @__PURE__ */
|
|
1854
|
+
children: /* @__PURE__ */ U(Pt, {
|
|
1854
1855
|
size: 16,
|
|
1855
1856
|
"aria-hidden": "true"
|
|
1856
1857
|
})
|
|
1857
1858
|
}),
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ U(Q, {
|
|
1859
1860
|
appearance: e?.button,
|
|
1860
1861
|
asChild: !0,
|
|
1861
1862
|
className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__image-download",
|
|
1862
|
-
children: /* @__PURE__ */
|
|
1863
|
+
children: /* @__PURE__ */ W("a", {
|
|
1863
1864
|
href: b,
|
|
1864
1865
|
download: S ?? "",
|
|
1865
1866
|
"aria-disabled": !b || void 0,
|
|
1866
1867
|
target: "_blank",
|
|
1867
1868
|
rel: "noreferrer",
|
|
1868
|
-
children: [/* @__PURE__ */
|
|
1869
|
+
children: [/* @__PURE__ */ U(Ke, {
|
|
1869
1870
|
size: 16,
|
|
1870
1871
|
"aria-hidden": "true"
|
|
1871
1872
|
}), n("image.preview.download")]
|
|
1872
1873
|
})
|
|
1873
1874
|
}),
|
|
1874
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ U(o.Close, {
|
|
1875
1876
|
asChild: !0,
|
|
1876
|
-
children: /* @__PURE__ */
|
|
1877
|
+
children: /* @__PURE__ */ U($, {
|
|
1877
1878
|
appearance: e?.iconButton,
|
|
1878
1879
|
ref: _,
|
|
1879
1880
|
size: "icon",
|
|
1880
1881
|
label: n("image.preview.close"),
|
|
1881
1882
|
overlayTarget: r,
|
|
1882
|
-
children: /* @__PURE__ */
|
|
1883
|
+
children: /* @__PURE__ */ U(Jt, {
|
|
1883
1884
|
size: 16,
|
|
1884
1885
|
"aria-hidden": "true"
|
|
1885
1886
|
})
|
|
@@ -1888,7 +1889,7 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1888
1889
|
]
|
|
1889
1890
|
})
|
|
1890
1891
|
]
|
|
1891
|
-
})] }), /* @__PURE__ */
|
|
1892
|
+
})] }), /* @__PURE__ */ U("div", {
|
|
1892
1893
|
className: "vibe-shadcn-tiptap__image-stage",
|
|
1893
1894
|
onPointerDown: (e) => {
|
|
1894
1895
|
e.shiftKey && e.button === 0 && e.isPrimary && (m.current = {
|
|
@@ -1904,7 +1905,7 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1904
1905
|
onLostPointerCapture: (e) => {
|
|
1905
1906
|
m.current?.pointerId === e.pointerId && (m.current = null);
|
|
1906
1907
|
},
|
|
1907
|
-
children: /* @__PURE__ */
|
|
1908
|
+
children: /* @__PURE__ */ U(rn, {
|
|
1908
1909
|
ref: h,
|
|
1909
1910
|
centerOnInit: !0,
|
|
1910
1911
|
centerZoomedOut: !0,
|
|
@@ -1919,10 +1920,10 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1919
1920
|
activationKeys: (e) => !e.includes("Shift")
|
|
1920
1921
|
},
|
|
1921
1922
|
onTransform: (e, { scale: t }) => p(Math.round(t * 100)),
|
|
1922
|
-
children: /* @__PURE__ */
|
|
1923
|
+
children: /* @__PURE__ */ U(nn, {
|
|
1923
1924
|
wrapperClass: "vibe-shadcn-tiptap__image-viewport",
|
|
1924
1925
|
contentClass: "vibe-shadcn-tiptap__image-plane",
|
|
1925
|
-
children: /* @__PURE__ */
|
|
1926
|
+
children: /* @__PURE__ */ U("img", {
|
|
1926
1927
|
src: y,
|
|
1927
1928
|
alt: S ?? "",
|
|
1928
1929
|
draggable: !1,
|
|
@@ -1934,33 +1935,117 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
|
|
|
1934
1935
|
})
|
|
1935
1936
|
});
|
|
1936
1937
|
}
|
|
1938
|
+
// src/mention-menu.tsx
|
|
1939
|
+
function ar({ state: e, target: t, t: n, renderItem: r }) {
|
|
1940
|
+
let { editor: i, items: a, selectedIndex: o, mount: s, loading: c } = e, l = `vibe-tiptap-mention-${i.instanceId}`, u = a[o] ? `${l}-${o}` : void 0, d = q(null);
|
|
1941
|
+
return K(() => {
|
|
1942
|
+
let e = d.current;
|
|
1943
|
+
if (e) return s(e);
|
|
1944
|
+
}, [s, t]), K(() => {
|
|
1945
|
+
let e = i.view.dom, t = d.current;
|
|
1946
|
+
if (!u || !t) return;
|
|
1947
|
+
let n = e.getAttribute("aria-activedescendant"), r = e.getAttribute("aria-controls");
|
|
1948
|
+
e.setAttribute("aria-activedescendant", u), e.setAttribute("aria-controls", l);
|
|
1949
|
+
let a = e.ownerDocument.getElementById(u);
|
|
1950
|
+
return a && a.offsetTop < t.scrollTop && (t.scrollTop = a.offsetTop), a && a.offsetTop + a.offsetHeight > t.scrollTop + t.clientHeight && (t.scrollTop = a.offsetTop + a.offsetHeight - t.clientHeight), () => {
|
|
1951
|
+
n === null ? e.removeAttribute("aria-activedescendant") : e.setAttribute("aria-activedescendant", n), r === null ? e.removeAttribute("aria-controls") : e.setAttribute("aria-controls", r);
|
|
1952
|
+
};
|
|
1953
|
+
}, [
|
|
1954
|
+
i,
|
|
1955
|
+
u,
|
|
1956
|
+
l
|
|
1957
|
+
]), an(/* @__PURE__ */ U("div", {
|
|
1958
|
+
ref: d,
|
|
1959
|
+
className: "z-3 vibe-shadcn-tiptap__mention",
|
|
1960
|
+
children: a.length ? /* @__PURE__ */ U("div", {
|
|
1961
|
+
id: l,
|
|
1962
|
+
role: "listbox",
|
|
1963
|
+
"aria-label": n("mention.label"),
|
|
1964
|
+
children: a.map((t, n) => /* @__PURE__ */ U("button", {
|
|
1965
|
+
id: `${l}-${n}`,
|
|
1966
|
+
type: "button",
|
|
1967
|
+
role: "option",
|
|
1968
|
+
tabIndex: -1,
|
|
1969
|
+
"aria-label": t.label,
|
|
1970
|
+
"aria-selected": n === o,
|
|
1971
|
+
className: "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",
|
|
1972
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1973
|
+
onClick: () => e.command(t),
|
|
1974
|
+
children: r ? r(t) : /* @__PURE__ */ W(he, { children: [t.avatar && /* @__PURE__ */ U("img", {
|
|
1975
|
+
src: t.avatar,
|
|
1976
|
+
alt: "",
|
|
1977
|
+
className: "vibe-tiptap-mention-avatar"
|
|
1978
|
+
}), /* @__PURE__ */ U("span", { children: t.label })] })
|
|
1979
|
+
}, t.id))
|
|
1980
|
+
}) : /* @__PURE__ */ U("div", {
|
|
1981
|
+
className: "px-3 py-1 text-sm",
|
|
1982
|
+
role: "status",
|
|
1983
|
+
children: n(c ? "mention.loading" : "mention.empty")
|
|
1984
|
+
})
|
|
1985
|
+
}), t);
|
|
1986
|
+
}
|
|
1987
|
+
// src/mention-popover.tsx
|
|
1988
|
+
function or({ editor: e, container: t, render: n, hoverDelay: r }) {
|
|
1989
|
+
let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c = Te(() => ({ current: {
|
|
1990
|
+
contextElement: e,
|
|
1991
|
+
getBoundingClientRect: () => a?.element.getBoundingClientRect() ?? new DOMRect()
|
|
1992
|
+
} }), [e, a]);
|
|
1993
|
+
return G(() => {
|
|
1994
|
+
let t = on(e, o, r);
|
|
1995
|
+
return s.current = t, () => {
|
|
1996
|
+
t.destroy(), s.current = void 0;
|
|
1997
|
+
};
|
|
1998
|
+
}, [e, r]), /* @__PURE__ */ W(i.Root, {
|
|
1999
|
+
open: !!a,
|
|
2000
|
+
onOpenChange: (e) => {
|
|
2001
|
+
e || s.current?.close();
|
|
2002
|
+
},
|
|
2003
|
+
children: [/* @__PURE__ */ U(i.Anchor, { virtualRef: c }), /* @__PURE__ */ U(i.Content, {
|
|
2004
|
+
container: t ?? e.ownerDocument.body,
|
|
2005
|
+
side: "top",
|
|
2006
|
+
align: "center",
|
|
2007
|
+
sideOffset: 6,
|
|
2008
|
+
collisionPadding: 8,
|
|
2009
|
+
className: "z-3 p-2",
|
|
2010
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
2011
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2012
|
+
onFocusOutside: (e) => e.preventDefault(),
|
|
2013
|
+
onPointerDownOutside: (t) => {
|
|
2014
|
+
ie(e, t.target) && t.preventDefault();
|
|
2015
|
+
},
|
|
2016
|
+
onMouseEnter: () => s.current?.keepOpen(),
|
|
2017
|
+
onMouseLeave: () => s.current?.leave(),
|
|
2018
|
+
children: a && n(a)
|
|
2019
|
+
})]
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
1937
2022
|
// src/slash-menu.tsx
|
|
1938
|
-
var
|
|
1939
|
-
heading1:
|
|
1940
|
-
heading:
|
|
1941
|
-
heading3:
|
|
1942
|
-
heading4:
|
|
1943
|
-
todo:
|
|
1944
|
-
bulletList:
|
|
1945
|
-
orderedList:
|
|
1946
|
-
blockquote:
|
|
1947
|
-
table:
|
|
1948
|
-
image:
|
|
1949
|
-
imageUrl:
|
|
1950
|
-
whiteboard:
|
|
1951
|
-
video:
|
|
1952
|
-
videoUrl:
|
|
1953
|
-
audio:
|
|
1954
|
-
audioUrl:
|
|
1955
|
-
upload:
|
|
1956
|
-
link:
|
|
1957
|
-
codeBlock:
|
|
1958
|
-
mermaid:
|
|
2023
|
+
var sr = {
|
|
2024
|
+
heading1: $e,
|
|
2025
|
+
heading: et,
|
|
2026
|
+
heading3: tt,
|
|
2027
|
+
heading4: nt,
|
|
2028
|
+
todo: ht,
|
|
2029
|
+
bulletList: mt,
|
|
2030
|
+
orderedList: gt,
|
|
2031
|
+
blockquote: kt,
|
|
2032
|
+
table: zt,
|
|
2033
|
+
image: lt,
|
|
2034
|
+
imageUrl: ct,
|
|
2035
|
+
whiteboard: Tt,
|
|
2036
|
+
video: Kt,
|
|
2037
|
+
videoUrl: Ht,
|
|
2038
|
+
audio: xt,
|
|
2039
|
+
audioUrl: xt,
|
|
2040
|
+
upload: Ct,
|
|
2041
|
+
link: pt,
|
|
2042
|
+
codeBlock: Ue,
|
|
2043
|
+
mermaid: qt,
|
|
1959
2044
|
divider: "solid",
|
|
1960
2045
|
dividerThick: "thick",
|
|
1961
2046
|
dividerDashed: "dashed",
|
|
1962
2047
|
dividerDotted: "dotted"
|
|
1963
|
-
},
|
|
2048
|
+
}, cr = {
|
|
1964
2049
|
heading1: "slashCommand.group.headings",
|
|
1965
2050
|
heading: "slashCommand.group.headings",
|
|
1966
2051
|
heading3: "slashCommand.group.headings",
|
|
@@ -1986,9 +2071,9 @@ var nr = {
|
|
|
1986
2071
|
dividerDashed: "slashCommand.group.dividers",
|
|
1987
2072
|
dividerDotted: "slashCommand.group.dividers"
|
|
1988
2073
|
};
|
|
1989
|
-
function
|
|
1990
|
-
let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u =
|
|
1991
|
-
|
|
2074
|
+
function lr({ appearance: e, state: t, target: n, t: r }) {
|
|
2075
|
+
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
|
+
K(() => {
|
|
1992
2077
|
let e = u.current;
|
|
1993
2078
|
if (e) return e.style.visibility = "hidden", c(e, { onPosition: ({ x: t, y: n, strategy: r }) => {
|
|
1994
2079
|
Object.assign(e.style, {
|
|
@@ -1998,7 +2083,7 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
|
|
|
1998
2083
|
visibility: ""
|
|
1999
2084
|
});
|
|
2000
2085
|
} });
|
|
2001
|
-
}, [c, n]),
|
|
2086
|
+
}, [c, n]), K(() => {
|
|
2002
2087
|
let e = i.view.dom;
|
|
2003
2088
|
if (!f) return;
|
|
2004
2089
|
let t = e.getAttribute("aria-activedescendant"), n = e.getAttribute("aria-controls");
|
|
@@ -2013,30 +2098,30 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2013
2098
|
l
|
|
2014
2099
|
]);
|
|
2015
2100
|
let p = [];
|
|
2016
|
-
if (
|
|
2101
|
+
if (z(o)) p.push({ items: a });
|
|
2017
2102
|
else for (let e of a) {
|
|
2018
|
-
let t = e.disabledReason ? "slashCommand.group.unavailable" :
|
|
2103
|
+
let t = e.disabledReason ? "slashCommand.group.unavailable" : cr[e.id], n = p.at(-1);
|
|
2019
2104
|
n?.label === t ? n.items.push(e) : p.push({
|
|
2020
2105
|
label: t,
|
|
2021
2106
|
items: [e]
|
|
2022
2107
|
});
|
|
2023
2108
|
}
|
|
2024
|
-
return
|
|
2109
|
+
return an(/* @__PURE__ */ U("div", {
|
|
2025
2110
|
ref: u,
|
|
2026
|
-
className:
|
|
2027
|
-
children: a.length ? /* @__PURE__ */
|
|
2111
|
+
className: Y("z-3 vibe-shadcn-tiptap__slash", e?.className),
|
|
2112
|
+
children: a.length ? /* @__PURE__ */ U("div", {
|
|
2028
2113
|
id: l,
|
|
2029
2114
|
role: "listbox",
|
|
2030
2115
|
"aria-label": r("slashCommand.label"),
|
|
2031
|
-
children: p.map(({ label: n, items: i }) => /* @__PURE__ */
|
|
2116
|
+
children: p.map(({ label: n, items: i }) => /* @__PURE__ */ W("div", {
|
|
2032
2117
|
...n ? {
|
|
2033
2118
|
role: "group",
|
|
2034
2119
|
"aria-label": r(n)
|
|
2035
2120
|
} : {},
|
|
2036
|
-
children: [n && /* @__PURE__ */
|
|
2121
|
+
children: [n && /* @__PURE__ */ U("div", {
|
|
2037
2122
|
className: "vibe-shadcn-tiptap__slash-label",
|
|
2038
2123
|
children: r(n)
|
|
2039
|
-
}), i.map((n) => /* @__PURE__ */
|
|
2124
|
+
}), i.map((n) => /* @__PURE__ */ W("button", {
|
|
2040
2125
|
id: `${l}-${n.id}`,
|
|
2041
2126
|
type: "button",
|
|
2042
2127
|
role: "option",
|
|
@@ -2045,94 +2130,94 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
|
|
|
2045
2130
|
"aria-selected": n === d && !n.disabledReason,
|
|
2046
2131
|
"aria-describedby": n.disabledReason || n.hint ? `${l}-${n.id}-hint` : void 0,
|
|
2047
2132
|
disabled: !!n.disabledReason,
|
|
2048
|
-
className:
|
|
2133
|
+
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 whitespace-nowrap enabled:hover:bg-accent enabled:hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground disabled:opacity-40", e?.button?.className),
|
|
2049
2134
|
onMouseDown: (e) => e.preventDefault(),
|
|
2050
2135
|
onClick: () => t.command(n),
|
|
2051
2136
|
children: [
|
|
2052
|
-
/* @__PURE__ */
|
|
2137
|
+
/* @__PURE__ */ U(ur, { command: n.id }),
|
|
2053
2138
|
n.label,
|
|
2054
|
-
(n.disabledReason || n.hint) && /* @__PURE__ */
|
|
2139
|
+
(n.disabledReason || n.hint) && /* @__PURE__ */ U("small", {
|
|
2055
2140
|
id: `${l}-${n.id}-hint`,
|
|
2056
2141
|
children: n.disabledReason || n.hint
|
|
2057
2142
|
})
|
|
2058
2143
|
]
|
|
2059
2144
|
}, n.id))]
|
|
2060
2145
|
}, i[0]?.id ?? "results"))
|
|
2061
|
-
}) : !t.loading && /* @__PURE__ */
|
|
2146
|
+
}) : !t.loading && /* @__PURE__ */ U("div", {
|
|
2062
2147
|
role: "status",
|
|
2063
2148
|
children: r("slashCommand.empty")
|
|
2064
2149
|
})
|
|
2065
2150
|
}), n);
|
|
2066
2151
|
}
|
|
2067
|
-
function
|
|
2068
|
-
let t =
|
|
2069
|
-
return /* @__PURE__ */
|
|
2152
|
+
function ur({ command: e }) {
|
|
2153
|
+
let t = sr[e];
|
|
2154
|
+
return /* @__PURE__ */ U("span", {
|
|
2070
2155
|
className: "vibe-shadcn-tiptap__slash-icon",
|
|
2071
2156
|
"aria-hidden": !0,
|
|
2072
|
-
children: typeof t == "string" ? /* @__PURE__ */
|
|
2157
|
+
children: typeof t == "string" ? /* @__PURE__ */ U("span", {
|
|
2073
2158
|
className: "vibe-shadcn-tiptap__divider-icon",
|
|
2074
2159
|
"data-style": t
|
|
2075
|
-
}) : /* @__PURE__ */
|
|
2160
|
+
}) : /* @__PURE__ */ U(t, { size: 18 })
|
|
2076
2161
|
});
|
|
2077
2162
|
}
|
|
2078
2163
|
// src/table-grips.tsx
|
|
2079
|
-
var
|
|
2164
|
+
var dr = ["row", "column"], fr = {
|
|
2080
2165
|
row: [
|
|
2081
2166
|
[
|
|
2082
2167
|
"addRowBefore",
|
|
2083
2168
|
"table.insertAbove",
|
|
2084
|
-
|
|
2169
|
+
Dt
|
|
2085
2170
|
],
|
|
2086
2171
|
[
|
|
2087
2172
|
"addRowAfter",
|
|
2088
2173
|
"table.insertBelow",
|
|
2089
|
-
|
|
2174
|
+
Dt
|
|
2090
2175
|
],
|
|
2091
2176
|
[
|
|
2092
2177
|
"moveRowUp",
|
|
2093
2178
|
"table.moveUp",
|
|
2094
|
-
|
|
2179
|
+
Fe
|
|
2095
2180
|
],
|
|
2096
2181
|
[
|
|
2097
2182
|
"moveRowDown",
|
|
2098
2183
|
"table.moveDown",
|
|
2099
|
-
|
|
2184
|
+
Me
|
|
2100
2185
|
]
|
|
2101
2186
|
],
|
|
2102
2187
|
column: [
|
|
2103
2188
|
[
|
|
2104
2189
|
"addColumnBefore",
|
|
2105
2190
|
"table.insertLeft",
|
|
2106
|
-
|
|
2191
|
+
Dt
|
|
2107
2192
|
],
|
|
2108
2193
|
[
|
|
2109
2194
|
"addColumnAfter",
|
|
2110
2195
|
"table.insertRight",
|
|
2111
|
-
|
|
2196
|
+
Dt
|
|
2112
2197
|
],
|
|
2113
2198
|
[
|
|
2114
2199
|
"moveColumnLeft",
|
|
2115
2200
|
"table.moveLeft",
|
|
2116
|
-
|
|
2201
|
+
Ne
|
|
2117
2202
|
],
|
|
2118
2203
|
[
|
|
2119
2204
|
"moveColumnRight",
|
|
2120
2205
|
"table.moveRight",
|
|
2121
|
-
|
|
2206
|
+
Pe
|
|
2122
2207
|
]
|
|
2123
2208
|
]
|
|
2124
2209
|
};
|
|
2125
|
-
function
|
|
2126
|
-
let { DropdownMenu: r } =
|
|
2210
|
+
function pr({ appearance: e, context: t, overlayTarget: n }) {
|
|
2211
|
+
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);
|
|
2127
2212
|
function g(e) {
|
|
2128
2213
|
let { view: t, state: n } = i;
|
|
2129
|
-
if (t.dom.contains(e)) return
|
|
2214
|
+
if (t.dom.contains(e)) return cn(n.doc.resolve(t.posAtDOM(e, 0)));
|
|
2130
2215
|
}
|
|
2131
2216
|
function _(e, t) {
|
|
2132
2217
|
let n = g(t.cell);
|
|
2133
2218
|
return !!(n && a.selectTableLineAt(e, n.pos, t[e]));
|
|
2134
2219
|
}
|
|
2135
|
-
if (
|
|
2220
|
+
if (G(() => {
|
|
2136
2221
|
let e = i.view.dom.parentElement, t = e?.parentElement;
|
|
2137
2222
|
if (!t) return;
|
|
2138
2223
|
function n() {
|
|
@@ -2156,10 +2241,10 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2156
2241
|
}
|
|
2157
2242
|
let o = a.closest("table");
|
|
2158
2243
|
if (!o || !e?.contains(o) || i.isDestroyed) return;
|
|
2159
|
-
let s =
|
|
2244
|
+
let s = cn(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
|
|
2160
2245
|
if (!s) return;
|
|
2161
2246
|
n();
|
|
2162
|
-
let { left: c, right: d, top: f } =
|
|
2247
|
+
let { left: c, right: d, top: f } = sn.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))));
|
|
2163
2248
|
for (let e = c; e < d; e += 1) {
|
|
2164
2249
|
let n = p[e]?.getBoundingClientRect();
|
|
2165
2250
|
if (n && n.width > 0 && t.clientX < n.right) {
|
|
@@ -2177,7 +2262,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2177
2262
|
return t.addEventListener("pointermove", a), t.addEventListener("pointerleave", r), () => {
|
|
2178
2263
|
n(), t.removeEventListener("pointermove", a), t.removeEventListener("pointerleave", r);
|
|
2179
2264
|
};
|
|
2180
|
-
}, [u, i]),
|
|
2265
|
+
}, [u, i]), K(() => {
|
|
2181
2266
|
let e = i.view.dom.parentElement, t = e?.parentElement, n = t?.ownerDocument.defaultView;
|
|
2182
2267
|
if (!c || !t || !e || !n) {
|
|
2183
2268
|
p(void 0);
|
|
@@ -2186,7 +2271,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2186
2271
|
let r = t, a = e, o = c;
|
|
2187
2272
|
function s() {
|
|
2188
2273
|
if (i.isDestroyed) return;
|
|
2189
|
-
let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ?
|
|
2274
|
+
let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ? cn(i.state.doc.resolve(i.view.posAtDOM(e, 0))) : void 0;
|
|
2190
2275
|
if (!c || !u) {
|
|
2191
2276
|
l(void 0), d(void 0);
|
|
2192
2277
|
return;
|
|
@@ -2196,7 +2281,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2196
2281
|
l(void 0), d(void 0);
|
|
2197
2282
|
return;
|
|
2198
2283
|
}
|
|
2199
|
-
let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } =
|
|
2284
|
+
let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } = sn.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);
|
|
2200
2285
|
p({
|
|
2201
2286
|
row: {
|
|
2202
2287
|
left: Math.max(m.left + 11, h.left - 11) - f.left,
|
|
@@ -2219,7 +2304,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2219
2304
|
function v(e, t) {
|
|
2220
2305
|
let n = g(t.cell);
|
|
2221
2306
|
if (!n) return !1;
|
|
2222
|
-
let r = n.node(-1), i =
|
|
2307
|
+
let r = n.node(-1), i = sn.get(r);
|
|
2223
2308
|
return i.cellsInRect({
|
|
2224
2309
|
left: 0,
|
|
2225
2310
|
top: 0,
|
|
@@ -2227,20 +2312,20 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2227
2312
|
bottom: e === "column" ? i.height : 1
|
|
2228
2313
|
}).every((e) => r.nodeAt(e)?.type.spec.tableRole === "header_cell");
|
|
2229
2314
|
}
|
|
2230
|
-
return
|
|
2231
|
-
let s = t === "row" ?
|
|
2315
|
+
return dr.map((t) => {
|
|
2316
|
+
let s = t === "row" ? Je : qe, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
|
|
2232
2317
|
function m(e) {
|
|
2233
2318
|
c && i.isEditable && _(t, c) && (h.current = !0, e(), l(void 0), d(void 0));
|
|
2234
2319
|
}
|
|
2235
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ W(r.Root, {
|
|
2236
2321
|
modal: !1,
|
|
2237
2322
|
open: u === t,
|
|
2238
2323
|
onOpenChange: (e) => {
|
|
2239
2324
|
e ? (h.current = !1, _(t, c) && d(t)) : d(void 0);
|
|
2240
2325
|
},
|
|
2241
|
-
children: [/* @__PURE__ */
|
|
2326
|
+
children: [/* @__PURE__ */ U(r.Trigger, {
|
|
2242
2327
|
asChild: !0,
|
|
2243
|
-
children: /* @__PURE__ */
|
|
2328
|
+
children: /* @__PURE__ */ U($, {
|
|
2244
2329
|
label: p,
|
|
2245
2330
|
appearance: e?.button,
|
|
2246
2331
|
defaultSizeClassName: "size-5 p-0",
|
|
@@ -2248,40 +2333,40 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2248
2333
|
style: f[t],
|
|
2249
2334
|
overlayTarget: n,
|
|
2250
2335
|
onMouseDown: (e) => e.preventDefault(),
|
|
2251
|
-
children: /* @__PURE__ */
|
|
2336
|
+
children: /* @__PURE__ */ U(s, {
|
|
2252
2337
|
size: 16,
|
|
2253
2338
|
"aria-hidden": !0
|
|
2254
2339
|
})
|
|
2255
2340
|
})
|
|
2256
|
-
}), /* @__PURE__ */
|
|
2341
|
+
}), /* @__PURE__ */ W(r.Content, {
|
|
2257
2342
|
container: n,
|
|
2258
|
-
className:
|
|
2343
|
+
className: Y("z-3", e?.className),
|
|
2259
2344
|
align: "start",
|
|
2260
2345
|
side: t === "row" ? "right" : "top",
|
|
2261
2346
|
onCloseAutoFocus: (e) => {
|
|
2262
2347
|
h.current && e.preventDefault();
|
|
2263
2348
|
},
|
|
2264
2349
|
children: [
|
|
2265
|
-
|
|
2350
|
+
fr[t].map(([e, t, n]) => /* @__PURE__ */ W(r.Item, {
|
|
2266
2351
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2267
2352
|
onSelect: () => m(a[e]),
|
|
2268
|
-
children: [/* @__PURE__ */
|
|
2353
|
+
children: [/* @__PURE__ */ U(n, {
|
|
2269
2354
|
size: 15,
|
|
2270
2355
|
"aria-hidden": !0
|
|
2271
2356
|
}), o(t)]
|
|
2272
2357
|
}, e)),
|
|
2273
|
-
c[t] === 0 && /* @__PURE__ */
|
|
2358
|
+
c[t] === 0 && /* @__PURE__ */ W(r.Item, {
|
|
2274
2359
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2275
2360
|
onSelect: () => m(t === "row" ? a.toggleHeaderRow : a.toggleHeaderColumn),
|
|
2276
|
-
children: [/* @__PURE__ */
|
|
2361
|
+
children: [/* @__PURE__ */ U(Bt, {
|
|
2277
2362
|
size: 15,
|
|
2278
2363
|
"aria-hidden": !0
|
|
2279
2364
|
}), o(v(t, c) ? "table.unsetHeader" : "table.setHeader")]
|
|
2280
2365
|
}),
|
|
2281
|
-
/* @__PURE__ */
|
|
2366
|
+
/* @__PURE__ */ W(r.Item, {
|
|
2282
2367
|
className: "vibe-shadcn-tiptap__menu-item",
|
|
2283
2368
|
onSelect: () => m(() => t === "row" ? a.deleteRow(c.row) : a.deleteColumn(c.column)),
|
|
2284
|
-
children: [/* @__PURE__ */
|
|
2369
|
+
children: [/* @__PURE__ */ U(Vt, {
|
|
2285
2370
|
size: 15,
|
|
2286
2371
|
"aria-hidden": !0
|
|
2287
2372
|
}), o("table.deleteLine")]
|
|
@@ -2292,54 +2377,73 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
|
|
|
2292
2377
|
});
|
|
2293
2378
|
}
|
|
2294
2379
|
// src/use-vibe-tiptap.ts
|
|
2295
|
-
var
|
|
2296
|
-
function
|
|
2297
|
-
let [t] =
|
|
2380
|
+
var mr = Symbol();
|
|
2381
|
+
function hr(e = {}) {
|
|
2382
|
+
let [t] = J(() => ({ ...e })), [n, r] = J(!1), i = q(void 0), a = q(e), o = q(void 0), s = q(void 0), c = q(void 0), [l] = J(() => {
|
|
2298
2383
|
function e() {
|
|
2299
2384
|
let e = s.current;
|
|
2300
|
-
s.current = void 0, i.current?.onSlash(void 0), e && !e.editor.isDestroyed &&
|
|
2385
|
+
s.current = void 0, i.current?.onSlash(void 0), e && !e.editor.isDestroyed && M(e.editor.view, (t.slashCommand || void 0)?.pluginKey ?? de);
|
|
2386
|
+
}
|
|
2387
|
+
function n() {
|
|
2388
|
+
c.current && te(c.current.editor);
|
|
2301
2389
|
}
|
|
2302
2390
|
return {
|
|
2303
2391
|
bind(t) {
|
|
2304
2392
|
if (i.current) throw Error("useVibeTiptap already has a mounted editor view");
|
|
2305
|
-
return e(), i.current = t, () => {
|
|
2306
|
-
i.current = void 0, e(), r(!1);
|
|
2393
|
+
return e(), n(), i.current = t, () => {
|
|
2394
|
+
i.current = void 0, e(), n(), r(!1);
|
|
2307
2395
|
};
|
|
2308
2396
|
},
|
|
2309
2397
|
closeSlashMenu: e
|
|
2310
2398
|
};
|
|
2311
|
-
}),
|
|
2312
|
-
onOpen:
|
|
2313
|
-
onUpdate:
|
|
2314
|
-
onClose: () =>
|
|
2399
|
+
}), u = {
|
|
2400
|
+
onOpen: d,
|
|
2401
|
+
onUpdate: d,
|
|
2402
|
+
onClose: () => d(void 0),
|
|
2315
2403
|
onExecute: (e) => i.current?.onExecute(e)
|
|
2316
2404
|
};
|
|
2317
|
-
function
|
|
2405
|
+
function d(e) {
|
|
2318
2406
|
s.current = e, i.current?.onSlash(e);
|
|
2319
2407
|
}
|
|
2320
|
-
function
|
|
2408
|
+
function f(e) {
|
|
2409
|
+
c.current = e, i.current?.onMention(e);
|
|
2410
|
+
}
|
|
2411
|
+
let p = t.mention || void 0, m = p && {
|
|
2412
|
+
...p,
|
|
2413
|
+
onOpen(e) {
|
|
2414
|
+
f(e), p.onOpen?.(e);
|
|
2415
|
+
},
|
|
2416
|
+
onUpdate(e) {
|
|
2417
|
+
f(e), p.onUpdate?.(e);
|
|
2418
|
+
},
|
|
2419
|
+
onClose() {
|
|
2420
|
+
f(void 0), p.onClose?.();
|
|
2421
|
+
}
|
|
2422
|
+
};
|
|
2423
|
+
function h() {
|
|
2321
2424
|
let e = o.current;
|
|
2322
2425
|
if (e?.editor.schema.nodes.image) return A(e, () => a.current.uploadAsset, () => a.current.editorBehaviorOptions);
|
|
2323
2426
|
}
|
|
2324
|
-
|
|
2427
|
+
G(() => {
|
|
2325
2428
|
a.current = e;
|
|
2326
2429
|
}, [e]);
|
|
2327
|
-
let
|
|
2430
|
+
let g = pe({
|
|
2328
2431
|
...t,
|
|
2329
2432
|
content: t.initialContent,
|
|
2330
2433
|
editable: (e.editable ?? !0) && !n,
|
|
2331
2434
|
uploadAsset: e.uploadAsset,
|
|
2332
2435
|
editorBehaviorOptions: e.editorBehaviorOptions,
|
|
2333
2436
|
slashCommand: t.slashCommand ?? {},
|
|
2437
|
+
mention: m,
|
|
2334
2438
|
editorProps: {
|
|
2335
2439
|
...t.editorProps,
|
|
2336
2440
|
handleDOMEvents: {
|
|
2337
2441
|
...t.editorProps?.handleDOMEvents,
|
|
2338
2442
|
paste(e, t) {
|
|
2339
|
-
return a.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (
|
|
2443
|
+
return a.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (h()?.onPaste(t), t.defaultPrevented);
|
|
2340
2444
|
},
|
|
2341
2445
|
drop(e, t) {
|
|
2342
|
-
return a.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (
|
|
2446
|
+
return a.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (h()?.onDrop(t), t.defaultPrevented);
|
|
2343
2447
|
}
|
|
2344
2448
|
}
|
|
2345
2449
|
},
|
|
@@ -2350,16 +2454,17 @@ function ur(e = {}) {
|
|
|
2350
2454
|
notify(t, n = "info") {
|
|
2351
2455
|
(e.notify ?? i.current?.notify)?.(t, n);
|
|
2352
2456
|
}
|
|
2353
|
-
}, t.slashCommand === !1 ? void 0 :
|
|
2354
|
-
return
|
|
2457
|
+
}, t.slashCommand === !1 ? void 0 : u);
|
|
2458
|
+
return G(() => (o.current = g, () => {
|
|
2355
2459
|
o.current = void 0;
|
|
2356
|
-
}), [
|
|
2357
|
-
context:
|
|
2358
|
-
[
|
|
2359
|
-
bridge:
|
|
2460
|
+
}), [g]), {
|
|
2461
|
+
context: g,
|
|
2462
|
+
[mr]: {
|
|
2463
|
+
bridge: l,
|
|
2360
2464
|
preview: n,
|
|
2361
2465
|
setPreview: r,
|
|
2362
2466
|
editable: e.editable ?? !0,
|
|
2467
|
+
mentionHoverDelay: p?.hoverDelay,
|
|
2363
2468
|
codeBlockLanguages: t.codeBlockLanguages,
|
|
2364
2469
|
horizontalRules: t.horizontalRules,
|
|
2365
2470
|
uploadAsset: e.uploadAsset,
|
|
@@ -2368,98 +2473,99 @@ function ur(e = {}) {
|
|
|
2368
2473
|
};
|
|
2369
2474
|
}
|
|
2370
2475
|
// src/shadcn-tiptap-editor.tsx
|
|
2371
|
-
function
|
|
2372
|
-
let t =
|
|
2476
|
+
function gr(e) {
|
|
2477
|
+
let t = Rn(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 } = {
|
|
2373
2478
|
...e,
|
|
2374
2479
|
...t
|
|
2375
|
-
}, { context:
|
|
2376
|
-
|
|
2377
|
-
let e =
|
|
2378
|
-
onSlash:
|
|
2480
|
+
}, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[mr], { Tooltip: ee } = n, [D, O] = J(null), [k, A] = J(null), [j, te] = J(!1), [M, N] = J(), [P, F] = J(), [ne, re] = J(), [ie, ae] = J(!1), [I, L] = J(), [oe, R] = J(), [se, z] = J([]), ce = q(0), B = q(/* @__PURE__ */ new Map()), ue = 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
|
+
G(() => {
|
|
2482
|
+
let e = T.bind({
|
|
2483
|
+
onSlash: F,
|
|
2484
|
+
onMention: re,
|
|
2379
2485
|
onExecute: ({ item: e }) => {
|
|
2380
|
-
|
|
2381
|
-
onImage: () =>
|
|
2486
|
+
_ && le(_, e, {
|
|
2487
|
+
onImage: () => L({
|
|
2382
2488
|
kind: "image",
|
|
2383
2489
|
tab: "upload"
|
|
2384
2490
|
}),
|
|
2385
|
-
onImageUrl: () =>
|
|
2491
|
+
onImageUrl: () => L({
|
|
2386
2492
|
kind: "image",
|
|
2387
2493
|
tab: "url"
|
|
2388
2494
|
}),
|
|
2389
|
-
onVideo: () =>
|
|
2495
|
+
onVideo: () => L({
|
|
2390
2496
|
kind: "video",
|
|
2391
2497
|
tab: "upload"
|
|
2392
2498
|
}),
|
|
2393
|
-
onVideoUrl: () =>
|
|
2499
|
+
onVideoUrl: () => L({
|
|
2394
2500
|
kind: "video",
|
|
2395
2501
|
tab: "url"
|
|
2396
2502
|
}),
|
|
2397
|
-
onAudio: () =>
|
|
2503
|
+
onAudio: () => L({
|
|
2398
2504
|
kind: "audio",
|
|
2399
2505
|
tab: "upload"
|
|
2400
2506
|
}),
|
|
2401
|
-
onAudioUrl: () =>
|
|
2507
|
+
onAudioUrl: () => L({
|
|
2402
2508
|
kind: "audio",
|
|
2403
2509
|
tab: "url"
|
|
2404
2510
|
}),
|
|
2405
|
-
onUpload: () =>
|
|
2511
|
+
onUpload: () => L({
|
|
2406
2512
|
kind: "attachment",
|
|
2407
2513
|
tab: "upload"
|
|
2408
2514
|
}),
|
|
2409
|
-
onLink: () =>
|
|
2410
|
-
onWhiteboard: () =>
|
|
2515
|
+
onLink: () => L({ kind: "link" }),
|
|
2516
|
+
onWhiteboard: () => R("new")
|
|
2411
2517
|
});
|
|
2412
2518
|
},
|
|
2413
2519
|
onImagePreview(e) {
|
|
2414
|
-
|
|
2520
|
+
N({
|
|
2415
2521
|
...e,
|
|
2416
2522
|
urls: [...e.urls],
|
|
2417
2523
|
names: e.names?.slice()
|
|
2418
2524
|
});
|
|
2419
2525
|
},
|
|
2420
2526
|
notify(e, t = "info") {
|
|
2421
|
-
let n = ++
|
|
2422
|
-
|
|
2527
|
+
let n = ++ce.current;
|
|
2528
|
+
z((r) => [...r, {
|
|
2423
2529
|
id: n,
|
|
2424
2530
|
message: e,
|
|
2425
2531
|
type: t
|
|
2426
|
-
}]),
|
|
2427
|
-
|
|
2532
|
+
}]), B.current.set(n, setTimeout(() => {
|
|
2533
|
+
B.current.delete(n), z((e) => e.filter((e) => e.id !== n));
|
|
2428
2534
|
}, 3e3));
|
|
2429
2535
|
}
|
|
2430
|
-
}), t =
|
|
2536
|
+
}), t = B.current;
|
|
2431
2537
|
return () => {
|
|
2432
2538
|
e();
|
|
2433
2539
|
for (let e of t.values()) clearTimeout(e);
|
|
2434
|
-
t.clear(),
|
|
2540
|
+
t.clear(), z([]), F(void 0), re(void 0), N(void 0), L(void 0), R(void 0), ae(!1);
|
|
2435
2541
|
};
|
|
2436
|
-
}, [
|
|
2437
|
-
|
|
2438
|
-
}, [
|
|
2439
|
-
if (!
|
|
2440
|
-
let e =
|
|
2542
|
+
}, [T, _]), G(() => {
|
|
2543
|
+
de || b(!1);
|
|
2544
|
+
}, [de, b]), G(() => {
|
|
2545
|
+
if (!D) return;
|
|
2546
|
+
let e = D.ownerDocument, t = () => te(e.fullscreenElement === D);
|
|
2441
2547
|
return e.addEventListener("fullscreenchange", t), () => e.removeEventListener("fullscreenchange", t);
|
|
2442
|
-
}, [
|
|
2443
|
-
|
|
2548
|
+
}, [D]), G(() => {
|
|
2549
|
+
V || (L(void 0), R(void 0), ae(!1)), !V && P && T.closeSlashMenu();
|
|
2444
2550
|
}, [
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2551
|
+
T,
|
|
2552
|
+
V,
|
|
2553
|
+
P
|
|
2448
2554
|
]);
|
|
2449
|
-
async function
|
|
2450
|
-
if (
|
|
2451
|
-
|
|
2555
|
+
async function pe(e) {
|
|
2556
|
+
if (D && !ue.current && e !== j) {
|
|
2557
|
+
ue.current = !0;
|
|
2452
2558
|
try {
|
|
2453
|
-
e ? await
|
|
2559
|
+
e ? await D.requestFullscreen() : await D.ownerDocument.exitFullscreen();
|
|
2454
2560
|
} catch {
|
|
2455
|
-
|
|
2561
|
+
_ && !_.editor.isDestroyed && _.notify(_.t("notify.fullscreenFailed"), "warning");
|
|
2456
2562
|
} finally {
|
|
2457
|
-
|
|
2563
|
+
ue.current = !1;
|
|
2458
2564
|
}
|
|
2459
2565
|
}
|
|
2460
2566
|
}
|
|
2461
|
-
function
|
|
2462
|
-
let t =
|
|
2567
|
+
function me(e) {
|
|
2568
|
+
let t = _?.editor;
|
|
2463
2569
|
if (!t?.isEditable || e.defaultPrevented || e.button !== 0 || e.shiftKey || e.ctrlKey || e.metaKey || e.altKey || !(e.target instanceof Element)) return;
|
|
2464
2570
|
let n = e.target.closest("a[href]"), { view: r, state: i } = t, a = i.schema.marks.link;
|
|
2465
2571
|
if (!n || !r.dom.contains(n) || !a) return;
|
|
@@ -2467,125 +2573,137 @@ function dr(e) {
|
|
|
2467
2573
|
if (!o.nodeAfter?.isText) return;
|
|
2468
2574
|
let s = a.isInSet(o.nodeAfter.marks);
|
|
2469
2575
|
if (!s || s.attrs.href !== n.getAttribute("href")) return;
|
|
2470
|
-
let c =
|
|
2576
|
+
let c = ge(o, a, s.attrs);
|
|
2471
2577
|
if (!c) return;
|
|
2472
2578
|
e.preventDefault();
|
|
2473
2579
|
let { from: l, to: u } = i.selection;
|
|
2474
2580
|
(l < c.from || l >= c.to || u > c.to) && t.commands.setTextSelection(c), r.focus();
|
|
2475
2581
|
}
|
|
2476
|
-
return /* @__PURE__ */
|
|
2582
|
+
return /* @__PURE__ */ U(fn, {
|
|
2477
2583
|
value: n,
|
|
2478
|
-
children: /* @__PURE__ */
|
|
2584
|
+
children: /* @__PURE__ */ U(ee.Provider, {
|
|
2479
2585
|
delayDuration: 500,
|
|
2480
2586
|
skipDelayDuration: 0,
|
|
2481
|
-
children: /* @__PURE__ */
|
|
2482
|
-
...
|
|
2483
|
-
ref:
|
|
2484
|
-
className: ["vibe-shadcn-tiptap",
|
|
2485
|
-
"data-scroll-locked":
|
|
2587
|
+
children: /* @__PURE__ */ W("div", {
|
|
2588
|
+
...g,
|
|
2589
|
+
ref: O,
|
|
2590
|
+
className: ["vibe-shadcn-tiptap", m].filter(Boolean).join(" "),
|
|
2591
|
+
"data-scroll-locked": V && !!(P || ne || I || ie) || void 0,
|
|
2486
2592
|
onKeyDown: (e) => {
|
|
2487
|
-
if (
|
|
2593
|
+
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")) {
|
|
2488
2594
|
if (e.preventDefault(), e.target instanceof Element && e.target.closest(".vibe-shadcn-tiptap__find")) {
|
|
2489
|
-
let e =
|
|
2595
|
+
let e = D?.querySelector(".vibe-shadcn-tiptap__find input");
|
|
2490
2596
|
e instanceof HTMLInputElement && (e.focus(), e.select());
|
|
2491
|
-
} else
|
|
2597
|
+
} else _.commands.openFindReplace();
|
|
2492
2598
|
}
|
|
2493
2599
|
},
|
|
2494
|
-
children: [
|
|
2495
|
-
a !== !1 && /* @__PURE__ */
|
|
2496
|
-
context:
|
|
2600
|
+
children: [_ && /* @__PURE__ */ W(he, { children: [
|
|
2601
|
+
a !== !1 && /* @__PURE__ */ U(Kn, {
|
|
2602
|
+
context: _,
|
|
2497
2603
|
toolbar: a,
|
|
2498
2604
|
toolbarOptions: o,
|
|
2499
|
-
codeBlockLanguages:
|
|
2500
|
-
horizontalRules:
|
|
2605
|
+
codeBlockLanguages: x,
|
|
2606
|
+
horizontalRules: S,
|
|
2501
2607
|
colors: s,
|
|
2502
2608
|
highlights: c,
|
|
2503
2609
|
ui: l,
|
|
2504
2610
|
markdownOptions: u,
|
|
2505
|
-
printOptions:
|
|
2506
|
-
uploadAsset:
|
|
2507
|
-
openWhiteboard: () =>
|
|
2508
|
-
editorBehaviorOptions:
|
|
2509
|
-
preview:
|
|
2510
|
-
onPreviewChange:
|
|
2511
|
-
fullscreen:
|
|
2512
|
-
onFullscreenChange:
|
|
2513
|
-
overlayTarget:
|
|
2514
|
-
},
|
|
2515
|
-
/* @__PURE__ */
|
|
2611
|
+
printOptions: p,
|
|
2612
|
+
uploadAsset: C,
|
|
2613
|
+
openWhiteboard: () => R("new"),
|
|
2614
|
+
editorBehaviorOptions: w,
|
|
2615
|
+
preview: y,
|
|
2616
|
+
onPreviewChange: b,
|
|
2617
|
+
fullscreen: fe || j ? j : void 0,
|
|
2618
|
+
onFullscreenChange: pe,
|
|
2619
|
+
overlayTarget: k ?? void 0
|
|
2620
|
+
}, _.editor.instanceId),
|
|
2621
|
+
/* @__PURE__ */ W("div", {
|
|
2516
2622
|
className: "vibe-shadcn-tiptap__body",
|
|
2517
2623
|
children: [
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
context:
|
|
2624
|
+
/* @__PURE__ */ U(nr, {
|
|
2625
|
+
context: _,
|
|
2520
2626
|
appearance: l?.findReplace,
|
|
2521
|
-
editable:
|
|
2522
|
-
overlayTarget:
|
|
2627
|
+
editable: V,
|
|
2628
|
+
overlayTarget: k ?? void 0
|
|
2523
2629
|
}),
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
context:
|
|
2526
|
-
tabIndex: !
|
|
2527
|
-
onClick:
|
|
2630
|
+
/* @__PURE__ */ U(ln, {
|
|
2631
|
+
context: _,
|
|
2632
|
+
tabIndex: !V && typeof _.editor.commands.openFindReplace == "function" ? 0 : void 0,
|
|
2633
|
+
onClick: me,
|
|
2528
2634
|
onBlur: (e) => {
|
|
2529
|
-
!e.currentTarget.contains(e.relatedTarget) &&
|
|
2635
|
+
!e.currentTarget.contains(e.relatedTarget) && P && !_.editor.isDestroyed && T.closeSlashMenu();
|
|
2530
2636
|
}
|
|
2531
2637
|
}),
|
|
2532
|
-
|
|
2638
|
+
V && k && /* @__PURE__ */ U(pr, {
|
|
2533
2639
|
appearance: l?.tableGrips,
|
|
2534
|
-
context:
|
|
2535
|
-
overlayTarget:
|
|
2640
|
+
context: _,
|
|
2641
|
+
overlayTarget: k
|
|
2536
2642
|
})
|
|
2537
2643
|
]
|
|
2538
2644
|
}),
|
|
2539
|
-
i && /* @__PURE__ */
|
|
2540
|
-
|
|
2541
|
-
context:
|
|
2645
|
+
i && /* @__PURE__ */ U(un, { context: _ }),
|
|
2646
|
+
V && k && /* @__PURE__ */ U(tr, {
|
|
2647
|
+
context: _,
|
|
2542
2648
|
ui: l,
|
|
2543
|
-
overlayTarget:
|
|
2649
|
+
overlayTarget: k,
|
|
2544
2650
|
colors: s,
|
|
2545
2651
|
highlights: c,
|
|
2546
|
-
uploadAsset:
|
|
2547
|
-
behaviorOptions:
|
|
2548
|
-
onLink:
|
|
2549
|
-
onWhiteboardEdit: () =>
|
|
2550
|
-
onPaletteOpenChange:
|
|
2652
|
+
uploadAsset: C,
|
|
2653
|
+
behaviorOptions: w,
|
|
2654
|
+
onLink: L,
|
|
2655
|
+
onWhiteboardEdit: () => R("edit"),
|
|
2656
|
+
onPaletteOpenChange: ae
|
|
2551
2657
|
}),
|
|
2552
|
-
|
|
2658
|
+
V && k && C && oe && /* @__PURE__ */ U(zn, {
|
|
2553
2659
|
appearance: l?.whiteboard,
|
|
2554
|
-
context:
|
|
2555
|
-
uploadAsset:
|
|
2556
|
-
overlayTarget:
|
|
2557
|
-
edit:
|
|
2558
|
-
onClose: () =>
|
|
2660
|
+
context: _,
|
|
2661
|
+
uploadAsset: C,
|
|
2662
|
+
overlayTarget: k,
|
|
2663
|
+
edit: oe === "edit",
|
|
2664
|
+
onClose: () => R(void 0)
|
|
2559
2665
|
}),
|
|
2560
|
-
|
|
2666
|
+
V && P && k && /* @__PURE__ */ U(lr, {
|
|
2561
2667
|
appearance: l?.slashMenu,
|
|
2562
|
-
state:
|
|
2563
|
-
target:
|
|
2564
|
-
t:
|
|
2668
|
+
state: P,
|
|
2669
|
+
target: k,
|
|
2670
|
+
t: _.t
|
|
2671
|
+
}),
|
|
2672
|
+
V && ne && k && /* @__PURE__ */ U(ar, {
|
|
2673
|
+
state: ne,
|
|
2674
|
+
target: k,
|
|
2675
|
+
t: _.t,
|
|
2676
|
+
renderItem: d
|
|
2565
2677
|
}),
|
|
2566
|
-
|
|
2678
|
+
f && k && /* @__PURE__ */ U(or, {
|
|
2679
|
+
editor: _.editor.view.dom,
|
|
2680
|
+
container: k,
|
|
2681
|
+
hoverDelay: r[mr].mentionHoverDelay,
|
|
2682
|
+
render: f
|
|
2683
|
+
}, _.editor.instanceId),
|
|
2684
|
+
V && I && k && /* @__PURE__ */ U(Dn, {
|
|
2567
2685
|
appearance: l?.insertionPopover,
|
|
2568
|
-
context:
|
|
2569
|
-
request:
|
|
2570
|
-
overlayTarget:
|
|
2571
|
-
canUpload: !!
|
|
2572
|
-
behaviorOptions:
|
|
2573
|
-
onClose: () =>
|
|
2574
|
-
},
|
|
2575
|
-
|
|
2686
|
+
context: _,
|
|
2687
|
+
request: I,
|
|
2688
|
+
overlayTarget: k,
|
|
2689
|
+
canUpload: !!C,
|
|
2690
|
+
behaviorOptions: w,
|
|
2691
|
+
onClose: () => L(void 0)
|
|
2692
|
+
}, I.kind),
|
|
2693
|
+
k && M && /* @__PURE__ */ U(ir, {
|
|
2576
2694
|
appearance: l?.imagePreview,
|
|
2577
|
-
context:
|
|
2578
|
-
overlayTarget:
|
|
2579
|
-
imagePreview:
|
|
2580
|
-
onClose: () =>
|
|
2695
|
+
context: _,
|
|
2696
|
+
overlayTarget: k,
|
|
2697
|
+
imagePreview: M,
|
|
2698
|
+
onClose: () => N(void 0)
|
|
2581
2699
|
})
|
|
2582
|
-
] }), /* @__PURE__ */
|
|
2583
|
-
ref:
|
|
2700
|
+
] }), /* @__PURE__ */ U("div", {
|
|
2701
|
+
ref: A,
|
|
2584
2702
|
className: "vibe-shadcn-tiptap__overlays",
|
|
2585
|
-
children: /* @__PURE__ */
|
|
2703
|
+
children: /* @__PURE__ */ U("div", {
|
|
2586
2704
|
className: "vibe-shadcn-tiptap__notices",
|
|
2587
2705
|
"aria-live": "polite",
|
|
2588
|
-
children:
|
|
2706
|
+
children: se.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ U("div", {
|
|
2589
2707
|
role: n === "error" ? "alert" : "status",
|
|
2590
2708
|
"data-type": n,
|
|
2591
2709
|
children: t
|
|
@@ -2596,4 +2714,4 @@ function dr(e) {
|
|
|
2596
2714
|
})
|
|
2597
2715
|
});
|
|
2598
2716
|
}
|
|
2599
|
-
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,
|
|
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, ln as ShadcnTiptapContent, gr as ShadcnTiptapEditor, gr as VibeTiptap, un as ShadcnTiptapStatusBar, Gn 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, Ln as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, hr as useVibeTiptap };
|