@airalogy/aimd-editor 1.9.0 → 1.9.1
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 +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/{AimdEditorTopBar.vue_vue_type_script_setup_true_lang-DUzstO_i.js → AimdEditorTopBar.vue_vue_type_script_setup_true_lang-BL2zaxn-.js} +375 -355
- package/dist/{AimdSourceEditor.vue_vue_type_script_setup_true_lang-ttzw5IdG.js → AimdSourceEditor.vue_vue_type_script_setup_true_lang-CHXbJJa_.js} +606 -551
- package/dist/embedded.js +1 -1
- package/dist/index.js +2 -2
- package/dist/vue.js +2 -2
- package/package.json +7 -7
- package/src/vue/AimdEditor.vue +26 -1
- package/src/vue/AimdEditorToolbar.vue +2 -2
- package/src/vue/index.ts +3 -0
- package/src/vue/types.ts +18 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as ve, computed as
|
|
2
|
-
import { callCommand as De, insert as
|
|
1
|
+
import { defineComponent as ve, computed as $, ref as B, watch as E, openBlock as u, createBlock as Be, Teleport as Ue, createElementBlock as v, withModifiers as ue, createElementVNode as l, normalizeStyle as me, createTextVNode as N, toDisplayString as i, Fragment as q, renderList as j, normalizeClass as W, withDirectives as b, vModelText as x, createCommentVNode as z, vModelSelect as ke, vModelRadio as Le, vModelCheckbox as He, shallowRef as _e, nextTick as ze, unref as K, createVNode as Me, vShow as Ie } from "vue";
|
|
2
|
+
import { callCommand as De, insert as Te, replaceAll as ce, getMarkdown as xe } from "@milkdown/kit/utils";
|
|
3
3
|
import "@milkdown/theme-nord/style.css";
|
|
4
|
-
import { j as
|
|
5
|
-
import { _ as Qe } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { j as Ve, m as ie, k as Pe, h as $e, o as Re, i as Ne, l as Fe, _ as Oe, n as Ke } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-BYUea59a.js";
|
|
5
|
+
import { _ as Qe } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-CHXbJJa_.js";
|
|
6
6
|
import { protectAimdInlineTemplates as je, restoreAimdInlineTemplates as We } from "@airalogy/aimd-core";
|
|
7
7
|
import { parseAndExtract as Ge } from "@airalogy/aimd-renderer";
|
|
8
8
|
import { insertTableCommand as Je } from "@milkdown/kit/preset/gfm";
|
|
9
|
-
const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze = { class: "aimd-dialog-title" }, el = ["innerHTML"], ll = { class: "aimd-dialog-type-tabs" }, sl = ["onClick"], tl = ["innerHTML"], ol = { class: "aimd-dialog-body" }, al = { class: "aimd-field-row" }, il = { class: "aimd-field-label" }, nl = ["placeholder"], dl = { class: "aimd-field-row" }, rl = { class: "aimd-field-label" }, ul = { class: "aimd-field-hint" }, cl = { class: "aimd-var-type-grid" }, ml = ["onClick"], vl = { class: "aimd-var-type-card-title" }, pl = { class: "aimd-var-type-card-desc" }, gl = { class: "aimd-field-row" }, fl = { class: "aimd-field-label" }, hl = ["placeholder"], yl = { class: "aimd-field-hint" }, bl = { class: "aimd-field-row" }, wl = { class: "aimd-field-label" }, kl = ["placeholder"], _l = { class: "aimd-field-row" }, Ml = { class: "aimd-field-label" }, Tl = ["placeholder"], Cl = { class: "aimd-field-row" }, zl = { class: "aimd-field-label" }, Il = ["placeholder"], xl = { class: "aimd-field-row" }, $l = { class: "aimd-field-label" },
|
|
9
|
+
const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze = { class: "aimd-dialog-title" }, el = ["innerHTML"], ll = { class: "aimd-dialog-type-tabs" }, sl = ["onClick"], tl = ["innerHTML"], ol = { class: "aimd-dialog-body" }, al = { class: "aimd-field-row" }, il = { class: "aimd-field-label" }, nl = ["placeholder"], dl = { class: "aimd-field-row" }, rl = { class: "aimd-field-label" }, ul = { class: "aimd-field-hint" }, cl = { class: "aimd-var-type-grid" }, ml = ["onClick"], vl = { class: "aimd-var-type-card-title" }, pl = { class: "aimd-var-type-card-desc" }, gl = { class: "aimd-field-row" }, fl = { class: "aimd-field-label" }, hl = ["placeholder"], yl = { class: "aimd-field-hint" }, bl = { class: "aimd-field-row" }, wl = { class: "aimd-field-label" }, kl = ["placeholder"], _l = { class: "aimd-field-row" }, Ml = { class: "aimd-field-label" }, Tl = ["placeholder"], Cl = { class: "aimd-field-row" }, zl = { class: "aimd-field-label" }, Il = ["placeholder"], xl = { class: "aimd-field-row" }, $l = { class: "aimd-field-label" }, Bl = ["placeholder"], Vl = { class: "aimd-field-hint" }, Al = { class: "aimd-field-row" }, ql = { class: "aimd-field-label" }, Sl = ["placeholder"], El = { class: "aimd-field-row" }, Ul = { class: "aimd-field-label" }, Ll = { value: "1" }, Hl = { value: "2" }, Dl = { value: "3" }, Pl = { class: "aimd-field-row" }, Rl = { class: "aimd-field-label" }, Nl = ["placeholder"], Fl = { class: "aimd-field-row" }, Ol = { class: "aimd-field-label" }, Kl = { value: "choice" }, Ql = { value: "blank" }, jl = { value: "open" }, Wl = { class: "aimd-field-row" }, Gl = { class: "aimd-field-label" }, Jl = ["placeholder"], Xl = { class: "aimd-field-row" }, Yl = { class: "aimd-field-label" }, Zl = ["placeholder"], es = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "aimd-field-hint"
|
|
12
12
|
}, ls = { class: "aimd-field-row" }, ss = { class: "aimd-field-label" }, ts = { value: "single" }, os = { value: "multiple" }, as = { class: "aimd-field-row" }, is = { class: "aimd-field-label" }, ns = { class: "aimd-collection-editor" }, ds = ["onDragover", "onDrop"], rs = ["title", "onDragstart"], us = ["onUpdate:modelValue", "placeholder"], cs = ["onUpdate:modelValue", "placeholder"], ms = { class: "aimd-option-answer-toggle" }, vs = ["value", "disabled"], ps = ["value", "disabled"], gs = ["disabled", "onClick"], fs = { class: "aimd-field-hint" }, hs = {
|
|
@@ -18,13 +18,13 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
18
18
|
}, Cs = { class: "aimd-field-label" }, zs = ["placeholder"], Is = {
|
|
19
19
|
key: 4,
|
|
20
20
|
class: "aimd-field-row"
|
|
21
|
-
}, xs = { class: "aimd-field-label" }, $s = ["placeholder"],
|
|
21
|
+
}, xs = { class: "aimd-field-label" }, $s = ["placeholder"], Bs = {
|
|
22
22
|
key: 5,
|
|
23
23
|
class: "aimd-field-row"
|
|
24
|
-
},
|
|
24
|
+
}, Vs = { class: "aimd-field-label" }, As = ["placeholder"], qs = { id: "aimd-ref-suggestions" }, Ss = ["value"], Es = {
|
|
25
25
|
key: 0,
|
|
26
26
|
class: "aimd-field-hint"
|
|
27
|
-
},
|
|
27
|
+
}, Us = {
|
|
28
28
|
key: 6,
|
|
29
29
|
class: "aimd-field-row"
|
|
30
30
|
}, Ls = { class: "aimd-field-label" }, Hs = ["placeholder"], Ds = { class: "aimd-field-hint" }, Ps = { class: "aimd-dialog-preview" }, Rs = { class: "aimd-preview-header" }, Ns = { class: "aimd-preview-panel" }, Fs = { class: "aimd-preview-code" }, Os = {
|
|
@@ -42,18 +42,18 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
42
42
|
existingQuizIds: {}
|
|
43
43
|
},
|
|
44
44
|
emits: ["update:visible", "insert"],
|
|
45
|
-
setup(
|
|
46
|
-
const o =
|
|
47
|
-
const a =
|
|
45
|
+
setup(c, { emit: F }) {
|
|
46
|
+
const o = c, M = F, w = $(() => {
|
|
47
|
+
const a = Ve(o.messages);
|
|
48
48
|
if (!o.allowedTypes || o.allowedTypes.length === 0)
|
|
49
49
|
return a;
|
|
50
50
|
const s = new Set(o.allowedTypes);
|
|
51
51
|
return a.filter((e) => s.has(e.type));
|
|
52
52
|
});
|
|
53
|
-
function
|
|
53
|
+
function f(a) {
|
|
54
54
|
return a && w.value.some((s) => s.type === a) ? a : w.value[0]?.type ?? a ?? "var";
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const p = $(() => new Set(o.existingQuizIds || [])), d = B(f(o.initialType)), t = B(ie(d.value, o.messages, p.value)), C = B([]), V = B([]), h = B([]), T = B(null), U = B(null), k = B(""), G = $(
|
|
57
57
|
() => Pe(o.messages, o.varTypePlugins ?? [])
|
|
58
58
|
);
|
|
59
59
|
function D(a) {
|
|
@@ -67,23 +67,23 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
67
67
|
}
|
|
68
68
|
function Y(a, s) {
|
|
69
69
|
const e = `quiz_${a}`;
|
|
70
|
-
let
|
|
71
|
-
for (; s.has(`${e}_${
|
|
72
|
-
|
|
73
|
-
return `${e}_${
|
|
70
|
+
let g = 1;
|
|
71
|
+
for (; s.has(`${e}_${g}`); )
|
|
72
|
+
g += 1;
|
|
73
|
+
return `${e}_${g}`;
|
|
74
74
|
}
|
|
75
75
|
function Z(a) {
|
|
76
76
|
const s = a.split(",").map((e) => e.trim()).filter(Boolean);
|
|
77
77
|
return s.length === 0 ? [
|
|
78
78
|
{ key: "A", text: "" },
|
|
79
79
|
{ key: "B", text: "" }
|
|
80
|
-
] : s.map((e,
|
|
80
|
+
] : s.map((e, g) => {
|
|
81
81
|
const y = e.indexOf(":");
|
|
82
82
|
if (y > 0) {
|
|
83
|
-
const Q = e.slice(0, y).trim() || String.fromCharCode(65 +
|
|
83
|
+
const Q = e.slice(0, y).trim() || String.fromCharCode(65 + g), re = e.slice(y + 1).trim() || o.messages.defaults.optionText(Q);
|
|
84
84
|
return { key: Q, text: re };
|
|
85
85
|
}
|
|
86
|
-
return { key: String.fromCharCode(65 +
|
|
86
|
+
return { key: String.fromCharCode(65 + g), text: e };
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function ee(a) {
|
|
@@ -92,29 +92,29 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
92
92
|
}
|
|
93
93
|
function le(a) {
|
|
94
94
|
const s = a.split(",").map((e) => e.trim()).filter(Boolean);
|
|
95
|
-
return s.length === 0 ? [{ key: "b1", answer: "" }] : s.map((e,
|
|
95
|
+
return s.length === 0 ? [{ key: "b1", answer: "" }] : s.map((e, g) => {
|
|
96
96
|
const y = e.indexOf(":");
|
|
97
97
|
if (y > 0) {
|
|
98
|
-
const oe = e.slice(0, y).trim() || `b${
|
|
98
|
+
const oe = e.slice(0, y).trim() || `b${g + 1}`, Q = e.slice(y + 1).trim() || "";
|
|
99
99
|
return { key: oe, answer: Q };
|
|
100
100
|
}
|
|
101
|
-
return { key: `b${
|
|
101
|
+
return { key: `b${g + 1}`, answer: e };
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function A(a) {
|
|
105
105
|
const s = a.map((e) => ({ key: e.key.trim(), answer: e.answer.trim() })).filter((e) => e.key);
|
|
106
106
|
return s.length === 0 ? "b1:" : s.map((e) => `${e.key}:${e.answer}`).join(", ");
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function S(a) {
|
|
109
109
|
return a.split(",").map((s) => s.trim()).filter(Boolean);
|
|
110
110
|
}
|
|
111
111
|
function L() {
|
|
112
|
-
d.value === "quiz" && (t.value.quizType === "choice" ? (
|
|
112
|
+
d.value === "quiz" && (t.value.quizType === "choice" ? (C.value = Z(t.value.options || ""), h.value = S(t.value.answer || "")) : t.value.quizType === "blank" && (V.value = le(t.value.blanks || "")));
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function O() {
|
|
115
115
|
if (d.value !== "quiz" || t.value.quizType !== "choice") return;
|
|
116
116
|
const a = new Set(
|
|
117
|
-
|
|
117
|
+
C.value.map((s) => s.key.trim()).filter(Boolean)
|
|
118
118
|
);
|
|
119
119
|
if (t.value.mode === "multiple") {
|
|
120
120
|
const s = h.value.map((e) => e.trim()).filter((e) => e && a.has(e));
|
|
@@ -126,38 +126,38 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
126
126
|
}
|
|
127
127
|
function se() {
|
|
128
128
|
const a = new Set(
|
|
129
|
-
|
|
129
|
+
C.value.map((s) => s.key.trim().toUpperCase()).filter(Boolean)
|
|
130
130
|
);
|
|
131
131
|
for (let s = 0; s < 26; s++) {
|
|
132
132
|
const e = String.fromCharCode(65 + s);
|
|
133
133
|
if (!a.has(e)) return e;
|
|
134
134
|
}
|
|
135
|
-
return `K${
|
|
135
|
+
return `K${C.value.length + 1}`;
|
|
136
136
|
}
|
|
137
137
|
function n() {
|
|
138
138
|
const a = se();
|
|
139
|
-
|
|
139
|
+
C.value.push({ key: a, text: "" });
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
141
|
+
function m(a) {
|
|
142
|
+
C.value.length <= 1 || C.value.splice(a, 1);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
144
|
+
function I(a) {
|
|
145
|
+
T.value = a, U.value = a;
|
|
146
146
|
}
|
|
147
147
|
function P(a) {
|
|
148
|
-
|
|
148
|
+
T.value !== null && (U.value = a);
|
|
149
149
|
}
|
|
150
150
|
function H(a) {
|
|
151
|
-
const s =
|
|
151
|
+
const s = T.value;
|
|
152
152
|
if (s === null || s === a) {
|
|
153
|
-
|
|
153
|
+
T.value = null, U.value = null;
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const e =
|
|
157
|
-
|
|
156
|
+
const e = C.value.splice(s, 1)[0];
|
|
157
|
+
C.value.splice(a, 0, e), T.value = null, U.value = null;
|
|
158
158
|
}
|
|
159
159
|
function R() {
|
|
160
|
-
|
|
160
|
+
T.value = null, U.value = null;
|
|
161
161
|
}
|
|
162
162
|
function ne() {
|
|
163
163
|
const a = new Set(
|
|
@@ -176,109 +176,109 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
176
176
|
}
|
|
177
177
|
function de(a) {
|
|
178
178
|
const s = /* @__PURE__ */ new Set(), e = [];
|
|
179
|
-
for (const
|
|
180
|
-
s.has(
|
|
179
|
+
for (const g of a)
|
|
180
|
+
s.has(g) && !e.includes(g) && e.push(g), s.add(g);
|
|
181
181
|
return e;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function ge(a) {
|
|
184
184
|
const s = [], e = /\[\[([^\[\]\s]+)\]\]/g;
|
|
185
|
-
for (const
|
|
186
|
-
s.push(
|
|
185
|
+
for (const g of a.matchAll(e))
|
|
186
|
+
s.push(g[1]);
|
|
187
187
|
return s;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function fe() {
|
|
190
190
|
const a = V.value.map((ae) => ae.key.trim()).filter(Boolean);
|
|
191
191
|
if (a.length === 0)
|
|
192
192
|
return o.messages.errors.blankQuizRequiresBlankKey;
|
|
193
193
|
const s = de(a);
|
|
194
194
|
if (s.length > 0)
|
|
195
195
|
return o.messages.errors.blankKeysMustBeUnique(s);
|
|
196
|
-
const e = t.value.stem || "",
|
|
197
|
-
if (
|
|
196
|
+
const e = t.value.stem || "", g = ge(e);
|
|
197
|
+
if (g.length === 0)
|
|
198
198
|
return o.messages.errors.blankStemRequiresPlaceholders;
|
|
199
|
-
const y = de(
|
|
199
|
+
const y = de(g);
|
|
200
200
|
if (y.length > 0)
|
|
201
201
|
return o.messages.errors.duplicatePlaceholders(y);
|
|
202
|
-
const oe = new Set(a), Q = new Set(
|
|
202
|
+
const oe = new Set(a), Q = new Set(g), re = [...Q].filter((ae) => !oe.has(ae));
|
|
203
203
|
if (re.length > 0)
|
|
204
204
|
return o.messages.errors.undefinedPlaceholders(re);
|
|
205
|
-
const
|
|
206
|
-
return
|
|
205
|
+
const Ce = [...oe].filter((ae) => !Q.has(ae));
|
|
206
|
+
return Ce.length > 0 ? o.messages.errors.missingPlaceholders(Ce) : null;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
return d.value !== "quiz" || t.value.quizType !== "blank" ? null :
|
|
208
|
+
function r() {
|
|
209
|
+
return d.value !== "quiz" || t.value.quizType !== "blank" ? null : fe();
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
const s =
|
|
213
|
-
d.value = s, t.value = ie(s, o.messages,
|
|
214
|
-
}),
|
|
215
|
-
const a =
|
|
216
|
-
a !== d.value && (d.value = a, t.value = ie(a, o.messages,
|
|
217
|
-
}),
|
|
218
|
-
a && (t.value = ie(d.value, o.messages,
|
|
211
|
+
E(() => o.initialType, (a) => {
|
|
212
|
+
const s = f(a);
|
|
213
|
+
d.value = s, t.value = ie(s, o.messages, p.value), L(), k.value = "";
|
|
214
|
+
}), E(w, () => {
|
|
215
|
+
const a = f(d.value);
|
|
216
|
+
a !== d.value && (d.value = a, t.value = ie(a, o.messages, p.value), L(), k.value = "");
|
|
217
|
+
}), E(() => o.visible, (a) => {
|
|
218
|
+
a && (t.value = ie(d.value, o.messages, p.value), L(), k.value = "");
|
|
219
219
|
});
|
|
220
|
-
function
|
|
221
|
-
const s =
|
|
222
|
-
d.value = s, t.value = ie(s, o.messages,
|
|
220
|
+
function _(a) {
|
|
221
|
+
const s = f(a);
|
|
222
|
+
d.value = s, t.value = ie(s, o.messages, p.value), L(), k.value = "";
|
|
223
223
|
}
|
|
224
|
-
const
|
|
224
|
+
const he = $(() => $e(d.value, t.value, o.messages));
|
|
225
225
|
function Ae(a) {
|
|
226
226
|
return w.value.find((s) => s.type === a) || { type: a, label: a, icon: "?", svgIcon: "", desc: "", color: "#666" };
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
a === "quiz" && (a !== e || s !==
|
|
231
|
-
}),
|
|
232
|
-
|
|
233
|
-
}),
|
|
234
|
-
d.value === "quiz" && t.value.quizType === "choice" && (t.value.options = ee(a),
|
|
235
|
-
}, { deep: !0 }),
|
|
236
|
-
d.value === "quiz" && t.value.quizType === "blank" && (t.value.blanks =
|
|
237
|
-
}, { deep: !0 }),
|
|
228
|
+
const ye = $(() => Ae(d.value)), be = $(() => o.refSuggestions ? o.refSuggestions : []), qe = $(() => d.value === "ref_step" ? o.messages.dialog.referencedStepId : d.value === "ref_var" ? o.messages.dialog.referencedVariableId : o.messages.dialog.referencedFigureId), Se = $(() => d.value === "ref_step" ? "step_id" : d.value === "ref_var" ? "var_id" : "fig_id");
|
|
229
|
+
E(() => [d.value, t.value.quizType], ([a, s], [e, g]) => {
|
|
230
|
+
a === "quiz" && (a !== e || s !== g) && (s !== g && g && (t.value.id = Y(s, p.value), s === "choice" ? (t.value.stem = o.messages.defaults.questionStem, t.value.mode = "single", t.value.options = "A:, B:", t.value.answer = "A", t.value.blanks = "", t.value.rubric = "") : s === "blank" ? (t.value.stem = o.messages.defaults.fillQuestionStem, t.value.blanks = "b1:", t.value.options = "", t.value.answer = "", t.value.mode = "", t.value.rubric = "", V.value = [{ key: "b1", answer: "" }]) : s === "open" && (t.value.stem = o.messages.defaults.fillQuestionStem, t.value.rubric = "", t.value.options = "", t.value.answer = "", t.value.blanks = "", t.value.mode = "")), L());
|
|
231
|
+
}), E(() => t.value.mode, () => {
|
|
232
|
+
O();
|
|
233
|
+
}), E(C, (a) => {
|
|
234
|
+
d.value === "quiz" && t.value.quizType === "choice" && (t.value.options = ee(a), O());
|
|
235
|
+
}, { deep: !0 }), E(V, (a) => {
|
|
236
|
+
d.value === "quiz" && t.value.quizType === "blank" && (t.value.blanks = A(a));
|
|
237
|
+
}, { deep: !0 }), E(h, (a) => {
|
|
238
238
|
d.value === "quiz" && t.value.quizType === "choice" && t.value.mode === "multiple" && (t.value.answer = a.join(", "));
|
|
239
|
-
}, { deep: !0 }),
|
|
239
|
+
}, { deep: !0 }), E(t, () => {
|
|
240
240
|
k.value && (k.value = "");
|
|
241
|
-
}, { deep: !0 }),
|
|
241
|
+
}, { deep: !0 }), E(V, () => {
|
|
242
242
|
k.value && (k.value = "");
|
|
243
243
|
}, { deep: !0 });
|
|
244
|
-
function
|
|
245
|
-
const a =
|
|
244
|
+
function Ee() {
|
|
245
|
+
const a = r();
|
|
246
246
|
if (a) {
|
|
247
247
|
k.value = a;
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
k.value = "", M("insert",
|
|
250
|
+
k.value = "", M("insert", $e(d.value, t.value, o.messages)), M("update:visible", !1);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function we() {
|
|
253
253
|
M("update:visible", !1);
|
|
254
254
|
}
|
|
255
|
-
return (a, s) => (
|
|
256
|
-
|
|
255
|
+
return (a, s) => (u(), Be(Ue, { to: "body" }, [
|
|
256
|
+
c.visible ? (u(), v("div", {
|
|
257
257
|
key: 0,
|
|
258
258
|
class: "aimd-dialog-overlay",
|
|
259
|
-
onClick: ue(
|
|
259
|
+
onClick: ue(we, ["self"])
|
|
260
260
|
}, [
|
|
261
261
|
l("div", Xe, [
|
|
262
262
|
l("div", Ye, [
|
|
263
263
|
l("span", Ze, [
|
|
264
264
|
l("span", {
|
|
265
265
|
class: "aimd-dialog-icon",
|
|
266
|
-
style: me({ color:
|
|
267
|
-
innerHTML:
|
|
266
|
+
style: me({ color: ye.value.color }),
|
|
267
|
+
innerHTML: ye.value.svgIcon
|
|
268
268
|
}, null, 12, el),
|
|
269
|
-
N(" " + i(o.messages.dialog.title(
|
|
269
|
+
N(" " + i(o.messages.dialog.title(ye.value.label)), 1)
|
|
270
270
|
]),
|
|
271
271
|
l("button", {
|
|
272
272
|
class: "aimd-dialog-close",
|
|
273
|
-
onClick:
|
|
273
|
+
onClick: we
|
|
274
274
|
}, "×")
|
|
275
275
|
]),
|
|
276
276
|
l("div", ll, [
|
|
277
|
-
(
|
|
277
|
+
(u(!0), v(q, null, j(w.value, (e) => (u(), v("button", {
|
|
278
278
|
key: e.type,
|
|
279
279
|
class: W(["aimd-type-tab", { active: d.value === e.type }]),
|
|
280
280
|
style: me(d.value === e.type ? { borderColor: e.color, color: e.color, background: `${e.color}14` } : {}),
|
|
281
|
-
onClick: (
|
|
281
|
+
onClick: (g) => _(e.type)
|
|
282
282
|
}, [
|
|
283
283
|
l("span", {
|
|
284
284
|
innerHTML: e.svgIcon,
|
|
@@ -288,7 +288,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
288
288
|
], 14, sl))), 128))
|
|
289
289
|
]),
|
|
290
290
|
l("div", ol, [
|
|
291
|
-
d.value === "var" ? (
|
|
291
|
+
d.value === "var" ? (u(), v(q, { key: 0 }, [
|
|
292
292
|
l("label", al, [
|
|
293
293
|
l("span", il, [
|
|
294
294
|
N(i(o.messages.dialog.variableId) + " ", 1),
|
|
@@ -299,18 +299,18 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
299
299
|
placeholder: o.messages.placeholders.variableId,
|
|
300
300
|
class: "aimd-field-input"
|
|
301
301
|
}, null, 8, nl), [
|
|
302
|
-
[
|
|
302
|
+
[x, t.value.name]
|
|
303
303
|
])
|
|
304
304
|
]),
|
|
305
305
|
l("div", dl, [
|
|
306
306
|
l("span", rl, i(o.messages.dialog.typePresetLabel), 1),
|
|
307
307
|
l("span", ul, i(o.messages.dialog.typeHint), 1),
|
|
308
308
|
l("div", cl, [
|
|
309
|
-
(
|
|
309
|
+
(u(!0), v(q, null, j(G.value, (e) => (u(), v("button", {
|
|
310
310
|
key: e.key,
|
|
311
311
|
type: "button",
|
|
312
312
|
class: W(["aimd-var-type-card", { active: J(e.value) }]),
|
|
313
|
-
onClick: (
|
|
313
|
+
onClick: (g) => X(e.value)
|
|
314
314
|
}, [
|
|
315
315
|
l("span", vl, i(e.label), 1),
|
|
316
316
|
l("span", pl, i(e.desc), 1)
|
|
@@ -324,7 +324,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
324
324
|
placeholder: o.messages.placeholders.type,
|
|
325
325
|
class: "aimd-field-input"
|
|
326
326
|
}, null, 8, hl), [
|
|
327
|
-
[
|
|
327
|
+
[x, t.value.type]
|
|
328
328
|
]),
|
|
329
329
|
l("span", yl, i(o.messages.dialog.customTypeHint), 1)
|
|
330
330
|
]),
|
|
@@ -335,7 +335,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
335
335
|
placeholder: o.messages.placeholders.defaultValue,
|
|
336
336
|
class: "aimd-field-input"
|
|
337
337
|
}, null, 8, kl), [
|
|
338
|
-
[
|
|
338
|
+
[x, t.value.default]
|
|
339
339
|
])
|
|
340
340
|
]),
|
|
341
341
|
l("label", _l, [
|
|
@@ -345,11 +345,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
345
345
|
placeholder: o.messages.placeholders.title,
|
|
346
346
|
class: "aimd-field-input"
|
|
347
347
|
}, null, 8, Tl), [
|
|
348
|
-
[
|
|
348
|
+
[x, t.value.title]
|
|
349
349
|
])
|
|
350
350
|
])
|
|
351
|
-
], 64)) :
|
|
352
|
-
d.value === "var_table" ? (
|
|
351
|
+
], 64)) : z("", !0),
|
|
352
|
+
d.value === "var_table" ? (u(), v(q, { key: 1 }, [
|
|
353
353
|
l("label", Cl, [
|
|
354
354
|
l("span", zl, [
|
|
355
355
|
N(i(o.messages.dialog.tableId) + " ", 1),
|
|
@@ -360,7 +360,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
360
360
|
placeholder: o.messages.placeholders.tableId,
|
|
361
361
|
class: "aimd-field-input"
|
|
362
362
|
}, null, 8, Il), [
|
|
363
|
-
[
|
|
363
|
+
[x, t.value.name]
|
|
364
364
|
])
|
|
365
365
|
]),
|
|
366
366
|
l("label", xl, [
|
|
@@ -369,13 +369,13 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
369
369
|
"onUpdate:modelValue": s[5] || (s[5] = (e) => t.value.subvars = e),
|
|
370
370
|
placeholder: o.messages.placeholders.subVariableColumns,
|
|
371
371
|
class: "aimd-field-input"
|
|
372
|
-
}, null, 8,
|
|
373
|
-
[
|
|
372
|
+
}, null, 8, Bl), [
|
|
373
|
+
[x, t.value.subvars]
|
|
374
374
|
]),
|
|
375
|
-
l("span",
|
|
375
|
+
l("span", Vl, i(o.messages.dialog.subVariableColumnsHint), 1)
|
|
376
376
|
])
|
|
377
|
-
], 64)) :
|
|
378
|
-
d.value === "step" ? (
|
|
377
|
+
], 64)) : z("", !0),
|
|
378
|
+
d.value === "step" ? (u(), v(q, { key: 2 }, [
|
|
379
379
|
l("label", Al, [
|
|
380
380
|
l("span", ql, [
|
|
381
381
|
N(i(o.messages.dialog.stepId) + " ", 1),
|
|
@@ -386,11 +386,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
386
386
|
placeholder: o.messages.placeholders.stepId,
|
|
387
387
|
class: "aimd-field-input"
|
|
388
388
|
}, null, 8, Sl), [
|
|
389
|
-
[
|
|
389
|
+
[x, t.value.name]
|
|
390
390
|
])
|
|
391
391
|
]),
|
|
392
|
-
l("label",
|
|
393
|
-
l("span",
|
|
392
|
+
l("label", El, [
|
|
393
|
+
l("span", Ul, i(o.messages.dialog.level), 1),
|
|
394
394
|
b(l("select", {
|
|
395
395
|
"onUpdate:modelValue": s[7] || (s[7] = (e) => t.value.level = e),
|
|
396
396
|
class: "aimd-field-input"
|
|
@@ -399,11 +399,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
399
399
|
l("option", Hl, i(o.messages.dialog.level2), 1),
|
|
400
400
|
l("option", Dl, i(o.messages.dialog.level3), 1)
|
|
401
401
|
], 512), [
|
|
402
|
-
[
|
|
402
|
+
[ke, t.value.level]
|
|
403
403
|
])
|
|
404
404
|
])
|
|
405
|
-
], 64)) :
|
|
406
|
-
d.value === "quiz" ? (
|
|
405
|
+
], 64)) : z("", !0),
|
|
406
|
+
d.value === "quiz" ? (u(), v(q, { key: 3 }, [
|
|
407
407
|
l("label", Pl, [
|
|
408
408
|
l("span", Rl, [
|
|
409
409
|
N(i(o.messages.dialog.quizId) + " ", 1),
|
|
@@ -414,7 +414,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
414
414
|
placeholder: o.messages.placeholders.quizId,
|
|
415
415
|
class: "aimd-field-input"
|
|
416
416
|
}, null, 8, Nl), [
|
|
417
|
-
[
|
|
417
|
+
[x, t.value.id]
|
|
418
418
|
])
|
|
419
419
|
]),
|
|
420
420
|
l("label", Fl, [
|
|
@@ -427,7 +427,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
427
427
|
l("option", Ql, i(o.messages.quiz.types.blank), 1),
|
|
428
428
|
l("option", jl, i(o.messages.quiz.types.open), 1)
|
|
429
429
|
], 512), [
|
|
430
|
-
[
|
|
430
|
+
[ke, t.value.quizType]
|
|
431
431
|
])
|
|
432
432
|
]),
|
|
433
433
|
l("label", Wl, [
|
|
@@ -437,7 +437,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
437
437
|
placeholder: o.messages.placeholders.score,
|
|
438
438
|
class: "aimd-field-input"
|
|
439
439
|
}, null, 8, Jl), [
|
|
440
|
-
[
|
|
440
|
+
[x, t.value.score]
|
|
441
441
|
])
|
|
442
442
|
]),
|
|
443
443
|
l("label", Xl, [
|
|
@@ -450,11 +450,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
450
450
|
placeholder: o.messages.placeholders.stem,
|
|
451
451
|
class: "aimd-field-input aimd-field-textarea"
|
|
452
452
|
}, null, 8, Zl), [
|
|
453
|
-
[
|
|
453
|
+
[x, t.value.stem]
|
|
454
454
|
]),
|
|
455
|
-
t.value.quizType === "blank" ? (
|
|
455
|
+
t.value.quizType === "blank" ? (u(), v("span", es, i(o.messages.dialog.blankStemHint), 1)) : z("", !0)
|
|
456
456
|
]),
|
|
457
|
-
t.value.quizType === "choice" ? (
|
|
457
|
+
t.value.quizType === "choice" ? (u(), v(q, { key: 0 }, [
|
|
458
458
|
l("label", ls, [
|
|
459
459
|
l("span", ss, i(o.messages.dialog.mode), 1),
|
|
460
460
|
b(l("select", {
|
|
@@ -464,23 +464,23 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
464
464
|
l("option", ts, i(o.messages.quiz.modes.single), 1),
|
|
465
465
|
l("option", os, i(o.messages.quiz.modes.multiple), 1)
|
|
466
466
|
], 512), [
|
|
467
|
-
[
|
|
467
|
+
[ke, t.value.mode]
|
|
468
468
|
])
|
|
469
469
|
]),
|
|
470
470
|
l("div", as, [
|
|
471
471
|
l("span", is, i(o.messages.dialog.options), 1),
|
|
472
472
|
l("div", ns, [
|
|
473
|
-
(
|
|
474
|
-
key: `choice-option-${
|
|
475
|
-
class: W(["aimd-collection-row aimd-option-row", { "aimd-option-row-dragover":
|
|
476
|
-
onDragover: ue((y) => P(
|
|
477
|
-
onDrop: ue((y) => H(
|
|
473
|
+
(u(!0), v(q, null, j(C.value, (e, g) => (u(), v("div", {
|
|
474
|
+
key: `choice-option-${g}`,
|
|
475
|
+
class: W(["aimd-collection-row aimd-option-row", { "aimd-option-row-dragover": U.value === g && T.value !== null && T.value !== g }]),
|
|
476
|
+
onDragover: ue((y) => P(g), ["prevent"]),
|
|
477
|
+
onDrop: ue((y) => H(g), ["prevent"])
|
|
478
478
|
}, [
|
|
479
479
|
l("span", {
|
|
480
480
|
class: "aimd-drag-handle",
|
|
481
481
|
title: o.messages.dialog.dragToReorder,
|
|
482
482
|
draggable: "true",
|
|
483
|
-
onDragstart: (y) =>
|
|
483
|
+
onDragstart: (y) => I(g),
|
|
484
484
|
onDragend: R
|
|
485
485
|
}, " ⋮⋮ ", 40, rs),
|
|
486
486
|
b(l("input", {
|
|
@@ -488,17 +488,17 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
488
488
|
placeholder: o.messages.placeholders.optionKey,
|
|
489
489
|
class: "aimd-field-input"
|
|
490
490
|
}, null, 8, us), [
|
|
491
|
-
[
|
|
491
|
+
[x, e.key]
|
|
492
492
|
]),
|
|
493
493
|
b(l("input", {
|
|
494
494
|
"onUpdate:modelValue": (y) => e.text = y,
|
|
495
495
|
placeholder: o.messages.placeholders.optionText,
|
|
496
496
|
class: "aimd-field-input"
|
|
497
497
|
}, null, 8, cs), [
|
|
498
|
-
[
|
|
498
|
+
[x, e.text]
|
|
499
499
|
]),
|
|
500
500
|
l("label", ms, [
|
|
501
|
-
t.value.mode === "single" ? b((
|
|
501
|
+
t.value.mode === "single" ? b((u(), v("input", {
|
|
502
502
|
key: 0,
|
|
503
503
|
"onUpdate:modelValue": s[13] || (s[13] = (y) => t.value.answer = y),
|
|
504
504
|
type: "radio",
|
|
@@ -507,7 +507,7 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
507
507
|
disabled: !e.key.trim()
|
|
508
508
|
}, null, 8, vs)), [
|
|
509
509
|
[Le, t.value.answer]
|
|
510
|
-
]) : b((
|
|
510
|
+
]) : b((u(), v("input", {
|
|
511
511
|
key: 1,
|
|
512
512
|
"onUpdate:modelValue": s[14] || (s[14] = (y) => h.value = y),
|
|
513
513
|
type: "checkbox",
|
|
@@ -521,8 +521,8 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
521
521
|
l("button", {
|
|
522
522
|
type: "button",
|
|
523
523
|
class: "aimd-mini-btn",
|
|
524
|
-
disabled:
|
|
525
|
-
onClick: (y) =>
|
|
524
|
+
disabled: C.value.length <= 1,
|
|
525
|
+
onClick: (y) => m(g)
|
|
526
526
|
}, i(o.messages.common.remove), 9, gs)
|
|
527
527
|
], 42, ds))), 128)),
|
|
528
528
|
l("button", {
|
|
@@ -533,11 +533,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
533
533
|
]),
|
|
534
534
|
l("span", fs, i(o.messages.dialog.optionsHint), 1)
|
|
535
535
|
])
|
|
536
|
-
], 64)) : t.value.quizType === "blank" ? (
|
|
536
|
+
], 64)) : t.value.quizType === "blank" ? (u(), v("div", hs, [
|
|
537
537
|
l("span", ys, i(o.messages.dialog.blanks), 1),
|
|
538
538
|
l("div", bs, [
|
|
539
|
-
(
|
|
540
|
-
key: `blank-item-${
|
|
539
|
+
(u(!0), v(q, null, j(V.value, (e, g) => (u(), v("div", {
|
|
540
|
+
key: `blank-item-${g}`,
|
|
541
541
|
class: "aimd-collection-row"
|
|
542
542
|
}, [
|
|
543
543
|
b(l("input", {
|
|
@@ -545,20 +545,20 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
545
545
|
placeholder: o.messages.placeholders.blankKey,
|
|
546
546
|
class: "aimd-field-input"
|
|
547
547
|
}, null, 8, ws), [
|
|
548
|
-
[
|
|
548
|
+
[x, e.key]
|
|
549
549
|
]),
|
|
550
550
|
b(l("input", {
|
|
551
551
|
"onUpdate:modelValue": (y) => e.answer = y,
|
|
552
552
|
placeholder: o.messages.placeholders.blankAnswer,
|
|
553
553
|
class: "aimd-field-input"
|
|
554
554
|
}, null, 8, ks), [
|
|
555
|
-
[
|
|
555
|
+
[x, e.answer]
|
|
556
556
|
]),
|
|
557
557
|
l("button", {
|
|
558
558
|
type: "button",
|
|
559
559
|
class: "aimd-mini-btn",
|
|
560
560
|
disabled: V.value.length <= 1,
|
|
561
|
-
onClick: (y) => pe(
|
|
561
|
+
onClick: (y) => pe(g)
|
|
562
562
|
}, i(o.messages.common.remove), 9, _s)
|
|
563
563
|
]))), 128)),
|
|
564
564
|
l("button", {
|
|
@@ -568,18 +568,18 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
568
568
|
}, i(o.messages.actions.addBlank), 1)
|
|
569
569
|
]),
|
|
570
570
|
l("span", Ms, i(o.messages.dialog.blanksHint), 1)
|
|
571
|
-
])) : (
|
|
571
|
+
])) : (u(), v("label", Ts, [
|
|
572
572
|
l("span", Cs, i(o.messages.dialog.rubric), 1),
|
|
573
573
|
b(l("textarea", {
|
|
574
574
|
"onUpdate:modelValue": s[15] || (s[15] = (e) => t.value.rubric = e),
|
|
575
575
|
placeholder: o.messages.placeholders.rubric,
|
|
576
576
|
class: "aimd-field-input aimd-field-textarea"
|
|
577
577
|
}, null, 8, zs), [
|
|
578
|
-
[
|
|
578
|
+
[x, t.value.rubric]
|
|
579
579
|
])
|
|
580
580
|
]))
|
|
581
|
-
], 64)) :
|
|
582
|
-
d.value === "check" ? (
|
|
581
|
+
], 64)) : z("", !0),
|
|
582
|
+
d.value === "check" ? (u(), v("label", Is, [
|
|
583
583
|
l("span", xs, [
|
|
584
584
|
N(i(o.messages.dialog.checkpointId) + " ", 1),
|
|
585
585
|
s[24] || (s[24] = l("em", null, "*", -1))
|
|
@@ -589,11 +589,11 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
589
589
|
placeholder: o.messages.placeholders.checkpointId,
|
|
590
590
|
class: "aimd-field-input"
|
|
591
591
|
}, null, 8, $s), [
|
|
592
|
-
[
|
|
592
|
+
[x, t.value.name]
|
|
593
593
|
])
|
|
594
|
-
])) :
|
|
595
|
-
["ref_step", "ref_var", "ref_fig"].includes(d.value) ? (
|
|
596
|
-
l("span",
|
|
594
|
+
])) : z("", !0),
|
|
595
|
+
["ref_step", "ref_var", "ref_fig"].includes(d.value) ? (u(), v("label", Bs, [
|
|
596
|
+
l("span", Vs, [
|
|
597
597
|
N(i(qe.value) + " ", 1),
|
|
598
598
|
s[25] || (s[25] = l("em", null, "*", -1))
|
|
599
599
|
]),
|
|
@@ -603,17 +603,17 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
603
603
|
class: "aimd-field-input",
|
|
604
604
|
list: "aimd-ref-suggestions"
|
|
605
605
|
}, null, 8, As), [
|
|
606
|
-
[
|
|
606
|
+
[x, t.value.name]
|
|
607
607
|
]),
|
|
608
608
|
l("datalist", qs, [
|
|
609
|
-
(
|
|
609
|
+
(u(!0), v(q, null, j(be.value, (e) => (u(), v("option", {
|
|
610
610
|
key: e,
|
|
611
611
|
value: e
|
|
612
612
|
}, null, 8, Ss))), 128))
|
|
613
613
|
]),
|
|
614
|
-
|
|
615
|
-
])) :
|
|
616
|
-
d.value === "cite" ? (
|
|
614
|
+
be.value.length ? (u(), v("span", Es, i(o.messages.common.available) + ": " + i(be.value.join(", ")), 1)) : z("", !0)
|
|
615
|
+
])) : z("", !0),
|
|
616
|
+
d.value === "cite" ? (u(), v("label", Us, [
|
|
617
617
|
l("span", Ls, [
|
|
618
618
|
N(i(o.messages.dialog.citationId) + " ", 1),
|
|
619
619
|
s[26] || (s[26] = l("em", null, "*", -1))
|
|
@@ -623,30 +623,30 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
623
623
|
placeholder: o.messages.placeholders.citationIds,
|
|
624
624
|
class: "aimd-field-input"
|
|
625
625
|
}, null, 8, Hs), [
|
|
626
|
-
[
|
|
626
|
+
[x, t.value.refs]
|
|
627
627
|
]),
|
|
628
628
|
l("span", Ds, i(o.messages.dialog.citationHint), 1)
|
|
629
|
-
])) :
|
|
629
|
+
])) : z("", !0),
|
|
630
630
|
l("div", Ps, [
|
|
631
631
|
l("div", Rs, i(o.messages.common.preview), 1),
|
|
632
632
|
l("pre", Ns, [
|
|
633
|
-
l("code", Fs, i(
|
|
633
|
+
l("code", Fs, i(he.value), 1)
|
|
634
634
|
])
|
|
635
635
|
]),
|
|
636
|
-
k.value ? (
|
|
636
|
+
k.value ? (u(), v("div", Os, i(k.value), 1)) : z("", !0)
|
|
637
637
|
]),
|
|
638
638
|
l("div", Ks, [
|
|
639
639
|
l("button", {
|
|
640
640
|
class: "aimd-btn aimd-btn-cancel",
|
|
641
|
-
onClick:
|
|
641
|
+
onClick: we
|
|
642
642
|
}, i(o.messages.common.cancel), 1),
|
|
643
643
|
l("button", {
|
|
644
644
|
class: "aimd-btn aimd-btn-primary",
|
|
645
|
-
onClick:
|
|
645
|
+
onClick: Ee
|
|
646
646
|
}, i(o.messages.common.insert), 1)
|
|
647
647
|
])
|
|
648
648
|
])
|
|
649
|
-
])) :
|
|
649
|
+
])) : z("", !0)
|
|
650
650
|
]));
|
|
651
651
|
}
|
|
652
652
|
}), js = { class: "aimd-editor-toolbar" }, Ws = {
|
|
@@ -673,71 +673,71 @@ const Xe = { class: "aimd-dialog" }, Ye = { class: "aimd-dialog-header" }, Ze =
|
|
|
673
673
|
localizedMdToolbarItems: {}
|
|
674
674
|
},
|
|
675
675
|
emits: ["switch-mode", "md-action", "open-aimd-dialog", "quick-insert-aimd"],
|
|
676
|
-
setup(
|
|
676
|
+
setup(c, { emit: F }) {
|
|
677
677
|
const o = F;
|
|
678
|
-
return (M, w) => (
|
|
679
|
-
|
|
678
|
+
return (M, w) => (u(), v("div", js, [
|
|
679
|
+
c.showTopBar ? (u(), v("div", Ws, [
|
|
680
680
|
l("button", {
|
|
681
681
|
type: "button",
|
|
682
|
-
class: W(["aimd-editor-mode-btn", { active:
|
|
683
|
-
onClick: w[0] || (w[0] = (
|
|
684
|
-
title:
|
|
682
|
+
class: W(["aimd-editor-mode-btn", { active: c.editorMode === "source" }]),
|
|
683
|
+
onClick: w[0] || (w[0] = (f) => o("switch-mode", "source")),
|
|
684
|
+
title: c.resolvedMessages.mode.sourceTitle
|
|
685
685
|
}, [
|
|
686
686
|
w[2] || (w[2] = l("span", {
|
|
687
687
|
class: "aimd-editor-mode-icon",
|
|
688
688
|
innerHTML: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>'
|
|
689
689
|
}, null, -1)),
|
|
690
|
-
l("span", null, i(
|
|
690
|
+
l("span", null, i(c.resolvedMessages.mode.source), 1)
|
|
691
691
|
], 10, Gs),
|
|
692
692
|
l("button", {
|
|
693
693
|
type: "button",
|
|
694
|
-
class: W(["aimd-editor-mode-btn", { active:
|
|
695
|
-
onClick: w[1] || (w[1] = (
|
|
696
|
-
title:
|
|
694
|
+
class: W(["aimd-editor-mode-btn", { active: c.editorMode === "wysiwyg" }]),
|
|
695
|
+
onClick: w[1] || (w[1] = (f) => o("switch-mode", "wysiwyg")),
|
|
696
|
+
title: c.resolvedMessages.mode.wysiwygTitle
|
|
697
697
|
}, [
|
|
698
698
|
w[3] || (w[3] = l("span", {
|
|
699
699
|
class: "aimd-editor-mode-icon",
|
|
700
700
|
innerHTML: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>'
|
|
701
701
|
}, null, -1)),
|
|
702
|
-
l("span", null, i(
|
|
702
|
+
l("span", null, i(c.resolvedMessages.mode.wysiwyg), 1)
|
|
703
703
|
], 10, Js)
|
|
704
|
-
])) :
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
key:
|
|
704
|
+
])) : z("", !0),
|
|
705
|
+
c.showTopBar && c.showMdToolbar ? (u(), v("div", Xs)) : z("", !0),
|
|
706
|
+
c.showMdToolbar ? (u(!0), v(q, { key: 2 }, j(c.localizedMdToolbarItems, (f) => (u(), v(q, {
|
|
707
|
+
key: f.action
|
|
708
708
|
}, [
|
|
709
|
-
|
|
709
|
+
f.action.startsWith("sep") ? (u(), v("div", Ys)) : (u(), v("button", {
|
|
710
710
|
key: 1,
|
|
711
711
|
type: "button",
|
|
712
712
|
class: "aimd-editor-fmt-btn",
|
|
713
|
-
title:
|
|
714
|
-
onClick: (
|
|
715
|
-
innerHTML:
|
|
713
|
+
title: f.title,
|
|
714
|
+
onClick: (p) => o("md-action", f.action, p),
|
|
715
|
+
innerHTML: f.svgIcon
|
|
716
716
|
}, null, 8, Zs))
|
|
717
|
-
], 64))), 128)) :
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
key:
|
|
717
|
+
], 64))), 128)) : z("", !0),
|
|
718
|
+
c.showMdToolbar && c.showAimdToolbar ? (u(), v("div", et)) : z("", !0),
|
|
719
|
+
c.showAimdToolbar ? (u(!0), v(q, { key: 4 }, j(c.localizedFieldTypes, (f) => (u(), v("button", {
|
|
720
|
+
key: f.type,
|
|
721
721
|
type: "button",
|
|
722
722
|
class: "aimd-editor-fmt-btn aimd-editor-aimd-btn",
|
|
723
|
-
title:
|
|
724
|
-
style: me({ "--aimd-color":
|
|
725
|
-
onClick: (
|
|
726
|
-
onMouseup: ue((
|
|
723
|
+
title: f.desc,
|
|
724
|
+
style: me({ "--aimd-color": f.color }),
|
|
725
|
+
onClick: (p) => o("open-aimd-dialog", f.type),
|
|
726
|
+
onMouseup: ue((p) => o("quick-insert-aimd", f.type), ["middle", "prevent"])
|
|
727
727
|
}, [
|
|
728
728
|
l("span", {
|
|
729
729
|
class: "aimd-editor-aimd-btn-icon",
|
|
730
|
-
innerHTML:
|
|
730
|
+
innerHTML: f.svgIcon
|
|
731
731
|
}, null, 8, st),
|
|
732
|
-
l("span", tt, i(
|
|
733
|
-
], 44, lt))), 128)) :
|
|
732
|
+
l("span", tt, i(f.label), 1)
|
|
733
|
+
], 44, lt))), 128)) : z("", !0)
|
|
734
734
|
]));
|
|
735
735
|
}
|
|
736
736
|
});
|
|
737
|
-
function at(
|
|
738
|
-
const { initialContent: F, initialMode: o, resolvedMessages: M, emitModelValue: w, emitMode:
|
|
739
|
-
let
|
|
740
|
-
function
|
|
737
|
+
function at(c) {
|
|
738
|
+
const { initialContent: F, initialMode: o, resolvedMessages: M, emitModelValue: w, emitMode: f } = c, p = B(o), d = B(F), t = _e(null), C = _e(null), V = B(!0), h = _e(null);
|
|
739
|
+
let T = !1;
|
|
740
|
+
function U(n) {
|
|
741
741
|
n !== d.value && (d.value = n, w(n));
|
|
742
742
|
}
|
|
743
743
|
function k(n) {
|
|
@@ -746,9 +746,9 @@ function at(u) {
|
|
|
746
746
|
function G(n) {
|
|
747
747
|
return /class="ProseMirror milkdown-editor-content editor"/.test(n) || /<div class="milkdown">/.test(n) || /<\/?[a-z][^>]*>/i.test(n) && /AIMDINLINETEMPLATE[0-9a-f]+TOKEN/.test(n);
|
|
748
748
|
}
|
|
749
|
-
function D(n,
|
|
750
|
-
const
|
|
751
|
-
return G(
|
|
749
|
+
function D(n, m) {
|
|
750
|
+
const I = Re(We(n));
|
|
751
|
+
return G(I) ? m : I;
|
|
752
752
|
}
|
|
753
753
|
function J(n) {
|
|
754
754
|
return /\{\{(?:var_table|var|quiz|step|check|ref_step|ref_var|ref_fig|cite|fig)\|/.test(n) || /```(?:quiz|fig|assigner)\b/.test(n);
|
|
@@ -756,15 +756,15 @@ function at(u) {
|
|
|
756
756
|
function X() {
|
|
757
757
|
if (h.value)
|
|
758
758
|
try {
|
|
759
|
-
const n = h.value.action(
|
|
759
|
+
const n = h.value.action(xe());
|
|
760
760
|
if (typeof n != "string")
|
|
761
761
|
return;
|
|
762
|
-
const
|
|
763
|
-
h.value.action(ce(k(
|
|
762
|
+
const m = D(n, d.value);
|
|
763
|
+
h.value.action(ce(k(m)));
|
|
764
764
|
} catch {
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
const Y =
|
|
767
|
+
const Y = $(() => {
|
|
768
768
|
try {
|
|
769
769
|
return Ge(d.value);
|
|
770
770
|
} catch {
|
|
@@ -772,141 +772,141 @@ function at(u) {
|
|
|
772
772
|
}
|
|
773
773
|
});
|
|
774
774
|
async function Z(n) {
|
|
775
|
-
if (n !==
|
|
776
|
-
if (
|
|
775
|
+
if (n !== p.value) {
|
|
776
|
+
if (p.value === "source" && t.value && (d.value = t.value.getValue()), p.value === "wysiwyg" && h.value)
|
|
777
777
|
try {
|
|
778
|
-
const
|
|
779
|
-
typeof
|
|
778
|
+
const m = h.value.action(xe());
|
|
779
|
+
typeof m == "string" && (d.value = D(m, d.value));
|
|
780
780
|
} catch {
|
|
781
781
|
}
|
|
782
|
-
if (
|
|
783
|
-
await
|
|
784
|
-
else if (n === "wysiwyg" && (await
|
|
782
|
+
if (p.value = n, f(n), n === "source")
|
|
783
|
+
await ze(), t.value && (T = !0, t.value.setValue(d.value), T = !1);
|
|
784
|
+
else if (n === "wysiwyg" && (await ze(), h.value))
|
|
785
785
|
try {
|
|
786
|
-
|
|
786
|
+
T = !0, h.value.action(ce(k(d.value))), T = !1;
|
|
787
787
|
} catch {
|
|
788
|
-
|
|
788
|
+
T = !1;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
function ee(n) {
|
|
793
793
|
if (n !== d.value) {
|
|
794
|
-
if (
|
|
794
|
+
if (T = !0, d.value = n, p.value === "source" && t.value)
|
|
795
795
|
t.value.setValue(n);
|
|
796
|
-
else if (
|
|
796
|
+
else if (p.value === "wysiwyg" && h.value)
|
|
797
797
|
try {
|
|
798
798
|
h.value.action(ce(k(n)));
|
|
799
799
|
} catch {
|
|
800
800
|
}
|
|
801
|
-
|
|
801
|
+
T = !1;
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
function le(n) {
|
|
805
|
-
if (
|
|
806
|
-
const
|
|
805
|
+
if (p.value === "source" && t.value) {
|
|
806
|
+
const m = t.value.getSelection(), I = t.value.getModel(), P = t.value.getPosition(), te = I.getLineContent(P.lineNumber).substring(0, P.column - 1).trim() !== "" && !n.startsWith(`
|
|
807
807
|
`) ? `
|
|
808
808
|
` + n : n;
|
|
809
809
|
t.value.executeEdits("toolbar", [{
|
|
810
|
-
range:
|
|
810
|
+
range: m,
|
|
811
811
|
text: te,
|
|
812
812
|
forceMoveMarkers: !0
|
|
813
813
|
}]), t.value.focus();
|
|
814
|
-
} else if (
|
|
814
|
+
} else if (p.value === "wysiwyg" && h.value)
|
|
815
815
|
try {
|
|
816
|
-
h.value.action(
|
|
816
|
+
h.value.action(Te(n)), J(n) && X();
|
|
817
817
|
} catch {
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
function
|
|
821
|
-
if (
|
|
822
|
-
const P = t.value.getSelection(), H = t.value.getModel().getValueInRange(P) ||
|
|
820
|
+
function A(n, m = "", I = "") {
|
|
821
|
+
if (p.value === "source" && t.value) {
|
|
822
|
+
const P = t.value.getSelection(), H = t.value.getModel().getValueInRange(P) || I, R = n + H + m;
|
|
823
823
|
t.value.executeEdits("toolbar", [{
|
|
824
824
|
range: P,
|
|
825
825
|
text: R,
|
|
826
826
|
forceMoveMarkers: !0
|
|
827
827
|
}]), t.value.focus();
|
|
828
|
-
} else if (
|
|
828
|
+
} else if (p.value === "wysiwyg" && h.value)
|
|
829
829
|
try {
|
|
830
|
-
h.value.action(
|
|
830
|
+
h.value.action(Te(n + I + m));
|
|
831
831
|
} catch {
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
834
|
+
function S(n, m = "") {
|
|
835
|
+
if (p.value === "source" && t.value) {
|
|
836
|
+
const I = t.value.getPosition(), H = t.value.getModel().getLineContent(I.lineNumber);
|
|
837
837
|
if (H.trim() === "") {
|
|
838
|
-
const R = { startLineNumber:
|
|
839
|
-
t.value.executeEdits("toolbar", [{ range: R, text: n +
|
|
838
|
+
const R = { startLineNumber: I.lineNumber, startColumn: 1, endLineNumber: I.lineNumber, endColumn: H.length + 1 };
|
|
839
|
+
t.value.executeEdits("toolbar", [{ range: R, text: n + m, forceMoveMarkers: !0 }]);
|
|
840
840
|
} else {
|
|
841
|
-
const R = { startLineNumber:
|
|
841
|
+
const R = { startLineNumber: I.lineNumber, startColumn: H.length + 1, endLineNumber: I.lineNumber, endColumn: H.length + 1 };
|
|
842
842
|
t.value.executeEdits("toolbar", [{ range: R, text: `
|
|
843
|
-
` + n +
|
|
843
|
+
` + n + m, forceMoveMarkers: !0 }]);
|
|
844
844
|
}
|
|
845
845
|
t.value.focus();
|
|
846
|
-
} else if (
|
|
846
|
+
} else if (p.value === "wysiwyg" && h.value)
|
|
847
847
|
try {
|
|
848
|
-
h.value.action(
|
|
849
|
-
` + n +
|
|
848
|
+
h.value.action(Te(`
|
|
849
|
+
` + n + m));
|
|
850
850
|
} catch {
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
function L(n) {
|
|
854
|
-
const
|
|
854
|
+
const m = M.value.snippets;
|
|
855
855
|
switch (n) {
|
|
856
856
|
case "h1":
|
|
857
|
-
|
|
857
|
+
S("# ", m.heading);
|
|
858
858
|
break;
|
|
859
859
|
case "h2":
|
|
860
|
-
|
|
860
|
+
S("## ", m.heading);
|
|
861
861
|
break;
|
|
862
862
|
case "h3":
|
|
863
|
-
|
|
863
|
+
S("### ", m.heading);
|
|
864
864
|
break;
|
|
865
865
|
case "bold":
|
|
866
|
-
|
|
866
|
+
A("**", "**", m.boldText);
|
|
867
867
|
break;
|
|
868
868
|
case "italic":
|
|
869
|
-
|
|
869
|
+
A("*", "*", m.italicText);
|
|
870
870
|
break;
|
|
871
871
|
case "strikethrough":
|
|
872
|
-
|
|
872
|
+
A("~~", "~~", m.strikethrough);
|
|
873
873
|
break;
|
|
874
874
|
case "ul":
|
|
875
|
-
|
|
875
|
+
S("- ", m.listItem);
|
|
876
876
|
break;
|
|
877
877
|
case "ol":
|
|
878
|
-
|
|
878
|
+
S("1. ", m.listItem);
|
|
879
879
|
break;
|
|
880
880
|
case "blockquote":
|
|
881
|
-
|
|
881
|
+
S("> ", m.quote);
|
|
882
882
|
break;
|
|
883
883
|
case "code":
|
|
884
|
-
|
|
884
|
+
A("`", "`", m.code);
|
|
885
885
|
break;
|
|
886
886
|
case "codeblock":
|
|
887
|
-
|
|
887
|
+
A("```\n", "\n```", m.codeBlock);
|
|
888
888
|
break;
|
|
889
889
|
case "link":
|
|
890
|
-
|
|
890
|
+
A("[", "](url)", m.linkText);
|
|
891
891
|
break;
|
|
892
892
|
case "image":
|
|
893
|
-
|
|
893
|
+
A("", m.altText);
|
|
894
894
|
break;
|
|
895
895
|
case "hr":
|
|
896
|
-
|
|
896
|
+
S("---");
|
|
897
897
|
break;
|
|
898
898
|
case "math":
|
|
899
|
-
|
|
899
|
+
A("$", "$", m.mathFormula);
|
|
900
900
|
break;
|
|
901
901
|
case "table":
|
|
902
|
-
if (
|
|
902
|
+
if (p.value === "wysiwyg" && h.value)
|
|
903
903
|
try {
|
|
904
904
|
h.value.action(De(Je.key, { row: 3, col: 3 }));
|
|
905
905
|
} catch {
|
|
906
906
|
}
|
|
907
907
|
else
|
|
908
|
-
|
|
909
|
-
`| ${
|
|
908
|
+
S(
|
|
909
|
+
`| ${m.tableColumnA} | ${m.tableColumnB} | ${m.tableColumnC} |
|
|
910
910
|
|-------|-------|-------|
|
|
911
911
|
| `,
|
|
912
912
|
" | | |"
|
|
@@ -914,18 +914,18 @@ function at(u) {
|
|
|
914
914
|
break;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
function
|
|
918
|
-
|
|
917
|
+
function O(n, m, I) {
|
|
918
|
+
T || U(D(m, d.value));
|
|
919
919
|
}
|
|
920
920
|
function se(n) {
|
|
921
921
|
h.value = n;
|
|
922
922
|
}
|
|
923
923
|
return {
|
|
924
|
-
editorMode:
|
|
924
|
+
editorMode: p,
|
|
925
925
|
content: d,
|
|
926
|
-
commitUserContent:
|
|
926
|
+
commitUserContent: U,
|
|
927
927
|
monacoEditor: t,
|
|
928
|
-
monacoInstance:
|
|
928
|
+
monacoInstance: C,
|
|
929
929
|
monacoLoading: V,
|
|
930
930
|
milkdownEditorRef: h,
|
|
931
931
|
extractedFields: Y,
|
|
@@ -934,7 +934,7 @@ function at(u) {
|
|
|
934
934
|
syncFromProp: ee,
|
|
935
935
|
insertTextIntoActiveEditor: le,
|
|
936
936
|
handleMdAction: L,
|
|
937
|
-
onMilkdownMarkdownUpdated:
|
|
937
|
+
onMilkdownMarkdownUpdated: O,
|
|
938
938
|
onMilkdownReady: se
|
|
939
939
|
};
|
|
940
940
|
}
|
|
@@ -950,6 +950,7 @@ const it = { class: "aimd-editor" }, nt = { key: 0 }, dt = { key: 1 }, _t = /* @
|
|
|
950
950
|
showToolbar: { type: Boolean, default: !0 },
|
|
951
951
|
showAimdToolbar: { type: Boolean, default: !0 },
|
|
952
952
|
showMdToolbar: { type: Boolean, default: !0 },
|
|
953
|
+
imageToolbarAction: { default: "markdown" },
|
|
953
954
|
enableBlockHandle: { type: Boolean, default: !0 },
|
|
954
955
|
enableSlashMenu: { type: Boolean, default: !0 },
|
|
955
956
|
keepInactiveEditorsMounted: { type: Boolean, default: !0 },
|
|
@@ -958,17 +959,17 @@ const it = { class: "aimd-editor" }, nt = { key: 0 }, dt = { key: 1 }, _t = /* @
|
|
|
958
959
|
monacoOptions: { default: () => ({}) },
|
|
959
960
|
varTypePlugins: {}
|
|
960
961
|
},
|
|
961
|
-
emits: ["update:modelValue", "update:mode", "ready"],
|
|
962
|
-
setup(
|
|
963
|
-
const M =
|
|
964
|
-
editorMode:
|
|
962
|
+
emits: ["update:modelValue", "update:mode", "ready", "request-image"],
|
|
963
|
+
setup(c, { expose: F, emit: o }) {
|
|
964
|
+
const M = c, w = o, f = $(() => Ne(M.locale, M.messages)), {
|
|
965
|
+
editorMode: p,
|
|
965
966
|
content: d,
|
|
966
967
|
commitUserContent: t,
|
|
967
|
-
monacoEditor:
|
|
968
|
+
monacoEditor: C,
|
|
968
969
|
monacoInstance: V,
|
|
969
970
|
milkdownEditorRef: h,
|
|
970
|
-
extractedFields:
|
|
971
|
-
toMilkdownMarkdown:
|
|
971
|
+
extractedFields: T,
|
|
972
|
+
toMilkdownMarkdown: U,
|
|
972
973
|
switchMode: k,
|
|
973
974
|
syncFromProp: G,
|
|
974
975
|
insertTextIntoActiveEditor: D,
|
|
@@ -978,122 +979,141 @@ const it = { class: "aimd-editor" }, nt = { key: 0 }, dt = { key: 1 }, _t = /* @
|
|
|
978
979
|
} = at({
|
|
979
980
|
initialContent: M.modelValue,
|
|
980
981
|
initialMode: M.mode,
|
|
981
|
-
resolvedMessages:
|
|
982
|
-
emitModelValue: (
|
|
983
|
-
emitMode: (
|
|
982
|
+
resolvedMessages: f,
|
|
983
|
+
emitModelValue: (r) => w("update:modelValue", r),
|
|
984
|
+
emitMode: (r) => w("update:mode", r)
|
|
984
985
|
});
|
|
985
|
-
|
|
986
|
-
|
|
986
|
+
E(() => M.modelValue, (r) => G(r)), E(() => M.mode, (r) => {
|
|
987
|
+
r !== p.value && k(r);
|
|
987
988
|
});
|
|
988
|
-
const Z =
|
|
989
|
-
const
|
|
990
|
-
if (!
|
|
991
|
-
const
|
|
992
|
-
return
|
|
993
|
-
}), n =
|
|
994
|
-
const
|
|
995
|
-
return
|
|
989
|
+
const Z = B(M.theme), ee = $(() => M.keepInactiveEditorsMounted || p.value === "source"), le = $(() => M.keepInactiveEditorsMounted || p.value === "wysiwyg"), A = $(() => Ve(f.value)), S = $(() => Fe(f.value)), L = B(!1), O = B("var"), se = $(() => {
|
|
990
|
+
const r = T.value;
|
|
991
|
+
if (!r) return [];
|
|
992
|
+
const _ = O.value;
|
|
993
|
+
return _ === "ref_step" ? r.step || [] : _ === "ref_var" ? r.var || [] : _ === "ref_fig" ? r.ref_fig || [] : [];
|
|
994
|
+
}), n = $(() => {
|
|
995
|
+
const r = T.value;
|
|
996
|
+
return r?.quiz ? r.quiz.map((_) => _.id) : [];
|
|
996
997
|
});
|
|
997
|
-
function
|
|
998
|
-
|
|
998
|
+
function m(r) {
|
|
999
|
+
O.value = r, L.value = !0;
|
|
1000
|
+
}
|
|
1001
|
+
function I(r) {
|
|
1002
|
+
D(Ke(r, f.value));
|
|
1003
|
+
}
|
|
1004
|
+
function P(r) {
|
|
1005
|
+
D(r);
|
|
999
1006
|
}
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1007
|
+
function H(r) {
|
|
1008
|
+
if (!(r instanceof HTMLElement)) return;
|
|
1009
|
+
const _ = r.getBoundingClientRect();
|
|
1010
|
+
return {
|
|
1011
|
+
top: _.top,
|
|
1012
|
+
right: _.right,
|
|
1013
|
+
bottom: _.bottom,
|
|
1014
|
+
left: _.left,
|
|
1015
|
+
width: _.width,
|
|
1016
|
+
height: _.height
|
|
1017
|
+
};
|
|
1002
1018
|
}
|
|
1003
|
-
function
|
|
1004
|
-
|
|
1019
|
+
function R(r, _) {
|
|
1020
|
+
if (r === "image" && M.imageToolbarAction === "custom") {
|
|
1021
|
+
w("request-image", { buttonRect: H(_.currentTarget) });
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
J(r);
|
|
1005
1025
|
}
|
|
1006
|
-
const
|
|
1007
|
-
function
|
|
1008
|
-
t(
|
|
1026
|
+
const ne = B(null), te = B(null);
|
|
1027
|
+
function pe(r) {
|
|
1028
|
+
t(r);
|
|
1009
1029
|
}
|
|
1010
|
-
function
|
|
1011
|
-
w("ready", { monaco:
|
|
1030
|
+
function de(r) {
|
|
1031
|
+
w("ready", { monaco: r });
|
|
1012
1032
|
}
|
|
1013
|
-
function
|
|
1014
|
-
V.value =
|
|
1033
|
+
function ge(r, _) {
|
|
1034
|
+
V.value = r, C.value = _;
|
|
1015
1035
|
}
|
|
1016
|
-
function
|
|
1017
|
-
Y(
|
|
1036
|
+
function fe(r) {
|
|
1037
|
+
Y(r), w("ready", { milkdown: r });
|
|
1018
1038
|
}
|
|
1019
1039
|
return F({
|
|
1020
1040
|
getContent: () => d.value,
|
|
1021
|
-
setContent: (
|
|
1022
|
-
if (d.value =
|
|
1023
|
-
|
|
1041
|
+
setContent: (r) => {
|
|
1042
|
+
if (d.value = r, p.value === "source" && C.value)
|
|
1043
|
+
C.value.setValue(r);
|
|
1024
1044
|
else if (h.value)
|
|
1025
1045
|
try {
|
|
1026
|
-
h.value.action(ce(
|
|
1046
|
+
h.value.action(ce(U(r)));
|
|
1027
1047
|
} catch {
|
|
1028
1048
|
}
|
|
1029
1049
|
},
|
|
1030
|
-
getMode: () =>
|
|
1031
|
-
setMode: (
|
|
1032
|
-
getMonacoEditor: () =>
|
|
1050
|
+
getMode: () => p.value,
|
|
1051
|
+
setMode: (r) => k(r),
|
|
1052
|
+
getMonacoEditor: () => C.value,
|
|
1033
1053
|
getMilkdownEditor: () => h.value,
|
|
1034
1054
|
insertText: D
|
|
1035
|
-
}), (
|
|
1036
|
-
|
|
1055
|
+
}), (r, _) => (u(), v("div", it, [
|
|
1056
|
+
c.showToolbar ? (u(), Be(ot, {
|
|
1037
1057
|
key: 0,
|
|
1038
|
-
"show-top-bar":
|
|
1039
|
-
"show-md-toolbar":
|
|
1040
|
-
"show-aimd-toolbar":
|
|
1041
|
-
"editor-mode":
|
|
1042
|
-
"resolved-messages":
|
|
1043
|
-
"localized-field-types":
|
|
1044
|
-
"localized-md-toolbar-items":
|
|
1045
|
-
onSwitchMode:
|
|
1046
|
-
onMdAction:
|
|
1047
|
-
onOpenAimdDialog:
|
|
1048
|
-
onQuickInsertAimd:
|
|
1049
|
-
}, null, 8, ["show-top-bar", "show-md-toolbar", "show-aimd-toolbar", "editor-mode", "resolved-messages", "localized-field-types", "localized-md-toolbar-items", "onSwitchMode"
|
|
1058
|
+
"show-top-bar": c.showTopBar,
|
|
1059
|
+
"show-md-toolbar": c.showMdToolbar,
|
|
1060
|
+
"show-aimd-toolbar": c.showAimdToolbar,
|
|
1061
|
+
"editor-mode": K(p),
|
|
1062
|
+
"resolved-messages": f.value,
|
|
1063
|
+
"localized-field-types": A.value,
|
|
1064
|
+
"localized-md-toolbar-items": S.value,
|
|
1065
|
+
onSwitchMode: K(k),
|
|
1066
|
+
onMdAction: R,
|
|
1067
|
+
onOpenAimdDialog: m,
|
|
1068
|
+
onQuickInsertAimd: I
|
|
1069
|
+
}, null, 8, ["show-top-bar", "show-md-toolbar", "show-aimd-toolbar", "editor-mode", "resolved-messages", "localized-field-types", "localized-md-toolbar-items", "onSwitchMode"])) : z("", !0),
|
|
1050
1070
|
l("div", {
|
|
1051
1071
|
class: "aimd-editor-panel",
|
|
1052
|
-
style: me({ minHeight:
|
|
1072
|
+
style: me({ minHeight: c.minHeight + "px" })
|
|
1053
1073
|
}, [
|
|
1054
|
-
ee.value ? b((
|
|
1055
|
-
|
|
1074
|
+
ee.value ? b((u(), v("div", nt, [
|
|
1075
|
+
Me(Qe, {
|
|
1056
1076
|
ref_key: "sourceEditorRef",
|
|
1057
|
-
ref:
|
|
1058
|
-
content:
|
|
1077
|
+
ref: ne,
|
|
1078
|
+
content: K(d),
|
|
1059
1079
|
theme: Z.value,
|
|
1060
|
-
"min-height":
|
|
1061
|
-
readonly:
|
|
1062
|
-
"monaco-options":
|
|
1063
|
-
"resolved-messages":
|
|
1064
|
-
onContentChange:
|
|
1065
|
-
onReady:
|
|
1066
|
-
onMonacoLoaded:
|
|
1080
|
+
"min-height": c.minHeight,
|
|
1081
|
+
readonly: c.readonly,
|
|
1082
|
+
"monaco-options": c.monacoOptions,
|
|
1083
|
+
"resolved-messages": f.value,
|
|
1084
|
+
onContentChange: pe,
|
|
1085
|
+
onReady: de,
|
|
1086
|
+
onMonacoLoaded: ge
|
|
1067
1087
|
}, null, 8, ["content", "theme", "min-height", "readonly", "monaco-options", "resolved-messages"])
|
|
1068
1088
|
], 512)), [
|
|
1069
|
-
[
|
|
1070
|
-
]) :
|
|
1071
|
-
le.value ? b((
|
|
1072
|
-
|
|
1089
|
+
[Ie, K(p) === "source"]
|
|
1090
|
+
]) : z("", !0),
|
|
1091
|
+
le.value ? b((u(), v("div", dt, [
|
|
1092
|
+
Me(Oe, {
|
|
1073
1093
|
ref_key: "wysiwygEditorRef",
|
|
1074
|
-
ref:
|
|
1075
|
-
content:
|
|
1076
|
-
"min-height":
|
|
1077
|
-
"enable-block-handle":
|
|
1078
|
-
active:
|
|
1079
|
-
"resolved-messages":
|
|
1080
|
-
"localized-field-types":
|
|
1081
|
-
onMarkdownUpdated:
|
|
1082
|
-
onReady:
|
|
1083
|
-
onOpenAimdDialog:
|
|
1094
|
+
ref: te,
|
|
1095
|
+
content: K(d),
|
|
1096
|
+
"min-height": c.minHeight,
|
|
1097
|
+
"enable-block-handle": c.enableBlockHandle,
|
|
1098
|
+
active: K(p) === "wysiwyg",
|
|
1099
|
+
"resolved-messages": f.value,
|
|
1100
|
+
"localized-field-types": A.value,
|
|
1101
|
+
onMarkdownUpdated: K(X),
|
|
1102
|
+
onReady: fe,
|
|
1103
|
+
onOpenAimdDialog: m
|
|
1084
1104
|
}, null, 8, ["content", "min-height", "enable-block-handle", "active", "resolved-messages", "localized-field-types", "onMarkdownUpdated"])
|
|
1085
1105
|
], 512)), [
|
|
1086
|
-
[
|
|
1087
|
-
]) :
|
|
1106
|
+
[Ie, K(p) === "wysiwyg"]
|
|
1107
|
+
]) : z("", !0)
|
|
1088
1108
|
], 4),
|
|
1089
|
-
|
|
1109
|
+
Me(Qs, {
|
|
1090
1110
|
visible: L.value,
|
|
1091
|
-
"initial-type":
|
|
1092
|
-
messages:
|
|
1111
|
+
"initial-type": O.value,
|
|
1112
|
+
messages: f.value,
|
|
1093
1113
|
"ref-suggestions": se.value,
|
|
1094
|
-
"var-type-plugins":
|
|
1114
|
+
"var-type-plugins": c.varTypePlugins,
|
|
1095
1115
|
"existing-quiz-ids": n.value,
|
|
1096
|
-
"onUpdate:visible":
|
|
1116
|
+
"onUpdate:visible": _[0] || (_[0] = (he) => L.value = he),
|
|
1097
1117
|
onInsert: P
|
|
1098
1118
|
}, null, 8, ["visible", "initial-type", "messages", "ref-suggestions", "var-type-plugins", "existing-quiz-ids"])
|
|
1099
1119
|
]));
|
|
@@ -1105,33 +1125,33 @@ const it = { class: "aimd-editor" }, nt = { key: 0 }, dt = { key: 1 }, _t = /* @
|
|
|
1105
1125
|
resolvedMessages: {}
|
|
1106
1126
|
},
|
|
1107
1127
|
emits: ["switch-mode"],
|
|
1108
|
-
setup(
|
|
1128
|
+
setup(c, { emit: F }) {
|
|
1109
1129
|
const o = F, M = {
|
|
1110
1130
|
source: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>',
|
|
1111
1131
|
wysiwyg: '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>'
|
|
1112
1132
|
};
|
|
1113
|
-
return (w,
|
|
1133
|
+
return (w, f) => (u(), v("div", rt, [
|
|
1114
1134
|
l("button", {
|
|
1115
|
-
class: W(["aimd-editor-mode-btn", { active:
|
|
1116
|
-
onClick:
|
|
1117
|
-
title:
|
|
1135
|
+
class: W(["aimd-editor-mode-btn", { active: c.editorMode === "source" }]),
|
|
1136
|
+
onClick: f[0] || (f[0] = (p) => o("switch-mode", "source")),
|
|
1137
|
+
title: c.resolvedMessages.mode.sourceTitle
|
|
1118
1138
|
}, [
|
|
1119
1139
|
l("span", {
|
|
1120
1140
|
class: "aimd-editor-mode-icon",
|
|
1121
1141
|
innerHTML: M.source
|
|
1122
1142
|
}, null, 8, ct),
|
|
1123
|
-
l("span", null, i(
|
|
1143
|
+
l("span", null, i(c.resolvedMessages.mode.source), 1)
|
|
1124
1144
|
], 10, ut),
|
|
1125
1145
|
l("button", {
|
|
1126
|
-
class: W(["aimd-editor-mode-btn", { active:
|
|
1127
|
-
onClick:
|
|
1128
|
-
title:
|
|
1146
|
+
class: W(["aimd-editor-mode-btn", { active: c.editorMode === "wysiwyg" }]),
|
|
1147
|
+
onClick: f[1] || (f[1] = (p) => o("switch-mode", "wysiwyg")),
|
|
1148
|
+
title: c.resolvedMessages.mode.wysiwygTitle
|
|
1129
1149
|
}, [
|
|
1130
1150
|
l("span", {
|
|
1131
1151
|
class: "aimd-editor-mode-icon",
|
|
1132
1152
|
innerHTML: M.wysiwyg
|
|
1133
1153
|
}, null, 8, vt),
|
|
1134
|
-
l("span", null, i(
|
|
1154
|
+
l("span", null, i(c.resolvedMessages.mode.wysiwyg), 1)
|
|
1135
1155
|
], 10, mt)
|
|
1136
1156
|
]));
|
|
1137
1157
|
}
|