laif-ds 0.2.83 → 0.2.85
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/dist/CHANGELOG.md +30 -0
- package/dist/agent-docs/adoption-report.json +17 -13
- package/dist/agent-docs/components/AppEditor.md +117 -7
- package/dist/agent-docs/manifest.json +119 -13
- package/dist/components/editor/nodes/mention-node.js +113 -0
- package/dist/components/editor/plugins/mention-plugin.js +224 -0
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +41 -0
- package/dist/components/ui/app-editor.js +150 -112
- package/dist/index.d.ts +40 -4
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +5 -5
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +220 -0
- package/dist/node_modules/lexical/Lexical.prod.js +314 -303
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
- /package/dist/agent-docs/{truncated-cell.md → components/truncated-cell.md} +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as d, jsxs as C } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext as I } from "../../../node_modules/@lexical/react/LexicalComposerContext.prod.js";
|
|
4
|
+
import { useBasicTypeaheadTriggerMatch as P, LexicalTypeaheadMenuPlugin as U, MenuOption as q } from "../../../node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js";
|
|
5
|
+
import { $createTextNode as F } from "../../../node_modules/lexical/Lexical.prod.js";
|
|
6
|
+
import { useState as N, useRef as L, useEffect as x, useMemo as Q, useCallback as _ } from "react";
|
|
7
|
+
import { createPortal as j } from "react-dom";
|
|
8
|
+
import { MentionNode as z, $createMentionNode as T, $isMentionNode as B } from "../nodes/mention-node.js";
|
|
9
|
+
import { cn as $ } from "../../../lib/utils.js";
|
|
10
|
+
const w = "app-editor-mention-menu", E = (e) => `${w}-option-${e}`;
|
|
11
|
+
class H extends q {
|
|
12
|
+
item;
|
|
13
|
+
constructor(t) {
|
|
14
|
+
super(String(t.id)), this.item = t;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function V(e, t) {
|
|
18
|
+
const o = t.trim().toLowerCase();
|
|
19
|
+
return o ? e.filter(
|
|
20
|
+
(n) => n.label.toLowerCase().split(/\s+/).some((i) => i.startsWith(o))
|
|
21
|
+
) : e;
|
|
22
|
+
}
|
|
23
|
+
const v = (e) => {
|
|
24
|
+
try {
|
|
25
|
+
return decodeURIComponent(e);
|
|
26
|
+
} catch {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
}, ne = {
|
|
30
|
+
dependencies: [z],
|
|
31
|
+
export: (e) => {
|
|
32
|
+
if (!B(e)) return null;
|
|
33
|
+
const { id: t, label: o, value: n } = e.getMentionData(), i = encodeURIComponent(o), a = encodeURIComponent(String(t)), m = n ? `?v=${encodeURIComponent(n)}` : "";
|
|
34
|
+
return `@[${i}](mention:${a}${m})`;
|
|
35
|
+
},
|
|
36
|
+
importRegExp: /@\[([^\]]*)\]\(mention:([^?)]+)(?:\?v=([^)]*))?\)/,
|
|
37
|
+
regExp: /@\[([^\]]*)\]\(mention:([^?)]+)(?:\?v=([^)]*))?\)$/,
|
|
38
|
+
replace: (e, t) => {
|
|
39
|
+
const [, o, n, i] = t, a = T({
|
|
40
|
+
id: v(n),
|
|
41
|
+
label: v(o),
|
|
42
|
+
value: i ? v(i) : void 0
|
|
43
|
+
});
|
|
44
|
+
e.replace(a);
|
|
45
|
+
},
|
|
46
|
+
trigger: ")",
|
|
47
|
+
type: "text-match"
|
|
48
|
+
};
|
|
49
|
+
function oe({ source: e, trigger: t }) {
|
|
50
|
+
const [o] = I(), [n, i] = N(null), a = typeof e == "function", [m, f] = N([]), [l, r] = N("idle"), c = L(e);
|
|
51
|
+
c.current = e;
|
|
52
|
+
const y = L(!0);
|
|
53
|
+
x(
|
|
54
|
+
() => () => {
|
|
55
|
+
y.current = !1;
|
|
56
|
+
},
|
|
57
|
+
[]
|
|
58
|
+
), x(() => {
|
|
59
|
+
if (n === null || l !== "idle") return;
|
|
60
|
+
const s = c.current;
|
|
61
|
+
typeof s == "function" && (r("loading"), Promise.resolve(s()).then(
|
|
62
|
+
(u) => {
|
|
63
|
+
y.current && (f(u), r("ready"));
|
|
64
|
+
},
|
|
65
|
+
() => {
|
|
66
|
+
y.current && r("error");
|
|
67
|
+
}
|
|
68
|
+
));
|
|
69
|
+
}, [n, l]), x(() => {
|
|
70
|
+
n === null && l === "error" && r("idle");
|
|
71
|
+
}, [n, l]);
|
|
72
|
+
const R = a ? m : e, p = a ? l : "ready", O = t.length === 1 ? t : "@", k = P(O, {
|
|
73
|
+
minLength: 0
|
|
74
|
+
}), g = Q(
|
|
75
|
+
() => V(R, n ?? "").map(
|
|
76
|
+
(s) => new H(s)
|
|
77
|
+
),
|
|
78
|
+
[R, n]
|
|
79
|
+
), A = _(
|
|
80
|
+
(s, u, M) => {
|
|
81
|
+
o.update(() => {
|
|
82
|
+
const h = T({
|
|
83
|
+
id: s.item.id,
|
|
84
|
+
label: s.item.label,
|
|
85
|
+
value: s.item.value
|
|
86
|
+
});
|
|
87
|
+
u && u.replace(h);
|
|
88
|
+
const b = F(" ");
|
|
89
|
+
h.insertAfter(b), b.select(), M();
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
[o]
|
|
93
|
+
);
|
|
94
|
+
return /* @__PURE__ */ d(
|
|
95
|
+
U,
|
|
96
|
+
{
|
|
97
|
+
onQueryChange: i,
|
|
98
|
+
onSelectOption: A,
|
|
99
|
+
triggerFn: k,
|
|
100
|
+
options: g,
|
|
101
|
+
menuRenderFn: (s, { selectedIndex: u, selectOptionAndCleanUp: M, setHighlightedIndex: h }) => {
|
|
102
|
+
if (s.current === null)
|
|
103
|
+
return null;
|
|
104
|
+
const b = p === "loading" || p === "error", D = (n ?? "").length > 0, S = p === "ready" && D && g.length === 0;
|
|
105
|
+
return !b && g.length === 0 && !S ? null : j(
|
|
106
|
+
/* @__PURE__ */ d(
|
|
107
|
+
W,
|
|
108
|
+
{
|
|
109
|
+
options: g,
|
|
110
|
+
selectedIndex: u,
|
|
111
|
+
status: p,
|
|
112
|
+
showEmptyState: S,
|
|
113
|
+
query: n ?? "",
|
|
114
|
+
onHighlight: h,
|
|
115
|
+
onSelect: M
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
s.current
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function W({
|
|
125
|
+
options: e,
|
|
126
|
+
selectedIndex: t,
|
|
127
|
+
status: o,
|
|
128
|
+
showEmptyState: n,
|
|
129
|
+
query: i,
|
|
130
|
+
onHighlight: a,
|
|
131
|
+
onSelect: m
|
|
132
|
+
}) {
|
|
133
|
+
const [f] = I(), l = o === "ready" && !n && e.length > 0;
|
|
134
|
+
return x(() => {
|
|
135
|
+
const r = f.getRootElement();
|
|
136
|
+
if (r)
|
|
137
|
+
return l && t !== null ? r.setAttribute(
|
|
138
|
+
"aria-activedescendant",
|
|
139
|
+
E(t)
|
|
140
|
+
) : r.removeAttribute("aria-activedescendant"), () => {
|
|
141
|
+
r.removeAttribute("aria-activedescendant");
|
|
142
|
+
};
|
|
143
|
+
}, [f, t, l]), /* @__PURE__ */ d(
|
|
144
|
+
"ul",
|
|
145
|
+
{
|
|
146
|
+
id: w,
|
|
147
|
+
role: "listbox",
|
|
148
|
+
"aria-label": "People you can mention",
|
|
149
|
+
"aria-busy": o === "loading",
|
|
150
|
+
"data-slot": "mention-menu",
|
|
151
|
+
className: $(
|
|
152
|
+
// The menu is portaled to <body>. Inside a laif-ds Dialog two things
|
|
153
|
+
// break there, both fixed on this element:
|
|
154
|
+
// - `relative z-[60]`: z-index is INERT on a statically-positioned
|
|
155
|
+
// element, so the menu must be positioned (`relative`) for `z-[60]`
|
|
156
|
+
// to take effect and paint ABOVE the Dialog (z-50). Same z convention
|
|
157
|
+
// as popover.tsx.
|
|
158
|
+
// - `pointer-events-auto`: Radix sets `pointer-events:none` on <body>
|
|
159
|
+
// while a modal is open; the portaled menu inherits it and its options
|
|
160
|
+
// stop receiving clicks. Re-enable pointer events on the menu itself.
|
|
161
|
+
"border-d-border bg-d-background pointer-events-auto relative z-[60] max-h-60 min-w-52 overflow-auto rounded-md border p-1 shadow-md"
|
|
162
|
+
),
|
|
163
|
+
children: o === "loading" ? /* @__PURE__ */ d(
|
|
164
|
+
"li",
|
|
165
|
+
{
|
|
166
|
+
role: "presentation",
|
|
167
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
168
|
+
children: "Loading…"
|
|
169
|
+
}
|
|
170
|
+
) : o === "error" ? /* @__PURE__ */ d(
|
|
171
|
+
"li",
|
|
172
|
+
{
|
|
173
|
+
role: "presentation",
|
|
174
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
175
|
+
children: "Couldn't load mentions"
|
|
176
|
+
}
|
|
177
|
+
) : n ? /* @__PURE__ */ C(
|
|
178
|
+
"li",
|
|
179
|
+
{
|
|
180
|
+
role: "presentation",
|
|
181
|
+
className: "text-d-muted-foreground px-2 py-1.5 text-sm",
|
|
182
|
+
children: [
|
|
183
|
+
'No matches for "',
|
|
184
|
+
i,
|
|
185
|
+
'"'
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) : e.map((r, c) => /* @__PURE__ */ C(
|
|
189
|
+
"li",
|
|
190
|
+
{
|
|
191
|
+
id: E(c),
|
|
192
|
+
role: "option",
|
|
193
|
+
"aria-selected": t === c,
|
|
194
|
+
ref: r.setRefElement,
|
|
195
|
+
tabIndex: -1,
|
|
196
|
+
className: $(
|
|
197
|
+
"flex cursor-pointer flex-col rounded-sm px-2 py-1.5 text-sm",
|
|
198
|
+
t === c ? "bg-d-accent text-d-accent-foreground" : "text-d-foreground"
|
|
199
|
+
),
|
|
200
|
+
onMouseEnter: () => a(c),
|
|
201
|
+
onClick: () => m(r),
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ d("span", { className: "font-medium", children: r.item.label }),
|
|
204
|
+
r.item.sublabel && /* @__PURE__ */ d("span", { className: "text-d-muted-foreground text-xs", children: r.item.sublabel })
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
r.key
|
|
208
|
+
))
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
function re(e) {
|
|
213
|
+
const t = /* @__PURE__ */ new Set(), o = [];
|
|
214
|
+
for (const n of e) {
|
|
215
|
+
const i = n.getMentionData(), a = String(i.id);
|
|
216
|
+
t.has(a) || (t.add(a), o.push(i));
|
|
217
|
+
}
|
|
218
|
+
return o;
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
ne as MENTION_TRANSFORMER,
|
|
222
|
+
oe as MentionPlugin,
|
|
223
|
+
re as collectMentions
|
|
224
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { $getSelection as i, $isRangeSelection as c, $getRoot as a } from "../../../../node_modules/lexical/Lexical.prod.js";
|
|
4
|
+
import { useToolbarContext as f } from "../../context/toolbar-context.js";
|
|
5
|
+
import { Toggle as m } from "../../../ui/toggle.js";
|
|
6
|
+
import p from "../../../../node_modules/lucide-react/dist/esm/icons/at-sign.js";
|
|
7
|
+
function l(n, t) {
|
|
8
|
+
const { anchor: o } = n;
|
|
9
|
+
let e = "";
|
|
10
|
+
return o.type === "text" && (e = o.getNode().getTextContent().slice(0, o.offset).slice(-1)), e !== "" && !/[\s(]/.test(e) ? ` ${t}` : t;
|
|
11
|
+
}
|
|
12
|
+
function T({ trigger: n }) {
|
|
13
|
+
const { activeEditor: t } = f();
|
|
14
|
+
return /* @__PURE__ */ r(
|
|
15
|
+
m,
|
|
16
|
+
{
|
|
17
|
+
"aria-label": "Insert mention",
|
|
18
|
+
variant: "outline",
|
|
19
|
+
size: "sm",
|
|
20
|
+
pressed: !1,
|
|
21
|
+
onClick: () => {
|
|
22
|
+
t.focus(), t.update(() => {
|
|
23
|
+
const e = i();
|
|
24
|
+
if (c(e)) {
|
|
25
|
+
e.insertText(l(e, n));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
a().selectEnd();
|
|
29
|
+
const s = i();
|
|
30
|
+
c(s) && s.insertText(
|
|
31
|
+
l(s, n)
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
children: /* @__PURE__ */ r(p, { className: "h-4 w-4" })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
T as MentionInsertToolbarPlugin
|
|
41
|
+
};
|
|
@@ -1,169 +1,207 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { ListNode as
|
|
4
|
-
import {
|
|
5
|
-
import { CheckListPlugin as
|
|
6
|
-
import { ClearEditorPlugin as
|
|
7
|
-
import { LexicalComposer as
|
|
8
|
-
import { useLexicalComposerContext as
|
|
9
|
-
import { LexicalErrorBoundary as
|
|
10
|
-
import { HistoryPlugin as
|
|
11
|
-
import { ListPlugin as
|
|
12
|
-
import { OnChangePlugin as
|
|
13
|
-
import { RichTextPlugin as
|
|
14
|
-
import { HeadingNode as
|
|
15
|
-
import { ParagraphNode as
|
|
16
|
-
import { useState as
|
|
17
|
-
import { ContentEditable as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
|
|
2
|
+
import { jsx as r, jsxs as t, Fragment as p } from "react/jsx-runtime";
|
|
3
|
+
import { ListNode as D, ListItemNode as H } from "../../node_modules/@lexical/list/LexicalList.prod.js";
|
|
4
|
+
import { TRANSFORMERS as z, $convertToMarkdownString as U, $convertFromMarkdownString as _ } from "../../node_modules/@lexical/markdown/LexicalMarkdown.prod.js";
|
|
5
|
+
import { CheckListPlugin as Q } from "../../node_modules/@lexical/react/LexicalCheckListPlugin.prod.js";
|
|
6
|
+
import { ClearEditorPlugin as J } from "../../node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js";
|
|
7
|
+
import { LexicalComposer as q } from "../../node_modules/@lexical/react/LexicalComposer.prod.js";
|
|
8
|
+
import { useLexicalComposerContext as G } from "../../node_modules/@lexical/react/LexicalComposerContext.prod.js";
|
|
9
|
+
import { LexicalErrorBoundary as K } from "../../node_modules/@lexical/react/LexicalErrorBoundary.prod.js";
|
|
10
|
+
import { HistoryPlugin as W } from "../../node_modules/@lexical/react/LexicalHistoryPlugin.prod.js";
|
|
11
|
+
import { ListPlugin as X } from "../../node_modules/@lexical/react/LexicalListPlugin.prod.js";
|
|
12
|
+
import { OnChangePlugin as Y } from "../../node_modules/@lexical/react/LexicalOnChangePlugin.prod.js";
|
|
13
|
+
import { RichTextPlugin as Z } from "../../node_modules/@lexical/react/LexicalRichTextPlugin.prod.js";
|
|
14
|
+
import { HeadingNode as V, QuoteNode as rr } from "../../node_modules/@lexical/rich-text/LexicalRichText.prod.js";
|
|
15
|
+
import { ParagraphNode as g, TextNode as h, $nodesOfType as or, $getRoot as b } from "../../node_modules/lexical/Lexical.prod.js";
|
|
16
|
+
import { useState as er, useMemo as tr, useEffect as ir } from "react";
|
|
17
|
+
import { ContentEditable as nr } from "../editor/editor-ui/content-editable.js";
|
|
18
|
+
import { MentionNode as S } from "../editor/nodes/mention-node.js";
|
|
19
|
+
import { ActionsPlugin as lr } from "../editor/plugins/actions/actions-plugin.js";
|
|
20
|
+
import { ClearEditorActionPlugin as ar } from "../editor/plugins/actions/clear-editor-plugin.js";
|
|
21
|
+
import { CounterCharacterPlugin as sr } from "../editor/plugins/actions/counter-character-plugin.js";
|
|
22
|
+
import { MENTION_TRANSFORMER as mr, MentionPlugin as cr, collectMentions as dr } from "../editor/plugins/mention-plugin.js";
|
|
23
|
+
import { FormatBulletedList as fr } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
|
|
24
|
+
import { FormatCheckList as pr } from "../editor/plugins/toolbar/block-format/format-check-list.js";
|
|
25
|
+
import { FormatHeading as ur } from "../editor/plugins/toolbar/block-format/format-heading.js";
|
|
26
|
+
import { FormatNumberedList as gr } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
|
|
27
|
+
import { FormatParagraph as hr } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
|
|
28
|
+
import { FormatQuote as br } from "../editor/plugins/toolbar/block-format/format-quote.js";
|
|
29
|
+
import { BlockFormatDropDown as xr } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
|
|
30
|
+
import { FontFormatToolbarPlugin as d } from "../editor/plugins/toolbar/font-format-toolbar-plugin.js";
|
|
31
|
+
import { MentionInsertToolbarPlugin as Nr } from "../editor/plugins/toolbar/mention-insert-toolbar-plugin.js";
|
|
32
|
+
import { ToolbarPlugin as u } from "../editor/plugins/toolbar/toolbar-plugin.js";
|
|
33
|
+
import { editorTheme as vr } from "../editor/themes/editor-theme.js";
|
|
34
|
+
import { TooltipProvider as Er } from "./tooltip.js";
|
|
35
|
+
import { HistoryToolbarPlugin as Fr } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
|
|
36
|
+
import { cn as Pr } from "../../lib/utils.js";
|
|
37
|
+
const yr = "Start typing...", Cr = {
|
|
35
38
|
format: ["underline"],
|
|
36
39
|
tag: "++",
|
|
37
40
|
type: "text-format"
|
|
38
|
-
},
|
|
39
|
-
...
|
|
40
|
-
|
|
41
|
-
],
|
|
42
|
-
function
|
|
41
|
+
}, w = [
|
|
42
|
+
...z,
|
|
43
|
+
Cr
|
|
44
|
+
], Rr = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), Tr = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
|
|
45
|
+
function Sr({
|
|
43
46
|
defaultValue: o,
|
|
44
|
-
onlyMarkdown:
|
|
47
|
+
onlyMarkdown: a,
|
|
48
|
+
transformers: n
|
|
45
49
|
}) {
|
|
46
|
-
const [
|
|
47
|
-
return
|
|
48
|
-
o &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
) :
|
|
53
|
-
new
|
|
50
|
+
const [s] = G();
|
|
51
|
+
return ir(() => {
|
|
52
|
+
o && s.update(() => {
|
|
53
|
+
a ? _(
|
|
54
|
+
Rr(o),
|
|
55
|
+
n
|
|
56
|
+
) : b().append(
|
|
57
|
+
new g().append(new h(o))
|
|
54
58
|
);
|
|
55
|
-
const
|
|
56
|
-
(
|
|
59
|
+
const m = b();
|
|
60
|
+
(m.getFirstChild() ?? m).selectStart();
|
|
57
61
|
});
|
|
58
|
-
}, [
|
|
62
|
+
}, [s, o, a, n]), null;
|
|
59
63
|
}
|
|
60
|
-
function
|
|
64
|
+
function co({
|
|
61
65
|
defaultValue: o,
|
|
62
|
-
onMarkdownEdit:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
onMarkdownEdit: a,
|
|
67
|
+
onValueChange: n,
|
|
68
|
+
plugins: s = [],
|
|
69
|
+
toolbars: m = [],
|
|
70
|
+
placeholder: M = yr,
|
|
71
|
+
onlyMarkdown: x = !0,
|
|
72
|
+
className: L = "rounded-lg border border-d-border",
|
|
73
|
+
wrpClassName: A = "",
|
|
74
|
+
mentions: c,
|
|
75
|
+
mentionTrigger: N = "@"
|
|
69
76
|
}) {
|
|
70
|
-
const [,
|
|
77
|
+
const [, k] = er(null), l = c !== void 0, v = tr(
|
|
78
|
+
() => l ? [mr, ...w] : w,
|
|
79
|
+
[l]
|
|
80
|
+
), O = {
|
|
71
81
|
namespace: "AppEditor",
|
|
72
|
-
theme:
|
|
82
|
+
theme: vr,
|
|
73
83
|
nodes: [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
V,
|
|
85
|
+
g,
|
|
86
|
+
h,
|
|
87
|
+
rr,
|
|
88
|
+
D,
|
|
89
|
+
H,
|
|
90
|
+
...l ? [S] : []
|
|
80
91
|
],
|
|
81
|
-
onError: (
|
|
82
|
-
console.error(
|
|
92
|
+
onError: (e) => {
|
|
93
|
+
console.error(e);
|
|
83
94
|
},
|
|
84
|
-
...o && !
|
|
95
|
+
...o && !x ? {
|
|
85
96
|
editorState: () => {
|
|
86
|
-
|
|
87
|
-
new
|
|
97
|
+
b().append(
|
|
98
|
+
new g().append(new h(o))
|
|
88
99
|
);
|
|
89
100
|
}
|
|
90
101
|
} : {}
|
|
91
|
-
},
|
|
92
|
-
return /* @__PURE__ */ r("div", { className:
|
|
102
|
+
}, E = (e) => s.includes(e), f = (e) => m.includes(e), F = E("clear"), P = E("counter"), y = f("block-format"), I = f("font-format"), C = f("history");
|
|
103
|
+
return /* @__PURE__ */ r("div", { className: Pr("bg-d-background flex h-96 flex-col", A), children: /* @__PURE__ */ r(q, { initialConfig: O, children: /* @__PURE__ */ t(Er, { children: [
|
|
93
104
|
o && /* @__PURE__ */ r(
|
|
94
|
-
|
|
105
|
+
Sr,
|
|
95
106
|
{
|
|
96
107
|
defaultValue: o,
|
|
97
|
-
onlyMarkdown:
|
|
108
|
+
onlyMarkdown: x,
|
|
109
|
+
transformers: v
|
|
98
110
|
}
|
|
99
111
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/* @__PURE__ */ r(
|
|
105
|
-
/* @__PURE__ */ r(
|
|
106
|
-
/* @__PURE__ */ r(
|
|
107
|
-
/* @__PURE__ */ r(
|
|
108
|
-
/* @__PURE__ */ r(
|
|
112
|
+
l && /* @__PURE__ */ r(cr, { source: c, trigger: N }),
|
|
113
|
+
/* @__PURE__ */ t("div", { className: "border-d-border flex items-center border-b", children: [
|
|
114
|
+
C && /* @__PURE__ */ r(u, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(Fr, {}) }) }),
|
|
115
|
+
y && /* @__PURE__ */ r(u, { children: () => /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ t(xr, { children: [
|
|
116
|
+
/* @__PURE__ */ r(hr, {}),
|
|
117
|
+
/* @__PURE__ */ r(ur, { levels: ["h1", "h2", "h3"] }),
|
|
118
|
+
/* @__PURE__ */ r(gr, {}),
|
|
119
|
+
/* @__PURE__ */ r(fr, {}),
|
|
120
|
+
/* @__PURE__ */ r(pr, {}),
|
|
121
|
+
/* @__PURE__ */ r(br, {})
|
|
109
122
|
] }) }) }) }),
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ r(
|
|
112
|
-
/* @__PURE__ */ r(
|
|
113
|
-
/* @__PURE__ */ r(
|
|
114
|
-
/* @__PURE__ */ r(
|
|
123
|
+
I && /* @__PURE__ */ r(u, { children: () => /* @__PURE__ */ t("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
|
|
124
|
+
/* @__PURE__ */ r(d, { format: "bold" }),
|
|
125
|
+
/* @__PURE__ */ r(d, { format: "italic" }),
|
|
126
|
+
/* @__PURE__ */ r(d, { format: "underline" }),
|
|
127
|
+
/* @__PURE__ */ r(d, { format: "strikethrough" }),
|
|
128
|
+
l && /* @__PURE__ */ r(
|
|
129
|
+
Nr,
|
|
130
|
+
{
|
|
131
|
+
trigger: N ?? "@"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
115
134
|
] }) })
|
|
116
135
|
] }),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
136
|
+
/* @__PURE__ */ t("div", { className: "relative flex min-h-0 w-full flex-1 flex-col", children: [
|
|
137
|
+
C && /* @__PURE__ */ r(W, {}),
|
|
119
138
|
/* @__PURE__ */ r(
|
|
120
|
-
|
|
139
|
+
Z,
|
|
121
140
|
{
|
|
122
|
-
ErrorBoundary:
|
|
141
|
+
ErrorBoundary: K,
|
|
123
142
|
contentEditable: /* @__PURE__ */ r(
|
|
124
143
|
"div",
|
|
125
144
|
{
|
|
126
|
-
ref:
|
|
145
|
+
ref: k,
|
|
127
146
|
className: "flex min-h-0 w-full flex-1 overflow-auto",
|
|
128
147
|
children: /* @__PURE__ */ r(
|
|
129
|
-
|
|
148
|
+
nr,
|
|
130
149
|
{
|
|
131
|
-
placeholder:
|
|
132
|
-
className: `border-d-border w-full rounded-none border-b ${
|
|
150
|
+
placeholder: M,
|
|
151
|
+
className: `border-d-border w-full rounded-none border-b ${L}`
|
|
133
152
|
}
|
|
134
153
|
)
|
|
135
154
|
}
|
|
136
155
|
)
|
|
137
156
|
}
|
|
138
157
|
),
|
|
139
|
-
|
|
140
|
-
/* @__PURE__ */ r(
|
|
141
|
-
/* @__PURE__ */ r(
|
|
158
|
+
y && /* @__PURE__ */ t(p, { children: [
|
|
159
|
+
/* @__PURE__ */ r(X, {}),
|
|
160
|
+
/* @__PURE__ */ r(Q, {})
|
|
142
161
|
] }),
|
|
143
|
-
(
|
|
162
|
+
(F || P) && /* @__PURE__ */ r(lr, { children: /* @__PURE__ */ t("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
|
|
144
163
|
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-start" }),
|
|
145
|
-
/* @__PURE__ */ r("div", { children:
|
|
146
|
-
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children:
|
|
147
|
-
/* @__PURE__ */ r(
|
|
148
|
-
/* @__PURE__ */ r(
|
|
164
|
+
/* @__PURE__ */ r("div", { children: P && /* @__PURE__ */ r(sr, { charset: "UTF-16" }) }),
|
|
165
|
+
/* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */ t(p, { children: [
|
|
166
|
+
/* @__PURE__ */ r(ar, {}),
|
|
167
|
+
/* @__PURE__ */ r(J, {})
|
|
149
168
|
] }) })
|
|
150
169
|
] }) })
|
|
151
170
|
] }),
|
|
152
171
|
/* @__PURE__ */ r(
|
|
153
|
-
|
|
172
|
+
Y,
|
|
154
173
|
{
|
|
155
174
|
ignoreSelectionChange: !0,
|
|
156
|
-
onChange: (
|
|
157
|
-
if (!
|
|
158
|
-
const R =
|
|
159
|
-
() =>
|
|
175
|
+
onChange: (e) => {
|
|
176
|
+
if (!n && !a) return;
|
|
177
|
+
const R = Tr(
|
|
178
|
+
e.read(() => U(v))
|
|
160
179
|
);
|
|
161
|
-
|
|
180
|
+
if (!n) {
|
|
181
|
+
a?.(R);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
let T = [];
|
|
185
|
+
if (l) {
|
|
186
|
+
const $ = e.read(
|
|
187
|
+
() => dr(or(S))
|
|
188
|
+
), j = Array.isArray(c) ? c : [], B = new Map(
|
|
189
|
+
j.map((i) => [String(i.id), i])
|
|
190
|
+
);
|
|
191
|
+
T = $.map(
|
|
192
|
+
(i) => B.get(String(i.id)) ?? {
|
|
193
|
+
id: i.id,
|
|
194
|
+
label: i.label,
|
|
195
|
+
value: i.value
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
n(R, { mentions: T });
|
|
162
200
|
}
|
|
163
201
|
}
|
|
164
202
|
)
|
|
165
203
|
] }) }) });
|
|
166
204
|
}
|
|
167
205
|
export {
|
|
168
|
-
|
|
206
|
+
co as AppEditor
|
|
169
207
|
};
|