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