@nivaro/react 0.3.123 → 0.3.124

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.
@@ -1,70 +1,45 @@
1
- import { jsxs as g, Fragment as Y, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as g, Fragment as X, jsx as e } from "react/jsx-runtime";
2
2
  import { useQuery as U } from "@tanstack/react-query";
3
- import G from "@tiptap/extension-link";
4
- import Z from "@tiptap/extension-placeholder";
5
- import ee from "@tiptap/extension-underline";
6
- import { useEditor as te, EditorContent as re } from "@tiptap/react";
7
- import ie from "@tiptap/starter-kit";
8
- import { Bold as ne, Italic as oe, UnderlineIcon as ae, Strikethrough as le, Heading1 as se, Heading2 as ce, Heading3 as de, List as pe, ListOrdered as ue, Quote as he, Code as fe, Minus as me, Link as ge, Link2Off as be, FileSymlink as K, Check as ke, X as J, Loader2 as xe } from "lucide-react";
9
- import { useState as w, useRef as S, useMemo as F, useEffect as R } from "react";
10
- import { useApiFetchConfig as ve, useItemNavigation as _e } from "../../context.js";
11
- import { useFieldEditors as ye } from "../../lib/co-edit.js";
3
+ import Y from "@tiptap/extension-link";
4
+ import G from "@tiptap/extension-placeholder";
5
+ import Z from "@tiptap/extension-underline";
6
+ import { useEditor as ee, EditorContent as te } from "@tiptap/react";
7
+ import re from "@tiptap/starter-kit";
8
+ import { Bold as ie, Italic as ne, UnderlineIcon as oe, Strikethrough as ae, Heading1 as le, Heading2 as se, Heading3 as ce, List as de, ListOrdered as pe, Quote as ue, Code as he, Minus as fe, Link as me, Link2Off as ge, FileSymlink as W, Check as be, X as K, Loader2 as ke } from "lucide-react";
9
+ import { useState as w, useRef as L, useMemo as j, useEffect as T } from "react";
10
+ import { useApiFetchConfig as xe, useItemNavigation as ve } from "../../context.js";
11
+ import { useFieldEditors as _e } from "../../lib/co-edit.js";
12
12
  import { cn as z } from "../../lib/utils.js";
13
- import { SimpleSelect as we } from "../ui/SimpleSelect.js";
14
- import { COEDIT_REMOTE as Ne } from "./coedit/collab.js";
15
- import { CoeditCursors as Ce, COEDIT_CURSOR_CSS as Le } from "./coedit/cursors.js";
16
- import { isSafeLinkHref as Se } from "./coedit/safe-link.js";
13
+ import { SimpleSelect as ye } from "../ui/SimpleSelect.js";
14
+ import { COEDIT_REMOTE as we } from "./coedit/collab.js";
15
+ import { CoeditCursors as Ne, COEDIT_CURSOR_CSS as Ce } from "./coedit/cursors.js";
16
+ import { isSafeLinkHref as Le } from "./coedit/safe-link.js";
17
17
  import { coeditColor as De } from "./coedit/session.js";
18
18
  import { useCoedit as Ae } from "./coedit/useCoedit.js";
19
- function E(t) {
20
- return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
21
- }
22
- function $e(t) {
23
- try {
24
- return (JSON.parse(t || "{}").blocks ?? []).map((a) => {
25
- const s = E(String(a.data.text ?? "")), c = Math.max(1, Math.min(6, Number(a.data.level ?? 2)));
26
- switch (a.type) {
27
- case "paragraph":
28
- return `<p>${s}</p>`;
29
- case "header":
30
- return `<h${c}>${s}</h${c}>`;
31
- case "list": {
32
- const l = (a.data.items ?? []).map((N) => `<li>${E(N)}</li>`).join("");
33
- return a.data.style === "ordered" ? `<ol>${l}</ol>` : `<ul>${l}</ul>`;
34
- }
35
- case "quote":
36
- return `<blockquote><p>${s}</p></blockquote>`;
37
- default:
38
- return s ? `<p>${s}</p>` : "";
39
- }
40
- }).join("");
41
- } catch {
42
- return `<p>${E(t)}</p>`;
43
- }
44
- }
19
+ import { editorJsToHtml as Se } from "../../lib/editorjs.js";
45
20
  const He = 2e3;
