@cocoar/vue-markdown-editor 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/CoarMarkdownEditor.vue.d.ts +7 -2
- package/dist/CoarMarkdownEditor.vue.d.ts.map +1 -1
- package/dist/CoarMarkdownEditorGroup.vue.d.ts +18 -0
- package/dist/CoarMarkdownEditorGroup.vue.d.ts.map +1 -0
- package/dist/CoarMarkdownToolbar.vue.d.ts +28 -0
- package/dist/CoarMarkdownToolbar.vue.d.ts.map +1 -0
- package/dist/editor-group.d.ts +22 -0
- package/dist/editor-group.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +620 -537
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, getCurrentInstance as d, h as f, inject as p, markRaw as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as ee, onMounted as _, openBlock as v,
|
|
2
|
-
import { Editor as
|
|
3
|
-
import { Milkdown as
|
|
4
|
-
import { CoarButton as
|
|
5
|
-
import { codeBlockSchema as
|
|
6
|
-
import { Plugin as
|
|
7
|
-
import { $markSchema as
|
|
8
|
-
import { isColorSpanClose as
|
|
9
|
-
import { CoarMarkdown as
|
|
10
|
-
import { addColAfterCommand as
|
|
11
|
-
import { Decoration as
|
|
12
|
-
import { history as
|
|
13
|
-
import { clipboard as
|
|
14
|
-
import { listener as
|
|
1
|
+
import { Fragment as e, Teleport as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, getCurrentInstance as d, h as f, inject as p, markRaw as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as ee, onMounted as _, openBlock as v, provide as y, ref as b, render as x, renderList as S, renderSlot as C, shallowRef as te, toDisplayString as w, unref as T, useId as E, useTemplateRef as D, vModelText as ne, vShow as O, watch as k, withCtx as A, withDirectives as j, withKeys as M, withModifiers as N } from "vue";
|
|
2
|
+
import { Editor as re, commandsCtx as P, defaultValueCtx as ie, editorViewCtx as F, editorViewOptionsCtx as I, rootCtx as ae } from "@milkdown/core";
|
|
3
|
+
import { Milkdown as L, MilkdownProvider as oe, useEditor as se, useInstance as ce } from "@milkdown/vue";
|
|
4
|
+
import { CoarButton as R, CoarCodeBlock as z, CoarContextMenu as le, CoarFormField as B, CoarIcon as V, CoarMenuDivider as ue, CoarMenuItem as de, CoarSelect as fe, CoarSidebar as pe, CoarSidebarDivider as H, CoarSidebarGroup as me, CoarSidebarItem as U, CoarTextInput as W, FORM_FIELD_INJECTION_KEY as G, menuPreset as he, useContextMenu as ge, useDialog as _e, useOverlay as ve } from "@cocoar/vue-ui";
|
|
5
|
+
import { codeBlockSchema as ye, commonmark as K, createCodeBlockCommand as be, insertHrCommand as xe, insertImageCommand as Se, liftListItemCommand as Ce, sinkListItemCommand as q, toggleEmphasisCommand as we, toggleInlineCodeCommand as Te, toggleStrongCommand as Ee, turnIntoTextCommand as De, wrapInBlockquoteCommand as Oe, wrapInBulletListCommand as ke, wrapInHeadingCommand as J, wrapInOrderedListCommand as Ae } from "@milkdown/preset-commonmark";
|
|
6
|
+
import { Plugin as je, PluginKey as Me, TextSelection as Ne } from "@milkdown/prose/state";
|
|
7
|
+
import { $markSchema as Pe, $nodeSchema as Fe, $prose as Ie, $remark as Le, $view as Re, replaceAll as ze } from "@milkdown/utils";
|
|
8
|
+
import { isColorSpanClose as Be, parse as Ve, parseColorSpanOpen as He, parseEmbedDirective as Ue, parseFrontmatter as We, sanitizeColor as Y, serializeColorSpanClose as Ge, serializeColorSpanOpen as Ke, serializeEmbedDirective as qe, toEmbedProps as Je } from "@cocoar/vue-markdown-core";
|
|
9
|
+
import { CoarMarkdown as Ye, EmbedRenderer as Xe, EmbedRenderer as Ze, MARKDOWN_EMBEDS_KEY as Qe, resolveEmbed as $e, resolveEmbed as et } from "@cocoar/vue-markdown";
|
|
10
|
+
import { addColAfterCommand as tt, addColBeforeCommand as nt, addRowAfterCommand as rt, addRowBeforeCommand as it, deleteSelectedCellsCommand as at, gfm as ot, insertTableCommand as st, moveColCommand as ct, moveRowCommand as lt, selectColCommand as ut, selectRowCommand as dt, selectTableCommand as ft, toggleStrikethroughCommand as pt } from "@milkdown/preset-gfm";
|
|
11
|
+
import { Decoration as mt, DecorationSet as ht } from "@milkdown/prose/view";
|
|
12
|
+
import { history as gt, redoCommand as _t, undoCommand as vt } from "@milkdown/plugin-history";
|
|
13
|
+
import { clipboard as yt } from "@milkdown/plugin-clipboard";
|
|
14
|
+
import { listener as bt, listenerCtx as xt } from "@milkdown/plugin-listener";
|
|
15
15
|
//#region \0rolldown/runtime.js
|
|
16
|
-
var
|
|
17
|
-
if (t && typeof t == "object" || typeof t == "function") for (var i =
|
|
16
|
+
var St = Object.create, Ct = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Tt = Object.getOwnPropertyNames, Et = Object.getPrototypeOf, Dt = Object.prototype.hasOwnProperty, Ot = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), kt = (e, t, n, r) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = Tt(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Dt.call(e, s) && s !== n && Ct(e, s, {
|
|
18
18
|
get: ((e) => t[e]).bind(null, s),
|
|
19
|
-
enumerable: !(r =
|
|
19
|
+
enumerable: !(r = wt(t, s)) || r.enumerable
|
|
20
20
|
});
|
|
21
21
|
return e;
|
|
22
|
-
},
|
|
22
|
+
}, At = (e, t, n) => (n = e == null ? {} : St(Et(e)), kt(t || !e || !e.__esModule ? Ct(n, "default", {
|
|
23
23
|
value: e,
|
|
24
24
|
enumerable: !0
|
|
25
25
|
}) : n, e));
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/toolbar-helpers.ts
|
|
28
|
-
function
|
|
28
|
+
function jt(e, t) {
|
|
29
29
|
switch (e) {
|
|
30
30
|
case "table":
|
|
31
31
|
case "tableOps":
|
|
@@ -35,16 +35,16 @@ function kt(e, t) {
|
|
|
35
35
|
default: return !0;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Mt(e, t) {
|
|
39
39
|
return t === void 0 ? !0 : "has" in t ? t.has(e) : t.includes(e);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Nt(e) {
|
|
42
42
|
let { target: t, inBulletList: n, inOrderedList: r } = e;
|
|
43
43
|
return (t === "bullet_list" ? n : r) ? "lift" : (t === "bullet_list" ? r : n) ? "switch" : "wrap";
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/flavor.ts
|
|
47
|
-
var
|
|
47
|
+
var Pt = {
|
|
48
48
|
commonmark: {
|
|
49
49
|
gfm: !1,
|
|
50
50
|
textColor: !1,
|
|
@@ -61,8 +61,8 @@ var Mt = {
|
|
|
61
61
|
embeds: !0
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
function
|
|
65
|
-
return e === void 0 ? { ...
|
|
64
|
+
function Ft(e) {
|
|
65
|
+
return e === void 0 ? { ...Pt.cocoar } : typeof e == "string" ? { ...Pt[e] ?? Pt.cocoar } : {
|
|
66
66
|
gfm: e.gfm ?? !1,
|
|
67
67
|
textColor: e.textColor ?? !1,
|
|
68
68
|
embeds: e.embeds ?? !1
|
|
@@ -70,7 +70,7 @@ function Nt(e) {
|
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/code-block-view/CodeBlockShell.vue?vue&type=script&setup=true&lang.ts
|
|
73
|
-
var
|
|
73
|
+
var It = { class: "coar-md-code-render" }, Lt = { class: "coar-md-code-edit" }, Rt = { class: "coar-md-code-lang-row" }, zt = /* @__PURE__ */ u({
|
|
74
74
|
__name: "CodeBlockShell",
|
|
75
75
|
props: {
|
|
76
76
|
text: {},
|
|
@@ -113,13 +113,13 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
113
113
|
value: "bash",
|
|
114
114
|
label: "Bash"
|
|
115
115
|
}
|
|
116
|
-
], a =
|
|
117
|
-
return
|
|
116
|
+
], a = D("contentMount");
|
|
117
|
+
return k([a, () => n.contentDOM], ([e, t]) => {
|
|
118
118
|
e && t && t.parentElement !== e && e.appendChild(t);
|
|
119
119
|
}, {
|
|
120
120
|
immediate: !0,
|
|
121
121
|
flush: "post"
|
|
122
|
-
}), (t, n) => (v(), o("div", { class: h(["coar-md-code-host", { "coar-md-code-host--editing": e.editing }]) }, [
|
|
122
|
+
}), (t, n) => (v(), o("div", { class: h(["coar-md-code-host", { "coar-md-code-host--editing": e.editing }]) }, [j(s("div", It, [l(T(z), {
|
|
123
123
|
code: e.text,
|
|
124
124
|
language: e.language || "text",
|
|
125
125
|
collapsible: !1,
|
|
@@ -128,11 +128,11 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
128
128
|
class: "coar-md-code-edit-btn",
|
|
129
129
|
type: "button",
|
|
130
130
|
title: "Edit code block",
|
|
131
|
-
onMousedown: n[0] ||=
|
|
132
|
-
}, [l(
|
|
131
|
+
onMousedown: n[0] ||= N((e) => r("enterEdit"), ["prevent"])
|
|
132
|
+
}, [l(T(V), {
|
|
133
133
|
name: "pencil",
|
|
134
134
|
size: "xs"
|
|
135
|
-
}), n[2] ||= s("span", null, "Edit", -1)], 32)], 512), [[
|
|
135
|
+
}), n[2] ||= s("span", null, "Edit", -1)], 32)], 512), [[O, !e.editing]]), j(s("div", Lt, [s("div", Rt, [l(T(fe), {
|
|
136
136
|
class: "coar-md-code-lang-select",
|
|
137
137
|
"model-value": e.language,
|
|
138
138
|
options: i,
|
|
@@ -142,21 +142,21 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
142
142
|
ref_key: "contentMount",
|
|
143
143
|
ref: a,
|
|
144
144
|
class: "coar-md-code-content"
|
|
145
|
-
}, null, 512)], 512), [[
|
|
145
|
+
}, null, 512)], 512), [[O, e.editing]])], 2));
|
|
146
146
|
}
|
|
147
|
-
}),
|
|
147
|
+
}), Bt = /* @__PURE__ */ new Set(), Vt = class {
|
|
148
148
|
dom;
|
|
149
149
|
contentDOM;
|
|
150
150
|
app;
|
|
151
|
-
text =
|
|
152
|
-
language =
|
|
153
|
-
editing =
|
|
151
|
+
text = b("");
|
|
152
|
+
language = b("");
|
|
153
|
+
editing = b(!1);
|
|
154
154
|
constructor(e, t, n) {
|
|
155
|
-
this.node = e, this.view = t, this.getPos = n,
|
|
155
|
+
this.node = e, this.view = t, this.getPos = n, Bt.add(this), this.dom = document.createElement("div"), this.dom.className = "coar-md-code-host-mount";
|
|
156
156
|
let i = document.createElement("pre"), a = document.createElement("code");
|
|
157
157
|
i.appendChild(a), this.contentDOM = a, this.text.value = e.textContent, this.language.value = e.attrs.language ?? "", this.app = r({
|
|
158
158
|
name: "CodeBlockShellRoot",
|
|
159
|
-
setup: () => () => f(
|
|
159
|
+
setup: () => () => f(zt, {
|
|
160
160
|
text: this.text.value,
|
|
161
161
|
language: this.language.value,
|
|
162
162
|
editing: this.editing.value,
|
|
@@ -178,7 +178,7 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
178
178
|
this.editing.value = !1;
|
|
179
179
|
}
|
|
180
180
|
destroy() {
|
|
181
|
-
|
|
181
|
+
Bt.delete(this), this.app.unmount();
|
|
182
182
|
}
|
|
183
183
|
notifySelectionChanged() {
|
|
184
184
|
let e = this.getPos();
|
|
@@ -196,17 +196,17 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
196
196
|
let e = this.getPos();
|
|
197
197
|
if (e == null) return;
|
|
198
198
|
let { tr: t } = this.view.state;
|
|
199
|
-
t.setSelection(
|
|
199
|
+
t.setSelection(Ne.create(this.view.state.doc, e + 1)), this.view.dispatch(t), this.view.focus();
|
|
200
200
|
};
|
|
201
201
|
handleLanguageChange = (e) => {
|
|
202
202
|
let t = this.getPos();
|
|
203
203
|
t != null && this.view.dispatch(this.view.state.tr.setNodeAttribute(t, "language", e));
|
|
204
204
|
};
|
|
205
|
-
},
|
|
206
|
-
e.state.selection.eq(t.selection) ||
|
|
205
|
+
}, Ht = [Re(ye.node, () => (e, t, n) => new Vt(e, t, n)), Ie(() => new je({ view: () => ({ update(e, t) {
|
|
206
|
+
e.state.selection.eq(t.selection) || Bt.forEach((t) => {
|
|
207
207
|
t.view === e && t.notifySelectionChanged();
|
|
208
208
|
});
|
|
209
|
-
} }) }))].flat(),
|
|
209
|
+
} }) }))].flat(), Ut = function() {
|
|
210
210
|
let e = this.data();
|
|
211
211
|
return (e.toMarkdownExtensions ??= []).push({ handlers: { colorTextSpan(e, t, n) {
|
|
212
212
|
let r = Y(e.color ?? "") ?? "";
|
|
@@ -218,45 +218,45 @@ var Pt = { class: "coar-md-code-render" }, Ft = { class: "coar-md-code-edit" },
|
|
|
218
218
|
before: ">",
|
|
219
219
|
after: "<"
|
|
220
220
|
});
|
|
221
|
-
return `${
|
|
221
|
+
return `${Ke(r)}${i}${Ge()}`;
|
|
222
222
|
} } }), (e) => {
|
|
223
223
|
t(e);
|
|
224
224
|
};
|
|
225
225
|
function t(e) {
|
|
226
226
|
if (Array.isArray(e.children)) {
|
|
227
|
-
let n =
|
|
227
|
+
let n = Kt(e.children);
|
|
228
228
|
e.children = n;
|
|
229
229
|
for (let e of n) t(e);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
function
|
|
233
|
+
function Wt(e) {
|
|
234
234
|
return !!e && e.type === "html" && typeof e.value == "string";
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function Gt(e, t) {
|
|
237
237
|
let n = 1;
|
|
238
238
|
for (let r = t + 1; r < e.length; r++) {
|
|
239
239
|
let t = e[r];
|
|
240
|
-
if (
|
|
241
|
-
if (
|
|
240
|
+
if (Wt(t)) {
|
|
241
|
+
if (He(t.value)) {
|
|
242
242
|
n++;
|
|
243
243
|
continue;
|
|
244
244
|
}
|
|
245
|
-
if (
|
|
245
|
+
if (Be(t.value) && (n--, n === 0)) return r;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
return null;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function Kt(e) {
|
|
251
251
|
let t = [], n = 0;
|
|
252
252
|
for (; n < e.length;) {
|
|
253
253
|
let r = e[n];
|
|
254
|
-
if (
|
|
255
|
-
let i =
|
|
254
|
+
if (Wt(r)) {
|
|
255
|
+
let i = He(r.value);
|
|
256
256
|
if (i) {
|
|
257
|
-
let r =
|
|
257
|
+
let r = Gt(e, n);
|
|
258
258
|
if (r !== null) {
|
|
259
|
-
let a =
|
|
259
|
+
let a = Kt(e.slice(n + 1, r)), o = {
|
|
260
260
|
type: "colorTextSpan",
|
|
261
261
|
color: i.color,
|
|
262
262
|
children: a,
|
|
@@ -271,7 +271,7 @@ function Wt(e) {
|
|
|
271
271
|
}
|
|
272
272
|
return t;
|
|
273
273
|
}
|
|
274
|
-
var
|
|
274
|
+
var qt = [Le("textColor", () => Ut), Pe("text_color", () => ({
|
|
275
275
|
attrs: { color: { default: "" } },
|
|
276
276
|
inclusive: !0,
|
|
277
277
|
parseDOM: [{
|
|
@@ -318,7 +318,7 @@ var Gt = [Fe("textColor", () => Vt), Me("text_color", () => ({
|
|
|
318
318
|
n.length !== 0 && e.withMark(t, "colorTextSpan", void 0, { color: n });
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
}))].flat(),
|
|
321
|
+
}))].flat(), Jt = [
|
|
322
322
|
{
|
|
323
323
|
name: "Default",
|
|
324
324
|
value: ""
|
|
@@ -355,26 +355,26 @@ var Gt = [Fe("textColor", () => Vt), Me("text_color", () => ({
|
|
|
355
355
|
name: "Gray",
|
|
356
356
|
value: "#6b7280"
|
|
357
357
|
}
|
|
358
|
-
],
|
|
358
|
+
], Yt = {
|
|
359
359
|
class: "coar-md-placeholder",
|
|
360
360
|
"aria-hidden": "true"
|
|
361
|
-
},
|
|
361
|
+
}, Xt = /* @__PURE__ */ u({
|
|
362
362
|
__name: "PlaceholderOverlay",
|
|
363
363
|
props: { source: {} },
|
|
364
364
|
setup(e) {
|
|
365
|
-
let t = e, r = n(() =>
|
|
366
|
-
return (e, t) => (v(), o("div",
|
|
365
|
+
let t = e, r = n(() => Ve(t.source));
|
|
366
|
+
return (e, t) => (v(), o("div", Yt, [l(T(Ye), { doc: r.value }, null, 8, ["doc"])]));
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
|
-
function
|
|
369
|
+
function Zt(e) {
|
|
370
370
|
return e !== null && e < -2;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function Qt(e) {
|
|
373
373
|
return e === -2 || e === -1 || e === 32;
|
|
374
374
|
}
|
|
375
375
|
//#endregion
|
|
376
376
|
//#region ../../node_modules/.pnpm/fault@2.0.1/node_modules/fault/index.js
|
|
377
|
-
var
|
|
377
|
+
var $t = /* @__PURE__ */ At((/* @__PURE__ */ Ot(((e, t) => {
|
|
378
378
|
(function() {
|
|
379
379
|
var e = t === void 0 ? function() {
|
|
380
380
|
return this || (0, eval)("this");
|
|
@@ -428,7 +428,7 @@ var Zt = /* @__PURE__ */ Ot((/* @__PURE__ */ Et(((e, t) => {
|
|
|
428
428
|
return a;
|
|
429
429
|
}
|
|
430
430
|
})();
|
|
431
|
-
})))(), 1),
|
|
431
|
+
})))(), 1), en = Object.assign(X(Error), {
|
|
432
432
|
eval: X(EvalError),
|
|
433
433
|
range: X(RangeError),
|
|
434
434
|
reference: X(ReferenceError),
|
|
@@ -439,44 +439,44 @@ var Zt = /* @__PURE__ */ Ot((/* @__PURE__ */ Et(((e, t) => {
|
|
|
439
439
|
function X(e) {
|
|
440
440
|
return t.displayName = e.displayName || e.name, t;
|
|
441
441
|
function t(t, ...n) {
|
|
442
|
-
return new e(t && (0,
|
|
442
|
+
return new e(t && (0, $t.default)(t, ...n));
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
//#endregion
|
|
446
446
|
//#region ../../node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/to-matters.js
|
|
447
|
-
var
|
|
447
|
+
var tn = {}.hasOwnProperty, nn = {
|
|
448
448
|
yaml: "-",
|
|
449
449
|
toml: "+"
|
|
450
450
|
};
|
|
451
|
-
function
|
|
451
|
+
function rn(e) {
|
|
452
452
|
let t = [], n = -1, r = Array.isArray(e) ? e : e ? [e] : ["yaml"];
|
|
453
|
-
for (; ++n < r.length;) t[n] =
|
|
453
|
+
for (; ++n < r.length;) t[n] = an(r[n]);
|
|
454
454
|
return t;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function an(e) {
|
|
457
457
|
let t = e;
|
|
458
458
|
if (typeof t == "string") {
|
|
459
|
-
if (
|
|
459
|
+
if (!tn.call(nn, t)) throw en("Missing matter definition for `%s`", t);
|
|
460
460
|
t = {
|
|
461
461
|
type: t,
|
|
462
|
-
marker:
|
|
462
|
+
marker: nn[t]
|
|
463
463
|
};
|
|
464
|
-
} else if (typeof t != "object") throw
|
|
465
|
-
if (
|
|
466
|
-
if (
|
|
464
|
+
} else if (typeof t != "object") throw en("Expected matter to be an object, not `%j`", t);
|
|
465
|
+
if (!tn.call(t, "type")) throw en("Missing `type` in matter `%j`", t);
|
|
466
|
+
if (!tn.call(t, "fence") && !tn.call(t, "marker")) throw en("Missing `marker` or `fence` in matter `%j`", t);
|
|
467
467
|
return t;
|
|
468
468
|
}
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region ../../node_modules/.pnpm/micromark-extension-frontmatter@2.0.0/node_modules/micromark-extension-frontmatter/lib/syntax.js
|
|
471
|
-
function
|
|
472
|
-
let t =
|
|
471
|
+
function on(e) {
|
|
472
|
+
let t = rn(e), n = {}, r = -1;
|
|
473
473
|
for (; ++r < t.length;) {
|
|
474
|
-
let e = t[r], i =
|
|
474
|
+
let e = t[r], i = cn(e, "open").charCodeAt(0), a = sn(e), o = n[i];
|
|
475
475
|
Array.isArray(o) ? o.push(a) : n[i] = [a];
|
|
476
476
|
}
|
|
477
477
|
return { flow: n };
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function sn(e) {
|
|
480
480
|
let t = e.anywhere, n = e.type, r = n + "Fence", i = r + "Sequence", a = n + "Value", o = {
|
|
481
481
|
tokenize: u,
|
|
482
482
|
partial: !0
|
|
@@ -490,22 +490,22 @@ function an(e) {
|
|
|
490
490
|
return p;
|
|
491
491
|
function p(a) {
|
|
492
492
|
let o = f.now();
|
|
493
|
-
return o.column === 1 && (o.line === 1 || t) && (s =
|
|
493
|
+
return o.column === 1 && (o.line === 1 || t) && (s = cn(e, "open"), c = 0, a === s.charCodeAt(c)) ? (l.enter(n), l.enter(r), l.enter(i), m(a)) : d(a);
|
|
494
494
|
}
|
|
495
495
|
function m(e) {
|
|
496
|
-
return c === s.length ? (l.exit(i),
|
|
496
|
+
return c === s.length ? (l.exit(i), Qt(e) ? (l.enter("whitespace"), h(e)) : g(e)) : e === s.charCodeAt(c++) ? (l.consume(e), m) : d(e);
|
|
497
497
|
}
|
|
498
498
|
function h(e) {
|
|
499
|
-
return
|
|
499
|
+
return Qt(e) ? (l.consume(e), h) : (l.exit("whitespace"), g(e));
|
|
500
500
|
}
|
|
501
501
|
function g(t) {
|
|
502
|
-
return
|
|
502
|
+
return Zt(t) ? (l.exit(r), l.enter("lineEnding"), l.consume(t), l.exit("lineEnding"), s = cn(e, "close"), c = 0, l.attempt(o, y, ee)) : d(t);
|
|
503
503
|
}
|
|
504
504
|
function ee(e) {
|
|
505
|
-
return e === null ||
|
|
505
|
+
return e === null || Zt(e) ? v(e) : (l.enter(a), _(e));
|
|
506
506
|
}
|
|
507
507
|
function _(e) {
|
|
508
|
-
return e === null ||
|
|
508
|
+
return e === null || Zt(e) ? (l.exit(a), v(e)) : (l.consume(e), _);
|
|
509
509
|
}
|
|
510
510
|
function v(e) {
|
|
511
511
|
return e === null ? d(e) : (l.enter("lineEnding"), l.consume(e), l.exit("lineEnding"), l.attempt(o, y, ee));
|
|
@@ -521,42 +521,42 @@ function an(e) {
|
|
|
521
521
|
return t === s.charCodeAt(a) ? (e.enter(r), e.enter(i), c(t)) : n(t);
|
|
522
522
|
}
|
|
523
523
|
function c(t) {
|
|
524
|
-
return a === s.length ? (e.exit(i),
|
|
524
|
+
return a === s.length ? (e.exit(i), Qt(t) ? (e.enter("whitespace"), l(t)) : u(t)) : t === s.charCodeAt(a++) ? (e.consume(t), c) : n(t);
|
|
525
525
|
}
|
|
526
526
|
function l(t) {
|
|
527
|
-
return
|
|
527
|
+
return Qt(t) ? (e.consume(t), l) : (e.exit("whitespace"), u(t));
|
|
528
528
|
}
|
|
529
529
|
function u(i) {
|
|
530
|
-
return i === null ||
|
|
530
|
+
return i === null || Zt(i) ? (e.exit(r), t(i)) : n(i);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
return e.marker ?
|
|
534
|
+
function cn(e, t) {
|
|
535
|
+
return e.marker ? ln(e.marker, t).repeat(3) : ln(e.fence, t);
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function ln(e, t) {
|
|
538
538
|
return typeof e == "string" ? e : e[t];
|
|
539
539
|
}
|
|
540
540
|
//#endregion
|
|
541
541
|
//#region ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
|
|
542
|
-
function
|
|
542
|
+
function un(e) {
|
|
543
543
|
if (typeof e != "string") throw TypeError("Expected a string");
|
|
544
544
|
return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
545
545
|
}
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region ../../node_modules/.pnpm/mdast-util-frontmatter@2.0.1/node_modules/mdast-util-frontmatter/lib/index.js
|
|
548
|
-
function
|
|
549
|
-
let t =
|
|
548
|
+
function dn(e) {
|
|
549
|
+
let t = rn(e), n = {}, r = {}, i = -1;
|
|
550
550
|
for (; ++i < t.length;) {
|
|
551
551
|
let e = t[i];
|
|
552
|
-
n[e.type] =
|
|
552
|
+
n[e.type] = fn(e), r[e.type] = pn, r[e.type + "Value"] = mn;
|
|
553
553
|
}
|
|
554
554
|
return {
|
|
555
555
|
enter: n,
|
|
556
556
|
exit: r
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function fn(e) {
|
|
560
560
|
return t;
|
|
561
561
|
function t(t) {
|
|
562
562
|
this.enter({
|
|
@@ -565,23 +565,23 @@ function un(e) {
|
|
|
565
565
|
}, t), this.buffer();
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function pn(e) {
|
|
569
569
|
let t = this.resume(), n = this.stack[this.stack.length - 1];
|
|
570
570
|
"value" in n, this.exit(e), n.value = t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function mn(e) {
|
|
573
573
|
this.config.enter.data.call(this, e), this.config.exit.data.call(this, e);
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
let t = [], n = {}, r =
|
|
575
|
+
function hn(e) {
|
|
576
|
+
let t = [], n = {}, r = rn(e), i = -1;
|
|
577
577
|
for (; ++i < r.length;) {
|
|
578
578
|
let e = r[i];
|
|
579
|
-
n[e.type] =
|
|
580
|
-
let a =
|
|
579
|
+
n[e.type] = gn(e);
|
|
580
|
+
let a = _n(e, "open");
|
|
581
581
|
t.push({
|
|
582
582
|
atBreak: !0,
|
|
583
583
|
character: a.charAt(0),
|
|
584
|
-
after:
|
|
584
|
+
after: un(a.charAt(1))
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
587
|
return {
|
|
@@ -589,29 +589,29 @@ function pn(e) {
|
|
|
589
589
|
handlers: n
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
function
|
|
593
|
-
let t =
|
|
592
|
+
function gn(e) {
|
|
593
|
+
let t = _n(e, "open"), n = _n(e, "close");
|
|
594
594
|
return r;
|
|
595
595
|
function r(e) {
|
|
596
596
|
return t + (e.value ? "\n" + e.value : "") + "\n" + n;
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
return e.marker ?
|
|
599
|
+
function _n(e, t) {
|
|
600
|
+
return e.marker ? vn(e.marker, t).repeat(3) : vn(e.fence, t);
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function vn(e, t) {
|
|
603
603
|
return typeof e == "string" ? e : e[t];
|
|
604
604
|
}
|
|
605
605
|
//#endregion
|
|
606
606
|
//#region ../../node_modules/.pnpm/remark-frontmatter@5.0.0/node_modules/remark-frontmatter/lib/index.js
|
|
607
|
-
var
|
|
608
|
-
function
|
|
609
|
-
let t = this, n = e ||
|
|
610
|
-
i.push(
|
|
607
|
+
var yn = "yaml";
|
|
608
|
+
function bn(e) {
|
|
609
|
+
let t = this, n = e || yn, r = t.data(), i = r.micromarkExtensions ||= [], a = r.fromMarkdownExtensions ||= [], o = r.toMarkdownExtensions ||= [];
|
|
610
|
+
i.push(on(n)), a.push(dn(n)), o.push(hn(n));
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
613
613
|
//#region src/frontmatter/index.ts
|
|
614
|
-
var
|
|
614
|
+
var xn = Le("coarRemarkFrontmatter", () => bn, ["yaml"]), Sn = Fe("frontmatter", () => ({
|
|
615
615
|
group: "block",
|
|
616
616
|
atom: !0,
|
|
617
617
|
marks: "",
|
|
@@ -639,8 +639,8 @@ var yn = Fe("coarRemarkFrontmatter", () => vn, ["yaml"]), bn = Ne("frontmatter",
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
}));
|
|
642
|
-
function
|
|
643
|
-
let { entries: n } =
|
|
642
|
+
function Cn(e, t) {
|
|
643
|
+
let { entries: n } = We(t);
|
|
644
644
|
if (e.replaceChildren(), n.length === 0) {
|
|
645
645
|
let n = document.createElement("pre");
|
|
646
646
|
n.className = "coar-markdown-frontmatter__raw", n.textContent = t, e.appendChild(n);
|
|
@@ -655,14 +655,14 @@ function xn(e, t) {
|
|
|
655
655
|
i.className = "coar-markdown-frontmatter__value", i.textContent = t.value, n.append(r, document.createTextNode(": "), i), e.appendChild(n);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
var
|
|
658
|
+
var wn = class {
|
|
659
659
|
dom;
|
|
660
660
|
node;
|
|
661
661
|
constructor(e) {
|
|
662
662
|
this.node = e, this.dom = document.createElement("div"), this.dom.className = "coar-markdown-frontmatter", this.dom.setAttribute("data-type", "frontmatter"), this.dom.setAttribute("aria-label", "Document metadata"), this.dom.contentEditable = "false", this.dom.draggable = !1, this.renderCard();
|
|
663
663
|
}
|
|
664
664
|
renderCard() {
|
|
665
|
-
|
|
665
|
+
Cn(this.dom, this.node.attrs.value ?? "");
|
|
666
666
|
}
|
|
667
667
|
update(e) {
|
|
668
668
|
if (e.type !== this.node.type) return !1;
|
|
@@ -675,25 +675,25 @@ var Sn = class {
|
|
|
675
675
|
stopEvent() {
|
|
676
676
|
return !1;
|
|
677
677
|
}
|
|
678
|
-
},
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
678
|
+
}, Tn = [
|
|
679
|
+
xn,
|
|
680
|
+
Sn,
|
|
681
|
+
Re(Sn.node, () => (e) => new wn(e))
|
|
682
682
|
].flat();
|
|
683
683
|
//#endregion
|
|
684
684
|
//#region src/embed/index.ts
|
|
685
|
-
function
|
|
685
|
+
function En(e, t) {
|
|
686
686
|
let n = e.position?.start?.offset, r = e.position?.end?.offset;
|
|
687
687
|
if (t && typeof n == "number" && typeof r == "number") return t.slice(n, r).trim();
|
|
688
688
|
let i = e.children;
|
|
689
689
|
return Array.isArray(i) && i.length === 1 && i[0]?.type === "text" && typeof i[0].value == "string" ? i[0].value.trim() : null;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Dn(e, t) {
|
|
692
692
|
Array.isArray(e.children) && (e.children = e.children.map((e) => {
|
|
693
693
|
if (e.type === "paragraph") {
|
|
694
|
-
let n =
|
|
694
|
+
let n = En(e, t);
|
|
695
695
|
if (n) {
|
|
696
|
-
let t =
|
|
696
|
+
let t = Ue(n);
|
|
697
697
|
if (t) return {
|
|
698
698
|
type: "embed",
|
|
699
699
|
embedKey: t.key,
|
|
@@ -702,21 +702,21 @@ function Tn(e, t) {
|
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
return
|
|
705
|
+
return Dn(e, t), e;
|
|
706
706
|
}));
|
|
707
707
|
}
|
|
708
|
-
var
|
|
708
|
+
var On = function() {
|
|
709
709
|
let e = this.data();
|
|
710
710
|
return (e.toMarkdownExtensions ??= []).push({ handlers: { embed(e) {
|
|
711
711
|
let t = typeof e.embedKey == "string" ? e.embedKey : "";
|
|
712
|
-
return t.length === 0 ? "" :
|
|
712
|
+
return t.length === 0 ? "" : qe({
|
|
713
713
|
key: t,
|
|
714
|
-
props:
|
|
714
|
+
props: Je(e.props)
|
|
715
715
|
});
|
|
716
716
|
} } }), (e, t) => {
|
|
717
|
-
|
|
717
|
+
Dn(e, typeof t?.value == "string" ? t.value : "");
|
|
718
718
|
};
|
|
719
|
-
},
|
|
719
|
+
}, kn = Le("coarEmbed", () => On), An = Fe("embed", () => ({
|
|
720
720
|
group: "block",
|
|
721
721
|
atom: !0,
|
|
722
722
|
marks: "",
|
|
@@ -765,7 +765,7 @@ var En = function() {
|
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
})),
|
|
768
|
+
})), jn = class {
|
|
769
769
|
dom;
|
|
770
770
|
node;
|
|
771
771
|
view;
|
|
@@ -784,19 +784,19 @@ var En = function() {
|
|
|
784
784
|
this.view.dispatch(n);
|
|
785
785
|
}
|
|
786
786
|
renderPreview() {
|
|
787
|
-
let e = this.node.attrs.embedKey ?? "", t = this.node.attrs.props ?? {}, n = this.options.resolveRegistry(), r =
|
|
787
|
+
let e = this.node.attrs.embedKey ?? "", t = this.node.attrs.props ?? {}, n = this.options.resolveRegistry(), r = et(n, e), i = r?.editor ? f(r.editor, { controller: {
|
|
788
788
|
props: t,
|
|
789
789
|
update: (e) => this.updateProps(e),
|
|
790
790
|
patch: (e) => this.updateProps({
|
|
791
791
|
...t,
|
|
792
792
|
...e
|
|
793
793
|
})
|
|
794
|
-
} }) : f(
|
|
794
|
+
} }) : f(Ze, {
|
|
795
795
|
embedKey: e,
|
|
796
796
|
embedProps: t,
|
|
797
797
|
registry: n
|
|
798
798
|
});
|
|
799
|
-
this.options.appContext && (i.appContext = this.options.appContext),
|
|
799
|
+
this.options.appContext && (i.appContext = this.options.appContext), x(i, this.dom);
|
|
800
800
|
}
|
|
801
801
|
update(e) {
|
|
802
802
|
return e.type === this.node.type ? (this.node = e, this.renderPreview(), !0) : !1;
|
|
@@ -814,35 +814,35 @@ var En = function() {
|
|
|
814
814
|
return !0;
|
|
815
815
|
}
|
|
816
816
|
destroy() {
|
|
817
|
-
|
|
817
|
+
x(null, this.dom);
|
|
818
818
|
}
|
|
819
|
-
},
|
|
820
|
-
function
|
|
819
|
+
}, Mn = (e) => Re(An.node, () => (t, n, r) => new jn(t, n, r, e));
|
|
820
|
+
function Nn(e) {
|
|
821
821
|
return [
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
822
|
+
kn,
|
|
823
|
+
An,
|
|
824
|
+
Mn(e)
|
|
825
825
|
].flat();
|
|
826
826
|
}
|
|
827
827
|
//#endregion
|
|
828
828
|
//#region src/text-color/ColorPickerPanel.vue?vue&type=script&setup=true&lang.ts
|
|
829
|
-
var
|
|
829
|
+
var Pn = { class: "coar-md-color-grid" }, Fn = [
|
|
830
830
|
"title",
|
|
831
831
|
"aria-label",
|
|
832
832
|
"onMousedown"
|
|
833
|
-
],
|
|
833
|
+
], In = { class: "coar-md-color-custom" }, Ln = /* @__PURE__ */ u({
|
|
834
834
|
__name: "ColorPickerPanel",
|
|
835
835
|
props: {
|
|
836
836
|
currentColor: {},
|
|
837
837
|
pick: { type: Function }
|
|
838
838
|
},
|
|
839
839
|
setup(t) {
|
|
840
|
-
let n =
|
|
840
|
+
let n = b(t.currentColor ?? "#000000");
|
|
841
841
|
return (r, c) => (v(), o("div", {
|
|
842
842
|
class: "coar-md-color-picker",
|
|
843
843
|
role: "menu",
|
|
844
|
-
onMousedown: c[2] ||=
|
|
845
|
-
}, [s("div",
|
|
844
|
+
onMousedown: c[2] ||= N(() => {}, ["stop"])
|
|
845
|
+
}, [s("div", Pn, [(v(!0), o(e, null, S(T(Jt), (e) => (v(), o("button", {
|
|
846
846
|
key: e.value || "default",
|
|
847
847
|
type: "button",
|
|
848
848
|
class: h([
|
|
@@ -853,35 +853,35 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
853
853
|
style: g(e.value ? { "--coar-md-swatch": e.value } : void 0),
|
|
854
854
|
title: e.name,
|
|
855
855
|
"aria-label": e.name,
|
|
856
|
-
onMousedown:
|
|
857
|
-
}, [e.value === "" ? (v(), i(
|
|
856
|
+
onMousedown: N((n) => t.pick(e.value === "" ? null : e.value), ["prevent"])
|
|
857
|
+
}, [e.value === "" ? (v(), i(T(V), {
|
|
858
858
|
key: 0,
|
|
859
859
|
name: "ban",
|
|
860
860
|
size: "s"
|
|
861
|
-
})) : a("", !0)], 46,
|
|
861
|
+
})) : a("", !0)], 46, Fn))), 128))]), s("div", In, [c[3] ||= s("label", {
|
|
862
862
|
class: "coar-md-color-custom-label",
|
|
863
863
|
for: "coar-md-color-custom-input"
|
|
864
|
-
}, " Custom ", -1),
|
|
864
|
+
}, " Custom ", -1), j(s("input", {
|
|
865
865
|
id: "coar-md-color-custom-input",
|
|
866
866
|
"onUpdate:modelValue": c[0] ||= (e) => n.value = e,
|
|
867
867
|
type: "color",
|
|
868
868
|
class: "coar-md-color-custom-input",
|
|
869
869
|
onChange: c[1] ||= (e) => t.pick(n.value)
|
|
870
|
-
}, null, 544), [[
|
|
870
|
+
}, null, 544), [[ne, n.value]])])], 32));
|
|
871
871
|
}
|
|
872
|
-
}),
|
|
872
|
+
}), Rn = [
|
|
873
873
|
"aria-label",
|
|
874
874
|
"onMouseover",
|
|
875
875
|
"onFocus",
|
|
876
876
|
"onClick"
|
|
877
|
-
],
|
|
877
|
+
], zn = { class: "coar-md-table-picker__label" }, Bn = /* @__PURE__ */ u({
|
|
878
878
|
__name: "TableSizePicker",
|
|
879
879
|
props: {
|
|
880
880
|
pick: { type: Function },
|
|
881
881
|
max: {}
|
|
882
882
|
},
|
|
883
883
|
setup(t) {
|
|
884
|
-
let r = t.max ?? 8, i = Array.from({ length: r }, (e, t) => t + 1), a =
|
|
884
|
+
let r = t.max ?? 8, i = Array.from({ length: r }, (e, t) => t + 1), a = b(0), l = b(0), u = n(() => a.value > 0 ? `${l.value} × ${a.value}` : "Pick size");
|
|
885
885
|
function d(e, t) {
|
|
886
886
|
a.value = e, l.value = t;
|
|
887
887
|
}
|
|
@@ -897,8 +897,8 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
897
897
|
}, [
|
|
898
898
|
s("div", {
|
|
899
899
|
class: "coar-md-table-picker__grid",
|
|
900
|
-
style: g({ gridTemplateColumns: `repeat(${
|
|
901
|
-
}, [(v(!0), o(e, null,
|
|
900
|
+
style: g({ gridTemplateColumns: `repeat(${T(r)}, 1fr)` })
|
|
901
|
+
}, [(v(!0), o(e, null, S(T(i), (n) => (v(), o(e, { key: n }, [(v(!0), o(e, null, S(T(i), (e) => (v(), o("button", {
|
|
902
902
|
key: `${n}-${e}`,
|
|
903
903
|
type: "button",
|
|
904
904
|
class: h(["coar-md-table-picker__cell", { "coar-md-table-picker__cell--on": p(n, e) }]),
|
|
@@ -906,8 +906,8 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
906
906
|
onMouseover: (t) => d(n, e),
|
|
907
907
|
onFocus: (t) => d(n, e),
|
|
908
908
|
onClick: (r) => t.pick(n, e)
|
|
909
|
-
}, null, 42,
|
|
910
|
-
s("div",
|
|
909
|
+
}, null, 42, Rn))), 128))], 64))), 128))], 4),
|
|
910
|
+
s("div", zn, w(u.value), 1),
|
|
911
911
|
a[0] ||= s("div", { class: "coar-md-table-picker__hint" }, [
|
|
912
912
|
c(" or type "),
|
|
913
913
|
s("code", null, "|3x4|"),
|
|
@@ -915,31 +915,31 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
915
915
|
], -1)
|
|
916
916
|
], 32));
|
|
917
917
|
}
|
|
918
|
-
}),
|
|
918
|
+
}), Vn = (e, t) => {
|
|
919
919
|
let n = e.__vccOpts || e;
|
|
920
920
|
for (let [e, r] of t) n[e] = r;
|
|
921
921
|
return n;
|
|
922
|
-
},
|
|
922
|
+
}, Hn = /* @__PURE__ */ Vn(Bn, [["__scopeId", "data-v-68fa1760"]]), Un = {
|
|
923
923
|
key: 0,
|
|
924
924
|
class: "coar-md-th"
|
|
925
|
-
},
|
|
925
|
+
}, Wn = [
|
|
926
926
|
"aria-label",
|
|
927
927
|
"onMouseenter",
|
|
928
928
|
"onMousedown"
|
|
929
|
-
],
|
|
929
|
+
], Gn = [
|
|
930
930
|
"aria-label",
|
|
931
931
|
"onMouseenter",
|
|
932
932
|
"onMousedown"
|
|
933
|
-
], Z = 14,
|
|
933
|
+
], Z = 14, Kn = 4, qn = /* @__PURE__ */ Vn(/* @__PURE__ */ u({
|
|
934
934
|
__name: "TableHandles",
|
|
935
935
|
props: { area: {} },
|
|
936
936
|
emits: ["menuToggle"],
|
|
937
937
|
setup(r, { emit: s }) {
|
|
938
|
-
let c = r, u = s, [, d] =
|
|
939
|
-
|
|
938
|
+
let c = r, u = s, [, d] = ce(), f = te(null), p = b(null), m = b(null), y = b(null), x = ge();
|
|
939
|
+
k(x.isOpen, (e) => {
|
|
940
940
|
!e && m.value && (m.value = null, p.value = null, u("menuToggle", !1));
|
|
941
941
|
});
|
|
942
|
-
function
|
|
942
|
+
function C(e) {
|
|
943
943
|
return {
|
|
944
944
|
left: e.left,
|
|
945
945
|
top: e.top,
|
|
@@ -947,22 +947,22 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
947
947
|
height: e.height
|
|
948
948
|
};
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function w(e) {
|
|
951
951
|
let t = Array.from(e.querySelectorAll("tr")), n = t[0];
|
|
952
952
|
if (!n) return null;
|
|
953
953
|
let r = Array.from(n.children);
|
|
954
954
|
return r.length === 0 ? null : {
|
|
955
955
|
table: e,
|
|
956
|
-
rect:
|
|
957
|
-
cols: r.map((e) =>
|
|
958
|
-
rows: t.map((e) =>
|
|
956
|
+
rect: C(e.getBoundingClientRect()),
|
|
957
|
+
cols: r.map((e) => C(e.getBoundingClientRect())),
|
|
958
|
+
rows: t.map((e) => C(e.getBoundingClientRect()))
|
|
959
959
|
};
|
|
960
960
|
}
|
|
961
961
|
function E(e, t, n) {
|
|
962
962
|
return t >= e.rect.left - Z - 4 && t <= e.rect.left + e.rect.width + Z + 4 && n >= e.rect.top - Z - 4 && n <= e.rect.top + e.rect.height + Z + 4;
|
|
963
963
|
}
|
|
964
964
|
let D = !1;
|
|
965
|
-
function
|
|
965
|
+
function ne(e, t) {
|
|
966
966
|
let n = c.area?.querySelectorAll("table");
|
|
967
967
|
if (!n) return null;
|
|
968
968
|
for (let r of Array.from(n)) {
|
|
@@ -971,39 +971,39 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
971
971
|
}
|
|
972
972
|
return null;
|
|
973
973
|
}
|
|
974
|
-
function
|
|
975
|
-
m.value ||
|
|
974
|
+
function O(e) {
|
|
975
|
+
m.value || L || y.value || D || (D = !0, requestAnimationFrame(() => {
|
|
976
976
|
D = !1;
|
|
977
977
|
let t = e.clientX, n = e.clientY;
|
|
978
978
|
if (f.value && E(f.value, t, n)) return;
|
|
979
|
-
let r =
|
|
980
|
-
r ? f.value =
|
|
979
|
+
let r = ne(t, n);
|
|
980
|
+
r ? f.value = w(r) : (f.value = null, p.value = null);
|
|
981
981
|
}));
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function j() {
|
|
984
984
|
if (f.value) {
|
|
985
|
-
let e =
|
|
986
|
-
f.value = e, e || (p.value = null,
|
|
985
|
+
let e = w(f.value.table);
|
|
986
|
+
f.value = e, e || (p.value = null, x.close());
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
_(() => {
|
|
990
|
-
document.addEventListener("mousemove",
|
|
990
|
+
document.addEventListener("mousemove", O, !0), window.addEventListener("scroll", j, !0), window.addEventListener("resize", j);
|
|
991
991
|
}), ee(() => {
|
|
992
|
-
document.removeEventListener("mousemove",
|
|
992
|
+
document.removeEventListener("mousemove", O, !0), document.removeEventListener("mousemove", z, !0), document.removeEventListener("mouseup", B, !0), window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j);
|
|
993
993
|
});
|
|
994
|
-
function
|
|
994
|
+
function M(e, t) {
|
|
995
995
|
let n = f.value, r = d();
|
|
996
996
|
if (!n || !r) return null;
|
|
997
997
|
let i = null;
|
|
998
998
|
return r.action((r) => {
|
|
999
|
-
let a = r.get(
|
|
999
|
+
let a = r.get(F), o = e === "col" ? n.table.querySelector("tr")?.children[t] : n.table.querySelectorAll("tr")[t]?.children[0];
|
|
1000
1000
|
o && (i = a.posAtDOM(o, 0));
|
|
1001
1001
|
}), i;
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1004
|
-
let r = d(), i =
|
|
1003
|
+
function N(e, t, ...n) {
|
|
1004
|
+
let r = d(), i = M(e, t);
|
|
1005
1005
|
if (!r || i == null) return;
|
|
1006
|
-
let a = e === "col" ?
|
|
1006
|
+
let a = e === "col" ? ut : dt;
|
|
1007
1007
|
r.action((e) => {
|
|
1008
1008
|
let r = e.get(P);
|
|
1009
1009
|
r.call(a.key, {
|
|
@@ -1011,29 +1011,29 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1011
1011
|
pos: i
|
|
1012
1012
|
});
|
|
1013
1013
|
for (let e of n) r.call(e.key);
|
|
1014
|
-
}),
|
|
1014
|
+
}), x.close(), f.value = null;
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1017
|
-
m.value &&
|
|
1016
|
+
function re() {
|
|
1017
|
+
m.value && N(m.value.kind, m.value.index, at);
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function ie() {
|
|
1020
1020
|
if (!m.value) return;
|
|
1021
1021
|
let { kind: e, index: t } = m.value;
|
|
1022
|
-
|
|
1022
|
+
N(e, t, e === "col" ? nt : it);
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function I() {
|
|
1025
1025
|
if (!m.value) return;
|
|
1026
1026
|
let { kind: e, index: t } = m.value;
|
|
1027
|
-
|
|
1027
|
+
N(e, t, e === "col" ? tt : rt);
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1030
|
-
return p.value?.kind === e && p.value.index === t || m.value?.kind === e && m.value.index === t ||
|
|
1029
|
+
function ae(e, t) {
|
|
1030
|
+
return p.value?.kind === e && p.value.index === t || m.value?.kind === e && m.value.index === t || y.value?.kind === e && y.value.from === t;
|
|
1031
1031
|
}
|
|
1032
|
-
let
|
|
1033
|
-
function
|
|
1034
|
-
let r = d(), i =
|
|
1032
|
+
let L = null;
|
|
1033
|
+
function oe(e, t, n) {
|
|
1034
|
+
let r = d(), i = M(e, t);
|
|
1035
1035
|
if (!r || i == null || t === n) return;
|
|
1036
|
-
let a = e === "col" ?
|
|
1036
|
+
let a = e === "col" ? ut : dt, o = e === "col" ? ct : lt;
|
|
1037
1037
|
r.action((e) => {
|
|
1038
1038
|
let r = e.get(P);
|
|
1039
1039
|
r.call(a.key, {
|
|
@@ -1044,11 +1044,11 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1044
1044
|
to: n,
|
|
1045
1045
|
pos: i
|
|
1046
1046
|
});
|
|
1047
|
-
let s = e.get(
|
|
1048
|
-
c.selection.empty || s.dispatch(c.tr.setSelection(
|
|
1047
|
+
let s = e.get(F), { state: c } = s;
|
|
1048
|
+
c.selection.empty || s.dispatch(c.tr.setSelection(Ne.create(c.doc, c.selection.from)));
|
|
1049
1049
|
}), f.value = null, p.value = null;
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function se(e, t, n) {
|
|
1052
1052
|
let r = f.value;
|
|
1053
1053
|
if (!r) return 0;
|
|
1054
1054
|
if (e === "col") {
|
|
@@ -1058,45 +1058,45 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1058
1058
|
let i = r.rows.findIndex((e) => n < e.top + e.height);
|
|
1059
1059
|
return i === -1 ? r.rows.length - 1 : i;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1062
|
-
n.preventDefault(), n.stopPropagation(),
|
|
1061
|
+
function R(e, t, n) {
|
|
1062
|
+
n.preventDefault(), n.stopPropagation(), L = {
|
|
1063
1063
|
kind: e,
|
|
1064
1064
|
from: t,
|
|
1065
1065
|
x: n.clientX,
|
|
1066
1066
|
y: n.clientY,
|
|
1067
1067
|
ev: n
|
|
1068
|
-
}, document.addEventListener("mousemove",
|
|
1069
|
-
}
|
|
1070
|
-
function
|
|
1071
|
-
if (
|
|
1072
|
-
if (!
|
|
1073
|
-
if (Math.hypot(e.clientX -
|
|
1074
|
-
|
|
1075
|
-
kind:
|
|
1076
|
-
from:
|
|
1077
|
-
target:
|
|
1068
|
+
}, document.addEventListener("mousemove", z, !0), document.addEventListener("mouseup", B, !0);
|
|
1069
|
+
}
|
|
1070
|
+
function z(e) {
|
|
1071
|
+
if (L) {
|
|
1072
|
+
if (!y.value) {
|
|
1073
|
+
if (Math.hypot(e.clientX - L.x, e.clientY - L.y) < Kn) return;
|
|
1074
|
+
y.value = {
|
|
1075
|
+
kind: L.kind,
|
|
1076
|
+
from: L.from,
|
|
1077
|
+
target: L.from
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
|
|
1081
|
-
...
|
|
1082
|
-
target:
|
|
1080
|
+
y.value = {
|
|
1081
|
+
...y.value,
|
|
1082
|
+
target: se(y.value.kind, e.clientX, e.clientY)
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1087
|
-
if (document.removeEventListener("mousemove",
|
|
1088
|
-
let { kind: e, from: t, target: n } =
|
|
1089
|
-
|
|
1090
|
-
} else
|
|
1091
|
-
|
|
1086
|
+
function B() {
|
|
1087
|
+
if (document.removeEventListener("mousemove", z, !0), document.removeEventListener("mouseup", B, !0), y.value) {
|
|
1088
|
+
let { kind: e, from: t, target: n } = y.value;
|
|
1089
|
+
y.value = null, oe(e, t, n);
|
|
1090
|
+
} else L && V(L.kind, L.from, L.ev);
|
|
1091
|
+
L = null;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function V(e, t, n) {
|
|
1094
1094
|
n.preventDefault(), n.stopPropagation(), m.value = {
|
|
1095
1095
|
kind: e,
|
|
1096
1096
|
index: t
|
|
1097
|
-
}, u("menuToggle", !0),
|
|
1097
|
+
}, u("menuToggle", !0), x.open(n), requestAnimationFrame(j);
|
|
1098
1098
|
}
|
|
1099
|
-
let
|
|
1099
|
+
let fe = n(() => {
|
|
1100
1100
|
let e = f.value;
|
|
1101
1101
|
return e ? [{
|
|
1102
1102
|
key: "top",
|
|
@@ -1111,7 +1111,7 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1111
1111
|
width: e.rect.width,
|
|
1112
1112
|
height: Z
|
|
1113
1113
|
}] : [];
|
|
1114
|
-
}),
|
|
1114
|
+
}), pe = n(() => {
|
|
1115
1115
|
let e = f.value;
|
|
1116
1116
|
return e ? [{
|
|
1117
1117
|
key: "left",
|
|
@@ -1126,10 +1126,10 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1126
1126
|
width: Z,
|
|
1127
1127
|
height: e.rect.height
|
|
1128
1128
|
}] : [];
|
|
1129
|
-
}),
|
|
1130
|
-
let e = f.value, t = p.value ?? m.value ?? (
|
|
1131
|
-
kind:
|
|
1132
|
-
index:
|
|
1129
|
+
}), H = n(() => {
|
|
1130
|
+
let e = f.value, t = p.value ?? m.value ?? (y.value ? {
|
|
1131
|
+
kind: y.value.kind,
|
|
1132
|
+
index: y.value.from
|
|
1133
1133
|
} : null);
|
|
1134
1134
|
if (!e || !t) return null;
|
|
1135
1135
|
if (t.kind === "col") {
|
|
@@ -1148,8 +1148,8 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1148
1148
|
width: `${e.rect.width}px`,
|
|
1149
1149
|
height: `${n.height}px`
|
|
1150
1150
|
};
|
|
1151
|
-
}),
|
|
1152
|
-
let e = f.value, t =
|
|
1151
|
+
}), me = n(() => {
|
|
1152
|
+
let e = f.value, t = y.value;
|
|
1153
1153
|
if (!e || !t) return null;
|
|
1154
1154
|
if (t.kind === "col") {
|
|
1155
1155
|
let n = e.cols[t.target], r = t.target >= t.from ? n.left + n.width : n.left;
|
|
@@ -1168,18 +1168,18 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1168
1168
|
height: "2px"
|
|
1169
1169
|
};
|
|
1170
1170
|
});
|
|
1171
|
-
return (n, r) => (v(), i(t, { to: "body" }, [f.value ? (v(), o("div",
|
|
1172
|
-
|
|
1171
|
+
return (n, r) => (v(), i(t, { to: "body" }, [f.value ? (v(), o("div", Un, [
|
|
1172
|
+
H.value ? (v(), o("div", {
|
|
1173
1173
|
key: 0,
|
|
1174
1174
|
class: "coar-md-th__hl",
|
|
1175
|
-
style: g(
|
|
1175
|
+
style: g(H.value)
|
|
1176
1176
|
}, null, 4)) : a("", !0),
|
|
1177
|
-
|
|
1177
|
+
me.value ? (v(), o("div", {
|
|
1178
1178
|
key: 1,
|
|
1179
1179
|
class: "coar-md-th__drop",
|
|
1180
|
-
style: g(
|
|
1180
|
+
style: g(me.value)
|
|
1181
1181
|
}, null, 4)) : a("", !0),
|
|
1182
|
-
(v(!0), o(e, null,
|
|
1182
|
+
(v(!0), o(e, null, S(fe.value, (t) => (v(), o("div", {
|
|
1183
1183
|
key: t.key,
|
|
1184
1184
|
class: "coar-md-th__bar coar-md-th__bar--col",
|
|
1185
1185
|
style: g({
|
|
@@ -1188,10 +1188,10 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1188
1188
|
width: `${t.width}px`,
|
|
1189
1189
|
height: `${t.height}px`
|
|
1190
1190
|
})
|
|
1191
|
-
}, [(v(!0), o(e, null,
|
|
1191
|
+
}, [(v(!0), o(e, null, S(f.value.cols, (e, t) => (v(), o("button", {
|
|
1192
1192
|
key: `c${t}`,
|
|
1193
1193
|
type: "button",
|
|
1194
|
-
class: h(["coar-md-th__grip", { "coar-md-th__grip--active":
|
|
1194
|
+
class: h(["coar-md-th__grip", { "coar-md-th__grip--active": ae("col", t) }]),
|
|
1195
1195
|
style: g({
|
|
1196
1196
|
left: `${e.left - f.value.rect.left}px`,
|
|
1197
1197
|
width: `${e.width}px`
|
|
@@ -1202,9 +1202,9 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1202
1202
|
index: t
|
|
1203
1203
|
},
|
|
1204
1204
|
onMouseleave: r[0] ||= (e) => p.value = null,
|
|
1205
|
-
onMousedown: (e) =>
|
|
1206
|
-
}, null, 46,
|
|
1207
|
-
(v(!0), o(e, null,
|
|
1205
|
+
onMousedown: (e) => R("col", t, e)
|
|
1206
|
+
}, null, 46, Wn))), 128))], 4))), 128)),
|
|
1207
|
+
(v(!0), o(e, null, S(pe.value, (t) => (v(), o("div", {
|
|
1208
1208
|
key: t.key,
|
|
1209
1209
|
class: "coar-md-th__bar coar-md-th__bar--row",
|
|
1210
1210
|
style: g({
|
|
@@ -1213,10 +1213,10 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1213
1213
|
width: `${t.width}px`,
|
|
1214
1214
|
height: `${t.height}px`
|
|
1215
1215
|
})
|
|
1216
|
-
}, [(v(!0), o(e, null,
|
|
1216
|
+
}, [(v(!0), o(e, null, S(f.value.rows, (e, t) => (v(), o("button", {
|
|
1217
1217
|
key: `r${t}`,
|
|
1218
1218
|
type: "button",
|
|
1219
|
-
class: h(["coar-md-th__grip", { "coar-md-th__grip--active":
|
|
1219
|
+
class: h(["coar-md-th__grip", { "coar-md-th__grip--active": ae("row", t) }]),
|
|
1220
1220
|
style: g({
|
|
1221
1221
|
top: `${e.top - f.value.rect.top}px`,
|
|
1222
1222
|
height: `${e.height}px`
|
|
@@ -1227,31 +1227,31 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1227
1227
|
index: t
|
|
1228
1228
|
},
|
|
1229
1229
|
onMouseleave: r[1] ||= (e) => p.value = null,
|
|
1230
|
-
onMousedown: (e) =>
|
|
1231
|
-
}, null, 46,
|
|
1232
|
-
])) : a("", !0), l(
|
|
1233
|
-
default:
|
|
1234
|
-
l(
|
|
1230
|
+
onMousedown: (e) => R("row", t, e)
|
|
1231
|
+
}, null, 46, Gn))), 128))], 4))), 128))
|
|
1232
|
+
])) : a("", !0), l(T(le), { menu: T(x) }, {
|
|
1233
|
+
default: A(() => [
|
|
1234
|
+
l(T(de), {
|
|
1235
1235
|
label: m.value?.kind === "col" ? "Insert column left" : "Insert row above",
|
|
1236
1236
|
icon: m.value?.kind === "col" ? "table-column-plus-left" : "table-row-plus-above",
|
|
1237
|
-
onClicked:
|
|
1237
|
+
onClicked: ie
|
|
1238
1238
|
}, null, 8, ["label", "icon"]),
|
|
1239
|
-
l(
|
|
1239
|
+
l(T(de), {
|
|
1240
1240
|
label: m.value?.kind === "col" ? "Insert column right" : "Insert row below",
|
|
1241
1241
|
icon: m.value?.kind === "col" ? "table-column-plus-right" : "table-row-plus-below",
|
|
1242
|
-
onClicked:
|
|
1242
|
+
onClicked: I
|
|
1243
1243
|
}, null, 8, ["label", "icon"]),
|
|
1244
|
-
l(
|
|
1245
|
-
l(
|
|
1244
|
+
l(T(ue)),
|
|
1245
|
+
l(T(de), {
|
|
1246
1246
|
label: m.value?.kind === "col" ? "Delete column" : "Delete row",
|
|
1247
1247
|
icon: "trash-2",
|
|
1248
|
-
onClicked:
|
|
1248
|
+
onClicked: re
|
|
1249
1249
|
}, null, 8, ["label"])
|
|
1250
1250
|
]),
|
|
1251
1251
|
_: 1
|
|
1252
1252
|
}, 8, ["menu"])]));
|
|
1253
1253
|
}
|
|
1254
|
-
}), [["__scopeId", "data-v-24e26df4"]]),
|
|
1254
|
+
}), [["__scopeId", "data-v-24e26df4"]]), Jn = ["onKeydown"], Yn = { ref: "urlField" }, Xn = { class: "coar-md-image-dialog__actions" }, Zn = /* @__PURE__ */ Vn(/* @__PURE__ */ u({
|
|
1255
1255
|
__name: "ImageInsertDialog",
|
|
1256
1256
|
props: {
|
|
1257
1257
|
close: { type: Function },
|
|
@@ -1260,7 +1260,7 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1260
1260
|
initialTitle: {}
|
|
1261
1261
|
},
|
|
1262
1262
|
setup(e) {
|
|
1263
|
-
let t = e, r =
|
|
1263
|
+
let t = e, r = b(t.initialUrl ?? ""), i = b(t.initialAlt ?? ""), a = b(t.initialTitle ?? ""), u = D("urlField"), d = n(() => r.value.trim().length > 0);
|
|
1264
1264
|
function f() {
|
|
1265
1265
|
d.value && t.close({
|
|
1266
1266
|
url: r.value.trim(),
|
|
@@ -1275,13 +1275,13 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1275
1275
|
u.value?.querySelector("input")?.focus();
|
|
1276
1276
|
}), (e, t) => (v(), o("div", {
|
|
1277
1277
|
class: "coar-md-image-dialog",
|
|
1278
|
-
onKeydown:
|
|
1278
|
+
onKeydown: M(N(f, ["prevent"]), ["enter"])
|
|
1279
1279
|
}, [
|
|
1280
|
-
s("div",
|
|
1280
|
+
s("div", Yn, [l(T(B), {
|
|
1281
1281
|
label: "Image URL",
|
|
1282
1282
|
required: ""
|
|
1283
1283
|
}, {
|
|
1284
|
-
default:
|
|
1284
|
+
default: A(() => [l(T(W), {
|
|
1285
1285
|
modelValue: r.value,
|
|
1286
1286
|
"onUpdate:modelValue": t[0] ||= (e) => r.value = e,
|
|
1287
1287
|
placeholder: "https://example.com/image.png",
|
|
@@ -1289,8 +1289,8 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1289
1289
|
}, null, 8, ["modelValue"])]),
|
|
1290
1290
|
_: 1
|
|
1291
1291
|
})], 512),
|
|
1292
|
-
l(
|
|
1293
|
-
default:
|
|
1292
|
+
l(T(B), { label: "Alt text" }, {
|
|
1293
|
+
default: A(() => [l(T(W), {
|
|
1294
1294
|
modelValue: i.value,
|
|
1295
1295
|
"onUpdate:modelValue": t[1] ||= (e) => i.value = e,
|
|
1296
1296
|
placeholder: "Describe the image",
|
|
@@ -1298,8 +1298,8 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1298
1298
|
}, null, 8, ["modelValue"])]),
|
|
1299
1299
|
_: 1
|
|
1300
1300
|
}),
|
|
1301
|
-
l(
|
|
1302
|
-
default:
|
|
1301
|
+
l(T(B), { label: "Title (optional)" }, {
|
|
1302
|
+
default: A(() => [l(T(W), {
|
|
1303
1303
|
modelValue: a.value,
|
|
1304
1304
|
"onUpdate:modelValue": t[2] ||= (e) => a.value = e,
|
|
1305
1305
|
placeholder: "Shown on hover",
|
|
@@ -1307,39 +1307,39 @@ var Mn = { class: "coar-md-color-grid" }, Nn = [
|
|
|
1307
1307
|
}, null, 8, ["modelValue"])]),
|
|
1308
1308
|
_: 1
|
|
1309
1309
|
}),
|
|
1310
|
-
s("div",
|
|
1310
|
+
s("div", Xn, [l(T(R), {
|
|
1311
1311
|
variant: "tertiary",
|
|
1312
1312
|
type: "button",
|
|
1313
1313
|
onClick: p
|
|
1314
1314
|
}, {
|
|
1315
|
-
default:
|
|
1315
|
+
default: A(() => [...t[3] ||= [c("Cancel", -1)]]),
|
|
1316
1316
|
_: 1
|
|
1317
|
-
}), l(
|
|
1317
|
+
}), l(T(R), {
|
|
1318
1318
|
variant: "primary",
|
|
1319
1319
|
type: "button",
|
|
1320
1320
|
disabled: !d.value,
|
|
1321
1321
|
onClick: f
|
|
1322
1322
|
}, {
|
|
1323
|
-
default:
|
|
1323
|
+
default: A(() => [...t[4] ||= [c("Insert", -1)]]),
|
|
1324
1324
|
_: 1
|
|
1325
1325
|
}, 8, ["disabled"])])
|
|
1326
|
-
], 40,
|
|
1326
|
+
], 40, Jn));
|
|
1327
1327
|
}
|
|
1328
|
-
}), [["__scopeId", "data-v-a0456b93"]]), Q = new
|
|
1329
|
-
function
|
|
1328
|
+
}), [["__scopeId", "data-v-a0456b93"]]), Q = new Me("coar-image-upload-placeholder");
|
|
1329
|
+
function Qn() {
|
|
1330
1330
|
let e = document.createElement("span");
|
|
1331
1331
|
return e.className = "coar-md-image-uploading", e.setAttribute("aria-label", "Uploading image…"), e.setAttribute("role", "img"), e;
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1333
|
+
function $n(e, t) {
|
|
1334
1334
|
let n = Q.getState(e.state);
|
|
1335
1335
|
if (!n) return null;
|
|
1336
1336
|
let r = n.find(void 0, void 0, (e) => e.id === t);
|
|
1337
1337
|
return r.length ? r[0].from : null;
|
|
1338
1338
|
}
|
|
1339
|
-
function
|
|
1339
|
+
function er(e) {
|
|
1340
1340
|
return e ? Array.from(e.files).filter((e) => e.type.startsWith("image/")) : [];
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function tr(e, t, n, r) {
|
|
1343
1343
|
let i = r.getUploader();
|
|
1344
1344
|
if (!i) return;
|
|
1345
1345
|
let a = { token: Symbol("coar-image-upload") };
|
|
@@ -1348,7 +1348,7 @@ function $n(e, t, n, r) {
|
|
|
1348
1348
|
id: a,
|
|
1349
1349
|
pos: n
|
|
1350
1350
|
})), i(t).then(({ url: n, alt: r }) => {
|
|
1351
|
-
let i =
|
|
1351
|
+
let i = $n(e, a);
|
|
1352
1352
|
if (i === null) return;
|
|
1353
1353
|
let o = e.state.schema.nodes.image;
|
|
1354
1354
|
if (!o) return;
|
|
@@ -1361,21 +1361,21 @@ function $n(e, t, n, r) {
|
|
|
1361
1361
|
});
|
|
1362
1362
|
e.dispatch(c);
|
|
1363
1363
|
}).catch((n) => {
|
|
1364
|
-
|
|
1364
|
+
$n(e, a) !== null && e.dispatch(e.state.tr.setMeta(Q, {
|
|
1365
1365
|
type: "remove",
|
|
1366
1366
|
id: a
|
|
1367
1367
|
})), (r.onError ?? ((e) => console.error("[CoarMarkdownEditor] image upload failed", e)))(n, t);
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1371
|
-
return
|
|
1370
|
+
function nr(e) {
|
|
1371
|
+
return Ie(() => new je({
|
|
1372
1372
|
key: Q,
|
|
1373
1373
|
state: {
|
|
1374
|
-
init: () =>
|
|
1374
|
+
init: () => ht.empty,
|
|
1375
1375
|
apply(e, t) {
|
|
1376
1376
|
let n = t.map(e.mapping, e.doc), r = e.getMeta(Q);
|
|
1377
1377
|
if (r?.type === "add") {
|
|
1378
|
-
let t =
|
|
1378
|
+
let t = mt.widget(r.pos, Qn(), { id: r.id });
|
|
1379
1379
|
n = n.add(e.doc, [t]);
|
|
1380
1380
|
} else r?.type === "remove" && (n = n.remove(n.find(void 0, void 0, (e) => e.id === r.id)));
|
|
1381
1381
|
return n;
|
|
@@ -1387,29 +1387,29 @@ function er(e) {
|
|
|
1387
1387
|
},
|
|
1388
1388
|
handlePaste(t, n) {
|
|
1389
1389
|
if (!e.getUploader()) return !1;
|
|
1390
|
-
let r =
|
|
1390
|
+
let r = er(n.clipboardData);
|
|
1391
1391
|
if (r.length === 0) return !1;
|
|
1392
1392
|
n.preventDefault();
|
|
1393
1393
|
let i = t.state.selection.from;
|
|
1394
|
-
return r.forEach((n) =>
|
|
1394
|
+
return r.forEach((n) => tr(t, n, i, e)), !0;
|
|
1395
1395
|
},
|
|
1396
1396
|
handleDrop(t, n, r, i) {
|
|
1397
1397
|
if (i || !e.getUploader()) return !1;
|
|
1398
|
-
let a =
|
|
1398
|
+
let a = er(n.dataTransfer);
|
|
1399
1399
|
if (a.length === 0) return !1;
|
|
1400
1400
|
n.preventDefault();
|
|
1401
1401
|
let o = t.posAtCoords({
|
|
1402
1402
|
left: n.clientX,
|
|
1403
1403
|
top: n.clientY
|
|
1404
1404
|
})?.pos ?? t.state.selection.from;
|
|
1405
|
-
return a.forEach((n) =>
|
|
1405
|
+
return a.forEach((n) => tr(t, n, o, e)), !0;
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
}));
|
|
1409
1409
|
}
|
|
1410
1410
|
//#endregion
|
|
1411
|
-
//#region src/
|
|
1412
|
-
var
|
|
1411
|
+
//#region src/editor-group.ts
|
|
1412
|
+
var rr = Symbol.for("coar:markdown-editor-group"), ir = [
|
|
1413
1413
|
"bold",
|
|
1414
1414
|
"italic",
|
|
1415
1415
|
"strikethrough",
|
|
@@ -1431,26 +1431,26 @@ var tr = [
|
|
|
1431
1431
|
"undo",
|
|
1432
1432
|
"redo"
|
|
1433
1433
|
], $ = {
|
|
1434
|
-
bold: { command:
|
|
1435
|
-
italic: { command:
|
|
1436
|
-
strike: { command:
|
|
1437
|
-
code: { command:
|
|
1438
|
-
bulletList: { command:
|
|
1439
|
-
orderedList: { command:
|
|
1440
|
-
blockquote: { command:
|
|
1441
|
-
hr: { command:
|
|
1442
|
-
codeBlock: { command:
|
|
1443
|
-
table: { command:
|
|
1444
|
-
undo: { command:
|
|
1445
|
-
redo: { command:
|
|
1446
|
-
paragraph: { command:
|
|
1447
|
-
addRowBefore: { command:
|
|
1448
|
-
addRowAfter: { command:
|
|
1449
|
-
addColBefore: { command:
|
|
1450
|
-
addColAfter: { command:
|
|
1451
|
-
deleteCell: { command:
|
|
1452
|
-
indent: { command:
|
|
1453
|
-
outdent: { command:
|
|
1434
|
+
bold: { command: Ee },
|
|
1435
|
+
italic: { command: we },
|
|
1436
|
+
strike: { command: pt },
|
|
1437
|
+
code: { command: Te },
|
|
1438
|
+
bulletList: { command: ke },
|
|
1439
|
+
orderedList: { command: Ae },
|
|
1440
|
+
blockquote: { command: Oe },
|
|
1441
|
+
hr: { command: xe },
|
|
1442
|
+
codeBlock: { command: be },
|
|
1443
|
+
table: { command: st },
|
|
1444
|
+
undo: { command: vt },
|
|
1445
|
+
redo: { command: _t },
|
|
1446
|
+
paragraph: { command: De },
|
|
1447
|
+
addRowBefore: { command: it },
|
|
1448
|
+
addRowAfter: { command: rt },
|
|
1449
|
+
addColBefore: { command: nt },
|
|
1450
|
+
addColAfter: { command: tt },
|
|
1451
|
+
deleteCell: { command: at },
|
|
1452
|
+
indent: { command: q },
|
|
1453
|
+
outdent: { command: Ce },
|
|
1454
1454
|
h1: {
|
|
1455
1455
|
command: J,
|
|
1456
1456
|
payload: 1
|
|
@@ -1475,7 +1475,7 @@ var tr = [
|
|
|
1475
1475
|
command: J,
|
|
1476
1476
|
payload: 6
|
|
1477
1477
|
}
|
|
1478
|
-
},
|
|
1478
|
+
}, ar = u({
|
|
1479
1479
|
props: {
|
|
1480
1480
|
initialValue: {
|
|
1481
1481
|
type: String,
|
|
@@ -1549,29 +1549,33 @@ var tr = [
|
|
|
1549
1549
|
type: Object,
|
|
1550
1550
|
default: void 0
|
|
1551
1551
|
},
|
|
1552
|
+
editorGroupId: {
|
|
1553
|
+
type: String,
|
|
1554
|
+
required: !0
|
|
1555
|
+
},
|
|
1552
1556
|
onMarkdownChange: {
|
|
1553
1557
|
type: Function,
|
|
1554
1558
|
required: !0
|
|
1555
1559
|
}
|
|
1556
1560
|
},
|
|
1557
1561
|
setup(e) {
|
|
1558
|
-
let t = d()?.appContext ?? null, n =
|
|
1559
|
-
|
|
1560
|
-
let a =
|
|
1561
|
-
t.set(
|
|
1562
|
+
let t = d()?.appContext ?? null, n = b(e.initialValue), r = b("rendered"), i = Ft(e.flavor);
|
|
1563
|
+
se((r) => {
|
|
1564
|
+
let a = re.make().config((t) => {
|
|
1565
|
+
t.set(ae, r), t.set(ie, e.initialValue), t.update(I, (t) => ({
|
|
1562
1566
|
...t,
|
|
1563
1567
|
editable: () => !e.readonly
|
|
1564
|
-
})), t.get(
|
|
1568
|
+
})), t.get(xt).markdownUpdated((t, r) => {
|
|
1565
1569
|
r !== n.value && (n.value = r, e.onMarkdownChange(r));
|
|
1566
1570
|
});
|
|
1567
|
-
}).use(
|
|
1568
|
-
return i.gfm && a.use(
|
|
1571
|
+
}).use(K);
|
|
1572
|
+
return i.gfm && a.use(ot), a.use(Tn).use(gt).use(yt).use(bt), i.textColor && a.use(qt), i.embeds && a.use(Nn({
|
|
1569
1573
|
resolveRegistry: () => e.embeds,
|
|
1570
1574
|
appContext: t
|
|
1571
|
-
})), a.use(
|
|
1575
|
+
})), a.use(Ht).use(nr({ getUploader: () => e.uploadImage })), a;
|
|
1572
1576
|
});
|
|
1573
|
-
let [a, o] =
|
|
1574
|
-
return
|
|
1577
|
+
let [a, o] = ce(), s = b(null);
|
|
1578
|
+
return k(() => e.externalValue.value, (e) => {
|
|
1575
1579
|
if (e === n.value) return;
|
|
1576
1580
|
if (r.value === "source") {
|
|
1577
1581
|
n.value = e;
|
|
@@ -1582,26 +1586,26 @@ var tr = [
|
|
|
1582
1586
|
s.value = e;
|
|
1583
1587
|
return;
|
|
1584
1588
|
}
|
|
1585
|
-
s.value = null, n.value = e, t.action(
|
|
1586
|
-
}),
|
|
1589
|
+
s.value = null, n.value = e, t.action(ze(e));
|
|
1590
|
+
}), k(r, (e) => {
|
|
1587
1591
|
if (e !== "rendered") return;
|
|
1588
1592
|
let t = o();
|
|
1589
|
-
t && t.action(
|
|
1590
|
-
}),
|
|
1593
|
+
t && t.action(ze(n.value));
|
|
1594
|
+
}), k(a, (e) => {
|
|
1591
1595
|
if (e || s.value === null) return;
|
|
1592
1596
|
let t = o();
|
|
1593
1597
|
if (!t) return;
|
|
1594
1598
|
let r = s.value;
|
|
1595
|
-
s.value = null, r !== n.value && (n.value = r, t.action(
|
|
1596
|
-
}, { immediate: !0 }),
|
|
1599
|
+
s.value = null, r !== n.value && (n.value = r, t.action(ze(r)));
|
|
1600
|
+
}, { immediate: !0 }), k(() => e.readonly, () => {
|
|
1597
1601
|
let t = o();
|
|
1598
1602
|
t && t.action((t) => {
|
|
1599
|
-
t.update(
|
|
1603
|
+
t.update(I, (t) => ({
|
|
1600
1604
|
...t,
|
|
1601
1605
|
editable: () => !e.readonly
|
|
1602
|
-
})), t.get(
|
|
1606
|
+
})), t.get(F).update(t.get(F).props);
|
|
1603
1607
|
});
|
|
1604
|
-
}), () => f(
|
|
1608
|
+
}), () => f(or, {
|
|
1605
1609
|
readonly: e.readonly,
|
|
1606
1610
|
disabled: e.disabled,
|
|
1607
1611
|
toolbarMode: e.toolbarMode,
|
|
@@ -1615,6 +1619,7 @@ var tr = [
|
|
|
1615
1619
|
placeholder: e.placeholder,
|
|
1616
1620
|
pickImage: e.pickImage,
|
|
1617
1621
|
embeds: e.embeds,
|
|
1622
|
+
editorGroupId: e.editorGroupId,
|
|
1618
1623
|
flavor: e.flavor,
|
|
1619
1624
|
isEmpty: n.value.trim() === "",
|
|
1620
1625
|
sourceToggle: e.sourceToggle,
|
|
@@ -1628,7 +1633,7 @@ var tr = [
|
|
|
1628
1633
|
}
|
|
1629
1634
|
});
|
|
1630
1635
|
}
|
|
1631
|
-
}),
|
|
1636
|
+
}), or = u({
|
|
1632
1637
|
props: {
|
|
1633
1638
|
readonly: {
|
|
1634
1639
|
type: Boolean,
|
|
@@ -1702,6 +1707,10 @@ var tr = [
|
|
|
1702
1707
|
type: String,
|
|
1703
1708
|
default: ""
|
|
1704
1709
|
},
|
|
1710
|
+
editorGroupId: {
|
|
1711
|
+
type: String,
|
|
1712
|
+
required: !0
|
|
1713
|
+
},
|
|
1705
1714
|
onToggleView: {
|
|
1706
1715
|
type: Function,
|
|
1707
1716
|
default: void 0
|
|
@@ -1712,10 +1721,10 @@ var tr = [
|
|
|
1712
1721
|
}
|
|
1713
1722
|
},
|
|
1714
1723
|
setup(e) {
|
|
1715
|
-
let [, r] =
|
|
1724
|
+
let [, r] = ce(), i = p(rr, void 0), a = b(null), o = b(null), s = b(!1), c = b(!1), l = b({
|
|
1716
1725
|
left: "0px",
|
|
1717
1726
|
top: "0px"
|
|
1718
|
-
}),
|
|
1727
|
+
}), u = b("text"), d = b(!1), h = {
|
|
1719
1728
|
strong: !1,
|
|
1720
1729
|
emphasis: !1,
|
|
1721
1730
|
strike_through: !1,
|
|
@@ -1730,13 +1739,13 @@ var tr = [
|
|
|
1730
1739
|
cell_alignment: null,
|
|
1731
1740
|
code_block: !1,
|
|
1732
1741
|
list_item_depth: 0
|
|
1733
|
-
},
|
|
1734
|
-
function
|
|
1742
|
+
}, g = ve(), v = _e(), y = null, x = null, S = b({ ...h });
|
|
1743
|
+
function C(t) {
|
|
1735
1744
|
if (e.readonly) return;
|
|
1736
1745
|
let n = r();
|
|
1737
1746
|
n && (n.action((e) => {
|
|
1738
1747
|
e.get(P).call(t.command.key, t.payload);
|
|
1739
|
-
}),
|
|
1748
|
+
}), z());
|
|
1740
1749
|
}
|
|
1741
1750
|
async function te(t) {
|
|
1742
1751
|
if (e.readonly) return;
|
|
@@ -1748,20 +1757,20 @@ var tr = [
|
|
|
1748
1757
|
}
|
|
1749
1758
|
let a = r();
|
|
1750
1759
|
a && (a.action((e) => {
|
|
1751
|
-
let n = e.get(
|
|
1760
|
+
let n = e.get(F), r = n.state.schema.nodes.embed;
|
|
1752
1761
|
if (!r) return;
|
|
1753
1762
|
let a = r.create({
|
|
1754
1763
|
embedKey: t,
|
|
1755
1764
|
props: i
|
|
1756
1765
|
});
|
|
1757
1766
|
n.dispatch(n.state.tr.replaceSelectionWith(a).scrollIntoView()), n.focus();
|
|
1758
|
-
}),
|
|
1767
|
+
}), z());
|
|
1759
1768
|
}
|
|
1760
|
-
function
|
|
1769
|
+
function w(t) {
|
|
1761
1770
|
if (e.readonly) return;
|
|
1762
1771
|
let n = r();
|
|
1763
1772
|
n && (n.action((e) => {
|
|
1764
|
-
let n = e.get(
|
|
1773
|
+
let n = e.get(F), { state: r } = n, { $from: i } = r.selection, a = -1, o = null, s = -1;
|
|
1765
1774
|
for (let e = i.depth; e > 0; e--) {
|
|
1766
1775
|
let t = i.node(e);
|
|
1767
1776
|
t.type.name === "table" && (o = t, a = i.before(e)), (t.type.name === "table_cell" || t.type.name === "table_header") && s < 0 && (s = e);
|
|
@@ -1778,47 +1787,47 @@ var tr = [
|
|
|
1778
1787
|
});
|
|
1779
1788
|
});
|
|
1780
1789
|
}), l.docChanged && n.dispatch(l);
|
|
1781
|
-
}),
|
|
1790
|
+
}), z());
|
|
1782
1791
|
}
|
|
1783
|
-
function
|
|
1792
|
+
function T() {
|
|
1784
1793
|
if (e.readonly) return;
|
|
1785
1794
|
let t = r();
|
|
1786
1795
|
t && (t.action((e) => {
|
|
1787
1796
|
let t = e.get(P);
|
|
1788
|
-
t.call(
|
|
1789
|
-
}),
|
|
1797
|
+
t.call(ft.key), t.call(at.key);
|
|
1798
|
+
}), z());
|
|
1790
1799
|
}
|
|
1791
|
-
function
|
|
1800
|
+
function E(t) {
|
|
1792
1801
|
if (e.readonly) return;
|
|
1793
|
-
let n = t === "bullet_list" ? $.bulletList : $.orderedList, r =
|
|
1802
|
+
let n = t === "bullet_list" ? $.bulletList : $.orderedList, r = Nt({
|
|
1794
1803
|
target: t,
|
|
1795
|
-
inBulletList:
|
|
1796
|
-
inOrderedList:
|
|
1804
|
+
inBulletList: S.value.bullet_list,
|
|
1805
|
+
inOrderedList: S.value.ordered_list
|
|
1797
1806
|
});
|
|
1798
1807
|
if (r === "lift") {
|
|
1799
|
-
|
|
1808
|
+
C({ command: Ce });
|
|
1800
1809
|
return;
|
|
1801
1810
|
}
|
|
1802
|
-
r === "switch" &&
|
|
1811
|
+
r === "switch" && C({ command: Ce }), C(n);
|
|
1803
1812
|
}
|
|
1804
|
-
let
|
|
1813
|
+
let D = n(() => {
|
|
1805
1814
|
if (!e.tools) return;
|
|
1806
1815
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
1807
1816
|
typeof e == "string" && e !== "divider" && !e.startsWith("embed:") && t.add(e);
|
|
1808
1817
|
};
|
|
1809
1818
|
for (let t of e.tools) typeof t == "string" ? n(t) : t && typeof t == "object" && Array.isArray(t.flyout) && t.flyout.forEach(n);
|
|
1810
1819
|
return t;
|
|
1811
|
-
}),
|
|
1812
|
-
function
|
|
1813
|
-
return
|
|
1820
|
+
}), ne = n(() => Ft(e.flavor));
|
|
1821
|
+
function O(e) {
|
|
1822
|
+
return jt(e, ne.value) ? Mt(e, D.value) : !1;
|
|
1814
1823
|
}
|
|
1815
|
-
function
|
|
1824
|
+
function A(t) {
|
|
1816
1825
|
if (e.readonly) return;
|
|
1817
1826
|
let n = r();
|
|
1818
1827
|
if (!n) return;
|
|
1819
1828
|
let i = t === null ? null : Y(t);
|
|
1820
1829
|
n.action((e) => {
|
|
1821
|
-
let t = e.get(
|
|
1830
|
+
let t = e.get(F), { state: n } = t, r = n.schema.marks.text_color;
|
|
1822
1831
|
if (!r) return;
|
|
1823
1832
|
let { from: a, to: o, empty: s } = n.selection;
|
|
1824
1833
|
if (s) {
|
|
@@ -1828,17 +1837,17 @@ var tr = [
|
|
|
1828
1837
|
let e = n.tr.removeMark(a, o, r);
|
|
1829
1838
|
i && (e = e.addMark(a, o, r.create({ color: i }))), t.dispatch(e);
|
|
1830
1839
|
}
|
|
1831
|
-
}),
|
|
1840
|
+
}), M(), z();
|
|
1832
1841
|
}
|
|
1833
|
-
function
|
|
1842
|
+
function j(e) {
|
|
1834
1843
|
if (e) {
|
|
1835
|
-
if (
|
|
1836
|
-
|
|
1844
|
+
if (y && !y.isClosed) {
|
|
1845
|
+
M();
|
|
1837
1846
|
return;
|
|
1838
1847
|
}
|
|
1839
|
-
|
|
1848
|
+
y = g.open({
|
|
1840
1849
|
spec: {
|
|
1841
|
-
...
|
|
1850
|
+
...he,
|
|
1842
1851
|
anchor: {
|
|
1843
1852
|
kind: "element",
|
|
1844
1853
|
element: e
|
|
@@ -1846,39 +1855,39 @@ var tr = [
|
|
|
1846
1855
|
},
|
|
1847
1856
|
content: {
|
|
1848
1857
|
kind: "component",
|
|
1849
|
-
component: m(
|
|
1858
|
+
component: m(Ln)
|
|
1850
1859
|
},
|
|
1851
1860
|
inputs: {
|
|
1852
|
-
currentColor:
|
|
1853
|
-
pick: (e) =>
|
|
1861
|
+
currentColor: S.value.text_color,
|
|
1862
|
+
pick: (e) => A(e)
|
|
1854
1863
|
}
|
|
1855
|
-
}),
|
|
1856
|
-
|
|
1864
|
+
}), y.afterClosed.then(() => {
|
|
1865
|
+
y?.isClosed && (y = null);
|
|
1857
1866
|
});
|
|
1858
1867
|
}
|
|
1859
1868
|
}
|
|
1860
|
-
function
|
|
1861
|
-
|
|
1869
|
+
function M() {
|
|
1870
|
+
y && !y.isClosed && y.close(), y = null;
|
|
1862
1871
|
}
|
|
1863
|
-
function
|
|
1864
|
-
if (
|
|
1872
|
+
function N(t, n) {
|
|
1873
|
+
if (ie(), e.readonly) return;
|
|
1865
1874
|
let i = r();
|
|
1866
1875
|
i && (i.action((e) => {
|
|
1867
|
-
e.get(P).call(
|
|
1876
|
+
e.get(P).call(st.key, {
|
|
1868
1877
|
row: t,
|
|
1869
1878
|
col: n
|
|
1870
1879
|
});
|
|
1871
|
-
}),
|
|
1880
|
+
}), z());
|
|
1872
1881
|
}
|
|
1873
|
-
function
|
|
1882
|
+
function re(t) {
|
|
1874
1883
|
if (!(!t || e.readonly)) {
|
|
1875
|
-
if (
|
|
1876
|
-
|
|
1884
|
+
if (x && !x.isClosed) {
|
|
1885
|
+
ie();
|
|
1877
1886
|
return;
|
|
1878
1887
|
}
|
|
1879
|
-
|
|
1888
|
+
x = g.open({
|
|
1880
1889
|
spec: {
|
|
1881
|
-
...
|
|
1890
|
+
...he,
|
|
1882
1891
|
anchor: {
|
|
1883
1892
|
kind: "element",
|
|
1884
1893
|
element: t
|
|
@@ -1886,70 +1895,70 @@ var tr = [
|
|
|
1886
1895
|
},
|
|
1887
1896
|
content: {
|
|
1888
1897
|
kind: "component",
|
|
1889
|
-
component: m(
|
|
1898
|
+
component: m(Hn)
|
|
1890
1899
|
},
|
|
1891
|
-
inputs: { pick: (e, t) =>
|
|
1892
|
-
}),
|
|
1893
|
-
|
|
1900
|
+
inputs: { pick: (e, t) => N(e, t) }
|
|
1901
|
+
}), x.afterClosed.then(() => {
|
|
1902
|
+
x?.isClosed && (x = null);
|
|
1894
1903
|
});
|
|
1895
1904
|
}
|
|
1896
1905
|
}
|
|
1897
|
-
function
|
|
1898
|
-
|
|
1906
|
+
function ie() {
|
|
1907
|
+
x && !x.isClosed && x.close(), x = null;
|
|
1899
1908
|
}
|
|
1900
|
-
function
|
|
1909
|
+
function I(t) {
|
|
1901
1910
|
if (e.readonly || !t.url) return;
|
|
1902
1911
|
let n = r();
|
|
1903
1912
|
n && n.action((e) => {
|
|
1904
|
-
e.get(P).call(
|
|
1913
|
+
e.get(P).call(Se.key, {
|
|
1905
1914
|
src: t.url,
|
|
1906
1915
|
alt: t.alt || void 0,
|
|
1907
1916
|
title: t.title || void 0
|
|
1908
1917
|
});
|
|
1909
1918
|
});
|
|
1910
1919
|
}
|
|
1911
|
-
function
|
|
1920
|
+
function ae() {
|
|
1912
1921
|
let e = r();
|
|
1913
1922
|
if (!e) return "";
|
|
1914
1923
|
let t = "";
|
|
1915
1924
|
return e.action((e) => {
|
|
1916
|
-
let { state: n } = e.get(
|
|
1925
|
+
let { state: n } = e.get(F), { from: r, to: i } = n.selection;
|
|
1917
1926
|
t = n.doc.textBetween(r, i, " ");
|
|
1918
1927
|
}), t;
|
|
1919
1928
|
}
|
|
1920
|
-
function
|
|
1929
|
+
function oe() {
|
|
1921
1930
|
if (e.readonly) return;
|
|
1922
1931
|
let t = e.pickImage;
|
|
1923
1932
|
if (t) {
|
|
1924
1933
|
t({
|
|
1925
|
-
insertImage:
|
|
1926
|
-
selectedText:
|
|
1934
|
+
insertImage: I,
|
|
1935
|
+
selectedText: ae()
|
|
1927
1936
|
});
|
|
1928
1937
|
return;
|
|
1929
1938
|
}
|
|
1930
|
-
|
|
1939
|
+
v.open(Zn, {
|
|
1931
1940
|
title: "Insert image",
|
|
1932
1941
|
size: "s"
|
|
1933
1942
|
}).result.then((e) => {
|
|
1934
1943
|
let t = e;
|
|
1935
|
-
t?.url &&
|
|
1944
|
+
t?.url && I(t);
|
|
1936
1945
|
});
|
|
1937
1946
|
}
|
|
1938
|
-
function
|
|
1947
|
+
function se() {
|
|
1939
1948
|
if (e.readonly) return;
|
|
1940
1949
|
let t = r();
|
|
1941
1950
|
t && t.action((e) => {
|
|
1942
|
-
let t = e.get(
|
|
1951
|
+
let t = e.get(F), { state: n } = t, r = n.tr, { from: i, to: a, empty: o } = n.selection;
|
|
1943
1952
|
o ? r = r.setStoredMarks([]) : Object.values(n.schema.marks).forEach((e) => {
|
|
1944
1953
|
r = r.removeMark(i, a, e);
|
|
1945
|
-
}), t.dispatch(r), e.get(P).call(
|
|
1954
|
+
}), t.dispatch(r), e.get(P).call(De.key);
|
|
1946
1955
|
});
|
|
1947
1956
|
}
|
|
1948
|
-
function
|
|
1957
|
+
function R() {
|
|
1949
1958
|
if (e.readonly) return;
|
|
1950
1959
|
let t = r();
|
|
1951
1960
|
t && t.action((e) => {
|
|
1952
|
-
let n = e.get(
|
|
1961
|
+
let n = e.get(F), { $from: r } = n.state.selection;
|
|
1953
1962
|
for (let e = r.depth; e > 0; e--) {
|
|
1954
1963
|
let t = r.node(e);
|
|
1955
1964
|
if (t.type.name === "list_item") {
|
|
@@ -1958,9 +1967,9 @@ var tr = [
|
|
|
1958
1967
|
return;
|
|
1959
1968
|
}
|
|
1960
1969
|
}
|
|
1961
|
-
e.get(P).call(
|
|
1970
|
+
e.get(P).call(ke.key), queueMicrotask(() => {
|
|
1962
1971
|
t.action((e) => {
|
|
1963
|
-
let t = e.get(
|
|
1972
|
+
let t = e.get(F), { $from: n } = t.state.selection;
|
|
1964
1973
|
for (let e = n.depth; e > 0; e--) if (n.node(e).type.name === "list_item") {
|
|
1965
1974
|
t.dispatch(t.state.tr.setNodeAttribute(n.before(e), "checked", !1));
|
|
1966
1975
|
return;
|
|
@@ -1969,11 +1978,11 @@ var tr = [
|
|
|
1969
1978
|
});
|
|
1970
1979
|
});
|
|
1971
1980
|
}
|
|
1972
|
-
function
|
|
1981
|
+
function z() {
|
|
1973
1982
|
let e = r();
|
|
1974
1983
|
if (e) try {
|
|
1975
1984
|
e.action((e) => {
|
|
1976
|
-
let t = e.get(
|
|
1985
|
+
let t = e.get(F).state, { from: n, to: r, empty: i, $from: a } = t.selection, o = t.storedMarks, s = { ...h }, c = (e) => {
|
|
1977
1986
|
let s = t.schema.marks[e];
|
|
1978
1987
|
if (!s) return !1;
|
|
1979
1988
|
if (i) {
|
|
@@ -2012,35 +2021,35 @@ var tr = [
|
|
|
2012
2021
|
(e === "left" || e === "center" || e === "right") && (s.cell_alignment = e);
|
|
2013
2022
|
} else n === "code_block" ? s.code_block = !0 : n === "list_item" && (s.list_item_depth += 1, t.attrs.checked != null && (s.task_list = !0));
|
|
2014
2023
|
}
|
|
2015
|
-
|
|
2024
|
+
S.value = s;
|
|
2016
2025
|
});
|
|
2017
2026
|
} catch {
|
|
2018
|
-
|
|
2027
|
+
S.value = { ...h };
|
|
2019
2028
|
}
|
|
2020
2029
|
}
|
|
2021
|
-
function
|
|
2030
|
+
function le(t) {
|
|
2022
2031
|
if (e.readonly) return;
|
|
2023
2032
|
let n = t.target, i = n.closest("li[data-item-type=\"task\"]");
|
|
2024
2033
|
if (i) {
|
|
2025
2034
|
let e = i.getBoundingClientRect();
|
|
2026
2035
|
if (t.clientX - e.left < 18) {
|
|
2027
|
-
t.preventDefault(),
|
|
2036
|
+
t.preventDefault(), B(i);
|
|
2028
2037
|
return;
|
|
2029
2038
|
}
|
|
2030
2039
|
}
|
|
2031
2040
|
if (n.closest(".ProseMirror")) return;
|
|
2032
2041
|
let a = r();
|
|
2033
2042
|
a && (t.preventDefault(), a.action((e) => {
|
|
2034
|
-
let t = e.get(
|
|
2043
|
+
let t = e.get(F);
|
|
2035
2044
|
t.focus();
|
|
2036
|
-
let n = t.state.tr.setSelection(
|
|
2045
|
+
let n = t.state.tr.setSelection(Ne.atEnd(t.state.doc));
|
|
2037
2046
|
t.dispatch(n);
|
|
2038
2047
|
}));
|
|
2039
2048
|
}
|
|
2040
|
-
function
|
|
2049
|
+
function B(e) {
|
|
2041
2050
|
let t = r();
|
|
2042
2051
|
t && t.action((t) => {
|
|
2043
|
-
let n = t.get(
|
|
2052
|
+
let n = t.get(F), r = n.posAtDOM(e, 0);
|
|
2044
2053
|
if (r < 0) return;
|
|
2045
2054
|
let i = n.state.doc.resolve(r);
|
|
2046
2055
|
for (let e = i.depth; e >= 0; e--) {
|
|
@@ -2053,13 +2062,13 @@ var tr = [
|
|
|
2053
2062
|
}
|
|
2054
2063
|
});
|
|
2055
2064
|
}
|
|
2056
|
-
function
|
|
2065
|
+
function ue() {
|
|
2057
2066
|
let e = r();
|
|
2058
2067
|
if (!e) return "text";
|
|
2059
2068
|
try {
|
|
2060
2069
|
let t = "text";
|
|
2061
2070
|
return e.action((e) => {
|
|
2062
|
-
let { $from: n } = e.get(
|
|
2071
|
+
let { $from: n } = e.get(F).state.selection;
|
|
2063
2072
|
for (let e = n.depth; e > 0; e--) if (n.node(e).type.name === "table") {
|
|
2064
2073
|
t = "table";
|
|
2065
2074
|
break;
|
|
@@ -2069,78 +2078,87 @@ var tr = [
|
|
|
2069
2078
|
return "text";
|
|
2070
2079
|
}
|
|
2071
2080
|
}
|
|
2072
|
-
function
|
|
2081
|
+
function de(e) {
|
|
2073
2082
|
let t = e.left + e.width / 2, n = e.top - 8;
|
|
2074
|
-
t = Math.max(108, Math.min(t, window.innerWidth - 108)), n < 50 && (n = e.bottom + 8),
|
|
2083
|
+
t = Math.max(108, Math.min(t, window.innerWidth - 108)), n < 50 && (n = e.bottom + 8), l.value = {
|
|
2075
2084
|
left: `${t}px`,
|
|
2076
2085
|
top: `${n}px`
|
|
2077
2086
|
};
|
|
2078
2087
|
}
|
|
2079
|
-
function
|
|
2080
|
-
if (e.readonly || e.toolbarMode === "fixed") {
|
|
2081
|
-
|
|
2088
|
+
function fe() {
|
|
2089
|
+
if (e.readonly || e.toolbarMode === "fixed" || e.toolbarMode === "external") {
|
|
2090
|
+
s.value = !1;
|
|
2082
2091
|
return;
|
|
2083
2092
|
}
|
|
2084
2093
|
let t = window.getSelection();
|
|
2085
2094
|
if (!t || t.isCollapsed || !t.rangeCount) {
|
|
2086
|
-
|
|
2095
|
+
s.value = !1, d.value = !1;
|
|
2087
2096
|
return;
|
|
2088
2097
|
}
|
|
2089
|
-
let n = t.getRangeAt(0), r =
|
|
2098
|
+
let n = t.getRangeAt(0), r = a.value?.querySelector(".coar-md-area .milkdown");
|
|
2090
2099
|
if (!r || !r.contains(n.commonAncestorContainer)) {
|
|
2091
|
-
|
|
2100
|
+
s.value = !1, d.value = !1;
|
|
2092
2101
|
return;
|
|
2093
2102
|
}
|
|
2094
|
-
|
|
2103
|
+
de(n.getBoundingClientRect()), u.value = ue(), s.value = !0, d.value = !1;
|
|
2095
2104
|
}
|
|
2096
|
-
function W(
|
|
2097
|
-
let
|
|
2098
|
-
|
|
2105
|
+
function W(t) {
|
|
2106
|
+
let n = t.target;
|
|
2107
|
+
n.closest(".coar-md-floating-toolbar") || n.closest(".coar-md-float-submenu") || n.closest(".coar-md-external-toolbar") || n.closest(".coar-md-color-picker") || n.closest(".coar-overlay-outlet") || (!a.value || !a.value.contains(n)) && (s.value = !1, d.value = !1, i?.deactivate(e.editorGroupId));
|
|
2099
2108
|
}
|
|
2100
|
-
let
|
|
2101
|
-
function
|
|
2109
|
+
let G = null;
|
|
2110
|
+
function ge(e = 20) {
|
|
2102
2111
|
let t = r();
|
|
2103
2112
|
if (!t) {
|
|
2104
|
-
e > 0 && setTimeout(() =>
|
|
2113
|
+
e > 0 && setTimeout(() => ge(e - 1), 50);
|
|
2105
2114
|
return;
|
|
2106
2115
|
}
|
|
2107
2116
|
try {
|
|
2108
2117
|
t.action((e) => {
|
|
2109
|
-
let t = e.get(
|
|
2110
|
-
|
|
2118
|
+
let t = e.get(xt);
|
|
2119
|
+
G = () => queueMicrotask(z), t.selectionUpdated(G);
|
|
2111
2120
|
});
|
|
2112
2121
|
} catch {
|
|
2113
|
-
e > 0 && setTimeout(() =>
|
|
2122
|
+
e > 0 && setTimeout(() => ge(e - 1), 50);
|
|
2114
2123
|
}
|
|
2115
2124
|
}
|
|
2116
|
-
function
|
|
2117
|
-
if (!
|
|
2125
|
+
function ye() {
|
|
2126
|
+
if (!G) return;
|
|
2118
2127
|
let e = r();
|
|
2119
2128
|
if (e) {
|
|
2120
2129
|
try {
|
|
2121
2130
|
e.action((e) => {
|
|
2122
|
-
let t = e.get(
|
|
2131
|
+
let t = e.get(xt).listeners.selectionUpdated, n = t.indexOf(G);
|
|
2123
2132
|
n >= 0 && t.splice(n, 1);
|
|
2124
2133
|
});
|
|
2125
2134
|
} catch {}
|
|
2126
|
-
|
|
2135
|
+
G = null;
|
|
2127
2136
|
}
|
|
2128
2137
|
}
|
|
2138
|
+
let K, be = !1;
|
|
2139
|
+
function xe(t) {
|
|
2140
|
+
K?.(), K = void 0, t === "external" && (K = i?.register({
|
|
2141
|
+
id: e.editorGroupId,
|
|
2142
|
+
render: () => Te()
|
|
2143
|
+
}));
|
|
2144
|
+
}
|
|
2129
2145
|
_(() => {
|
|
2130
|
-
document.addEventListener("selectionchange",
|
|
2146
|
+
be = !0, document.addEventListener("selectionchange", fe), document.addEventListener("mousedown", W, !0), ge(), xe(e.toolbarMode);
|
|
2147
|
+
}), k(() => e.toolbarMode, (e) => {
|
|
2148
|
+
be && xe(e);
|
|
2131
2149
|
}), ee(() => {
|
|
2132
|
-
document.removeEventListener("selectionchange",
|
|
2150
|
+
be = !1, document.removeEventListener("selectionchange", fe), document.removeEventListener("mousedown", W, !0), ye(), K?.(), M();
|
|
2133
2151
|
});
|
|
2134
2152
|
function q(e, t, n, r = {}) {
|
|
2135
|
-
return f(
|
|
2153
|
+
return f(U, {
|
|
2136
2154
|
icon: e,
|
|
2137
2155
|
label: t,
|
|
2138
2156
|
active: r.active ?? !1,
|
|
2139
2157
|
disabled: r.disabled ?? !1,
|
|
2140
|
-
onClick: r.disabled ? () => {} : r.onClick ?? (() =>
|
|
2158
|
+
onClick: r.disabled ? () => {} : r.onClick ?? (() => C(n))
|
|
2141
2159
|
});
|
|
2142
2160
|
}
|
|
2143
|
-
let
|
|
2161
|
+
let we = [
|
|
2144
2162
|
"bold",
|
|
2145
2163
|
"italic",
|
|
2146
2164
|
"strikethrough",
|
|
@@ -2167,101 +2185,101 @@ var tr = [
|
|
|
2167
2185
|
"undo",
|
|
2168
2186
|
"redo"
|
|
2169
2187
|
];
|
|
2170
|
-
function
|
|
2171
|
-
let t =
|
|
2188
|
+
function Te() {
|
|
2189
|
+
let t = S.value, n = t.heading != null, r = ne.value;
|
|
2172
2190
|
function i(e) {
|
|
2173
|
-
e.length !== 0 && e[e.length - 1]?.type !==
|
|
2191
|
+
e.length !== 0 && e[e.length - 1]?.type !== H && e.push(f(H));
|
|
2174
2192
|
}
|
|
2175
2193
|
function a(e) {
|
|
2176
|
-
if (!
|
|
2194
|
+
if (!jt(e, r)) return [];
|
|
2177
2195
|
switch (e) {
|
|
2178
2196
|
case "bold": return [q("bold", "Bold", $.bold, { active: t.strong })];
|
|
2179
2197
|
case "italic": return [q("italic", "Italic", $.italic, { active: t.emphasis })];
|
|
2180
2198
|
case "strikethrough": return [q("strikethrough", "Strikethrough", $.strike, { active: t.strike_through })];
|
|
2181
2199
|
case "inlineCode": return [q("code", "Inline Code", $.code, { active: t.inlineCode })];
|
|
2182
|
-
case "textColor": return [f(
|
|
2200
|
+
case "textColor": return [f(U, {
|
|
2183
2201
|
icon: "palette",
|
|
2184
2202
|
label: "Text Color",
|
|
2185
2203
|
active: t.text_color !== null,
|
|
2186
2204
|
onClick: (e) => {
|
|
2187
|
-
|
|
2205
|
+
j(e.currentTarget ?? e.target);
|
|
2188
2206
|
}
|
|
2189
2207
|
})];
|
|
2190
|
-
case "headings": return [f(
|
|
2208
|
+
case "headings": return [f(me, {
|
|
2191
2209
|
icon: "hash",
|
|
2192
2210
|
label: n ? `Heading ${t.heading}` : "Headings",
|
|
2193
2211
|
mode: "flyout",
|
|
2194
2212
|
openOnHover: !0
|
|
2195
2213
|
}, { default: () => [
|
|
2196
|
-
f(
|
|
2214
|
+
f(U, {
|
|
2197
2215
|
icon: "pilcrow",
|
|
2198
2216
|
label: "Paragraph",
|
|
2199
2217
|
active: !n,
|
|
2200
|
-
onClick: () =>
|
|
2218
|
+
onClick: () => C($.paragraph)
|
|
2201
2219
|
}),
|
|
2202
|
-
f(
|
|
2220
|
+
f(U, {
|
|
2203
2221
|
icon: "heading",
|
|
2204
2222
|
label: "Heading 1",
|
|
2205
2223
|
active: t.heading === 1,
|
|
2206
|
-
onClick: () =>
|
|
2224
|
+
onClick: () => C($.h1)
|
|
2207
2225
|
}),
|
|
2208
|
-
f(
|
|
2226
|
+
f(U, {
|
|
2209
2227
|
icon: "heading",
|
|
2210
2228
|
label: "Heading 2",
|
|
2211
2229
|
active: t.heading === 2,
|
|
2212
|
-
onClick: () =>
|
|
2230
|
+
onClick: () => C($.h2)
|
|
2213
2231
|
}),
|
|
2214
|
-
f(
|
|
2232
|
+
f(U, {
|
|
2215
2233
|
icon: "heading",
|
|
2216
2234
|
label: "Heading 3",
|
|
2217
2235
|
active: t.heading === 3,
|
|
2218
|
-
onClick: () =>
|
|
2236
|
+
onClick: () => C($.h3)
|
|
2219
2237
|
}),
|
|
2220
|
-
f(
|
|
2238
|
+
f(U, {
|
|
2221
2239
|
icon: "heading",
|
|
2222
2240
|
label: "Heading 4",
|
|
2223
2241
|
active: t.heading === 4,
|
|
2224
|
-
onClick: () =>
|
|
2242
|
+
onClick: () => C($.h4)
|
|
2225
2243
|
}),
|
|
2226
|
-
f(
|
|
2244
|
+
f(U, {
|
|
2227
2245
|
icon: "heading",
|
|
2228
2246
|
label: "Heading 5",
|
|
2229
2247
|
active: t.heading === 5,
|
|
2230
|
-
onClick: () =>
|
|
2248
|
+
onClick: () => C($.h5)
|
|
2231
2249
|
}),
|
|
2232
|
-
f(
|
|
2250
|
+
f(U, {
|
|
2233
2251
|
icon: "heading",
|
|
2234
2252
|
label: "Heading 6",
|
|
2235
2253
|
active: t.heading === 6,
|
|
2236
|
-
onClick: () =>
|
|
2254
|
+
onClick: () => C($.h6)
|
|
2237
2255
|
})
|
|
2238
2256
|
] })];
|
|
2239
2257
|
case "bulletList": return [q("list", "Bullet List", $.bulletList, {
|
|
2240
2258
|
active: t.bullet_list,
|
|
2241
|
-
onClick: () =>
|
|
2259
|
+
onClick: () => E("bullet_list")
|
|
2242
2260
|
})];
|
|
2243
2261
|
case "orderedList": return [q("list-ordered", "Ordered List", $.orderedList, {
|
|
2244
2262
|
active: t.ordered_list,
|
|
2245
|
-
onClick: () =>
|
|
2263
|
+
onClick: () => E("ordered_list")
|
|
2246
2264
|
})];
|
|
2247
2265
|
case "taskList": return [q("clipboard-check", "Task List", $.bulletList, {
|
|
2248
2266
|
active: t.task_list,
|
|
2249
|
-
onClick:
|
|
2267
|
+
onClick: R
|
|
2250
2268
|
})];
|
|
2251
2269
|
case "outdent": return [q("indent-decrease", "Outdent", $.outdent, { disabled: t.list_item_depth < 2 })];
|
|
2252
2270
|
case "indent": return [q("indent-increase", "Indent", $.indent, { disabled: t.list_item_depth < 1 })];
|
|
2253
2271
|
case "blockquote": return [q("text-quote", "Blockquote", $.blockquote, { active: t.blockquote })];
|
|
2254
2272
|
case "horizontalRule": return [q("minus", "Horizontal Rule", $.hr)];
|
|
2255
2273
|
case "codeBlock": return [q("square-code", "Code Block", $.codeBlock, { active: t.code_block })];
|
|
2256
|
-
case "table": return [f(
|
|
2274
|
+
case "table": return [f(U, {
|
|
2257
2275
|
icon: "table",
|
|
2258
2276
|
label: "Insert Table",
|
|
2259
2277
|
active: t.table,
|
|
2260
2278
|
onClick: (e) => {
|
|
2261
|
-
|
|
2279
|
+
re(e.currentTarget ?? e.target);
|
|
2262
2280
|
}
|
|
2263
2281
|
})];
|
|
2264
|
-
case "image": return [q("image", "Insert Image", $.bold, { onClick:
|
|
2282
|
+
case "image": return [q("image", "Insert Image", $.bold, { onClick: oe })];
|
|
2265
2283
|
case "tableOps": return t.table ? [
|
|
2266
2284
|
q("table-row-plus-above", "Insert Row Above", $.addRowBefore),
|
|
2267
2285
|
q("table-row-plus-below", "Insert Row Below", $.addRowAfter),
|
|
@@ -2269,20 +2287,20 @@ var tr = [
|
|
|
2269
2287
|
q("table-column-plus-right", "Insert Column Right", $.addColAfter),
|
|
2270
2288
|
q("align-left", "Align Left", $.deleteCell, {
|
|
2271
2289
|
active: t.cell_alignment === "left",
|
|
2272
|
-
onClick: () =>
|
|
2290
|
+
onClick: () => w("left")
|
|
2273
2291
|
}),
|
|
2274
2292
|
q("align-center", "Align Center", $.deleteCell, {
|
|
2275
2293
|
active: t.cell_alignment === "center",
|
|
2276
|
-
onClick: () =>
|
|
2294
|
+
onClick: () => w("center")
|
|
2277
2295
|
}),
|
|
2278
2296
|
q("align-right", "Align Right", $.deleteCell, {
|
|
2279
2297
|
active: t.cell_alignment === "right",
|
|
2280
|
-
onClick: () =>
|
|
2298
|
+
onClick: () => w("right")
|
|
2281
2299
|
}),
|
|
2282
2300
|
q("trash-2", "Delete Cell", $.deleteCell),
|
|
2283
|
-
q("table", "Delete Table", $.deleteCell, { onClick:
|
|
2301
|
+
q("table", "Delete Table", $.deleteCell, { onClick: T })
|
|
2284
2302
|
] : [];
|
|
2285
|
-
case "clearFormatting": return [q("eraser", "Clear Formatting", $.bold, { onClick:
|
|
2303
|
+
case "clearFormatting": return [q("eraser", "Clear Formatting", $.bold, { onClick: se })];
|
|
2286
2304
|
case "undo": return [q("undo-2", "Undo", $.undo)];
|
|
2287
2305
|
case "redo": return [q("redo-2", "Redo", $.redo)];
|
|
2288
2306
|
default: return [];
|
|
@@ -2291,7 +2309,7 @@ var tr = [
|
|
|
2291
2309
|
function o(t) {
|
|
2292
2310
|
if (!r.embeds) return [];
|
|
2293
2311
|
let n = e.embeds?.[t];
|
|
2294
|
-
return n?.insert ? [f(
|
|
2312
|
+
return n?.insert ? [f(U, {
|
|
2295
2313
|
icon: n.insert.icon ?? "layout-grid",
|
|
2296
2314
|
label: n.insert.label ?? t,
|
|
2297
2315
|
onClick: () => {
|
|
@@ -2303,7 +2321,7 @@ var tr = [
|
|
|
2303
2321
|
if (typeof e == "string") return e === "divider" ? [] : e.startsWith("embed:") ? o(e.slice(6)) : a(e);
|
|
2304
2322
|
if (e && typeof e == "object" && Array.isArray(e.flyout)) {
|
|
2305
2323
|
let t = e.flyout.flatMap((e) => s(e));
|
|
2306
|
-
return t.length === 0 ? [] : [f(
|
|
2324
|
+
return t.length === 0 ? [] : [f(me, {
|
|
2307
2325
|
icon: e.icon ?? "plus",
|
|
2308
2326
|
label: e.label ?? "",
|
|
2309
2327
|
mode: "flyout",
|
|
@@ -2315,15 +2333,15 @@ var tr = [
|
|
|
2315
2333
|
let c = [];
|
|
2316
2334
|
if (e.sourceToggle) {
|
|
2317
2335
|
let t = e.viewMode === "source";
|
|
2318
|
-
if (c.push(f(
|
|
2336
|
+
if (c.push(f(U, {
|
|
2319
2337
|
icon: t ? "eye" : "code",
|
|
2320
2338
|
label: t ? "Rendered" : "Source",
|
|
2321
2339
|
active: t,
|
|
2322
2340
|
onClick: () => e.onToggleView?.(t ? "rendered" : "source")
|
|
2323
|
-
})), t) return
|
|
2341
|
+
})), t) return Ee(c);
|
|
2324
2342
|
i(c);
|
|
2325
2343
|
}
|
|
2326
|
-
let l = e.tools ??
|
|
2344
|
+
let l = e.tools ?? we;
|
|
2327
2345
|
for (let e of l) {
|
|
2328
2346
|
if (e === "divider") {
|
|
2329
2347
|
i(c);
|
|
@@ -2331,22 +2349,22 @@ var tr = [
|
|
|
2331
2349
|
}
|
|
2332
2350
|
for (let t of s(e)) c.push(t);
|
|
2333
2351
|
}
|
|
2334
|
-
return c[c.length - 1]?.type ===
|
|
2352
|
+
return c[c.length - 1]?.type === H && c.pop(), Ee(c);
|
|
2335
2353
|
}
|
|
2336
|
-
function
|
|
2354
|
+
function Ee(t) {
|
|
2337
2355
|
return f("div", {
|
|
2338
2356
|
key: "sidebar",
|
|
2339
|
-
class: "coar-md-sidebar-wrap",
|
|
2357
|
+
class: ["coar-md-sidebar-wrap", { "coar-md-sidebar-wrap--external": e.toolbarMode === "external" }],
|
|
2340
2358
|
onMousedown: (e) => e.preventDefault()
|
|
2341
|
-
}, [f(
|
|
2359
|
+
}, [f(pe, {
|
|
2342
2360
|
collapsed: !0,
|
|
2343
|
-
side: e.toolbarPosition,
|
|
2361
|
+
side: e.toolbarMode === "external" ? i?.position.value ?? e.toolbarPosition : e.toolbarPosition,
|
|
2344
2362
|
size: "s",
|
|
2345
2363
|
variant: "primary",
|
|
2346
2364
|
borderless: !0
|
|
2347
2365
|
}, { default: () => t })]);
|
|
2348
2366
|
}
|
|
2349
|
-
function
|
|
2367
|
+
function Oe() {
|
|
2350
2368
|
let e = (e, t, n, r = {}) => f("button", {
|
|
2351
2369
|
class: [
|
|
2352
2370
|
"coar-md-float-btn",
|
|
@@ -2357,20 +2375,20 @@ var tr = [
|
|
|
2357
2375
|
type: "button",
|
|
2358
2376
|
disabled: r.disabled ?? !1,
|
|
2359
2377
|
onMousedown: (e) => {
|
|
2360
|
-
e.preventDefault(), !r.disabled && (r.onClick ?? (() =>
|
|
2378
|
+
e.preventDefault(), !r.disabled && (r.onClick ?? (() => C(n)))();
|
|
2361
2379
|
}
|
|
2362
|
-
}, [f(
|
|
2380
|
+
}, [f(V, {
|
|
2363
2381
|
name: e,
|
|
2364
2382
|
size: "s"
|
|
2365
|
-
})]), n = () => f("div", { class: "coar-md-float-sep" }), r =
|
|
2383
|
+
})]), n = () => f("div", { class: "coar-md-float-sep" }), r = S.value;
|
|
2366
2384
|
function i(e, t, n) {
|
|
2367
|
-
|
|
2385
|
+
O(t) && e.push(n);
|
|
2368
2386
|
}
|
|
2369
2387
|
function a(e) {
|
|
2370
2388
|
e.length !== 0 && e[e.length - 1]?.props?.class !== "coar-md-float-sep" && e.push(n());
|
|
2371
2389
|
}
|
|
2372
2390
|
let o = [];
|
|
2373
|
-
if (i(o, "bold", e("bold", "Bold", $.bold, { isActive: r.strong })), i(o, "italic", e("italic", "Italic", $.italic, { isActive: r.emphasis })), i(o, "strikethrough", e("strikethrough", "Strikethrough", $.strike, { isActive: r.strike_through })), i(o, "inlineCode", e("code", "Inline Code", $.code, { isActive: r.inlineCode })),
|
|
2391
|
+
if (i(o, "bold", e("bold", "Bold", $.bold, { isActive: r.strong })), i(o, "italic", e("italic", "Italic", $.italic, { isActive: r.emphasis })), i(o, "strikethrough", e("strikethrough", "Strikethrough", $.strike, { isActive: r.strike_through })), i(o, "inlineCode", e("code", "Inline Code", $.code, { isActive: r.inlineCode })), O("textColor")) {
|
|
2374
2392
|
let e = r.text_color !== null;
|
|
2375
2393
|
o.push(f("button", {
|
|
2376
2394
|
class: ["coar-md-float-btn", e ? "coar-md-float-btn--active" : ""],
|
|
@@ -2378,24 +2396,24 @@ var tr = [
|
|
|
2378
2396
|
title: e ? `Text Color (${r.text_color})` : "Text Color",
|
|
2379
2397
|
style: e ? `--coar-md-color-indicator: ${r.text_color};` : void 0,
|
|
2380
2398
|
onMousedown: (e) => {
|
|
2381
|
-
e.preventDefault(),
|
|
2399
|
+
e.preventDefault(), j(e.currentTarget);
|
|
2382
2400
|
}
|
|
2383
|
-
}, [f(
|
|
2401
|
+
}, [f(V, {
|
|
2384
2402
|
name: "palette",
|
|
2385
2403
|
size: "s"
|
|
2386
2404
|
})]));
|
|
2387
2405
|
}
|
|
2388
|
-
|
|
2389
|
-
class: ["coar-md-float-btn",
|
|
2406
|
+
O("headings") && (a(o), o.push(f("div", { class: "coar-md-float-dropdown" }, [f("button", {
|
|
2407
|
+
class: ["coar-md-float-btn", d.value || r.heading != null ? "coar-md-float-btn--active" : ""],
|
|
2390
2408
|
title: r.heading == null ? "Headings" : `Heading ${r.heading}`,
|
|
2391
2409
|
type: "button",
|
|
2392
2410
|
onMousedown: (e) => {
|
|
2393
|
-
e.preventDefault(),
|
|
2411
|
+
e.preventDefault(), d.value = !d.value;
|
|
2394
2412
|
}
|
|
2395
|
-
}, [f(
|
|
2413
|
+
}, [f(V, {
|
|
2396
2414
|
name: "heading",
|
|
2397
2415
|
size: "s"
|
|
2398
|
-
})]),
|
|
2416
|
+
})]), d.value ? f("div", { class: "coar-md-float-submenu" }, [
|
|
2399
2417
|
{
|
|
2400
2418
|
label: "Paragraph",
|
|
2401
2419
|
cmd: $.paragraph,
|
|
@@ -2442,24 +2460,24 @@ var tr = [
|
|
|
2442
2460
|
class: ["coar-md-float-submenu-item", (i === 0 ? r.heading == null : r.heading === i) ? "coar-md-float-submenu-item--active" : ""],
|
|
2443
2461
|
type: "button",
|
|
2444
2462
|
onMousedown: (e) => {
|
|
2445
|
-
e.preventDefault(),
|
|
2463
|
+
e.preventDefault(), C(t), d.value = !1;
|
|
2446
2464
|
}
|
|
2447
|
-
}, [f(
|
|
2465
|
+
}, [f(V, {
|
|
2448
2466
|
name: n,
|
|
2449
2467
|
size: "xs"
|
|
2450
2468
|
}), f("span", null, e)]))) : null]))), a(o), i(o, "bulletList", e("list", "Bullet List", $.bulletList, {
|
|
2451
2469
|
isActive: r.bullet_list,
|
|
2452
|
-
onClick: () =>
|
|
2470
|
+
onClick: () => E("bullet_list")
|
|
2453
2471
|
})), i(o, "orderedList", e("list-ordered", "Ordered List", $.orderedList, {
|
|
2454
2472
|
isActive: r.ordered_list,
|
|
2455
|
-
onClick: () =>
|
|
2473
|
+
onClick: () => E("ordered_list")
|
|
2456
2474
|
})), i(o, "taskList", e("clipboard-check", "Task List", $.bulletList, {
|
|
2457
2475
|
isActive: r.task_list,
|
|
2458
|
-
onClick:
|
|
2459
|
-
})), i(o, "outdent", e("indent-decrease", "Outdent", $.outdent, { disabled: r.list_item_depth < 2 })), i(o, "indent", e("indent-increase", "Indent", $.indent, { disabled: r.list_item_depth < 1 })), a(o), i(o, "blockquote", e("text-quote", "Blockquote", $.blockquote, { isActive: r.blockquote })),
|
|
2476
|
+
onClick: R
|
|
2477
|
+
})), i(o, "outdent", e("indent-decrease", "Outdent", $.outdent, { disabled: r.list_item_depth < 2 })), i(o, "indent", e("indent-increase", "Indent", $.indent, { disabled: r.list_item_depth < 1 })), a(o), i(o, "blockquote", e("text-quote", "Blockquote", $.blockquote, { isActive: r.blockquote })), O("clearFormatting") && (a(o), o.push(e("eraser", "Clear Formatting", $.bold, { onClick: se }))), o[o.length - 1]?.props?.class === "coar-md-float-sep" && o.pop();
|
|
2460
2478
|
let s = {
|
|
2461
2479
|
text: o,
|
|
2462
|
-
table:
|
|
2480
|
+
table: O("tableOps") ? [
|
|
2463
2481
|
e("table-row-plus-above", "Insert Row Above", $.addRowBefore),
|
|
2464
2482
|
e("table-row-plus-below", "Insert Row Below", $.addRowAfter),
|
|
2465
2483
|
n(),
|
|
@@ -2468,31 +2486,31 @@ var tr = [
|
|
|
2468
2486
|
n(),
|
|
2469
2487
|
e("align-left", "Align Left", $.deleteCell, {
|
|
2470
2488
|
isActive: r.cell_alignment === "left",
|
|
2471
|
-
onClick: () =>
|
|
2489
|
+
onClick: () => w("left")
|
|
2472
2490
|
}),
|
|
2473
2491
|
e("align-center", "Align Center", $.deleteCell, {
|
|
2474
2492
|
isActive: r.cell_alignment === "center",
|
|
2475
|
-
onClick: () =>
|
|
2493
|
+
onClick: () => w("center")
|
|
2476
2494
|
}),
|
|
2477
2495
|
e("align-right", "Align Right", $.deleteCell, {
|
|
2478
2496
|
isActive: r.cell_alignment === "right",
|
|
2479
|
-
onClick: () =>
|
|
2497
|
+
onClick: () => w("right")
|
|
2480
2498
|
}),
|
|
2481
2499
|
n(),
|
|
2482
2500
|
e("trash-2", "Delete Cell", $.deleteCell),
|
|
2483
|
-
e("table", "Delete Table", $.deleteCell, { onClick:
|
|
2484
|
-
...
|
|
2485
|
-
...
|
|
2486
|
-
...
|
|
2487
|
-
...
|
|
2501
|
+
e("table", "Delete Table", $.deleteCell, { onClick: T }),
|
|
2502
|
+
...O("bold") || O("italic") || O("inlineCode") ? [n()] : [],
|
|
2503
|
+
...O("bold") ? [e("bold", "Bold", $.bold)] : [],
|
|
2504
|
+
...O("italic") ? [e("italic", "Italic", $.italic)] : [],
|
|
2505
|
+
...O("inlineCode") ? [e("code", "Code", $.code)] : []
|
|
2488
2506
|
] : o,
|
|
2489
|
-
"col-selection":
|
|
2507
|
+
"col-selection": O("tableOps") ? [
|
|
2490
2508
|
e("table-column-plus-left", "Insert Column Left", $.addColBefore),
|
|
2491
2509
|
e("table-column-plus-right", "Insert Column Right", $.addColAfter),
|
|
2492
2510
|
n(),
|
|
2493
2511
|
e("trash-2", "Delete Column", $.deleteCell)
|
|
2494
2512
|
] : o,
|
|
2495
|
-
"row-selection":
|
|
2513
|
+
"row-selection": O("tableOps") ? [
|
|
2496
2514
|
e("table-row-plus-above", "Insert Row Above", $.addRowBefore),
|
|
2497
2515
|
e("table-row-plus-below", "Insert Row Below", $.addRowAfter),
|
|
2498
2516
|
n(),
|
|
@@ -2501,33 +2519,33 @@ var tr = [
|
|
|
2501
2519
|
};
|
|
2502
2520
|
return f(t, { to: "body" }, f("div", {
|
|
2503
2521
|
class: "coar-md-floating-toolbar",
|
|
2504
|
-
style: `left:${
|
|
2505
|
-
}, s[
|
|
2522
|
+
style: `left:${l.value.left};top:${l.value.top};`
|
|
2523
|
+
}, s[u.value] || o));
|
|
2506
2524
|
}
|
|
2507
2525
|
return () => {
|
|
2508
|
-
let t = e.toolbarMode === "fixed" || e.toolbarMode === "both", n = e.sourceToggle && e.viewMode === "source", r = !e.readonly && !n && (e.toolbarMode === "floating" || e.toolbarMode === "both"),
|
|
2509
|
-
t &&
|
|
2510
|
-
let
|
|
2511
|
-
return
|
|
2526
|
+
let t = e.toolbarMode === "fixed" || e.toolbarMode === "both", n = e.sourceToggle && e.viewMode === "source", r = !e.readonly && !n && (e.toolbarMode === "floating" || e.toolbarMode === "both"), l = [], u = e.toolbarPosition === "left" || e.toolbarPosition === "top", d = e.toolbarPosition === "right" || e.toolbarPosition === "bottom";
|
|
2527
|
+
t && u && l.push(Te());
|
|
2528
|
+
let p = e.isEmpty && e.placeholder.length > 0 && !n;
|
|
2529
|
+
return l.push(f("div", {
|
|
2512
2530
|
key: "area",
|
|
2513
|
-
ref:
|
|
2531
|
+
ref: o,
|
|
2514
2532
|
class: [
|
|
2515
2533
|
"coar-md-area",
|
|
2516
2534
|
"coar-markdown",
|
|
2517
2535
|
{ "coar-md-area--source": n }
|
|
2518
2536
|
],
|
|
2519
|
-
onMousedown: n ? void 0 :
|
|
2537
|
+
onMousedown: n ? void 0 : le
|
|
2520
2538
|
}, [
|
|
2521
|
-
f(
|
|
2522
|
-
|
|
2539
|
+
f(L),
|
|
2540
|
+
p ? f(Xt, {
|
|
2523
2541
|
key: "placeholder",
|
|
2524
2542
|
source: e.placeholder
|
|
2525
2543
|
}) : null,
|
|
2526
|
-
!e.readonly && !n &&
|
|
2544
|
+
!e.readonly && !n && ne.value.gfm ? f(qn, {
|
|
2527
2545
|
key: "table-handles",
|
|
2528
|
-
area:
|
|
2546
|
+
area: o.value,
|
|
2529
2547
|
onMenuToggle: (e) => {
|
|
2530
|
-
|
|
2548
|
+
c.value = e;
|
|
2531
2549
|
}
|
|
2532
2550
|
}) : null,
|
|
2533
2551
|
n ? f("textarea", {
|
|
@@ -2540,7 +2558,7 @@ var tr = [
|
|
|
2540
2558
|
placeholder: e.placeholder || void 0,
|
|
2541
2559
|
onInput: (t) => e.onSourceInput?.(t.target.value)
|
|
2542
2560
|
}) : null,
|
|
2543
|
-
e.sourceToggle &&
|
|
2561
|
+
e.sourceToggle && e.toolbarMode !== "fixed" && e.toolbarMode !== "both" && e.toolbarMode !== "external" ? f("button", {
|
|
2544
2562
|
key: "source-corner",
|
|
2545
2563
|
class: "coar-md-source-corner",
|
|
2546
2564
|
type: "button",
|
|
@@ -2549,11 +2567,11 @@ var tr = [
|
|
|
2549
2567
|
onMousedown: (t) => {
|
|
2550
2568
|
t.preventDefault(), e.onToggleView?.(n ? "rendered" : "source");
|
|
2551
2569
|
}
|
|
2552
|
-
}, [f(
|
|
2570
|
+
}, [f(V, {
|
|
2553
2571
|
name: n ? "eye" : "code",
|
|
2554
2572
|
size: "s"
|
|
2555
2573
|
})]) : null
|
|
2556
|
-
])), t &&
|
|
2574
|
+
])), t && d && l.push(Te()), s.value && r && !c.value && l.push(Oe()), f("div", {
|
|
2557
2575
|
class: {
|
|
2558
2576
|
"coar-md-root": !0,
|
|
2559
2577
|
[`coar-md-root--toolbar-${e.toolbarPosition}`]: !0,
|
|
@@ -2561,18 +2579,24 @@ var tr = [
|
|
|
2561
2579
|
"coar-md-root--readonly": e.readonly && !e.disabled,
|
|
2562
2580
|
"coar-md-root--error": e.hasError
|
|
2563
2581
|
},
|
|
2564
|
-
ref:
|
|
2582
|
+
ref: a,
|
|
2565
2583
|
id: e.inputId,
|
|
2566
2584
|
"aria-invalid": e.hasError ? "true" : void 0,
|
|
2567
2585
|
"aria-describedby": e.describedBy,
|
|
2568
2586
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
2569
2587
|
"aria-readonly": e.readonly && !e.disabled ? "true" : void 0,
|
|
2570
2588
|
"aria-required": e.required ? "true" : void 0,
|
|
2571
|
-
"data-name": e.name
|
|
2572
|
-
|
|
2589
|
+
"data-name": e.name,
|
|
2590
|
+
onMousedown: () => i?.activate(e.editorGroupId),
|
|
2591
|
+
onFocusin: () => i?.activate(e.editorGroupId),
|
|
2592
|
+
onFocusout: (t) => {
|
|
2593
|
+
let n = t.relatedTarget;
|
|
2594
|
+
n instanceof Node && a.value?.contains(n) || i?.deactivate(e.editorGroupId);
|
|
2595
|
+
}
|
|
2596
|
+
}, l);
|
|
2573
2597
|
};
|
|
2574
2598
|
}
|
|
2575
|
-
}),
|
|
2599
|
+
}), sr = u({
|
|
2576
2600
|
name: "CoarMarkdownEditor",
|
|
2577
2601
|
props: {
|
|
2578
2602
|
modelValue: {
|
|
@@ -2643,32 +2667,91 @@ var tr = [
|
|
|
2643
2667
|
emits: ["update:modelValue"],
|
|
2644
2668
|
setup(e, { emit: t }) {
|
|
2645
2669
|
let r = e.modelValue, i = te({ value: e.modelValue });
|
|
2646
|
-
|
|
2670
|
+
k(() => e.modelValue, (e) => {
|
|
2647
2671
|
i.value = { value: e };
|
|
2648
2672
|
});
|
|
2649
|
-
let a = p(
|
|
2650
|
-
return () => f(
|
|
2673
|
+
let a = p(G, void 0), o = `coar-markdown-editor-${E()}`, s = `coar-markdown-editor-group-member-${E()}`, c = n(() => e.id || a?.inputId.value || o), l = n(() => e.error || (a?.hasError.value ?? !1)), u = n(() => a?.messageId.value), d = n(() => e.disabled || (a?.disabled.value ?? !1)), m = n(() => e.readonly || d.value);
|
|
2674
|
+
return () => f(oe, null, () => f(ar, {
|
|
2651
2675
|
initialValue: r,
|
|
2652
2676
|
externalValue: i.value,
|
|
2653
|
-
readonly:
|
|
2654
|
-
disabled:
|
|
2677
|
+
readonly: m.value,
|
|
2678
|
+
disabled: d.value,
|
|
2655
2679
|
sourceToggle: e.sourceToggle,
|
|
2656
2680
|
toolbarMode: e.toolbarMode,
|
|
2657
2681
|
toolbarPosition: e.toolbarPosition,
|
|
2658
2682
|
tools: e.tools,
|
|
2659
2683
|
flavor: e.flavor,
|
|
2660
|
-
inputId:
|
|
2661
|
-
hasError:
|
|
2662
|
-
describedBy:
|
|
2684
|
+
inputId: c.value,
|
|
2685
|
+
hasError: l.value,
|
|
2686
|
+
describedBy: u.value,
|
|
2663
2687
|
name: e.name,
|
|
2664
2688
|
required: e.required,
|
|
2665
2689
|
placeholder: e.placeholder,
|
|
2666
2690
|
uploadImage: e.uploadImage,
|
|
2667
2691
|
pickImage: e.pickImage,
|
|
2668
2692
|
embeds: e.embeds,
|
|
2693
|
+
editorGroupId: s,
|
|
2669
2694
|
onMarkdownChange: (e) => t("update:modelValue", e)
|
|
2670
2695
|
}));
|
|
2671
2696
|
}
|
|
2697
|
+
}), cr = /* @__PURE__ */ u({
|
|
2698
|
+
__name: "CoarMarkdownEditorGroup",
|
|
2699
|
+
setup(e) {
|
|
2700
|
+
let t = b("top"), n = b(null), r = te(null), i = [];
|
|
2701
|
+
function a(e) {
|
|
2702
|
+
let t = i.find((t) => t.id === e);
|
|
2703
|
+
t && (n.value = e, r.value = t);
|
|
2704
|
+
}
|
|
2705
|
+
function o(e) {
|
|
2706
|
+
n.value === e && (n.value = null);
|
|
2707
|
+
}
|
|
2708
|
+
function s(e) {
|
|
2709
|
+
return i.some((t) => t.id === e.id) || i.push(e), r.value === null && (r.value = e), () => {
|
|
2710
|
+
let t = i.findIndex((t) => t.id === e.id);
|
|
2711
|
+
t >= 0 && i.splice(t, 1), n.value === e.id && (n.value = null), r.value?.id === e.id && (r.value = i[0] ?? null);
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
return y(rr, {
|
|
2715
|
+
position: t,
|
|
2716
|
+
activeId: n,
|
|
2717
|
+
activeController: r,
|
|
2718
|
+
register: s,
|
|
2719
|
+
activate: a,
|
|
2720
|
+
deactivate: o
|
|
2721
|
+
}), (e, t) => C(e.$slots, "default");
|
|
2722
|
+
}
|
|
2723
|
+
}), lr = u({
|
|
2724
|
+
name: "CoarMarkdownToolbar",
|
|
2725
|
+
props: {
|
|
2726
|
+
position: {
|
|
2727
|
+
type: String,
|
|
2728
|
+
default: "top"
|
|
2729
|
+
},
|
|
2730
|
+
label: {
|
|
2731
|
+
type: String,
|
|
2732
|
+
default: "Markdown formatting"
|
|
2733
|
+
}
|
|
2734
|
+
},
|
|
2735
|
+
setup(e) {
|
|
2736
|
+
let t = p(rr, void 0);
|
|
2737
|
+
return k(() => e.position, (e) => {
|
|
2738
|
+
t && (t.position.value = e);
|
|
2739
|
+
}, { immediate: !0 }), () => {
|
|
2740
|
+
let n = t?.activeController.value?.render(), r = t?.activeId.value == null;
|
|
2741
|
+
return f("div", {
|
|
2742
|
+
class: [
|
|
2743
|
+
"coar-md-external-toolbar",
|
|
2744
|
+
`coar-md-external-toolbar--${e.position}`,
|
|
2745
|
+
{ "coar-md-external-toolbar--disabled": r }
|
|
2746
|
+
],
|
|
2747
|
+
role: "toolbar",
|
|
2748
|
+
"aria-label": e.label,
|
|
2749
|
+
"aria-disabled": r ? "true" : void 0,
|
|
2750
|
+
inert: r ? "" : void 0,
|
|
2751
|
+
"data-active-editor": t?.activeId.value ?? void 0
|
|
2752
|
+
}, n == null ? [] : [n]);
|
|
2753
|
+
};
|
|
2754
|
+
}
|
|
2672
2755
|
});
|
|
2673
2756
|
//#endregion
|
|
2674
|
-
export {
|
|
2757
|
+
export { ir as COAR_MARKDOWN_EDITOR_ALL_TOOLS, sr as CoarMarkdownEditor, cr as CoarMarkdownEditorGroup, lr as CoarMarkdownToolbar, Xe as EmbedRenderer, Qe as MARKDOWN_EMBEDS_KEY, Ft as resolveCapabilities, $e as resolveEmbed };
|