@synopackageland/ui 0.20.4 → 0.20.6
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/CHANGELOG.md +27 -0
- package/LICENSES/THIRD_PARTY.md +2 -32
- package/dist/cli.js +0 -0
- package/dist/components/app/app-layout/AppLayout.vue.d.ts +21 -1
- package/dist/components/app/app-layout/pageTitle.d.ts +24 -0
- package/dist/components/app/app-tab-bar/AppTabBar.vue.d.ts +1 -1
- package/dist/components/app/aside-panel/AsidePanel.vue.d.ts +1 -1
- package/dist/components/app/section-tabs/SectionTabs.vue.d.ts +22 -4
- package/dist/components/composite/about-dialog/AboutDialog.vue.d.ts +1 -1
- package/dist/components/composite/adaptive-panel/AdaptivePanel.vue.d.ts +1 -1
- package/dist/components/composite/data-grid/DataGrid.vue.d.ts +19 -1
- package/dist/components/composite/data-grid/labels.d.ts +15 -0
- package/dist/components/composite/data-grid/listLayout.d.ts +26 -0
- package/dist/components/composite/data-table/DataTable.vue.d.ts +33 -7
- package/dist/components/composite/file-picker/FilePicker.vue.d.ts +3 -2
- package/dist/components/composite/form/FormGroup.vue.d.ts +1 -1
- package/dist/components/composite/form/context.d.ts +13 -0
- package/dist/components/composite/form-actions/FormActions.vue.d.ts +6 -2
- package/dist/components/composite/record-panel/RecordPanel.vue.d.ts +20 -6
- package/dist/components/composite/settings-section/SettingsSection.vue.d.ts +1 -1
- package/dist/components/composite/tag-editor/TagEditor.vue.d.ts +2 -2
- package/dist/components/composite/tree-view/TreeView.vue.d.ts +4 -4
- package/dist/components/composite/wizard/WizardDialog.vue.d.ts +2 -2
- package/dist/components/containers/list-detail/ListDetail.vue.d.ts +5 -3
- package/dist/components/feedback/validation-popup/ValidationPopup.vue.d.ts +1 -1
- package/dist/components/primitives/color-picker/ColorPicker.vue.d.ts +4 -4
- package/dist/components/primitives/combobox/Combobox.vue.d.ts +4 -4
- package/dist/components/primitives/context-menu/ContextMenu.vue.d.ts +2 -2
- package/dist/components/primitives/date-picker/DatePicker.vue.d.ts +1 -1
- package/dist/components/primitives/dialog/Dialog.vue.d.ts +17 -9
- package/dist/components/primitives/dropdown-menu/DropdownMenu.vue.d.ts +3 -3
- package/dist/components/primitives/dropdown-menu/DropdownMenuSheet.vue.d.ts +28 -0
- package/dist/components/primitives/input/Input.vue.d.ts +8 -1
- package/dist/components/primitives/input/Textarea.vue.d.ts +1 -1
- package/dist/components/primitives/input-steppers/InputSteppers.vue.d.ts +1 -1
- package/dist/components/primitives/motion/PushTransition.vue.d.ts +38 -0
- package/dist/components/primitives/multiple-select/MultipleSelect.vue.d.ts +4 -4
- package/dist/components/primitives/pagination/Pagination.vue.d.ts +22 -9
- package/dist/components/primitives/pagination/PaginationSheet.vue.d.ts +27 -0
- package/dist/components/primitives/pagination/labels.d.ts +6 -0
- package/dist/components/primitives/popover/Popover.vue.d.ts +1 -1
- package/dist/components/primitives/select/internal/ComboboxField.vue.d.ts +5 -5
- package/dist/components/primitives/select/internal/SelectSheet.vue.d.ts +42 -0
- package/dist/components/primitives/sheet/BottomSheet.vue.d.ts +69 -0
- package/dist/components/primitives/sheet/Sheet.vue.d.ts +13 -5
- package/dist/components/primitives/sheet/phone.d.ts +7 -0
- package/dist/components/primitives/superbox-select/SuperboxSelect.vue.d.ts +4 -4
- package/dist/components/rich-text-editor/RichTextEditor.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/extensions.d.ts +2 -0
- package/dist/composables/formControl.d.ts +18 -0
- package/dist/composables/phoneSurface.d.ts +35 -0
- package/dist/feedback/StatusSlot.vue.d.ts +1 -1
- package/dist/grid/host/GridHost.vue.d.ts +1 -1
- package/dist/grid.js +358 -259
- package/dist/i18n/text.d.ts +11 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +21205 -16551
- package/dist/json-preview/preview.js +16913 -12418
- package/dist/reka-runtime.json +15 -12
- package/dist/rich-text.js +259 -255
- package/dist/theme.css +1 -1
- package/dist/themes/dsm7-embedded-reset.css +1 -1
- package/dist/themes/dsm7-embedded-theme.css +1 -1
- package/dist/themes/dsm7-embedded.css +1 -1
- package/dist/themes/dsm7.css +1 -1
- package/docs/adaptive-layout.md +11 -9
- package/docs/app-local-modal.md +1 -1
- package/docs/layout-rules.md +14 -0
- package/docs/list-detail.md +9 -3
- package/docs/mobile-native.md +299 -11
- package/docs/release-checks.md +5 -0
- package/docs/theme-hooks.md +2 -2
- package/package.json +65 -57
package/dist/rich-text.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as At, computed as
|
|
2
|
-
import { useEditor as
|
|
3
|
-
import { BubbleMenu as
|
|
4
|
-
import { Bold as
|
|
5
|
-
import { richTextParts as
|
|
6
|
-
import { Extension as
|
|
7
|
-
import
|
|
8
|
-
import { Placeholder as
|
|
9
|
-
import
|
|
10
|
-
import { Plugin as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return
|
|
1
|
+
import { defineComponent as At, computed as x, ref as q, watch as G, useId as zt, reactive as Et, onMounted as Bt, onBeforeUnmount as Tt, openBlock as p, createElementBlock as y, mergeProps as It, createElementVNode as B, unref as l, Fragment as Q, renderList as Z, withModifiers as F, normalizeClass as E, createBlock as T, resolveDynamicComponent as Me, withCtx as I, createVNode as _, createCommentVNode as C, createTextVNode as Qe, toDisplayString as ee, normalizeStyle as Rt, shallowRef as Ht } from "vue";
|
|
2
|
+
import { useEditor as qt, EditorContent as Ft } from "@tiptap/vue-3";
|
|
3
|
+
import { BubbleMenu as Nt } from "@tiptap/vue-3/menus";
|
|
4
|
+
import { Bold as Ut, Italic as Vt, Link as Dt, List as Ot, ListOrdered as jt, Heading2 as Kt, Heading3 as Gt, Code as Qt, TextQuote as Wt, SquareCode as Jt, Strikethrough as Xt, ImagePlus as We, AtSign as Je, Ellipsis as Yt, Unlink as Xe, X as _e, RotateCw as Zt, CaseSensitive as ea, SendHorizontal as ta } from "@lucide/vue";
|
|
5
|
+
import { richTextParts as aa, useUiText as ra, useUploadQueue as ia, DropdownMenu as na, Input as Ye, Button as Ze, IconButton as te, MentionList as oa, Spinner as et, UploadQueue as la, isUnsupportedPicture as sa, isPicture as ua } from "./index.js";
|
|
6
|
+
import { Extension as $e, mergeAttributes as at, Node as da } from "@tiptap/core";
|
|
7
|
+
import ca from "@tiptap/starter-kit";
|
|
8
|
+
import { Placeholder as fa } from "@tiptap/extensions";
|
|
9
|
+
import pa from "@tiptap/extension-mention";
|
|
10
|
+
import { Plugin as ma } from "@tiptap/pm/state";
|
|
11
|
+
const va = /^(?:https?:\/\/[^\s/]|mailto:[^\s@]+@)/i;
|
|
12
|
+
function ba(a) {
|
|
13
|
+
return da.create({
|
|
14
14
|
name: "fileImage",
|
|
15
15
|
group: "block",
|
|
16
16
|
atom: !0,
|
|
@@ -27,17 +27,17 @@ function va(a) {
|
|
|
27
27
|
},
|
|
28
28
|
// Only an image this editor made is taken back from the clipboard; any other is handled by the paste code.
|
|
29
29
|
parseHTML: () => [{ tag: "img[data-file-id]" }],
|
|
30
|
-
renderHTML: ({ HTMLAttributes: o }) => ["img",
|
|
30
|
+
renderHTML: ({ HTMLAttributes: o }) => ["img", at(o)],
|
|
31
31
|
addNodeView() {
|
|
32
32
|
return ({ node: o }) => {
|
|
33
33
|
let i = o;
|
|
34
34
|
const u = document.createElement("div");
|
|
35
35
|
u.className = "relative my-1 flex w-fit max-w-full overflow-hidden rounded-[var(--ui-radius-md)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-subtle)] [&.ProseMirror-selectednode]:shadow-[var(--ui-shadow-focus)]", u.setAttribute("data-ui-rich-editor-image", ""), u.contentEditable = "false";
|
|
36
36
|
const n = () => {
|
|
37
|
-
const { id: s, alt:
|
|
37
|
+
const { id: s, alt: S, upload: k, src: h } = i.attrs, m = s ? a.file(s) : void 0, v = i.attrs.progress < 0 ? "failed" : i.attrs.progress, c = h ?? m?.preview ?? m?.url ?? m?.thumb;
|
|
38
38
|
if (u.replaceChildren(), u.style.background = m?.dominant ?? "", u.dataset.state = v === "failed" ? "failed" : k ? "uploading" : m?.state ?? (c ? "ready" : "missing"), c) {
|
|
39
39
|
const f = document.createElement("img");
|
|
40
|
-
f.src = c, f.alt =
|
|
40
|
+
f.src = c, f.alt = S || m?.name || "", f.draggable = !1, f.className = `block max-h-80 max-w-full object-contain ${k ? "opacity-60" : ""}`, m?.width && m.height && (f.style.aspectRatio = `${m.width} / ${m.height}`), u.append(f);
|
|
41
41
|
} else {
|
|
42
42
|
const f = document.createElement("span");
|
|
43
43
|
f.className = "flex h-24 min-w-40 items-center justify-center px-3 text-[length:var(--ui-font-size-sm)] text-[var(--ui-text-secondary)]", f.textContent = a.labels.missing, u.append(f);
|
|
@@ -45,8 +45,8 @@ function va(a) {
|
|
|
45
45
|
if (k) {
|
|
46
46
|
const f = document.createElement("span");
|
|
47
47
|
f.className = "absolute inset-x-0 bottom-0 h-1 bg-[var(--ui-surface-subtle)]", f.setAttribute("role", "progressbar"), f.setAttribute("aria-label", v === "failed" ? a.labels.failed : a.labels.uploading);
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const w = document.createElement("span");
|
|
49
|
+
w.className = v === "failed" ? "block h-full w-full bg-[var(--ui-danger)]" : "block h-full bg-[var(--ui-primary)] transition-[width]", v !== "failed" && (w.style.width = `${Math.round((v ?? 0) * 100)}%`, f.setAttribute("aria-valuenow", String(Math.round((v ?? 0) * 100)))), f.append(w), u.append(f);
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
return n(), {
|
|
@@ -58,7 +58,7 @@ function va(a) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const ha = $e.create({
|
|
62
62
|
name: "listDepth",
|
|
63
63
|
priority: 1e3,
|
|
64
64
|
addKeyboardShortcuts() {
|
|
@@ -71,18 +71,18 @@ const ba = Ce.create({
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), ga = $e.create({
|
|
75
75
|
name: "imeBackspaceGuard",
|
|
76
76
|
addProseMirrorPlugins() {
|
|
77
77
|
const a = this.editor;
|
|
78
|
-
return [new
|
|
78
|
+
return [new ma({
|
|
79
79
|
filterTransaction: (o) => !a.view.composing || o.docChanged || o.selectionSet || o.storedMarksSet || Object.keys(o.meta).length > 0
|
|
80
80
|
})];
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
function
|
|
83
|
+
function ya(a) {
|
|
84
84
|
return [
|
|
85
|
-
|
|
85
|
+
ca.configure({
|
|
86
86
|
heading: a.headings ? { levels: [2, 3] } : !1,
|
|
87
87
|
horizontalRule: !1,
|
|
88
88
|
underline: !1,
|
|
@@ -93,26 +93,27 @@ function ga(a) {
|
|
|
93
93
|
linkOnPaste: !0,
|
|
94
94
|
defaultProtocol: "https",
|
|
95
95
|
protocols: [],
|
|
96
|
-
isAllowedUri: (o) =>
|
|
96
|
+
isAllowedUri: (o) => va.test(o),
|
|
97
97
|
HTMLAttributes: { rel: "noopener noreferrer", target: null }
|
|
98
98
|
}
|
|
99
99
|
}),
|
|
100
|
-
|
|
101
|
-
ba,
|
|
100
|
+
fa.configure({ placeholder: a.placeholder }),
|
|
102
101
|
ha,
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
ga,
|
|
103
|
+
ba(a.image),
|
|
104
|
+
pa.configure({
|
|
105
105
|
HTMLAttributes: { class: "font-semibold text-[var(--ui-primary)]" },
|
|
106
106
|
renderText: ({ node: o }) => `@${o.attrs.label ?? o.attrs.id}`,
|
|
107
|
-
renderHTML: ({ node: o, options: i }) => ["span",
|
|
107
|
+
renderHTML: ({ node: o, options: i }) => ["span", at({ "data-type": "mention", "data-id": o.attrs.id }, i.HTMLAttributes), `@${o.attrs.label ?? o.attrs.id}`],
|
|
108
108
|
suggestion: { char: "@", ...a.mention }
|
|
109
109
|
}),
|
|
110
|
-
|
|
110
|
+
$e.create({
|
|
111
111
|
name: "editorKeys",
|
|
112
112
|
addKeyboardShortcuts() {
|
|
113
113
|
const o = () => !this.editor.view.composing;
|
|
114
114
|
return {
|
|
115
115
|
"Mod-Enter": () => o() && (a.submit?.() ?? !1),
|
|
116
|
+
Enter: () => o() && (a.enter?.() ?? !1),
|
|
116
117
|
"Mod-k": () => o() && a.link(),
|
|
117
118
|
Escape: () => o() && a.escape()
|
|
118
119
|
};
|
|
@@ -120,52 +121,52 @@ function ga(a) {
|
|
|
120
121
|
})
|
|
121
122
|
];
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
const i = [], u =
|
|
124
|
+
function ka(a, o = {}) {
|
|
125
|
+
const i = [], u = aa(a, { people: o.people, headings: o.headings }).flatMap((n) => rt(n, o, i));
|
|
125
126
|
return { doc: { type: "doc", content: u.length ? u : [{ type: "paragraph" }] }, images: i };
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function rt(a, o, i) {
|
|
128
129
|
if (a.type === "code") return [{ type: "codeBlock", content: a.text ? [{ type: "text", text: a.text }] : void 0 }];
|
|
129
|
-
if (a.type === "quote") return [{ type: "blockquote", content: a.blocks.flatMap((s) =>
|
|
130
|
-
if (a.type === "list") return [
|
|
131
|
-
const u = (s) => a.type === "heading" ? { type: "heading", attrs: { level: a.level }, content: s } : { type: "paragraph", content: s }, n =
|
|
130
|
+
if (a.type === "quote") return [{ type: "blockquote", content: a.blocks.flatMap((s) => rt(s, o, i)) }];
|
|
131
|
+
if (a.type === "list") return [nt(a, o, i)];
|
|
132
|
+
const u = (s) => a.type === "heading" ? { type: "heading", attrs: { level: a.level }, content: s } : { type: "paragraph", content: s }, n = it(a.parts, u, o, i);
|
|
132
133
|
return o.imagesApart && a.parts.some((s) => s.type === "image") && n.every((s) => !s.content) ? [] : n;
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function it(a, o, i, u) {
|
|
135
136
|
const n = [];
|
|
136
137
|
let s = [];
|
|
137
|
-
const
|
|
138
|
+
const S = (k = !1) => {
|
|
138
139
|
for (; s.at(-1)?.type === "hardBreak"; ) s.pop();
|
|
139
140
|
for (; s[0]?.type === "hardBreak"; ) s.shift();
|
|
140
141
|
(s.length || k) && n.push(o(s.length ? s : [])), s = [];
|
|
141
142
|
};
|
|
142
143
|
for (const k of a) {
|
|
143
144
|
if (k.type !== "image") {
|
|
144
|
-
s.push(...
|
|
145
|
+
s.push(...xa(k));
|
|
145
146
|
continue;
|
|
146
147
|
}
|
|
147
148
|
if (i.imagesApart) {
|
|
148
149
|
u.push({ id: k.id, alt: k.alt });
|
|
149
150
|
continue;
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
S(), n.push({ type: "fileImage", attrs: { id: k.id, alt: k.alt } });
|
|
152
153
|
}
|
|
153
|
-
return
|
|
154
|
+
return S(!n.length), n.map((k) => k.content?.length === 0 ? { ...k, content: void 0 } : k);
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
+
function nt(a, o, i) {
|
|
156
157
|
return {
|
|
157
158
|
type: a.ordered ? "orderedList" : "bulletList",
|
|
158
159
|
attrs: a.ordered ? { start: a.start } : void 0,
|
|
159
160
|
content: a.items.map((u) => ({
|
|
160
161
|
type: "listItem",
|
|
161
162
|
content: [
|
|
162
|
-
...
|
|
163
|
-
...u.list ? [
|
|
163
|
+
...it(u.parts, (n) => ({ type: "paragraph", content: n }), o, i),
|
|
164
|
+
...u.list ? [nt(u.list, o, i)] : []
|
|
164
165
|
]
|
|
165
166
|
}))
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function xa(a) {
|
|
169
170
|
if (a.type === "mention") return [{ type: "mention", attrs: { id: a.id, label: a.label } }];
|
|
170
171
|
if (a.type === "code") return [{ type: "text", text: a.text, marks: [{ type: "code" }] }];
|
|
171
172
|
const o = [];
|
|
@@ -176,31 +177,31 @@ function ka(a) {
|
|
|
176
177
|
n && i.push({ type: "hardBreak" }), u && i.push(o.length ? { type: "text", text: u, marks: o } : { type: "text", text: u });
|
|
177
178
|
}), i;
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
+
function wa(a, o = {}) {
|
|
180
181
|
const i = o.blockSeparator ?? `
|
|
181
182
|
|
|
182
183
|
`;
|
|
183
|
-
return
|
|
184
|
+
return ot(a.content ?? [], "", i).replace(/\s+$/, "");
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function ot(a, o, i) {
|
|
186
187
|
const u = [];
|
|
187
188
|
for (const n of a) {
|
|
188
|
-
const s =
|
|
189
|
+
const s = Ma(n, o);
|
|
189
190
|
s !== null && u.push(s);
|
|
190
191
|
}
|
|
191
192
|
return u.join(i);
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function Ma(a, o) {
|
|
194
195
|
switch (a.type) {
|
|
195
196
|
case "paragraph":
|
|
196
|
-
return
|
|
197
|
+
return Ce(a.content ?? [], o);
|
|
197
198
|
case "heading":
|
|
198
|
-
return `${"#".repeat(a.attrs?.level === 3 ? 3 : 2)} ${
|
|
199
|
+
return `${"#".repeat(a.attrs?.level === 3 ? 3 : 2)} ${Ce(a.content ?? [], o)}`;
|
|
199
200
|
case "bulletList":
|
|
200
201
|
case "orderedList":
|
|
201
|
-
return
|
|
202
|
+
return ut(a, 0);
|
|
202
203
|
case "blockquote":
|
|
203
|
-
return
|
|
204
|
+
return ot(a.content ?? [], "", `
|
|
204
205
|
|
|
205
206
|
`).split(`
|
|
206
207
|
`).map((i) => i ? `> ${i}` : ">").join(`
|
|
@@ -212,31 +213,31 @@ ${i}
|
|
|
212
213
|
${u}`;
|
|
213
214
|
}
|
|
214
215
|
case "fileImage":
|
|
215
|
-
return a.attrs?.id ?
|
|
216
|
+
return a.attrs?.id ? st(a) : null;
|
|
216
217
|
default:
|
|
217
218
|
return null;
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
|
-
const
|
|
221
|
-
function
|
|
221
|
+
const lt = (a) => a.replace(/\n/g, " ").replace(/[\\[\]]/g, "\\$&"), st = (a) => ``, _a = (a) => a.replace(/[\\*`[\]]/g, "\\$&").replace(/~(?=~)/g, "\\~").replace(/&(?=(?:lt|gt|amp|nbsp);)/g, "\\&"), Ca = /^([ \t]*)(?:(#|>|-(?=[ \t]))|(\d{1,9})(?=[.)][ \t]))/gm, $a = (a) => a.replace(Ca, (o, i, u, n) => u ? `${i}\\${u}` : `${i}${n}\\`);
|
|
222
|
+
function ut(a, o) {
|
|
222
223
|
const i = a.type === "orderedList", u = Number(a.attrs?.start ?? 1) || 1, n = " ".repeat(Math.min(o, 1)), s = [];
|
|
223
|
-
return (a.content ?? []).forEach((
|
|
224
|
+
return (a.content ?? []).forEach((S, k) => {
|
|
224
225
|
const h = i ? `${u + k}. ` : "- ", m = n + " ".repeat(h.length);
|
|
225
226
|
let v = !0;
|
|
226
|
-
for (const c of
|
|
227
|
+
for (const c of S.content ?? []) {
|
|
227
228
|
if (c.type === "bulletList" || c.type === "orderedList") {
|
|
228
|
-
s.push(
|
|
229
|
+
s.push(ut(c, o + 1));
|
|
229
230
|
continue;
|
|
230
231
|
}
|
|
231
|
-
const f = c.type === "fileImage" ? c.attrs?.id ?
|
|
232
|
+
const f = c.type === "fileImage" ? c.attrs?.id ? st(c) : "" : c.type === "paragraph" || c.type === "heading" ? Ce(c.content ?? [], m) : "";
|
|
232
233
|
!f && !v || (s.push(v ? `${n}${h}${f}` : `${m}${f}`), v = !1);
|
|
233
234
|
}
|
|
234
235
|
v && s.push(`${n}${h}`.trimEnd());
|
|
235
236
|
}), s.join(`
|
|
236
237
|
`);
|
|
237
238
|
}
|
|
238
|
-
const
|
|
239
|
-
function
|
|
239
|
+
const tt = [["bold", "**"], ["italic", "*"], ["strike", "~~"]], Pa = /^(?:https?:\/\/[^\s/]|mailto:[^\s@]+@)/i;
|
|
240
|
+
function Ce(a, o) {
|
|
240
241
|
const i = [];
|
|
241
242
|
for (let h = 0; h < a.length; h++) {
|
|
242
243
|
const m = a[h];
|
|
@@ -250,29 +251,29 @@ function _e(a, o) {
|
|
|
250
251
|
}
|
|
251
252
|
if (m.type !== "text" || !m.text) continue;
|
|
252
253
|
const v = new Set((m.marks ?? []).map((f) => f.type)), c = m.marks?.find((f) => f.type === "link")?.attrs?.href;
|
|
253
|
-
if (c &&
|
|
254
|
+
if (c && Pa.test(c)) {
|
|
254
255
|
let f = m.text;
|
|
255
|
-
const
|
|
256
|
+
const w = new Set(v);
|
|
256
257
|
for (; a[h + 1]?.type === "text" && a[h + 1].marks?.some((z) => z.type === "link" && z.attrs?.href === c); ) {
|
|
257
258
|
const z = a[++h];
|
|
258
259
|
f += z.text;
|
|
259
260
|
const N = new Set((z.marks ?? []).map(($) => $.type));
|
|
260
|
-
for (const $ of
|
|
261
|
+
for (const $ of w) N.has($) || w.delete($);
|
|
261
262
|
}
|
|
262
|
-
|
|
263
|
+
w.delete("link"), w.delete("code"), i.push({ marks: w, raw: `[${lt(f.trim()) || c}](${c})` });
|
|
263
264
|
continue;
|
|
264
265
|
}
|
|
265
266
|
if (v.has("code")) {
|
|
266
267
|
v.delete("code"), i.push({ marks: v, raw: `\`${m.text.replace(/`/g, "ˋ")}\`` });
|
|
267
268
|
continue;
|
|
268
269
|
}
|
|
269
|
-
i.push({ marks: v, raw:
|
|
270
|
+
i.push({ marks: v, raw: _a(m.text) });
|
|
270
271
|
}
|
|
271
272
|
let u = "", n = [], s = "";
|
|
272
|
-
const
|
|
273
|
+
const S = (h) => {
|
|
273
274
|
const m = n.findIndex((v) => !h.has(v));
|
|
274
275
|
if (!(m < 0)) {
|
|
275
|
-
for (const v of n.slice(m).reverse()) u +=
|
|
276
|
+
for (const v of n.slice(m).reverse()) u += tt.find(([c]) => c === v)[1];
|
|
276
277
|
n = n.slice(0, m);
|
|
277
278
|
}
|
|
278
279
|
}, k = (h, m) => {
|
|
@@ -286,7 +287,7 @@ function _e(a, o) {
|
|
|
286
287
|
};
|
|
287
288
|
return i.forEach((h, m) => {
|
|
288
289
|
if ("lineBreak" in h) {
|
|
289
|
-
|
|
290
|
+
S(/* @__PURE__ */ new Set()), u += s + `
|
|
290
291
|
` + o, s = "";
|
|
291
292
|
return;
|
|
292
293
|
}
|
|
@@ -295,39 +296,39 @@ function _e(a, o) {
|
|
|
295
296
|
s += h.raw;
|
|
296
297
|
return;
|
|
297
298
|
}
|
|
298
|
-
|
|
299
|
-
const f =
|
|
300
|
-
for (const [
|
|
301
|
-
u += z, n.push(
|
|
299
|
+
S(h.marks), u += s + v, s = h.raw.slice(v.length + c.length);
|
|
300
|
+
const f = tt.filter(([w]) => h.marks.has(w) && !n.includes(w)).sort((w, z) => k(m, z[0]) - k(m, w[0]));
|
|
301
|
+
for (const [w, z] of f)
|
|
302
|
+
u += z, n.push(w);
|
|
302
303
|
u += c;
|
|
303
|
-
}),
|
|
304
|
+
}), S(/* @__PURE__ */ new Set()), $a(u + s).replace(/\s+$/, "");
|
|
304
305
|
}
|
|
305
|
-
const
|
|
306
|
+
const La = ["data-variant", "data-over"], Sa = ["aria-label"], Aa = ["aria-label", "title", "aria-pressed", "disabled", "data-ui-rich-tool", "onClick"], za = ["aria-label", "title", "disabled"], Ea = {
|
|
306
307
|
key: 1,
|
|
307
308
|
class: "flex items-center gap-1.5 border-b border-[var(--ui-border-subtle)] px-2 py-1.5",
|
|
308
309
|
"data-ui-rich-link-row": ""
|
|
309
|
-
},
|
|
310
|
+
}, Ba = ["aria-label"], Ta = ["aria-label", "title", "aria-pressed", "onClick"], Ia = ["aria-label"], Ra = ["data-ui-rich-attachment"], Ha = ["src", "alt"], qa = {
|
|
310
311
|
key: 0,
|
|
311
312
|
class: "absolute inset-0 flex items-center justify-center bg-[color-mix(in_srgb,var(--ui-danger)_35%,transparent)]"
|
|
312
|
-
},
|
|
313
|
+
}, Fa = {
|
|
313
314
|
key: 1,
|
|
314
315
|
class: "absolute inset-0 flex items-center justify-center"
|
|
315
|
-
},
|
|
316
|
+
}, Na = ["aria-label", "onClick"], Ua = {
|
|
316
317
|
key: 4,
|
|
317
318
|
class: "flex items-center gap-1.5 border-t border-[var(--ui-border-subtle)] px-2 py-1.5",
|
|
318
319
|
"data-ui-rich-link-row": ""
|
|
319
|
-
},
|
|
320
|
+
}, Va = ["aria-label"], Da = ["aria-label", "title", "aria-pressed", "disabled", "data-ui-rich-tool", "onClick"], Oa = {
|
|
320
321
|
key: 6,
|
|
321
322
|
class: "flex min-w-0 items-center gap-0.5 px-1 pb-1",
|
|
322
323
|
"data-ui-rich-actions": ""
|
|
323
|
-
},
|
|
324
|
+
}, ja = ["aria-label", "title", "disabled"], Ka = ["aria-label", "title", "disabled"], Ga = ["aria-label", "title", "aria-pressed", "aria-expanded", "disabled"], Qa = ["aria-label", "title", "disabled"], Wa = {
|
|
324
325
|
key: 7,
|
|
325
326
|
class: "flex flex-col gap-2 border-t border-[var(--ui-border-subtle)] px-3 py-2"
|
|
326
|
-
},
|
|
327
|
+
}, Ja = {
|
|
327
328
|
"aria-live": "polite",
|
|
328
329
|
class: "empty:hidden",
|
|
329
330
|
"data-ui-rich-notes": ""
|
|
330
|
-
}, oe =
|
|
331
|
+
}, oe = Ht(null), sr = /* @__PURE__ */ At({
|
|
331
332
|
inheritAttrs: !1,
|
|
332
333
|
__name: "RichTextEditor",
|
|
333
334
|
props: {
|
|
@@ -350,30 +351,30 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
350
351
|
},
|
|
351
352
|
emits: ["update:modelValue", "submit", "search", "pending"],
|
|
352
353
|
setup(a, { emit: o }) {
|
|
353
|
-
const i = a, u = o, n =
|
|
354
|
+
const i = a, u = o, n = ra(), s = x(() => i.variant === "compact"), S = x(() => i.headings ?? !s.value), k = x(() => i.maxImages ?? (s.value ? 20 : 50)), h = typeof window < "u" && window.matchMedia?.("(pointer: coarse)").matches, v = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform) ? "⌘" : "Ctrl+", c = q([]), f = /* @__PURE__ */ new Set(), w = q([]);
|
|
354
355
|
let z;
|
|
355
356
|
function N(...e) {
|
|
356
|
-
clearTimeout(z),
|
|
357
|
-
|
|
357
|
+
clearTimeout(z), w.value = e, e.length && (z = setTimeout(() => {
|
|
358
|
+
w.value = [];
|
|
358
359
|
}, 8e3));
|
|
359
360
|
}
|
|
360
|
-
const $ =
|
|
361
|
-
onDone: (e) =>
|
|
361
|
+
const $ = ia((e, t) => i.upload(e, t), {
|
|
362
|
+
onDone: (e) => dt(e),
|
|
362
363
|
onFailed: (e) => ue(e.key, -1)
|
|
363
|
-
}), U =
|
|
364
|
+
}), U = x(() => $.tasks.filter((e) => e.status !== "done" && e.status !== "canceled")), le = x(() => U.value.length);
|
|
364
365
|
G(() => $.tasks.map((e) => e.status === "uploading" && e.size ? e.loaded / e.size : -2), (e) => {
|
|
365
366
|
e.forEach((t, r) => {
|
|
366
367
|
t >= 0 && ue($.tasks[r].key, t);
|
|
367
368
|
});
|
|
368
369
|
}), G(le, (e) => u("pending", e));
|
|
369
|
-
function
|
|
370
|
+
function dt(e) {
|
|
370
371
|
const t = c.value.find((r) => r.task === e.key);
|
|
371
372
|
t && (t.id = e.result, t.task = void 0), de(e.key, (r, d) => g.value?.view.dispatch(g.value.state.tr.setNodeMarkup(r, void 0, { ...d, id: e.result, upload: null, progress: 1 }))), $.remove(e.key), Y();
|
|
372
373
|
}
|
|
373
374
|
const se = /* @__PURE__ */ new Map();
|
|
374
375
|
function ue(e, t) {
|
|
375
376
|
const r = t < 0 ? -1 : Math.floor(t * 20) / 20;
|
|
376
|
-
se.get(e) !== r && (se.set(e, r), de(e, (d,
|
|
377
|
+
se.get(e) !== r && (se.set(e, r), de(e, (d, M) => g.value?.view.dispatch(g.value.state.tr.setNodeMarkup(d, void 0, { ...M, progress: r }).setMeta("addToHistory", !1))));
|
|
377
378
|
}
|
|
378
379
|
function de(e, t) {
|
|
379
380
|
g.value?.state.doc.descendants((r, d) => {
|
|
@@ -381,79 +382,79 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
381
382
|
return t(d, r.attrs), !1;
|
|
382
383
|
});
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
+
function ct() {
|
|
385
386
|
if (s.value) return c.value.length;
|
|
386
387
|
let e = 0;
|
|
387
388
|
return g.value?.state.doc.descendants((t) => {
|
|
388
389
|
t.type.name === "fileImage" && e++;
|
|
389
390
|
}), e;
|
|
390
391
|
}
|
|
391
|
-
const
|
|
392
|
+
const ft = (e) => e.split(".").pop()?.toUpperCase() ?? "";
|
|
392
393
|
function ae(e, t) {
|
|
393
394
|
if (!i.upload || i.disabled || !e.length) return;
|
|
394
395
|
const r = [], d = [];
|
|
395
|
-
let
|
|
396
|
+
let M = k.value - ct();
|
|
396
397
|
for (const L of e)
|
|
397
|
-
|
|
398
|
+
sa(L) ? r.push(n("{name}: {kind} images are not supported; on an iPhone, set Settings > Camera > Formats to Most Compatible", { name: L.name, kind: ft(L.name) || "HEIC" })) : ua(L) ? M <= 0 ? r.push(n("You can add up to {count} images", { count: k.value })) : (d.push(L), M--) : r.push(n("{name} is not a JPEG, PNG, WebP or GIF image", { name: L.name }));
|
|
398
399
|
if (N(...new Set(r)), !d.length) return;
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
return f.add(
|
|
400
|
+
const De = $.add(d).map((L, Ke) => {
|
|
401
|
+
const Ge = URL.createObjectURL(d[Ke]);
|
|
402
|
+
return f.add(Ge), { key: L.key, name: d[Ke].name, src: Ge };
|
|
402
403
|
});
|
|
403
404
|
if (s.value) {
|
|
404
|
-
c.value.push(...
|
|
405
|
+
c.value.push(...De.map((L) => ({ key: L.key, task: L.key, name: L.name, alt: "", src: L.src }))), Y();
|
|
405
406
|
return;
|
|
406
407
|
}
|
|
407
|
-
const
|
|
408
|
-
t === void 0 ?
|
|
408
|
+
const Oe = De.map((L) => ({ type: "fileImage", attrs: { upload: L.key, src: L.src, alt: "", progress: 0 } })), je = g.value?.chain().focus();
|
|
409
|
+
t === void 0 ? je?.insertContent(Oe).run() : je?.insertContentAt(t, Oe).run();
|
|
409
410
|
}
|
|
410
|
-
function
|
|
411
|
+
function pt(e) {
|
|
411
412
|
e.task && $.remove(e.task), c.value = c.value.filter((t) => t.key !== e.key), Y();
|
|
412
413
|
}
|
|
413
414
|
function ce(e) {
|
|
414
415
|
se.delete(e), ue(e, 0), $.retry(e);
|
|
415
416
|
}
|
|
416
|
-
function
|
|
417
|
+
function Pe(e) {
|
|
417
418
|
$.remove(e), c.value = c.value.filter((t) => t.task !== e), de(e, (t, r) => {
|
|
418
419
|
g.value?.view.dispatch(g.value.state.tr.delete(t, t + 1));
|
|
419
420
|
}), Y();
|
|
420
421
|
}
|
|
421
|
-
const
|
|
422
|
-
function
|
|
423
|
-
|
|
422
|
+
const Le = q();
|
|
423
|
+
function Se() {
|
|
424
|
+
Le.value?.click();
|
|
424
425
|
}
|
|
425
|
-
function
|
|
426
|
+
function mt(e) {
|
|
426
427
|
const t = e.target;
|
|
427
428
|
ae(Array.from(t.files ?? [])), t.value = "";
|
|
428
429
|
}
|
|
429
430
|
const fe = [];
|
|
430
|
-
function
|
|
431
|
+
function vt(e) {
|
|
431
432
|
const t = new DOMParser().parseFromString(e, "text/html");
|
|
432
433
|
let r = !1;
|
|
433
434
|
for (const d of Array.from(t.querySelectorAll("img"))) {
|
|
434
435
|
if (d.hasAttribute("data-file-id")) continue;
|
|
435
|
-
const
|
|
436
|
-
/^data:image\//i.test(
|
|
436
|
+
const M = d.getAttribute("src") ?? "";
|
|
437
|
+
/^data:image\//i.test(M) || M && new URL(M, location.href).origin === location.origin && !/^data:/i.test(M) ? fe.push(M) : r = !0, d.remove();
|
|
437
438
|
}
|
|
438
|
-
return r && N(n("Images from other websites are not pasted; save them first and add them as files")), fe.length && setTimeout(
|
|
439
|
+
return r && N(n("Images from other websites are not pasted; save them first and add them as files")), fe.length && setTimeout(bt), t.body.innerHTML;
|
|
439
440
|
}
|
|
440
|
-
async function
|
|
441
|
+
async function bt() {
|
|
441
442
|
const e = fe.splice(0), t = [];
|
|
442
443
|
for (const [r, d] of e.entries())
|
|
443
444
|
try {
|
|
444
|
-
const
|
|
445
|
-
t.push(new File([
|
|
445
|
+
const M = await (await fetch(d)).blob();
|
|
446
|
+
t.push(new File([M], `pasted-${r + 1}.${M.type.split("/")[1] ?? "png"}`, { type: M.type }));
|
|
446
447
|
} catch {
|
|
447
448
|
}
|
|
448
449
|
ae(t);
|
|
449
450
|
}
|
|
450
|
-
const pe =
|
|
451
|
+
const pe = zt(), b = Et({
|
|
451
452
|
open: !1,
|
|
452
453
|
query: "",
|
|
453
454
|
active: 0,
|
|
454
455
|
reference: null,
|
|
455
456
|
command: null
|
|
456
|
-
}), W =
|
|
457
|
+
}), W = x(() => {
|
|
457
458
|
const e = b.query.toLocaleLowerCase();
|
|
458
459
|
return i.filter && e ? i.candidates.filter((t) => [t.label, t.id, t.description ?? ""].some((r) => r.toLocaleLowerCase().includes(e))) : i.candidates;
|
|
459
460
|
});
|
|
@@ -464,80 +465,80 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
464
465
|
const t = e.clientRect;
|
|
465
466
|
b.reference = t ? { getBoundingClientRect: () => t() ?? new DOMRect() } : null, b.command = (r) => e.command(r), !(e.editor.view.composing && b.open) && ((b.query !== e.query || !b.open) && (b.query = e.query, b.active = 0, u("search", e.query)), b.open = !0);
|
|
466
467
|
}
|
|
467
|
-
function
|
|
468
|
+
function ze(e) {
|
|
468
469
|
b.command?.({ id: e.id, label: e.label }), b.open = !1;
|
|
469
470
|
}
|
|
470
|
-
function
|
|
471
|
+
function ht({ event: e }) {
|
|
471
472
|
if (e.isComposing || e.keyCode === 229) return !1;
|
|
472
473
|
const t = W.value.length;
|
|
473
474
|
if (e.key === "ArrowDown" && t) b.active = (b.active + 1) % t;
|
|
474
475
|
else if (e.key === "ArrowUp" && t) b.active = (b.active - 1 + t) % t;
|
|
475
|
-
else if ((e.key === "Enter" || e.key === "Tab") && t)
|
|
476
|
+
else if ((e.key === "Enter" || e.key === "Tab") && t) ze(W.value[b.active]);
|
|
476
477
|
else if (e.key === "Escape") b.open = !1;
|
|
477
478
|
else return !1;
|
|
478
479
|
return !0;
|
|
479
480
|
}
|
|
480
|
-
const
|
|
481
|
-
{ key: "bold", label: "Bold", icon:
|
|
482
|
-
{ key: "italic", label: "Italic", icon:
|
|
483
|
-
{ key: "link", label: "Link", icon:
|
|
484
|
-
{ key: "bulletList", label: "Bulleted list", icon:
|
|
485
|
-
{ key: "orderedList", label: "Numbered list", icon:
|
|
486
|
-
{ key: "h2", label: "Heading", icon:
|
|
487
|
-
{ key: "h3", label: "Subheading", icon:
|
|
488
|
-
{ key: "code", label: "Code", icon:
|
|
489
|
-
{ key: "quote", label: "Quote", icon:
|
|
490
|
-
{ key: "codeBlock", label: "Code block", icon:
|
|
491
|
-
{ key: "strike", label: "Strikethrough", icon:
|
|
492
|
-
], re =
|
|
493
|
-
function
|
|
481
|
+
const gt = (e) => `${pe}-${e}`, A = () => g.value.chain().focus(), P = (e, t) => g.value?.isActive(e, t) ?? !1, yt = [
|
|
482
|
+
{ key: "bold", label: "Bold", icon: Ut, shortcut: `${v}B`, active: () => P("bold"), run: () => A().toggleBold().run() },
|
|
483
|
+
{ key: "italic", label: "Italic", icon: Vt, shortcut: `${v}I`, active: () => P("italic"), run: () => A().toggleItalic().run() },
|
|
484
|
+
{ key: "link", label: "Link", icon: Dt, shortcut: `${v}K`, active: () => P("link"), run: () => qe() },
|
|
485
|
+
{ key: "bulletList", label: "Bulleted list", icon: Ot, active: () => P("bulletList"), run: () => A().toggleBulletList().run() },
|
|
486
|
+
{ key: "orderedList", label: "Numbered list", icon: jt, active: () => P("orderedList"), run: () => A().toggleOrderedList().run() },
|
|
487
|
+
{ key: "h2", label: "Heading", icon: Kt, active: () => P("heading", { level: 2 }), run: () => A().toggleHeading({ level: 2 }).run(), full: !0 },
|
|
488
|
+
{ key: "h3", label: "Subheading", icon: Gt, active: () => P("heading", { level: 3 }), run: () => A().toggleHeading({ level: 3 }).run(), full: !0 },
|
|
489
|
+
{ key: "code", label: "Code", icon: Qt, active: () => P("code"), run: () => A().toggleCode().run() },
|
|
490
|
+
{ key: "quote", label: "Quote", icon: Wt, active: () => P("blockquote"), run: () => A().toggleBlockquote().run() },
|
|
491
|
+
{ key: "codeBlock", label: "Code block", icon: Jt, active: () => P("codeBlock"), run: () => A().toggleCodeBlock().run() },
|
|
492
|
+
{ key: "strike", label: "Strikethrough", icon: Xt, active: () => P("strike"), run: () => A().toggleStrike().run() }
|
|
493
|
+
], re = x(() => yt.filter((e) => !e.full || S.value)), kt = ["bold", "italic", "link", "code", "bulletList"], xt = x(() => re.value.filter((e) => kt.includes(e.key))), V = (e) => e.shortcut ? `${n(e.label)} (${e.shortcut})` : n(e.label), me = /* @__PURE__ */ Symbol("rich-text-editor"), J = x(() => oe.value === me);
|
|
494
|
+
function Ee() {
|
|
494
495
|
oe.value = J.value ? null : me, g.value?.commands.focus();
|
|
495
496
|
}
|
|
496
497
|
const ve = q(), be = q(1 / 0);
|
|
497
498
|
let he;
|
|
498
|
-
const ge = 34, ie =
|
|
499
|
+
const ge = h ? 46 : 34, ie = x(() => [
|
|
499
500
|
...re.value.map((e) => ({ key: e.key, label: e.label, icon: e.icon, action: e })),
|
|
500
|
-
...i.upload ? [{ key: "image", label: "Add image", icon:
|
|
501
|
-
{ key: "mention", label: "Mention someone", icon:
|
|
502
|
-
]),
|
|
503
|
-
function
|
|
504
|
-
if (e === "image") return
|
|
505
|
-
if (e === "mention") return
|
|
501
|
+
...i.upload ? [{ key: "image", label: "Add image", icon: We, action: void 0 }] : [],
|
|
502
|
+
{ key: "mention", label: "Mention someone", icon: Je, action: void 0 }
|
|
503
|
+
]), Be = x(() => ie.value.length * ge <= be.value ? ie.value.length : Math.max(1, Math.floor((be.value - ge) / ge))), wt = x(() => ie.value.slice(0, Be.value)), Te = x(() => ie.value.slice(Be.value).map((e) => ({ key: e.key, label: n(e.label), icon: e.icon })));
|
|
504
|
+
function Ie(e) {
|
|
505
|
+
if (e === "image") return Se();
|
|
506
|
+
if (e === "mention") return Re();
|
|
506
507
|
re.value.find((t) => t.key === e)?.run();
|
|
507
508
|
}
|
|
508
|
-
function
|
|
509
|
+
function Re() {
|
|
509
510
|
const e = g.value;
|
|
510
511
|
if (!e) return;
|
|
511
512
|
const { $from: t } = e.state.selection, r = t.parent.textBetween(Math.max(0, t.parentOffset - 1), t.parentOffset, `
|
|
512
513
|
`, " ");
|
|
513
|
-
|
|
514
|
+
A().insertContent(r && !/\s/.test(r) ? " @" : "@").run();
|
|
514
515
|
}
|
|
515
|
-
const
|
|
516
|
-
function
|
|
516
|
+
const He = /^(?:https?:\/\/[^\s/]|mailto:[^\s@]+@)/i, D = q(!1), O = q(""), ne = q();
|
|
517
|
+
function qe() {
|
|
517
518
|
return O.value = g.value?.getAttributes("link").href ?? "", D.value = !0, setTimeout(() => (ne.value?.$el?.querySelector("input") ?? ne.value?.$el)?.focus?.()), !0;
|
|
518
519
|
}
|
|
519
|
-
function
|
|
520
|
+
function Mt(e) {
|
|
520
521
|
const t = e.trim();
|
|
521
|
-
return !t ||
|
|
522
|
+
return !t || He.test(t) ? t : /^[^\s@/]+@[^\s@]+\.[^\s@]+$/.test(t) ? `mailto:${t}` : /^[^\s]+\.[^\s]+$/.test(t) ? `https://${t}` : t;
|
|
522
523
|
}
|
|
523
524
|
function ye() {
|
|
524
|
-
const e =
|
|
525
|
+
const e = Mt(O.value);
|
|
525
526
|
if (!e) return ke();
|
|
526
|
-
if (!
|
|
527
|
-
g.value.state.selection.empty && !P("link") ?
|
|
527
|
+
if (!He.test(e)) return N(n("Links start with http://, https:// or mailto:"));
|
|
528
|
+
g.value.state.selection.empty && !P("link") ? A().insertContent({ type: "text", text: e, marks: [{ type: "link", attrs: { href: e } }] }).run() : A().extendMarkRange("link").setLink({ href: e }).run(), j();
|
|
528
529
|
}
|
|
529
530
|
function ke() {
|
|
530
|
-
|
|
531
|
+
A().extendMarkRange("link").unsetLink().run(), j();
|
|
531
532
|
}
|
|
532
533
|
function j() {
|
|
533
534
|
D.value = !1, g.value?.commands.focus();
|
|
534
535
|
}
|
|
535
|
-
function
|
|
536
|
+
function Fe(e) {
|
|
536
537
|
e.isComposing || e.keyCode === 229 || (e.key === "Enter" ? (e.preventDefault(), ye()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), j()));
|
|
537
538
|
}
|
|
538
539
|
let X = i.modelValue;
|
|
539
|
-
function
|
|
540
|
-
const e = g.value?.getJSON() ?? {}, t =
|
|
540
|
+
function _t() {
|
|
541
|
+
const e = g.value?.getJSON() ?? {}, t = wa(e, s.value ? { blockSeparator: `
|
|
541
542
|
` } : {});
|
|
542
543
|
if (!s.value) return t;
|
|
543
544
|
const r = c.value.filter((d) => d.id).map((d) => `![${d.alt.replace(/[[\]\n]/g, " ")}](file:${d.id})`);
|
|
@@ -547,19 +548,19 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
547
548
|
`);
|
|
548
549
|
}
|
|
549
550
|
function Y() {
|
|
550
|
-
const e =
|
|
551
|
+
const e = _t();
|
|
551
552
|
e !== X && (X = e, u("update:modelValue", e));
|
|
552
553
|
}
|
|
553
|
-
function
|
|
554
|
-
const { doc: t, images: r } =
|
|
554
|
+
function Ne(e) {
|
|
555
|
+
const { doc: t, images: r } = ka(e, { people: i.candidates, headings: S.value, imagesApart: s.value });
|
|
555
556
|
for (const d of c.value) d.task && $.remove(d.task);
|
|
556
557
|
return c.value = r.map((d) => ({ key: d.id, id: d.id, name: i.files?.(d.id)?.name ?? d.alt, alt: d.alt })), t;
|
|
557
558
|
}
|
|
558
|
-
const g =
|
|
559
|
-
content:
|
|
559
|
+
const g = qt({
|
|
560
|
+
content: Ne(i.modelValue),
|
|
560
561
|
editable: !i.disabled,
|
|
561
|
-
extensions:
|
|
562
|
-
headings:
|
|
562
|
+
extensions: ya({
|
|
563
|
+
headings: S.value,
|
|
563
564
|
placeholder: i.placeholder,
|
|
564
565
|
image: { file: (e) => i.files?.(e), labels: { uploading: n("Uploading"), failed: n("Upload failed"), missing: n("File is missing") } },
|
|
565
566
|
mention: {
|
|
@@ -567,13 +568,15 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
567
568
|
allowSpaces: !1,
|
|
568
569
|
render: () => ({ onStart: Ae, onUpdate: Ae, onExit: () => {
|
|
569
570
|
b.open = !1;
|
|
570
|
-
}, onKeyDown:
|
|
571
|
+
}, onKeyDown: ht })
|
|
571
572
|
},
|
|
572
|
-
submit: () => s.value ? (
|
|
573
|
-
|
|
573
|
+
submit: () => s.value ? (we(), !0) : !1,
|
|
574
|
+
// A phone keyboard has no Ctrl+Enter: its return key says Send and sends (an open @ list keeps Enter to pick).
|
|
575
|
+
enter: () => Ve.value && !b.open ? (we(), !0) : !1,
|
|
576
|
+
link: qe,
|
|
574
577
|
escape: () => {
|
|
575
578
|
if (D.value) j();
|
|
576
|
-
else if (J.value)
|
|
579
|
+
else if (J.value) Ee();
|
|
577
580
|
else return !1;
|
|
578
581
|
return !0;
|
|
579
582
|
}
|
|
@@ -585,7 +588,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
585
588
|
"aria-multiline": "true",
|
|
586
589
|
"data-ui-rich-editor-content": ""
|
|
587
590
|
},
|
|
588
|
-
transformPastedHTML:
|
|
591
|
+
transformPastedHTML: vt,
|
|
589
592
|
handlePaste: (e, t) => {
|
|
590
593
|
const r = Array.from(t.clipboardData?.files ?? []);
|
|
591
594
|
if (!r.length || !i.upload) return !1;
|
|
@@ -593,47 +596,48 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
593
596
|
return d && new DOMParser().parseFromString(d, "text/html").body.textContent?.trim() ? !1 : (t.preventDefault(), ae(r), !0);
|
|
594
597
|
},
|
|
595
598
|
handleDrop: (e, t, r, d) => {
|
|
596
|
-
const
|
|
597
|
-
return d || !
|
|
599
|
+
const M = Array.from(t.dataTransfer?.files ?? []);
|
|
600
|
+
return d || !M.length || !i.upload ? !1 : (t.preventDefault(), ae(M, e.posAtCoords({ left: t.clientX, top: t.clientY })?.pos), !0);
|
|
598
601
|
}
|
|
599
602
|
},
|
|
600
603
|
onUpdate: () => Y()
|
|
601
604
|
});
|
|
602
605
|
G(() => i.modelValue, (e) => {
|
|
603
|
-
e === X || !g.value || (X = e, g.value.commands.setContent(
|
|
606
|
+
e === X || !g.value || (X = e, g.value.commands.setContent(Ne(e), { emitUpdate: !1 }));
|
|
604
607
|
}), G(() => i.disabled, (e) => g.value?.setEditable(!e));
|
|
605
|
-
const
|
|
608
|
+
const Ct = x(() => i.maxlength === void 0 ? 0 : Array.from(i.modelValue).length), K = x(() => (i.maxlength ?? 0) - Ct.value), R = x(() => i.maxlength !== void 0 && K.value < 0), xe = x(() => i.maxlength !== void 0 && K.value <= i.maxlength * 0.1), $t = x(() => !i.modelValue.trim()), Ue = x(() => !i.disabled && !i.sending && !$t.value && !R.value && !le.value), Ve = x(() => s.value && !!h), Pt = x(() => ({
|
|
606
609
|
id: i.id,
|
|
610
|
+
enterkeyhint: Ve.value ? "send" : void 0,
|
|
607
611
|
"aria-label": i.ariaLabel ?? (i.placeholder || void 0),
|
|
608
612
|
"aria-invalid": i.invalid || R.value ? "true" : void 0,
|
|
609
613
|
"aria-disabled": i.disabled ? "true" : void 0,
|
|
610
614
|
"aria-autocomplete": "list",
|
|
611
615
|
"aria-controls": b.open ? pe : void 0,
|
|
612
|
-
"aria-activedescendant": b.open && W.value.length ?
|
|
616
|
+
"aria-activedescendant": b.open && W.value.length ? gt(b.active) : void 0
|
|
613
617
|
}));
|
|
614
|
-
G([g,
|
|
618
|
+
G([g, Pt], ([e, t]) => {
|
|
615
619
|
const r = e?.view.dom;
|
|
616
620
|
if (r)
|
|
617
|
-
for (const [d,
|
|
618
|
-
|
|
621
|
+
for (const [d, M] of Object.entries(t))
|
|
622
|
+
M === void 0 ? r.removeAttribute(d) : r.setAttribute(d, String(M));
|
|
619
623
|
}, { immediate: !0 });
|
|
620
|
-
function
|
|
621
|
-
if (!
|
|
624
|
+
function we() {
|
|
625
|
+
if (!Ue.value) {
|
|
622
626
|
le.value && N(n("Wait for the images to finish uploading"));
|
|
623
627
|
return;
|
|
624
628
|
}
|
|
625
629
|
u("submit", X);
|
|
626
630
|
}
|
|
627
|
-
const
|
|
628
|
-
|
|
631
|
+
const Lt = ({ from: e, to: t }) => !h && e !== t && !D.value && !!g.value?.isEditable && !P("codeBlock") && !P("fileImage");
|
|
632
|
+
Bt(() => {
|
|
629
633
|
typeof ResizeObserver > "u" || !ve.value || (he = new ResizeObserver(([e]) => {
|
|
630
634
|
be.value = e.contentRect.width;
|
|
631
635
|
}), he.observe(ve.value));
|
|
632
|
-
}),
|
|
636
|
+
}), Tt(() => {
|
|
633
637
|
he?.disconnect(), $.cancelAll(), clearTimeout(z), oe.value === me && (oe.value = null);
|
|
634
638
|
for (const e of f) URL.revokeObjectURL(e);
|
|
635
639
|
});
|
|
636
|
-
const H = "relative flex size-8 shrink-0 items-center justify-center rounded-[var(--ui-radius-sm)] border-0 bg-transparent p-0 text-[var(--ui-text-secondary)] outline-none hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-text)] focus-visible:shadow-[var(--ui-shadow-focus)] disabled:pointer-events-none disabled:text-[var(--ui-text-disabled)] aria-pressed:bg-[var(--ui-primary-soft)] aria-pressed:text-[var(--ui-primary)] [@media(pointer:coarse)]:size-11",
|
|
640
|
+
const H = "relative flex size-8 shrink-0 items-center justify-center rounded-[var(--ui-radius-sm)] border-0 bg-transparent p-0 text-[var(--ui-text-secondary)] outline-none hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-text)] focus-visible:shadow-[var(--ui-shadow-focus)] disabled:pointer-events-none disabled:text-[var(--ui-text-disabled)] aria-pressed:bg-[var(--ui-primary-soft)] aria-pressed:text-[var(--ui-primary)] [@media(pointer:coarse)]:size-11", St = [
|
|
637
641
|
"min-w-0 text-[length:var(--ui-font-size)] leading-5 text-[var(--ui-text)] [overflow-wrap:anywhere]",
|
|
638
642
|
"[&_.ProseMirror]:outline-none [&_.ProseMirror]:whitespace-pre-wrap [&_.ProseMirror_p]:m-0 [&_.ProseMirror>*+*]:mt-2",
|
|
639
643
|
"[&_.ProseMirror_h2]:m-0 [&_.ProseMirror_h2]:text-[1.25em] [&_.ProseMirror_h2]:font-semibold [&_.ProseMirror_h3]:m-0 [&_.ProseMirror_h3]:text-[1.1em] [&_.ProseMirror_h3]:font-semibold",
|
|
@@ -644,7 +648,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
644
648
|
"[&_.ProseMirror_a]:text-[var(--ui-primary)] [&_.ProseMirror_a]:underline [&_.ProseMirror_a]:underline-offset-2",
|
|
645
649
|
"[&_.is-editor-empty:first-child]:before:pointer-events-none [&_.is-editor-empty:first-child]:before:float-start [&_.is-editor-empty:first-child]:before:h-0 [&_.is-editor-empty:first-child]:before:text-[var(--ui-text-muted)] [&_.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]"
|
|
646
650
|
];
|
|
647
|
-
return (e, t) => (p(), y("div",
|
|
651
|
+
return (e, t) => (p(), y("div", It(e.$attrs, {
|
|
648
652
|
class: [
|
|
649
653
|
"flex min-w-0 flex-col rounded-[var(--ui-radius-control)] border bg-[var(--ui-surface)] transition-[border-color,box-shadow] duration-[var(--ui-motion-fast)] focus-within:shadow-[var(--ui-shadow-focus)]",
|
|
650
654
|
a.invalid || R.value ? "border-[var(--ui-danger)]" : "border-[var(--ui-border)] focus-within:border-[var(--ui-primary)]",
|
|
@@ -657,14 +661,14 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
657
661
|
}), [
|
|
658
662
|
B("input", {
|
|
659
663
|
ref_key: "picker",
|
|
660
|
-
ref:
|
|
664
|
+
ref: Le,
|
|
661
665
|
type: "file",
|
|
662
666
|
class: "sr-only",
|
|
663
667
|
tabindex: "-1",
|
|
664
668
|
"aria-hidden": "true",
|
|
665
669
|
accept: "image/jpeg,image/png,image/webp,image/gif",
|
|
666
670
|
multiple: "",
|
|
667
|
-
onChange:
|
|
671
|
+
onChange: mt
|
|
668
672
|
}, null, 544),
|
|
669
673
|
s.value ? C("", !0) : (p(), y("div", {
|
|
670
674
|
key: 0,
|
|
@@ -675,7 +679,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
675
679
|
class: "sticky top-0 z-[1] flex min-w-0 items-center gap-0.5 overflow-hidden rounded-t-[var(--ui-radius-control)] border-b border-[var(--ui-border-subtle)] bg-[var(--ui-surface)] px-1 py-1",
|
|
676
680
|
"data-ui-rich-toolbar": ""
|
|
677
681
|
}, [
|
|
678
|
-
(p(!0), y(Q, null, Z(
|
|
682
|
+
(p(!0), y(Q, null, Z(wt.value, (r) => (p(), y("button", {
|
|
679
683
|
key: r.key,
|
|
680
684
|
type: "button",
|
|
681
685
|
class: E(H),
|
|
@@ -686,18 +690,18 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
686
690
|
"data-ui-rich-tool": r.key,
|
|
687
691
|
onMousedown: t[0] || (t[0] = F(() => {
|
|
688
692
|
}, ["prevent"])),
|
|
689
|
-
onClick: (d) =>
|
|
693
|
+
onClick: (d) => Ie(r.key)
|
|
690
694
|
}, [
|
|
691
|
-
(p(), T(
|
|
695
|
+
(p(), T(Me(r.icon), {
|
|
692
696
|
class: "size-4",
|
|
693
697
|
"aria-hidden": "true"
|
|
694
698
|
}))
|
|
695
699
|
], 40, Aa))), 128)),
|
|
696
|
-
|
|
700
|
+
Te.value.length ? (p(), T(l(na), {
|
|
697
701
|
key: 0,
|
|
698
|
-
items:
|
|
702
|
+
items: Te.value,
|
|
699
703
|
align: "end",
|
|
700
|
-
onSelect:
|
|
704
|
+
onSelect: Ie
|
|
701
705
|
}, {
|
|
702
706
|
trigger: I(() => [
|
|
703
707
|
B("button", {
|
|
@@ -710,17 +714,17 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
710
714
|
onMousedown: t[1] || (t[1] = F(() => {
|
|
711
715
|
}, ["prevent"]))
|
|
712
716
|
}, [
|
|
713
|
-
_(l(
|
|
717
|
+
_(l(Yt), {
|
|
714
718
|
class: "size-4",
|
|
715
719
|
"aria-hidden": "true"
|
|
716
720
|
})
|
|
717
|
-
], 40,
|
|
721
|
+
], 40, za)
|
|
718
722
|
]),
|
|
719
723
|
_: 1
|
|
720
724
|
}, 8, ["items"])) : C("", !0)
|
|
721
|
-
], 8,
|
|
722
|
-
D.value && !s.value ? (p(), y("div",
|
|
723
|
-
_(l(
|
|
725
|
+
], 8, Sa)),
|
|
726
|
+
D.value && !s.value ? (p(), y("div", Ea, [
|
|
727
|
+
_(l(Ye), {
|
|
724
728
|
ref_key: "linkInput",
|
|
725
729
|
ref: ne,
|
|
726
730
|
modelValue: O.value,
|
|
@@ -731,15 +735,15 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
731
735
|
inputmode: "url",
|
|
732
736
|
"aria-label": l(n)("Link address"),
|
|
733
737
|
placeholder: "https://",
|
|
734
|
-
onKeydown:
|
|
738
|
+
onKeydown: Fe
|
|
735
739
|
}, null, 8, ["modelValue", "aria-label"]),
|
|
736
|
-
_(l(
|
|
740
|
+
_(l(Ze), {
|
|
737
741
|
size: "sm",
|
|
738
742
|
variant: "primary",
|
|
739
743
|
onClick: ye
|
|
740
744
|
}, {
|
|
741
745
|
default: I(() => [
|
|
742
|
-
|
|
746
|
+
Qe(ee(l(n)("Apply")), 1)
|
|
743
747
|
]),
|
|
744
748
|
_: 1
|
|
745
749
|
}),
|
|
@@ -750,7 +754,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
750
754
|
onClick: ke
|
|
751
755
|
}, {
|
|
752
756
|
default: I(() => [
|
|
753
|
-
_(l(
|
|
757
|
+
_(l(Xe), {
|
|
754
758
|
class: "size-4",
|
|
755
759
|
"aria-hidden": "true"
|
|
756
760
|
})
|
|
@@ -763,7 +767,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
763
767
|
onClick: j
|
|
764
768
|
}, {
|
|
765
769
|
default: I(() => [
|
|
766
|
-
_(l(
|
|
770
|
+
_(l(_e), {
|
|
767
771
|
class: "size-4",
|
|
768
772
|
"aria-hidden": "true"
|
|
769
773
|
})
|
|
@@ -771,11 +775,11 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
771
775
|
_: 1
|
|
772
776
|
}, 8, ["label"])
|
|
773
777
|
])) : C("", !0),
|
|
774
|
-
_(l(
|
|
778
|
+
_(l(Ft), {
|
|
775
779
|
editor: l(g),
|
|
776
|
-
class: E([
|
|
780
|
+
class: E([St, s.value ? "max-h-[calc(8lh+16px)] overflow-y-auto px-2.5 py-2" : "min-h-32 px-3 py-2.5"])
|
|
777
781
|
}, null, 8, ["editor", "class"]),
|
|
778
|
-
_(l(
|
|
782
|
+
_(l(oa), {
|
|
779
783
|
id: l(pe),
|
|
780
784
|
open: b.open,
|
|
781
785
|
reference: b.reference,
|
|
@@ -783,16 +787,16 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
783
787
|
active: b.active,
|
|
784
788
|
loading: a.loading,
|
|
785
789
|
boundary: l(g)?.view.dom,
|
|
786
|
-
onChoose:
|
|
790
|
+
onChoose: ze,
|
|
787
791
|
onHover: t[3] || (t[3] = (r) => {
|
|
788
792
|
b.active = r;
|
|
789
793
|
}),
|
|
790
794
|
onClose: t[4] || (t[4] = (r) => b.open = !1)
|
|
791
795
|
}, null, 8, ["id", "open", "reference", "people", "active", "loading", "boundary"]),
|
|
792
|
-
l(g) ? (p(), T(l(
|
|
796
|
+
l(g) ? (p(), T(l(Nt), {
|
|
793
797
|
key: 2,
|
|
794
798
|
editor: l(g),
|
|
795
|
-
"should-show":
|
|
799
|
+
"should-show": Lt,
|
|
796
800
|
options: { placement: "top", offset: 6 }
|
|
797
801
|
}, {
|
|
798
802
|
default: I(() => [
|
|
@@ -802,7 +806,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
802
806
|
class: "flex items-center gap-0.5 rounded-[var(--ui-radius-md)] border border-[var(--ui-border)] bg-[var(--ui-surface-raised)] p-0.5 shadow-[var(--ui-shadow-menu)]",
|
|
803
807
|
"data-ui-rich-bubble": ""
|
|
804
808
|
}, [
|
|
805
|
-
(p(!0), y(Q, null, Z(
|
|
809
|
+
(p(!0), y(Q, null, Z(xt.value, (r) => (p(), y("button", {
|
|
806
810
|
key: r.key,
|
|
807
811
|
type: "button",
|
|
808
812
|
class: E(H),
|
|
@@ -813,12 +817,12 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
813
817
|
}, ["prevent"])),
|
|
814
818
|
onClick: (d) => r.run()
|
|
815
819
|
}, [
|
|
816
|
-
(p(), T(
|
|
820
|
+
(p(), T(Me(r.icon), {
|
|
817
821
|
class: "size-4",
|
|
818
822
|
"aria-hidden": "true"
|
|
819
823
|
}))
|
|
820
|
-
], 40,
|
|
821
|
-
], 8,
|
|
824
|
+
], 40, Ta))), 128))
|
|
825
|
+
], 8, Ba)
|
|
822
826
|
]),
|
|
823
827
|
_: 1
|
|
824
828
|
}, 8, ["editor"])) : C("", !0),
|
|
@@ -835,7 +839,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
835
839
|
}, [
|
|
836
840
|
B("div", {
|
|
837
841
|
class: "relative flex size-16 items-center justify-center overflow-hidden rounded-[var(--ui-radius-md)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-subtle)]",
|
|
838
|
-
style:
|
|
842
|
+
style: Rt({ background: a.files?.(r.id ?? "")?.dominant })
|
|
839
843
|
}, [
|
|
840
844
|
r.src ?? a.files?.(r.id ?? "")?.thumb ? (p(), y("img", {
|
|
841
845
|
key: 0,
|
|
@@ -843,9 +847,9 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
843
847
|
alt: r.name,
|
|
844
848
|
class: E(["size-full object-cover", r.task && "opacity-60"]),
|
|
845
849
|
draggable: "false"
|
|
846
|
-
}, null, 10,
|
|
850
|
+
}, null, 10, Ha)) : C("", !0),
|
|
847
851
|
r.task ? (p(), y(Q, { key: 1 }, [
|
|
848
|
-
l($).tasks.find((d) => d.key === r.task)?.status === "failed" ? (p(), y("span",
|
|
852
|
+
l($).tasks.find((d) => d.key === r.task)?.status === "failed" ? (p(), y("span", qa, [
|
|
849
853
|
_(l(te), {
|
|
850
854
|
size: "sm",
|
|
851
855
|
variant: "secondary",
|
|
@@ -853,15 +857,15 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
853
857
|
onClick: (d) => ce(r.task)
|
|
854
858
|
}, {
|
|
855
859
|
default: I(() => [
|
|
856
|
-
_(l(
|
|
860
|
+
_(l(Zt), {
|
|
857
861
|
class: "size-4",
|
|
858
862
|
"aria-hidden": "true"
|
|
859
863
|
})
|
|
860
864
|
]),
|
|
861
865
|
_: 1
|
|
862
866
|
}, 8, ["label", "onClick"])
|
|
863
|
-
])) : (p(), y("span",
|
|
864
|
-
_(l(
|
|
867
|
+
])) : (p(), y("span", Fa, [
|
|
868
|
+
_(l(et), {
|
|
865
869
|
size: 20,
|
|
866
870
|
inline: "",
|
|
867
871
|
label: l(n)("Uploading")
|
|
@@ -874,17 +878,17 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
874
878
|
class: "absolute -end-1.5 -top-1.5 flex size-5 items-center justify-center rounded-full border border-[var(--ui-surface)] bg-[var(--ui-text-secondary)] p-0 text-[var(--ui-surface)] outline-none hover:bg-[var(--ui-text)] focus-visible:shadow-[var(--ui-shadow-focus)] after:absolute after:-inset-3 [@media(pointer:fine)]:after:hidden",
|
|
875
879
|
"aria-label": l(n)("Remove {name}", { name: r.name }),
|
|
876
880
|
"data-ui-rich-attachment-remove": "",
|
|
877
|
-
onClick: (d) =>
|
|
881
|
+
onClick: (d) => pt(r)
|
|
878
882
|
}, [
|
|
879
|
-
_(l(
|
|
883
|
+
_(l(_e), {
|
|
880
884
|
class: "size-3",
|
|
881
885
|
"aria-hidden": "true"
|
|
882
886
|
})
|
|
883
|
-
], 8,
|
|
884
|
-
], 8,
|
|
885
|
-
], 8,
|
|
886
|
-
D.value && s.value ? (p(), y("div",
|
|
887
|
-
_(l(
|
|
887
|
+
], 8, Na)
|
|
888
|
+
], 8, Ra))), 128))
|
|
889
|
+
], 8, Ia)) : C("", !0),
|
|
890
|
+
D.value && s.value ? (p(), y("div", Ua, [
|
|
891
|
+
_(l(Ye), {
|
|
888
892
|
ref_key: "linkInput",
|
|
889
893
|
ref: ne,
|
|
890
894
|
modelValue: O.value,
|
|
@@ -895,15 +899,15 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
895
899
|
inputmode: "url",
|
|
896
900
|
"aria-label": l(n)("Link address"),
|
|
897
901
|
placeholder: "https://",
|
|
898
|
-
onKeydown:
|
|
902
|
+
onKeydown: Fe
|
|
899
903
|
}, null, 8, ["modelValue", "aria-label"]),
|
|
900
|
-
_(l(
|
|
904
|
+
_(l(Ze), {
|
|
901
905
|
size: "sm",
|
|
902
906
|
variant: "primary",
|
|
903
907
|
onClick: ye
|
|
904
908
|
}, {
|
|
905
909
|
default: I(() => [
|
|
906
|
-
|
|
910
|
+
Qe(ee(l(n)("Apply")), 1)
|
|
907
911
|
]),
|
|
908
912
|
_: 1
|
|
909
913
|
}),
|
|
@@ -914,7 +918,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
914
918
|
onClick: ke
|
|
915
919
|
}, {
|
|
916
920
|
default: I(() => [
|
|
917
|
-
_(l(
|
|
921
|
+
_(l(Xe), {
|
|
918
922
|
class: "size-4",
|
|
919
923
|
"aria-hidden": "true"
|
|
920
924
|
})
|
|
@@ -927,7 +931,7 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
927
931
|
onClick: j
|
|
928
932
|
}, {
|
|
929
933
|
default: I(() => [
|
|
930
|
-
_(l(
|
|
934
|
+
_(l(_e), {
|
|
931
935
|
class: "size-4",
|
|
932
936
|
"aria-hidden": "true"
|
|
933
937
|
})
|
|
@@ -955,13 +959,13 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
955
959
|
}, ["prevent"])),
|
|
956
960
|
onClick: (d) => r.run()
|
|
957
961
|
}, [
|
|
958
|
-
(p(), T(
|
|
962
|
+
(p(), T(Me(r.icon), {
|
|
959
963
|
class: "size-4",
|
|
960
964
|
"aria-hidden": "true"
|
|
961
965
|
}))
|
|
962
|
-
], 40,
|
|
963
|
-
], 8,
|
|
964
|
-
s.value ? (p(), y("div",
|
|
966
|
+
], 40, Da))), 128))
|
|
967
|
+
], 8, Va)) : C("", !0),
|
|
968
|
+
s.value ? (p(), y("div", Oa, [
|
|
965
969
|
a.upload ? (p(), y("button", {
|
|
966
970
|
key: 0,
|
|
967
971
|
type: "button",
|
|
@@ -972,13 +976,13 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
972
976
|
"data-ui-rich-tool": "image",
|
|
973
977
|
onMousedown: t[8] || (t[8] = F(() => {
|
|
974
978
|
}, ["prevent"])),
|
|
975
|
-
onClick:
|
|
979
|
+
onClick: Se
|
|
976
980
|
}, [
|
|
977
|
-
_(l(
|
|
981
|
+
_(l(We), {
|
|
978
982
|
class: "size-4",
|
|
979
983
|
"aria-hidden": "true"
|
|
980
984
|
})
|
|
981
|
-
], 40,
|
|
985
|
+
], 40, ja)) : C("", !0),
|
|
982
986
|
B("button", {
|
|
983
987
|
type: "button",
|
|
984
988
|
class: E(H),
|
|
@@ -988,13 +992,13 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
988
992
|
"data-ui-rich-tool": "mention",
|
|
989
993
|
onMousedown: t[9] || (t[9] = F(() => {
|
|
990
994
|
}, ["prevent"])),
|
|
991
|
-
onClick:
|
|
995
|
+
onClick: Re
|
|
992
996
|
}, [
|
|
993
|
-
_(l(
|
|
997
|
+
_(l(Je), {
|
|
994
998
|
class: "size-4",
|
|
995
999
|
"aria-hidden": "true"
|
|
996
1000
|
})
|
|
997
|
-
], 40,
|
|
1001
|
+
], 40, Ka),
|
|
998
1002
|
B("button", {
|
|
999
1003
|
type: "button",
|
|
1000
1004
|
class: E(H),
|
|
@@ -1006,13 +1010,13 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
1006
1010
|
"data-ui-rich-format-toggle": "",
|
|
1007
1011
|
onMousedown: t[10] || (t[10] = F(() => {
|
|
1008
1012
|
}, ["prevent"])),
|
|
1009
|
-
onClick:
|
|
1013
|
+
onClick: Ee
|
|
1010
1014
|
}, [
|
|
1011
|
-
_(l(
|
|
1015
|
+
_(l(ea), {
|
|
1012
1016
|
class: "size-4",
|
|
1013
1017
|
"aria-hidden": "true"
|
|
1014
1018
|
})
|
|
1015
|
-
], 40,
|
|
1019
|
+
], 40, Ga),
|
|
1016
1020
|
t[14] || (t[14] = B("span", { class: "flex-1" }, null, -1)),
|
|
1017
1021
|
xe.value ? (p(), y("span", {
|
|
1018
1022
|
key: 1,
|
|
@@ -1025,51 +1029,51 @@ const Pa = ["data-variant", "data-over"], La = ["aria-label"], Aa = ["aria-label
|
|
|
1025
1029
|
class: E([H, "text-[var(--ui-primary)] disabled:text-[var(--ui-text-disabled)]"]),
|
|
1026
1030
|
"aria-label": `${l(n)("Send")} (${l(v)}Enter)`,
|
|
1027
1031
|
title: `${l(n)("Send")} (${l(v)}Enter)`,
|
|
1028
|
-
disabled: !
|
|
1032
|
+
disabled: !Ue.value,
|
|
1029
1033
|
"data-ui-rich-send": "",
|
|
1030
1034
|
onMousedown: t[11] || (t[11] = F(() => {
|
|
1031
1035
|
}, ["prevent"])),
|
|
1032
|
-
onClick:
|
|
1036
|
+
onClick: we
|
|
1033
1037
|
}, [
|
|
1034
|
-
a.sending ? (p(), T(l(
|
|
1038
|
+
a.sending ? (p(), T(l(et), {
|
|
1035
1039
|
key: 0,
|
|
1036
1040
|
size: 16,
|
|
1037
1041
|
inline: "",
|
|
1038
1042
|
label: l(n)("Sending")
|
|
1039
|
-
}, null, 8, ["label"])) : (p(), T(l(
|
|
1043
|
+
}, null, 8, ["label"])) : (p(), T(l(ta), {
|
|
1040
1044
|
key: 1,
|
|
1041
1045
|
class: "size-4 rtl:-scale-x-100",
|
|
1042
1046
|
"aria-hidden": "true"
|
|
1043
1047
|
}))
|
|
1044
|
-
], 42,
|
|
1048
|
+
], 42, Qa)
|
|
1045
1049
|
])) : C("", !0),
|
|
1046
|
-
!s.value && (xe.value || U.value.length) ? (p(), y("div",
|
|
1050
|
+
!s.value && (xe.value || U.value.length) ? (p(), y("div", Wa, [
|
|
1047
1051
|
xe.value ? (p(), y("span", {
|
|
1048
1052
|
key: 0,
|
|
1049
1053
|
"aria-live": "polite",
|
|
1050
1054
|
class: E(["self-end text-[length:var(--ui-font-size-sm)] tabular-nums", R.value ? "text-[var(--ui-danger-text)]" : "text-[var(--ui-text-secondary)]"]),
|
|
1051
1055
|
"data-ui-rich-count": ""
|
|
1052
1056
|
}, ee(R.value ? l(n)("{count} characters over the limit", { count: -K.value }) : l(n)("{count} characters left", { count: K.value })), 3)) : C("", !0),
|
|
1053
|
-
U.value.length ? (p(), T(l(
|
|
1057
|
+
U.value.length ? (p(), T(l(la), {
|
|
1054
1058
|
key: 1,
|
|
1055
1059
|
tasks: U.value,
|
|
1056
1060
|
onRetry: ce,
|
|
1057
|
-
onCancel:
|
|
1061
|
+
onCancel: Pe,
|
|
1058
1062
|
onRetryAll: t[12] || (t[12] = (r) => U.value.forEach((d) => d.status === "failed" && ce(d.key))),
|
|
1059
|
-
onCancelAll: t[13] || (t[13] = (r) => U.value.forEach((d) =>
|
|
1063
|
+
onCancelAll: t[13] || (t[13] = (r) => U.value.forEach((d) => Pe(d.key)))
|
|
1060
1064
|
}, null, 8, ["tasks"])) : C("", !0)
|
|
1061
1065
|
])) : C("", !0),
|
|
1062
|
-
B("div",
|
|
1063
|
-
(p(!0), y(Q, null, Z(
|
|
1066
|
+
B("div", Ja, [
|
|
1067
|
+
(p(!0), y(Q, null, Z(w.value, (r) => (p(), y("p", {
|
|
1064
1068
|
key: r,
|
|
1065
1069
|
class: "m-0 border-t border-[var(--ui-border-subtle)] px-3 py-1.5 text-[length:var(--ui-font-size-sm)] text-[var(--ui-danger-text)]"
|
|
1066
1070
|
}, ee(r), 1))), 128))
|
|
1067
1071
|
])
|
|
1068
|
-
], 16,
|
|
1072
|
+
], 16, La));
|
|
1069
1073
|
}
|
|
1070
1074
|
});
|
|
1071
1075
|
export {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1076
|
+
sr as RichTextEditor,
|
|
1077
|
+
wa as docToMarkdown,
|
|
1078
|
+
ka as markdownToDoc
|
|
1075
1079
|
};
|