46
- function M(t) {
47
- return t ? t.trimStart().startsWith('{"time":') && t.includes('"blocks":') ? $e(t) : t : "";
21
+ function R(t) {
22
+ return t ? t.trimStart().startsWith('{"time":') && t.includes('"blocks":') ? Se(t) : t : "";
48
23
  }
49
- function d({
24
+ function s({
50
25
  active: t,
51
- title: p,
52
- onClick: a,
53
- children: s
26
+ title: c,
27
+ onClick: l,
28
+ children: p
54
29
  }) {
55
30
  return /* @__PURE__ */ e(
56
31
  "button",
57
32
  {
58
33
  type: "button",
59
- title: p,
60
- onMouseDown: (c) => {
61
- c.preventDefault(), a();
34
+ title: c,
35
+ onMouseDown: (d) => {
36
+ d.preventDefault(), l();
62
37
  },
63
38
  className: z(
64
39
  "flex h-6 w-6 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-300 dark:hover:bg-[#334155] dark:hover:text-white",
65
40
  t && "bg-slate-200 text-slate-900 dark:bg-[#334155] dark:text-white"
66
41
  ),
67
- children: s
42
+ children: p
68
43
  }
69
44
  );
70
45
  }
@@ -73,47 +48,47 @@ function H() {
73
48
  }
74
49
  function et({
75
50
  value: t,
76
- onChange: p,
77
- placeholder: a,
78
- disabled: s,
79
- pastePlain: c,
80
- coedit: l
51
+ onChange: c,
52
+ placeholder: l,
53
+ disabled: p,
54
+ pastePlain: d,
55
+ coedit: a
81
56
  }) {
82
- const [N, x] = w(!1), [C, b] = w(""), [D, y] = w(!1), v = S(null), _ = ve(), k = _e(), A = F(() => M(t), [t]), n = S(null), u = S([]), r = te({
57
+ const [E, x] = w(!1), [N, b] = w(""), [D, y] = w(!1), v = L(null), _ = xe(), k = ve(), A = j(() => R(t), [t]), n = L(null), u = L([]), r = ee({
83
58
  immediatelyRender: !1,
84
59
  extensions: [
85
60
  // StarterKit 3 bundles its own Link (autolink on) and Underline; they are
86
61
  // registered below with this editor's options, so the kit's copies stay out.
87
- ie.configure({
62
+ re.configure({
88
63
  bulletList: { keepMarks: !0 },
89
64
  orderedList: { keepMarks: !0 },
90
65
  link: !1,
91
66
  underline: !1
92
67
  }),
93
- ee,
94
- Z.configure({ placeholder: a ?? "Start writing…" }),
68
+ Z,
69
+ G.configure({ placeholder: l ?? "Start writing…" }),
95
70
  // 'record' protocol (#666): record://<collection>/<id> links survive the
96
71
  // Link extension's allowed-URI validation and render as record chips.
97
72
  // No autolink while typing: EFP site codes read like domains (byron.il,
98
73
  // oswego.il) and every one became a bogus http:// link in notes that go
99
74
  // to suppliers. Links are explicit — the toolbar, or pasting a URL.
100
75
  // Never a script / data / file href, whoever typed it (co-edited text included, L7).
101
- G.configure({
76
+ Y.configure({
102
77
  openOnClick: !1,
103
78
  autolink: !1,
104
79
  protocols: ["record"],
105
- isAllowedUri: (i, o) => Se(i) && o.defaultValidate(i)
80
+ isAllowedUri: (i, o) => Le(i) && o.defaultValidate(i)
106
81
  }),
107
82
  // Others' cursors while people write here together (inert otherwise).
108
- Ce
83
+ Ne
109
84
  ],
110
85
  content: A,
111
- editable: !s,
86
+ editable: !p,
112
87
  // NEVER undefined: an explicit `editorProps: undefined` overrides tiptap's
113
88
  // `{}` default in the options merge, and 3.26's createView reads
114
89
  // `editorProps.dispatchTransaction` unguarded — every non-pastePlain
115
90
  // editor crashed at mount ("Cannot read properties of undefined").
116
- editorProps: c ? {
91
+ editorProps: d ? {
117
92
  handlePaste(i, o) {
118
93
  var h;
119
94
  const m = (h = o.clipboardData) == null ? void 0 : h.getData("text/plain");
@@ -121,206 +96,206 @@ function et({
121
96
  }
122
97
  } : {},
123
98
  onUpdate({ editor: i, transaction: o }) {
124
- var L;
125
- if (o.getMeta(Ne) && !((L = n.current) != null && L.tracking())) return;
99
+ var C;
100
+ if (o.getMeta(we) && !((C = n.current) != null && C.tracking())) return;
126
101
  const m = i.getHTML(), h = u.current;
127
- h.push({ html: m, at: Date.now() }), h.length > 64 && h.shift(), p(m);
102
+ h.push({ html: m, at: Date.now() }), h.length > 64 && h.shift(), c(m);
128
103
  }
129
- }), f = Ae(r, l ?? null, t, M);
104
+ }), f = Ae(r, a ?? null, t, R);
130
105
  n.current = f.session;
131
- const Q = ye(l == null ? void 0 : l.collection, l == null ? void 0 : l.item), $ = l ? Q[l.field] : void 0, V = F(
132
- () => f.peers.length || !f.diverged || !$ ? f.peers : [{ name: $.name, color: De(String($.id)) }],
133
- [f.peers, f.diverged, $]
134
- ), q = S(null);
135
- R(() => {
106
+ const J = _e(a == null ? void 0 : a.collection, a == null ? void 0 : a.item), S = a ? J[a.field] : void 0, Q = j(
107
+ () => f.peers.length || !f.diverged || !S ? f.peers : [{ name: S.name, color: De(String(S.id)) }],
108
+ [f.peers, f.diverged, S]
109
+ ), M = L(null);
110
+ T(() => {
136
111
  var o;
137
- const i = (o = q.current) == null ? void 0 : o.closest("[data-field]");
112
+ const i = (o = M.current) == null ? void 0 : o.closest("[data-field]");
138
113
  if (i)
139
114
  return i.toggleAttribute("data-coedit-live", f.live), () => i.removeAttribute("data-coedit-live");
140
115
  }, [f.live]);
141
- const O = S(t);
142
- if (R(() => {
116
+ const O = L(t);
117
+ if (T(() => {
143
118
  if (!r || O.current === t) return;
144
119
  O.current = t;
145
120
  const i = Date.now();
146
121
  if (u.current.some((h) => h.html === t && i - h.at < He)) return;
147
122
  const o = n.current;
148
123
  if (o != null && o.isLive() && (r.isFocused || !o.tracking())) return;
149
- const m = M(t);
124
+ const m = R(t);
150
125
  r.getHTML() !== m && r.commands.setContent(m, { emitUpdate: !1 });
151
126
  }, [r, t]), !r) return null;
152
- const X = () => {
127
+ const V = () => {
153
128
  const i = r.getAttributes("link").href;
154
129
  b(i ?? "https://"), x(!0), setTimeout(() => {
155
130
  var o;
156
131
  return (o = v.current) == null ? void 0 : o.select();
157
132
  }, 0);
158
- }, T = () => {
159
- C === "" ? r.chain().focus().extendMarkRange("link").unsetLink().run() : r.chain().focus().extendMarkRange("link").setLink({ href: C }).run(), x(!1), b("");
160
133
  }, I = () => {
134
+ N === "" ? r.chain().focus().extendMarkRange("link").unsetLink().run() : r.chain().focus().extendMarkRange("link").setLink({ href: N }).run(), x(!1), b("");
135
+ }, $ = () => {
161
136
  x(!1), b("");
162
137
  };
163
138
  return /* @__PURE__ */ g(
164
139
  "div",
165
140
  {
166
- ref: q,
141
+ ref: M,
167
142
  className: z(
168
143
  "overflow-hidden rounded-md border border-slate-200 bg-background focus-within:ring-1 focus-within:ring-nvr-cyan focus-within:border-nvr-cyan dark:border-border",
169
- s && "opacity-60"
144
+ p && "opacity-60"
170
145
  ),
171
146
  children: [
172
- !s && /* @__PURE__ */ g(Y, { children: [
147
+ !p && /* @__PURE__ */ g(X, { children: [
173
148
  /* @__PURE__ */ g("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
174
149
  /* @__PURE__ */ e(
175
- d,
150
+ s,
176
151
  {
177
152
  title: "Bold",
178
153
  active: r.isActive("bold"),
179
154
  onClick: () => r.chain().focus().toggleBold().run(),
180
- children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" })
155
+ children: /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" })
181
156
  }
182
157
  ),
183
158
  /* @__PURE__ */ e(
184
- d,
159
+ s,
185
160
  {
186
161
  title: "Italic",
187
162
  active: r.isActive("italic"),
188
163
  onClick: () => r.chain().focus().toggleItalic().run(),
189
- children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
164
+ children: /* @__PURE__ */ e(ne, { className: "h-3.5 w-3.5" })
190
165
  }
191
166
  ),
192
167
  /* @__PURE__ */ e(
193
- d,
168
+ s,
194
169
  {
195
170
  title: "Underline",
196
171
  active: r.isActive("underline"),
197
172
  onClick: () => r.chain().focus().toggleUnderline().run(),
198
- children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
173
+ children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
199
174
  }
200
175
  ),
201
176
  /* @__PURE__ */ e(
202
- d,
177
+ s,
203
178
  {
204
179
  title: "Strikethrough",
205
180
  active: r.isActive("strike"),
206
181
  onClick: () => r.chain().focus().toggleStrike().run(),
207
- children: /* @__PURE__ */ e(le, { className: "h-3.5 w-3.5" })
182
+ children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
208
183
  }
209
184
  ),
210
185
  /* @__PURE__ */ e(H, {}),
211
186
  /* @__PURE__ */ e(
212
- d,
187
+ s,
213
188
  {
214
189
  title: "Heading 1",
215
190
  active: r.isActive("heading", { level: 1 }),
216
191
  onClick: () => r.chain().focus().toggleHeading({ level: 1 }).run(),
217
- children: /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5" })
192
+ children: /* @__PURE__ */ e(le, { className: "h-3.5 w-3.5" })
218
193
  }
219
194
  ),
220
195
  /* @__PURE__ */ e(
221
- d,
196
+ s,
222
197
  {
223
198
  title: "Heading 2",
224
199
  active: r.isActive("heading", { level: 2 }),
225
200
  onClick: () => r.chain().focus().toggleHeading({ level: 2 }).run(),
226
- children: /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" })
201
+ children: /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5" })
227
202
  }
228
203
  ),
229
204
  /* @__PURE__ */ e(
230
- d,
205
+ s,
231
206
  {
232
207
  title: "Heading 3",
233
208
  active: r.isActive("heading", { level: 3 }),
234
209
  onClick: () => r.chain().focus().toggleHeading({ level: 3 }).run(),
235
- children: /* @__PURE__ */ e(de, { className: "h-3.5 w-3.5" })
210
+ children: /* @__PURE__ */ e(ce, { className: "h-3.5 w-3.5" })
236
211
  }
237
212
  ),
238
213
  /* @__PURE__ */ e(H, {}),
239
214
  /* @__PURE__ */ e(
240
- d,
215
+ s,
241
216
  {
242
217
  title: "Bullet list",
243
218
  active: r.isActive("bulletList"),
244
219
  onClick: () => r.chain().focus().toggleBulletList().run(),
245
- children: /* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5" })
220
+ children: /* @__PURE__ */ e(de, { className: "h-3.5 w-3.5" })
246
221
  }
247
222
  ),
248
223
  /* @__PURE__ */ e(
249
- d,
224
+ s,
250
225
  {
251
226
  title: "Ordered list",
252
227
  active: r.isActive("orderedList"),
253
228
  onClick: () => r.chain().focus().toggleOrderedList().run(),
254
- children: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" })
229
+ children: /* @__PURE__ */ e(pe, { className: "h-3.5 w-3.5" })
255
230
  }
256
231
  ),
257
232
  /* @__PURE__ */ e(H, {}),
258
233
  /* @__PURE__ */ e(
259
- d,
234
+ s,
260
235
  {
261
236
  title: "Blockquote",
262
237
  active: r.isActive("blockquote"),
263
238
  onClick: () => r.chain().focus().toggleBlockquote().run(),
264
- children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
239
+ children: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" })
265
240
  }
266
241
  ),
267
242
  /* @__PURE__ */ e(
268
- d,
243
+ s,
269
244
  {
270
245
  title: "Code block",
271
246
  active: r.isActive("codeBlock"),
272
247
  onClick: () => r.chain().focus().toggleCodeBlock().run(),
273
- children: /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" })
248
+ children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
274
249
  }
275
250
  ),
276
251
  /* @__PURE__ */ e(
277
- d,
252
+ s,
278
253
  {
279
254
  title: "Horizontal rule",
280
255
  onClick: () => r.chain().focus().setHorizontalRule().run(),
281
- children: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" })
256
+ children: /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" })
282
257
  }
283
258
  ),
284
259
  /* @__PURE__ */ e(H, {}),
285
260
  /* @__PURE__ */ e(
286
- d,
261
+ s,
287
262
  {
288
263
  title: "Link",
289
264
  active: r.isActive("link"),
290
- onClick: X,
291
- children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
265
+ onClick: V,
266
+ children: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" })
292
267
  }
293
268
  ),
294
269
  r.isActive("link") && /* @__PURE__ */ e(
295
- d,
270
+ s,
296
271
  {
297
272
  title: "Remove link",
298
273
  onClick: () => r.chain().focus().unsetLink().run(),
299
- children: /* @__PURE__ */ e(be, { className: "h-3.5 w-3.5" })
274
+ children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
300
275
  }
301
276
  ),
302
277
  /* @__PURE__ */ e(
303
- d,
278
+ s,
304
279
  {
305
280
  title: "Link record",
306
281
  active: D,
307
282
  onClick: () => {
308
283
  y((i) => !i), x(!1);
309
284
  },
310
- children: /* @__PURE__ */ e(K, { className: "h-3.5 w-3.5" })
285
+ children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5" })
311
286
  }
312
287
  )
313
288
  ] }),
314
- N && /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
289
+ E && /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
315
290
  /* @__PURE__ */ e(
316
291
  "input",
317
292
  {
318
293
  ref: v,
319
294
  type: "url",
320
- value: C,
295
+ value: N,
321
296
  onChange: (i) => b(i.target.value),
322
297
  onKeyDown: (i) => {
323
- i.key === "Enter" && (i.preventDefault(), T()), i.key === "Escape" && (i.preventDefault(), I());
298
+ i.key === "Enter" && (i.preventDefault(), I()), i.key === "Escape" && (i.preventDefault(), $());
324
299
  },
325
300
  placeholder: "https://example.com",
326
301
  "aria-label": "Link URL",
@@ -333,10 +308,10 @@ function et({
333
308
  type: "button",
334
309
  title: "Apply link",
335
310
  onMouseDown: (i) => {
336
- i.preventDefault(), T();
311
+ i.preventDefault(), I();
337
312
  },
338
313
  className: "flex h-5 w-5 items-center justify-center rounded text-emerald-600 hover:bg-emerald-50",
339
- children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
314
+ children: /* @__PURE__ */ e(be, { className: "h-3.5 w-3.5" })
340
315
  }
341
316
  ),
342
317
  /* @__PURE__ */ e(
@@ -345,15 +320,15 @@ function et({
345
320
  type: "button",
346
321
  title: "Cancel",
347
322
  onMouseDown: (i) => {
348
- i.preventDefault(), I();
323
+ i.preventDefault(), $();
349
324
  },
350
325
  className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100 dark:hover:bg-[#334155]",
351
- children: /* @__PURE__ */ e(J, { className: "h-3.5 w-3.5" })
326
+ children: /* @__PURE__ */ e(K, { className: "h-3.5 w-3.5" })
352
327
  }
353
328
  )
354
329
  ] }),
355
330
  D && /* @__PURE__ */ e(
356
- qe,
331
+ Me,
357
332
  {
358
333
  apiBase: _.apiBase,
359
334
  authHeaders: _.authHeaders,
@@ -377,98 +352,98 @@ function et({
377
352
  }
378
353
  .nivaro-rich-text a[href^="record://"]::before { content: '↗ '; opacity: 0.55; }
379
354
  .nivaro-rich-text .tiptap ::selection { background: rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.26); }
380
- ${Le}
355
+ ${Ce}
381
356
  .nivaro-rich-text .tiptap > :first-child .nvr-coedit-flag {
382
357
  bottom: auto; top: 100%; margin: 1px 0 0; border-radius: 0 3px 3px 3px;
383
358
  }
384
359
  ` }),
385
360
  /* @__PURE__ */ e(
386
- re,
361
+ te,
387
362
  {
388
363
  onClick: (i) => {
389
- var h, L;
390
- const o = (L = (h = i.target).closest) == null ? void 0 : L.call(h, "a"), m = (o == null ? void 0 : o.getAttribute("href")) ?? "";
364
+ var h, C;
365
+ const o = (C = (h = i.target).closest) == null ? void 0 : C.call(h, "a"), m = (o == null ? void 0 : o.getAttribute("href")) ?? "";
391
366
  if (m.startsWith("record://")) {
392
367
  i.preventDefault();
393
- const [j, B] = m.slice(9).split("/");
394
- j && B && k.open({ collection: j, itemId: B });
368
+ const [q, B] = m.slice(9).split("/");
369
+ q && B && k.open({ collection: q, itemId: B });
395
370
  }
396
371
  },
397
372
  editor: r,
398
373
  className: "nivaro-rich-text min-h-[120px] px-3 py-2 text-[13px] [&_.tiptap]:outline-none [&_.tiptap]:min-h-[100px] [&_.tiptap_p]:my-1 [&_.tiptap_h1]:text-xl [&_.tiptap_h2]:text-lg [&_.tiptap_h3]:text-base [&_.tiptap_h1,&_.tiptap_h2,&_.tiptap_h3]:font-semibold [&_.tiptap_ul]:list-disc [&_.tiptap_ol]:list-decimal [&_.tiptap_ul]:!pl-6 [&_.tiptap_ol]:!pl-6 [&_.tiptap_ul]:list-outside [&_.tiptap_ol]:list-outside [&_.tiptap_li]:my-0.5 [&_.tiptap_blockquote]:border-l-2 [&_.tiptap_blockquote]:border-slate-300 [&_.tiptap_blockquote]:pl-3 [&_.tiptap_blockquote]:text-slate-500 dark:[&_.tiptap_blockquote]:border-slate-600 dark:[&_.tiptap_blockquote]:text-slate-400 [&_.tiptap_code]:bg-slate-100 dark:[&_.tiptap_code]:bg-[#1e293b] [&_.tiptap_code]:rounded [&_.tiptap_code]:px-1 [&_.tiptap_pre]:bg-slate-100 dark:[&_.tiptap_pre]:bg-[#1e293b] [&_.tiptap_pre]:rounded [&_.tiptap_pre]:p-2 [&_.tiptap_pre]:font-mono [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:text-slate-400 dark:[&_.tiptap_p.is-editor-empty:first-child::before]:text-slate-500 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0"
399
374
  }
400
375
  ),
401
- /* @__PURE__ */ e(Ee, { peers: V, diverged: f.diverged })
376
+ /* @__PURE__ */ e(Ee, { peers: Q, diverged: f.diverged })
402
377
  ]
403
378
  }
404
379
  );
405
380
  }
406
- const P = (t) => t.trim().split(/\s+/)[0] || t;
407
- function W(t) {
381
+ const F = (t) => t.trim().split(/\s+/)[0] || t;
382
+ function P(t) {
408
383
  return t.length <= 1 ? t[0] ?? "" : t.length === 2 ? `${t[0]} and ${t[1]}` : `${t[0]}, ${t[1]} and ${t.length - 2} more`;
409
384
  }
410
385
  function Ee({
411
386
  peers: t,
412
- diverged: p
387
+ diverged: c
413
388
  }) {
414
- return !p && t.length === 0 ? null : /* @__PURE__ */ g(
389
+ return !c && t.length === 0 ? null : /* @__PURE__ */ g(
415
390
  "div",
416
391
  {
417
392
  className: "flex min-h-[26px] items-center gap-1.5 border-t border-slate-100 px-3 py-1 text-[11px] text-slate-500 dark:border-border dark:text-slate-400",
418
393
  "aria-live": "polite",
419
394
  children: [
420
- /* @__PURE__ */ e("span", { className: "flex -space-x-0.5", "aria-hidden": "true", children: (t.length ? t : [{ name: "", color: "#94a3b8" }]).slice(0, 4).map((a) => /* @__PURE__ */ e(
395
+ /* @__PURE__ */ e("span", { className: "flex -space-x-0.5", "aria-hidden": "true", children: (t.length ? t : [{ name: "", color: "#94a3b8" }]).slice(0, 4).map((l) => /* @__PURE__ */ e(
421
396
  "span",
422
397
  {
423
398
  className: "h-2 w-2 rounded-full ring-2 ring-background",
424
- style: { backgroundColor: a.color }
399
+ style: { backgroundColor: l.color }
425
400
  },
426
- a.name || "someone"
401
+ l.name || "someone"
427
402
  )) }),
428
- p ? /* @__PURE__ */ g("span", { className: "min-w-0", children: [
429
- t.length ? W(t.map((a) => P(a.name))) : "Someone else",
403
+ c ? /* @__PURE__ */ g("span", { className: "min-w-0", children: [
404
+ t.length ? P(t.map((l) => F(l.name))) : "Someone else",
430
405
  " ",
431
406
  t.length > 1 ? "are" : "is",
432
407
  " writing here too. Your unsaved changes stay separate until you save."
433
408
  ] }) : /* @__PURE__ */ g("span", { className: "truncate", children: [
434
409
  "Writing together with ",
435
- W(t.map((a) => P(a.name)))
410
+ P(t.map((l) => F(l.name)))
436
411
  ] })
437
412
  ]
438
413
  }
439
414
  );
440
415
  }
441
- function Me(t, p) {
442
- return t ? t.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (a, s) => {
443
- if (s.includes(".")) return "";
444
- const c = p[s];
445
- return c == null ? "" : String(c);
416
+ function Re(t, c) {
417
+ return t ? t.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (l, p) => {
418
+ if (p.includes(".")) return "";
419
+ const d = c[p];
420
+ return d == null ? "" : String(d);
446
421
  }).replace(/\s+/g, " ").trim() : "";
447
422
  }
448
- function Re(t, p) {
449
- const a = Me(p, t);
450
- if (a) return a;
451
- for (const s of ["name", "title", "label", "subject"]) {
452
- const c = t[s];
453
- if (typeof c == "string" && c.trim()) return c.trim();
423
+ function Te(t, c) {
424
+ const l = Re(c, t);
425
+ if (l) return l;
426
+ for (const p of ["name", "title", "label", "subject"]) {
427
+ const d = t[p];
428
+ if (typeof d == "string" && d.trim()) return d.trim();
454
429
  }
455
430
  return `#${String(t.id ?? "")}`;
456
431
  }
457
- function qe({
432
+ function Me({
458
433
  apiBase: t,
459
- authHeaders: p,
460
- credentials: a,
461
- onInsert: s,
462
- onClose: c
434
+ authHeaders: c,
435
+ credentials: l,
436
+ onInsert: p,
437
+ onClose: d
463
438
  }) {
464
- const [l, N] = w(""), [x, C] = w(""), [b, D] = w("");
465
- R(() => {
439
+ const [a, E] = w(""), [x, N] = w(""), [b, D] = w("");
440
+ T(() => {
466
441
  const n = setTimeout(() => D(x), 300);
467
442
  return () => clearTimeout(n);
468
443
  }, [x]);
469
444
  const y = (n) => fetch(`${t}${n}`, {
470
- headers: p,
471
- credentials: a
445
+ headers: c,
446
+ credentials: l
472
447
  }).then((u) => {
473
448
  if (!u.ok) throw new Error(String(u.status));
474
449
  return u.json();
@@ -480,11 +455,11 @@ function qe({
480
455
  )
481
456
  ),
482
457
  staleTime: 5 * 6e4
483
- }), _ = v == null ? void 0 : v.find((n) => n.collection === l), { data: k, isFetching: A } = U({
484
- queryKey: ["rte-record-link-search", l, b],
485
- enabled: !!l && b.trim().length > 0,
458
+ }), _ = v == null ? void 0 : v.find((n) => n.collection === a), { data: k, isFetching: A } = U({
459
+ queryKey: ["rte-record-link-search", a, b],
460
+ enabled: !!a && b.trim().length > 0,
486
461
  queryFn: () => y(
487
- `/items/${l}?limit=10&search=${encodeURIComponent(b.trim())}`
462
+ `/items/${a}?limit=10&search=${encodeURIComponent(b.trim())}`
488
463
  ).then(
489
464
  (n) => Array.isArray(n == null ? void 0 : n.data) ? n.data : []
490
465
  )
@@ -492,10 +467,10 @@ function qe({
492
467
  return /* @__PURE__ */ g("div", { className: "space-y-1.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
493
468
  /* @__PURE__ */ g("div", { className: "flex items-center gap-1.5", children: [
494
469
  /* @__PURE__ */ e(
495
- we,
470
+ ye,
496
471
  {
497
- value: l,
498
- onChange: N,
472
+ value: a,
473
+ onChange: E,
499
474
  ariaLabel: "Collection",
500
475
  className: "h-6 w-44 rounded border-slate-200 bg-white text-[12px] dark:border-border dark:bg-background",
501
476
  options: [
@@ -511,41 +486,41 @@ function qe({
511
486
  "input",
512
487
  {
513
488
  value: x,
514
- onChange: (n) => C(n.target.value),
515
- onKeyDown: (n) => n.key === "Escape" && c(),
516
- placeholder: l ? "Search records…" : "Pick a collection first",
517
- disabled: !l,
489
+ onChange: (n) => N(n.target.value),
490
+ onKeyDown: (n) => n.key === "Escape" && d(),
491
+ placeholder: a ? "Search records…" : "Pick a collection first",
492
+ disabled: !a,
518
493
  "aria-label": "Search records",
519
494
  className: "flex-1 rounded border border-slate-200 bg-white px-2 py-0.5 text-[12px] text-slate-700 outline-none focus:border-nvr-cyan disabled:opacity-50"
520
495
  }
521
496
  ),
522
- A && /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }),
497
+ A && /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }),
523
498
  /* @__PURE__ */ e(
524
499
  "button",
525
500
  {
526
501
  type: "button",
527
502
  title: "Close",
528
503
  onMouseDown: (n) => {
529
- n.preventDefault(), c();
504
+ n.preventDefault(), d();
530
505
  },
531
506
  className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100",
532
- children: /* @__PURE__ */ e(J, { className: "h-3.5 w-3.5" })
507
+ children: /* @__PURE__ */ e(K, { className: "h-3.5 w-3.5" })
533
508
  }
534
509
  )
535
510
  ] }),
536
- l && b.trim() && ((k == null ? void 0 : k.length) ?? 0) === 0 && !A && /* @__PURE__ */ e("p", { className: "px-1 text-[11px] text-slate-400", children: "No matching records." }),
511
+ a && b.trim() && ((k == null ? void 0 : k.length) ?? 0) === 0 && !A && /* @__PURE__ */ e("p", { className: "px-1 text-[11px] text-slate-400", children: "No matching records." }),
537
512
  ((k == null ? void 0 : k.length) ?? 0) > 0 && /* @__PURE__ */ e("div", { className: "max-h-40 overflow-y-auto rounded border border-slate-200 bg-white", children: (k ?? []).map((n) => {
538
- const u = Re(n, _ == null ? void 0 : _.display_template), r = String(n.id ?? "");
513
+ const u = Te(n, _ == null ? void 0 : _.display_template), r = String(n.id ?? "");
539
514
  return /* @__PURE__ */ g(
540
515
  "button",
541
516
  {
542
517
  type: "button",
543
518
  onMouseDown: (f) => {
544
- f.preventDefault(), r && s(u, `record://${l}/${r}`);
519
+ f.preventDefault(), r && p(u, `record://${a}/${r}`);
545
520
  },
546
521
  className: "flex w-full items-center gap-1.5 px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-muted",
547
522
  children: [
548
- /* @__PURE__ */ e(K, { className: "h-3 w-3 shrink-0 text-[#00a5cc]" }),
523
+ /* @__PURE__ */ e(W, { className: "h-3 w-3 shrink-0 text-[#00a5cc]" }),
549
524
  /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children: u }),
550
525
  /* @__PURE__ */ g("span", { className: "shrink-0 font-mono text-[10.5px] text-slate-400", children: [
551
526
  "#",
@@ -561,6 +536,6 @@ function qe({
561
536
  export {
562
537
  et as RichTextEditor,
563
538
  H as TiptapDivider,
564
- d as TiptapToolbarButton,
565
- $e as editorJsToHtml
539
+ s as TiptapToolbarButton,
540
+ Se as editorJsToHtml
566
541
  };