@juit/vue-tiny-editor 1.0.26 → 1.0.28
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 +2 -1
- package/dist/index.d.ts +26 -4
- package/dist/index.js +372 -357
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
1
|
+
import { createElementBlock as N, openBlock as w, createElementVNode as b, defineComponent as Ge, mergeModels as Xe, useModel as Je, watch as T, shallowRef as q, ref as E, computed as z, onMounted as Qe, nextTick as Oe, onUnmounted as Ye, normalizeClass as L, createCommentVNode as me, Fragment as Ze, renderList as et, createTextVNode as tt, toDisplayString as H, createVNode as V, withDirectives as je, unref as $, vModelText as Le, createBlock as nt } from "vue";
|
|
2
2
|
function ie(n, e) {
|
|
3
|
-
return n instanceof Node && (n =
|
|
3
|
+
return n instanceof Node && (n = F(n)), n.isPointInRange(e.startContainer, e.startOffset) && n.isPointInRange(e.endContainer, e.endOffset) ? e : null;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function ot(n) {
|
|
6
6
|
const e = document.createRange();
|
|
7
7
|
return e.selectNode(n), e;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function F(n) {
|
|
10
10
|
const e = document.createRange();
|
|
11
11
|
return e.selectNodeContents(n), e;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
13
|
+
function Ce(n, e, l) {
|
|
14
|
+
if (!F(n).isPointInRange(e, l))
|
|
15
15
|
throw new Error("Range out of bounds");
|
|
16
|
-
const
|
|
17
|
-
return
|
|
16
|
+
const r = document.createRange();
|
|
17
|
+
return r.setStart(n, 0), r.setEnd(e, l), r.toString();
|
|
18
18
|
}
|
|
19
19
|
function W(n, e) {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
20
|
+
const l = { start: 0, end: 0, backwards: e.backwards };
|
|
21
|
+
return l.start = l.end = Ce(n, e.startContainer, e.startOffset).length, e.collapsed || (l.end = Ce(n, e.endContainer, e.endOffset).length), l;
|
|
22
22
|
}
|
|
23
23
|
function U(n, e) {
|
|
24
|
-
const
|
|
25
|
-
e.backwards && (
|
|
26
|
-
let { start: s, end:
|
|
27
|
-
const
|
|
28
|
-
for (let
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
if (s >= 0 && s <
|
|
32
|
-
return
|
|
33
|
-
if (
|
|
34
|
-
return f = "extra",
|
|
35
|
-
s -=
|
|
24
|
+
const l = F(n);
|
|
25
|
+
e.backwards && (l.backwards = !0);
|
|
26
|
+
let { start: s, end: r } = e, c = null, a = null, f = !1, i = !1;
|
|
27
|
+
const v = document.createNodeIterator(n, NodeFilter.SHOW_TEXT);
|
|
28
|
+
for (let h = v.nextNode(); h && (s >= 0 || r > 0); h = v.nextNode()) {
|
|
29
|
+
c || (c = h), a = h;
|
|
30
|
+
const p = h.nodeValue.length;
|
|
31
|
+
if (s >= 0 && s < p && (f = !0, l.setStart(h, s), s === r))
|
|
32
|
+
return i = "extra", l.setEnd(h, r), l;
|
|
33
|
+
if (r > 0 && r <= p && (i = !0, l.setEnd(h, r), r === s))
|
|
34
|
+
return f = "extra", l.setStart(h, s), l;
|
|
35
|
+
s -= p, r -= p;
|
|
36
36
|
}
|
|
37
|
-
return !f &&
|
|
37
|
+
return !f && c && l.setStart(c, 0), !i && a && l.setEnd(a, a.length), l;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const rt = /* @__PURE__ */ new Set([
|
|
40
40
|
"button",
|
|
41
41
|
"embed",
|
|
42
42
|
"form",
|
|
@@ -48,7 +48,7 @@ const st = /* @__PURE__ */ new Set([
|
|
|
48
48
|
"style",
|
|
49
49
|
"textarea"
|
|
50
50
|
]);
|
|
51
|
-
function
|
|
51
|
+
function Me(n) {
|
|
52
52
|
if (!n || !n.match(/^https?:\/\/[^\s]+$/)) return null;
|
|
53
53
|
try {
|
|
54
54
|
return new URL(n).href;
|
|
@@ -56,236 +56,236 @@ function $e(n) {
|
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
59
|
+
function De(n, e, l = !1) {
|
|
60
|
+
if (l) return n;
|
|
61
61
|
const s = document.createElement(e);
|
|
62
62
|
return s.append(n), s;
|
|
63
63
|
}
|
|
64
64
|
function Z(n, e = {}) {
|
|
65
65
|
var s;
|
|
66
|
-
const
|
|
67
|
-
for (const
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
else if (
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const f = ((s =
|
|
74
|
-
element:
|
|
75
|
-
tagName:
|
|
76
|
-
} : null,
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
(f == null ? void 0 : f.tagName) === "b" ? f.element.append(
|
|
81
|
-
} else if (
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
(f == null ? void 0 : f.tagName) === "i" ? f.element.append(
|
|
85
|
-
} else if (
|
|
86
|
-
|
|
87
|
-
else if (
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
} else if (
|
|
92
|
-
if (
|
|
93
|
-
const
|
|
94
|
-
if (!(
|
|
95
|
-
const
|
|
96
|
-
|
|
66
|
+
const l = document.createDocumentFragment();
|
|
67
|
+
for (const r of n.childNodes)
|
|
68
|
+
if (r.nodeType === Node.TEXT_NODE)
|
|
69
|
+
r.nodeValue && l.append(r.cloneNode());
|
|
70
|
+
else if (r.nodeType === Node.ELEMENT_NODE) {
|
|
71
|
+
const c = r, a = c.tagName.toLowerCase();
|
|
72
|
+
if (rt.has(a)) continue;
|
|
73
|
+
const f = ((s = l.lastChild) == null ? void 0 : s.nodeType) === Node.ELEMENT_NODE ? {
|
|
74
|
+
element: l.lastChild,
|
|
75
|
+
tagName: l.lastChild.tagName.toLowerCase()
|
|
76
|
+
} : null, i = document.createDocumentFragment();
|
|
77
|
+
if (a === "b" || a === "strong") {
|
|
78
|
+
const v = Z(c, { ...e, bold: !0 });
|
|
79
|
+
if (!v.hasChildNodes()) continue;
|
|
80
|
+
(f == null ? void 0 : f.tagName) === "b" ? f.element.append(v) : i.append(De(v, "b", e.bold));
|
|
81
|
+
} else if (a === "i" || a === "em") {
|
|
82
|
+
const v = Z(c, { ...e, italic: !0 });
|
|
83
|
+
if (!v.hasChildNodes()) continue;
|
|
84
|
+
(f == null ? void 0 : f.tagName) === "i" ? f.element.append(v) : i.append(De(v, "i", e.italic));
|
|
85
|
+
} else if (a === "br")
|
|
86
|
+
i.append(document.createElement("br"));
|
|
87
|
+
else if (a === "div" || a === "p" || a === "pre" || a === "h1" || a === "h2" || a === "h3" || a === "h4" || a === "h5" || a === "h6" || a === "ul" || a === "ol" || a === "li") {
|
|
88
|
+
i.append(document.createElement("br"));
|
|
89
|
+
const v = Z(c, e);
|
|
90
|
+
v.hasChildNodes() && (i.append(v), i.append(document.createElement("br")));
|
|
91
|
+
} else if (a === "link") {
|
|
92
|
+
if (c.getAttribute("rel") !== "mention") continue;
|
|
93
|
+
const h = c.getAttribute("name"), p = c.getAttribute("title");
|
|
94
|
+
if (!(h && p)) continue;
|
|
95
|
+
const x = document.createElement("link");
|
|
96
|
+
x.setAttribute("rel", "mention"), x.setAttribute("title", p), x.setAttribute("name", h), i.append(x);
|
|
97
97
|
} else
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
i.append(Z(c, e));
|
|
99
|
+
i.hasChildNodes() && l.append(i);
|
|
100
100
|
}
|
|
101
|
-
return
|
|
101
|
+
return l;
|
|
102
102
|
}
|
|
103
103
|
function lt(n) {
|
|
104
|
-
const e = n.map((s,
|
|
105
|
-
e.sort((s,
|
|
106
|
-
s.index <
|
|
107
|
-
const
|
|
104
|
+
const e = n.map((s, r) => ({ ...s, index: r }));
|
|
105
|
+
e.sort((s, r) => s.start < r.start ? -1 : s.start > r.start || s.end < r.end ? 1 : s.end > r.end || /* v8 ignore next 3 */
|
|
106
|
+
s.index < r.index ? -1 : s.index > r.index ? 1 : 0);
|
|
107
|
+
const l = /* @__PURE__ */ new Set();
|
|
108
108
|
for (let s = 0; s < e.length; s++) {
|
|
109
|
-
const
|
|
110
|
-
for (let
|
|
111
|
-
const
|
|
112
|
-
|
|
109
|
+
const r = e[s];
|
|
110
|
+
for (let c = s + 1; c < e.length; c++) {
|
|
111
|
+
const a = e[c];
|
|
112
|
+
l.has(a) || (a.start === a.end || a.start >= r.start && a.start < r.end || a.end >= r.start && a.end < r.end) && l.add(a);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
return e.filter((s) => !
|
|
116
|
-
const
|
|
117
|
-
return (
|
|
115
|
+
return e.filter((s) => !l.has(s)).filter((s, r, c) => {
|
|
116
|
+
const a = c[r - 1];
|
|
117
|
+
return (a == null ? void 0 : a.end) === s.start && a.href === s.href ? (a.end = s.end, !1) : !0;
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
const e = [],
|
|
122
|
-
for (let
|
|
123
|
-
const f =
|
|
124
|
-
|
|
120
|
+
function st(n) {
|
|
121
|
+
const e = [], l = /(https?:\/\/[^\s]+)/gm, s = n.textContent;
|
|
122
|
+
for (let a = l.exec(s); a; a = l.exec(s)) {
|
|
123
|
+
const f = a[1], i = Me(f);
|
|
124
|
+
i && e.push({ start: a.index, end: a.index + f.length, href: i });
|
|
125
125
|
}
|
|
126
|
-
const
|
|
127
|
-
for (let
|
|
128
|
-
const f =
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
126
|
+
const r = [], c = document.createNodeIterator(n, NodeFilter.SHOW_ELEMENT, (a) => a.nodeName.toLowerCase() === "a" ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP);
|
|
127
|
+
for (let a = c.nextNode(); a; a = c.nextNode()) {
|
|
128
|
+
const f = a, i = Me(f.getAttribute("href"));
|
|
129
|
+
if (i) {
|
|
130
|
+
const v = F(f);
|
|
131
|
+
r.push({ ...W(n, v), href: i });
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
return lt([...e, ...
|
|
134
|
+
return lt([...e, ...r]);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
136
|
+
function at(n) {
|
|
137
|
+
var l;
|
|
138
138
|
n.normalize();
|
|
139
139
|
const e = document.createNodeIterator(n, NodeFilter.SHOW_ELEMENT);
|
|
140
140
|
for (let s = e.nextNode(); s; s = e.nextNode())
|
|
141
141
|
s !== n && s.nodeName.toLowerCase() !== "link" && (s.hasChildNodes() || (s.nodeName.toLowerCase() === "br" && s.parentNode.replaceChild(document.createTextNode(`
|
|
142
|
-
`), s), (
|
|
142
|
+
`), s), (l = s.parentNode) == null || l.removeChild(s)));
|
|
143
143
|
n.normalize(), n.hasChildNodes() || n.append(document.createElement("br"));
|
|
144
144
|
}
|
|
145
145
|
function ee(n) {
|
|
146
146
|
var s;
|
|
147
147
|
if (n.innerHTML === "<br>") return n;
|
|
148
148
|
n.normalize();
|
|
149
|
-
const e =
|
|
150
|
-
return ((s =
|
|
151
|
-
const
|
|
152
|
-
f.setAttribute("href",
|
|
153
|
-
}),
|
|
149
|
+
const e = st(n), l = Z(n);
|
|
150
|
+
return ((s = l.lastChild) == null ? void 0 : s.nodeName.toLowerCase()) === "link" && l.append(document.createTextNode(" ")), n.replaceChildren(l), e.forEach((r) => {
|
|
151
|
+
const c = U(n, r), a = c.extractContents(), f = document.createElement("a");
|
|
152
|
+
f.setAttribute("href", r.href), f.append(a), c.insertNode(f);
|
|
153
|
+
}), at(n), n;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
var
|
|
157
|
-
if (typeof
|
|
155
|
+
function he(n, e, l) {
|
|
156
|
+
var p, x;
|
|
157
|
+
if (typeof l == "string") {
|
|
158
158
|
if (!ie(n, e)) throw new Error("Range out of bounds");
|
|
159
|
-
const
|
|
160
|
-
|
|
159
|
+
const P = new DOMParser().parseFromString(l, "text/html").body;
|
|
160
|
+
l = document.createDocumentFragment(), l.append(...P.childNodes);
|
|
161
161
|
}
|
|
162
|
-
const s = W(n, e),
|
|
163
|
-
|
|
162
|
+
const s = W(n, e), r = ((p = n.textContent) == null ? void 0 : p.length) || 0, c = F(n), a = document.createRange();
|
|
163
|
+
a.setStart(c.startContainer, c.startOffset), a.setEnd(e.startContainer, e.startOffset);
|
|
164
164
|
const f = document.createRange();
|
|
165
|
-
f.setStart(e.endContainer, e.endOffset), f.setEnd(
|
|
166
|
-
const
|
|
167
|
-
n.replaceChildren(), n.append(
|
|
168
|
-
const
|
|
169
|
-
return { ...s, end: s.end +
|
|
165
|
+
f.setStart(e.endContainer, e.endOffset), f.setEnd(c.endContainer, c.endOffset);
|
|
166
|
+
const i = a.extractContents(), v = f.extractContents();
|
|
167
|
+
n.replaceChildren(), n.append(i, l, v), ee(n);
|
|
168
|
+
const h = ((x = n.textContent) == null ? void 0 : x.length) || 0;
|
|
169
|
+
return { ...s, end: s.end + h - r };
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function xe(n) {
|
|
172
172
|
const e = document.getSelection();
|
|
173
173
|
if (!(e != null && e.rangeCount)) return null;
|
|
174
|
-
const
|
|
175
|
-
if (!ie(n,
|
|
174
|
+
const l = e.getRangeAt(0);
|
|
175
|
+
if (!ie(n, l)) return null;
|
|
176
176
|
const s = e.isCollapsed ? !1 : e.anchorNode === e.focusNode ? e.anchorOffset > e.focusOffset : e.anchorNode.compareDocumentPosition(e.focusNode) === Node.DOCUMENT_POSITION_PRECEDING;
|
|
177
|
-
return Object.assign(
|
|
177
|
+
return Object.assign(l, { backwards: s });
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
const e =
|
|
179
|
+
function ge(n) {
|
|
180
|
+
const e = xe(n);
|
|
181
181
|
return e ? W(n, e) : null;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
const s = U(n, e), { startContainer:
|
|
186
|
-
return
|
|
183
|
+
function be(n, e, l = !1) {
|
|
184
|
+
l && (e = { start: e.end, end: e.end });
|
|
185
|
+
const s = U(n, e), { startContainer: r, startOffset: c, endContainer: a, endOffset: f, backwards: i } = s, v = document.getSelection();
|
|
186
|
+
return v && (i ? v.setBaseAndExtent(a, f, r, c) : v.setBaseAndExtent(r, c, a, f)), s;
|
|
187
187
|
}
|
|
188
|
-
function ae(n, e,
|
|
189
|
-
const s =
|
|
188
|
+
function ae(n, e, l) {
|
|
189
|
+
const s = F(n);
|
|
190
190
|
if (!ie(n, e)) return null;
|
|
191
|
-
let
|
|
192
|
-
for (;
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
195
|
-
|
|
191
|
+
let r = e.commonAncestorContainer;
|
|
192
|
+
for (; r && s.intersectsNode(r); ) {
|
|
193
|
+
if (r.nodeType === Node.ELEMENT_NODE && r.nodeName.toLowerCase() === l)
|
|
194
|
+
return r;
|
|
195
|
+
r = r.parentNode;
|
|
196
196
|
}
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Be(n, e, l, s = {}) {
|
|
200
200
|
if (e.collapsed || !ie(n, e)) return;
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const r = ae(n, e, l), c = r ? ot(r) : F(e.commonAncestorContainer), a = document.createRange();
|
|
202
|
+
a.setStart(c.startContainer, c.startOffset), a.setEnd(e.startContainer, e.startOffset);
|
|
203
203
|
const f = document.createRange();
|
|
204
|
-
f.setStart(e.endContainer, e.endOffset), f.setEnd(
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
209
|
-
|
|
204
|
+
f.setStart(e.endContainer, e.endOffset), f.setEnd(c.endContainer, c.endOffset);
|
|
205
|
+
const i = f.extractContents(), v = e.extractContents(), h = a.extractContents();
|
|
206
|
+
c.deleteContents();
|
|
207
|
+
const p = document.createDocumentFragment();
|
|
208
|
+
if (p.append(h), r)
|
|
209
|
+
p.append(v);
|
|
210
210
|
else {
|
|
211
|
-
const
|
|
212
|
-
Object.entries(s).forEach((
|
|
211
|
+
const x = document.createElement(l);
|
|
212
|
+
Object.entries(s).forEach((P) => x.setAttribute(...P)), x.append(v), p.append(x);
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
p.append(i), c.insertNode(p), ee(n);
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const it = {
|
|
217
217
|
xmlns: "http://www.w3.org/2000/svg",
|
|
218
218
|
fill: "currentColor",
|
|
219
219
|
viewBox: "0 -960 960 960"
|
|
220
220
|
};
|
|
221
|
-
function
|
|
222
|
-
return
|
|
223
|
-
|
|
221
|
+
function ut(n, e) {
|
|
222
|
+
return w(), N("svg", it, e[0] || (e[0] = [
|
|
223
|
+
b("path", { d: "M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200zm121-112h104q48 0 58.5-24.5T566-372t-10.5-35.5T494-432H393zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95z" }, null, -1)
|
|
224
224
|
]));
|
|
225
225
|
}
|
|
226
|
-
const
|
|
226
|
+
const ct = { render: ut }, dt = {
|
|
227
227
|
xmlns: "http://www.w3.org/2000/svg",
|
|
228
228
|
fill: "currentColor",
|
|
229
229
|
viewBox: "0 -960 960 960"
|
|
230
230
|
};
|
|
231
|
-
function
|
|
232
|
-
return
|
|
233
|
-
|
|
231
|
+
function ft(n, e) {
|
|
232
|
+
return w(), N("svg", dt, e[0] || (e[0] = [
|
|
233
|
+
b("path", { d: "M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100z" }, null, -1)
|
|
234
234
|
]));
|
|
235
235
|
}
|
|
236
|
-
const vt = { render:
|
|
236
|
+
const vt = { render: ft }, pt = {
|
|
237
237
|
xmlns: "http://www.w3.org/2000/svg",
|
|
238
238
|
fill: "currentColor",
|
|
239
239
|
viewBox: "0 -960 960 960"
|
|
240
240
|
};
|
|
241
|
-
function
|
|
242
|
-
return
|
|
243
|
-
|
|
241
|
+
function mt(n, e) {
|
|
242
|
+
return w(), N("svg", pt, e[0] || (e[0] = [
|
|
243
|
+
b("path", { d: "M440-280H280q-83 0-141.5-58.5T80-480t58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85 35 85 85 35h160zM320-440v-80h320v80zm200 160v-80h160q50 0 85-35t35-85-35-85-85-35H520v-80h160q83 0 141.5 58.5T880-480t-58.5 141.5T680-280z" }, null, -1)
|
|
244
244
|
]));
|
|
245
245
|
}
|
|
246
|
-
const
|
|
246
|
+
const qe = { render: mt }, ht = {
|
|
247
247
|
xmlns: "http://www.w3.org/2000/svg",
|
|
248
248
|
fill: "currentColor",
|
|
249
249
|
viewBox: "0 -960 960 960"
|
|
250
250
|
};
|
|
251
|
-
function
|
|
252
|
-
return
|
|
253
|
-
|
|
251
|
+
function gt(n, e) {
|
|
252
|
+
return w(), N("svg", ht, e[0] || (e[0] = [
|
|
253
|
+
b("path", { d: "M480-80q-83 0-156-31.5T197-197t-85.5-127T80-480t31.5-156T197-763t127-85.5T480-880t156 31.5T763-763t85.5 127T880-480v58q0 59-40.5 100.5T740-280q-35 0-66-15t-52-43q-29 29-65.5 43.5T480-280q-83 0-141.5-58.5T280-480t58.5-141.5T480-680t141.5 58.5T680-480v58q0 26 17 44t43 18 43-18 17-44v-58q0-134-93-227t-227-93-227 93-93 227 93 227 227 93h200v80zm0-280q50 0 85-35t35-85-35-85-85-35-85 35-35 85 35 85 85 35" }, null, -1)
|
|
254
254
|
]));
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const bt = { render: gt }, Ct = {
|
|
257
257
|
xmlns: "http://www.w3.org/2000/svg",
|
|
258
258
|
fill: "currentColor",
|
|
259
259
|
viewBox: "0 -960 960 960"
|
|
260
260
|
};
|
|
261
|
-
function
|
|
262
|
-
return
|
|
263
|
-
|
|
261
|
+
function xt(n, e) {
|
|
262
|
+
return w(), N("svg", Ct, e[0] || (e[0] = [
|
|
263
|
+
b("path", { d: "M792-443 176-183q-20 8-38-3.5T120-220v-520q0-22 18-33.5t38-3.5l616 260q25 11 25 37t-25 37M200-280l474-200-474-200v140l240 60-240 60zm0 0v-400z" }, null, -1)
|
|
264
264
|
]));
|
|
265
265
|
}
|
|
266
|
-
const yt = { render:
|
|
266
|
+
const yt = { render: xt }, wt = {
|
|
267
267
|
xmlns: "http://www.w3.org/2000/svg",
|
|
268
268
|
fill: "currentColor",
|
|
269
269
|
viewBox: "0 -960 960 960"
|
|
270
270
|
};
|
|
271
|
-
function
|
|
272
|
-
return
|
|
273
|
-
|
|
271
|
+
function Nt(n, e) {
|
|
272
|
+
return w(), N("svg", wt, e[0] || (e[0] = [
|
|
273
|
+
b("path", { d: "M280-160v-520H80v-120h520v120H400v520zm360 0v-320H520v-120h360v120H760v320z" }, null, -1)
|
|
274
274
|
]));
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const Tt = { render: Nt }, Et = ["onMousedown"], Rt = { class: "-jte-mentions-entry" }, kt = { class: "-jte-mentions-ref" }, St = {
|
|
277
277
|
key: 0,
|
|
278
278
|
class: "-jte-mentions-waiting"
|
|
279
|
-
},
|
|
279
|
+
}, Ot = {
|
|
280
280
|
key: 1,
|
|
281
281
|
class: "-jte-mentions-none"
|
|
282
|
-
},
|
|
282
|
+
}, jt = {
|
|
283
283
|
key: 0,
|
|
284
284
|
class: "-jte-placeholder"
|
|
285
|
-
},
|
|
285
|
+
}, Lt = ["contenteditable"], Mt = { class: "-jte-toolbox" }, Bt = /* @__PURE__ */ Ge({
|
|
286
286
|
name: "JuitTinyEditor",
|
|
287
287
|
__name: "editor",
|
|
288
|
-
props: /* @__PURE__ */
|
|
288
|
+
props: /* @__PURE__ */ Xe({
|
|
289
289
|
/** A flag indicating if content can be edited (default: `true`) */
|
|
290
290
|
editable: {
|
|
291
291
|
type: Boolean,
|
|
@@ -309,6 +309,18 @@ const Et = { render: Tt }, Rt = ["onMousedown"], kt = { class: "-jte-mentions-en
|
|
|
309
309
|
type: Object,
|
|
310
310
|
required: !1,
|
|
311
311
|
default: () => ({})
|
|
312
|
+
},
|
|
313
|
+
/** Used as `@mention="..."`, notify the current mention text (`@abc...`) */
|
|
314
|
+
onMention: {
|
|
315
|
+
type: Function,
|
|
316
|
+
required: !1,
|
|
317
|
+
default: void 0
|
|
318
|
+
},
|
|
319
|
+
/** Used as `@submit="..."`, will display the send button and emit HTML */
|
|
320
|
+
onSubmit: {
|
|
321
|
+
type: Function,
|
|
322
|
+
required: !1,
|
|
323
|
+
default: void 0
|
|
312
324
|
}
|
|
313
325
|
}, {
|
|
314
326
|
modelValue: {
|
|
@@ -318,110 +330,111 @@ const Et = { render: Tt }, Rt = ["onMousedown"], kt = { class: "-jte-mentions-en
|
|
|
318
330
|
},
|
|
319
331
|
modelModifiers: {}
|
|
320
332
|
}),
|
|
321
|
-
emits:
|
|
322
|
-
setup(n
|
|
323
|
-
const
|
|
324
|
-
T(() =>
|
|
333
|
+
emits: ["update:modelValue"],
|
|
334
|
+
setup(n) {
|
|
335
|
+
const e = Je(n, "modelValue"), l = n;
|
|
336
|
+
T(() => l.dark, (o) => {
|
|
325
337
|
var t;
|
|
326
|
-
(t =
|
|
338
|
+
(t = s.value) == null || t.style.setProperty("color-scheme", o ? "dark light" : "light dark");
|
|
327
339
|
});
|
|
328
|
-
const
|
|
340
|
+
const s = q(null), r = q(null), c = q(null), a = q(null), f = q(null), i = q(null), v = E(""), h = E(0), p = q(null), x = z(() => {
|
|
329
341
|
var o;
|
|
330
|
-
return ((o =
|
|
331
|
-
}),
|
|
332
|
-
const o =
|
|
333
|
-
return
|
|
334
|
-
}), K = E(null), G = E(null), te = E(null),
|
|
342
|
+
return ((o = p.value) == null ? void 0 : o.toString()) || "";
|
|
343
|
+
}), P = z(() => !!l.mentions), M = z(() => {
|
|
344
|
+
const o = x.value.substring(1).toLowerCase();
|
|
345
|
+
return l.mentions ? Object.entries(l.mentions).filter(([t, m]) => m.toLowerCase().startsWith(o)).sort(([t, m], [u, g]) => m.localeCompare(g)).map(([t, m]) => ({ name: t, value: m })) : [];
|
|
346
|
+
}), K = E(null), G = E(null), te = E(null), A = z(() => K.value || G.value);
|
|
335
347
|
T(K, (o) => o && (te.value = o));
|
|
336
|
-
const ne = E(""),
|
|
337
|
-
if (!
|
|
348
|
+
const ne = E(""), S = E(""), $e = z(() => {
|
|
349
|
+
if (!S.value) return !0;
|
|
338
350
|
try {
|
|
339
|
-
return new URL(
|
|
351
|
+
return new URL(S.value), !0;
|
|
340
352
|
} catch {
|
|
341
353
|
return !1;
|
|
342
354
|
}
|
|
343
355
|
});
|
|
344
|
-
T([ne,
|
|
345
|
-
|
|
356
|
+
T([ne, S], ([o, t]) => {
|
|
357
|
+
A.value && (A.value.textContent = o, A.value.setAttribute("href", t), B());
|
|
346
358
|
});
|
|
347
|
-
const ue = E(null), ce = E(null), oe = E(0),
|
|
359
|
+
const ue = E(null), ce = E(null), oe = E(0), Fe = z(() => "." + ".".repeat(oe.value % 5));
|
|
348
360
|
let X = null;
|
|
349
|
-
const
|
|
350
|
-
T(
|
|
351
|
-
t !== null && o !== null && (t.startContainer == o.startContainer && t.startOffset == o.startOffset && t.endContainer == o.endContainer && t.endOffset == o.endOffset && (t == null ? void 0 : t.backwards) == (o == null ? void 0 : o.backwards) || (
|
|
361
|
+
const D = E("");
|
|
362
|
+
T(i, (o, t) => {
|
|
363
|
+
t !== null && o !== null && (t.startContainer == o.startContainer && t.startOffset == o.startOffset && t.endContainer == o.endContainer && t.endOffset == o.endOffset && (t == null ? void 0 : t.backwards) == (o == null ? void 0 : o.backwards) || (D.value = ""));
|
|
352
364
|
});
|
|
353
|
-
const
|
|
365
|
+
const I = [];
|
|
354
366
|
function de(o, t) {
|
|
355
|
-
return
|
|
367
|
+
return i.value ? t ? o && D.value === t ? "" : o || D.value === t ? "-jte-active" : "" : o ? "-jte-active" : i.value.collapsed ? "-jte-disabled" : "" : "-jte-disabled";
|
|
356
368
|
}
|
|
357
|
-
function
|
|
358
|
-
if (!
|
|
359
|
-
const o =
|
|
360
|
-
|
|
369
|
+
function B() {
|
|
370
|
+
if (!r.value) return void (v.value = "");
|
|
371
|
+
const o = r.value.innerHTML;
|
|
372
|
+
v.value = o === "<br>" ? "" : (
|
|
361
373
|
// edge case: empty editor
|
|
362
374
|
o.replaceAll(" ", " ").trimEnd()
|
|
363
375
|
);
|
|
364
376
|
}
|
|
365
377
|
function fe() {
|
|
366
378
|
var o;
|
|
367
|
-
if (
|
|
368
|
-
const t =
|
|
369
|
-
|
|
379
|
+
if (r.value && ((o = I[I.length - 1]) == null ? void 0 : o.content) !== v.value) {
|
|
380
|
+
const t = ge(r.value) || { start: 0, end: 0 };
|
|
381
|
+
I.push({ ...t, content: v.value }), I.length > 100 && I.shift();
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
|
-
function
|
|
373
|
-
if (!
|
|
374
|
-
const o =
|
|
384
|
+
function Pe() {
|
|
385
|
+
if (!r.value || !i.value) return;
|
|
386
|
+
const o = I.pop();
|
|
375
387
|
if (!o) return;
|
|
376
388
|
const t = new DOMParser().parseFromString(o.content, "text/html").body;
|
|
377
|
-
|
|
389
|
+
r.value.replaceChildren(...t.childNodes), be(r.value, o);
|
|
378
390
|
}
|
|
379
|
-
function
|
|
391
|
+
function ye() {
|
|
380
392
|
var o;
|
|
381
|
-
if (
|
|
382
|
-
const t =
|
|
383
|
-
if (t.setEnd(
|
|
384
|
-
|
|
393
|
+
if (p.value && ((o = i.value) != null && o.collapsed)) {
|
|
394
|
+
const t = p.value.cloneRange();
|
|
395
|
+
if (t.setEnd(i.value.startContainer, i.value.startOffset), t.toString().match(/^@[^\r\n]*$/)) {
|
|
396
|
+
p.value = t;
|
|
385
397
|
return;
|
|
386
398
|
}
|
|
387
399
|
}
|
|
388
|
-
|
|
400
|
+
p.value = null;
|
|
389
401
|
}
|
|
390
|
-
function
|
|
391
|
-
if (!
|
|
392
|
-
const
|
|
402
|
+
function we(o, t) {
|
|
403
|
+
if (!r.value || !p.value) return;
|
|
404
|
+
const m = r.value;
|
|
393
405
|
fe();
|
|
394
|
-
const u = document.createDocumentFragment(),
|
|
395
|
-
|
|
396
|
-
const d =
|
|
397
|
-
|
|
406
|
+
const u = document.createDocumentFragment(), g = document.createElement("link");
|
|
407
|
+
g.setAttribute("rel", "mention"), g.setAttribute("name", o), g.setAttribute("title", t), u.append(g, " ");
|
|
408
|
+
const d = he(m, p.value, u);
|
|
409
|
+
_(d, !0), p.value = null, B();
|
|
398
410
|
}
|
|
399
411
|
function J(o, t = {}) {
|
|
400
|
-
if (!
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
|
|
412
|
+
if (!r.value || !i.value) return;
|
|
413
|
+
const m = r.value;
|
|
414
|
+
if (i.value.collapsed) {
|
|
415
|
+
D.value = o, m.focus();
|
|
404
416
|
return;
|
|
405
417
|
}
|
|
406
418
|
fe();
|
|
407
|
-
const u = W(
|
|
408
|
-
|
|
419
|
+
const u = W(m, i.value);
|
|
420
|
+
Be(m, i.value, o, t), _(u), B();
|
|
409
421
|
}
|
|
410
|
-
function
|
|
422
|
+
function Ae() {
|
|
411
423
|
var u;
|
|
412
|
-
if (!
|
|
413
|
-
const o =
|
|
414
|
-
|
|
424
|
+
if (!r.value || !((u = i.value) != null && u.collapsed)) return;
|
|
425
|
+
const o = r.value, t = W(o, i.value), m = document.createTextNode("@");
|
|
426
|
+
i.value.insertNode(m), t.end += 1, p.value = U(o, t), t.start += 1, _(t);
|
|
415
427
|
}
|
|
416
|
-
function
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
|
|
428
|
+
function _(o, t) {
|
|
429
|
+
if (!r.value) return;
|
|
430
|
+
const m = r.value;
|
|
431
|
+
i.value = be(m, o, t), m.focus();
|
|
420
432
|
}
|
|
421
|
-
function
|
|
422
|
-
|
|
433
|
+
function Ie() {
|
|
434
|
+
var o;
|
|
435
|
+
v.value && ((o = l.onSubmit) == null || o.call(l, v.value));
|
|
423
436
|
}
|
|
424
|
-
function
|
|
437
|
+
function _e(o) {
|
|
425
438
|
if (o.metaKey || o.ctrlKey)
|
|
426
439
|
switch (o.key) {
|
|
427
440
|
case "b":
|
|
@@ -431,233 +444,235 @@ const Et = { render: Tt }, Rt = ["onMousedown"], kt = { class: "-jte-mentions-en
|
|
|
431
444
|
J("i"), o.preventDefault();
|
|
432
445
|
break;
|
|
433
446
|
case "z":
|
|
434
|
-
|
|
447
|
+
Pe(), o.preventDefault();
|
|
435
448
|
break;
|
|
436
449
|
}
|
|
437
|
-
else if (
|
|
450
|
+
else if (p.value)
|
|
438
451
|
switch (o.key) {
|
|
439
452
|
case "Home":
|
|
440
|
-
|
|
453
|
+
h.value = 0, o.preventDefault();
|
|
441
454
|
break;
|
|
442
455
|
case "ArrowUp":
|
|
443
|
-
|
|
456
|
+
h.value = Math.max(h.value - 1, 0), o.preventDefault();
|
|
444
457
|
break;
|
|
445
458
|
case "PageUp":
|
|
446
|
-
|
|
459
|
+
h.value = Math.max(h.value - 4, 0), o.preventDefault();
|
|
447
460
|
break;
|
|
448
461
|
case "ArrowDown":
|
|
449
|
-
|
|
462
|
+
h.value = Math.min(h.value + 1, M.value.length - 1), o.preventDefault();
|
|
450
463
|
break;
|
|
451
464
|
case "PageDown":
|
|
452
|
-
|
|
465
|
+
h.value = Math.min(h.value + 4, M.value.length - 1), o.preventDefault();
|
|
453
466
|
break;
|
|
454
467
|
case "End":
|
|
455
|
-
|
|
468
|
+
h.value = M.value.length - 1, o.preventDefault();
|
|
456
469
|
break;
|
|
457
470
|
case "Escape":
|
|
458
|
-
|
|
471
|
+
p.value = null, o.preventDefault();
|
|
459
472
|
break;
|
|
460
473
|
case "Enter": {
|
|
461
|
-
const t =
|
|
462
|
-
t &&
|
|
474
|
+
const t = M.value[h.value];
|
|
475
|
+
t && we(t.name, t.value), o.preventDefault();
|
|
463
476
|
break;
|
|
464
477
|
}
|
|
465
478
|
}
|
|
466
479
|
}
|
|
467
|
-
function
|
|
468
|
-
if (o.preventDefault(), !
|
|
480
|
+
function ze(o) {
|
|
481
|
+
if (o.preventDefault(), !r.value || !i.value) return;
|
|
469
482
|
const t = o.clipboardData;
|
|
470
483
|
if (!t) return;
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
473
|
-
const u =
|
|
474
|
-
|
|
484
|
+
const m = t.getData("text/html") || t.getData("text/plain");
|
|
485
|
+
if (!m) return;
|
|
486
|
+
const u = he(r.value, i.value, m);
|
|
487
|
+
_(u, !0), B();
|
|
475
488
|
}
|
|
476
|
-
function
|
|
477
|
-
if (
|
|
489
|
+
function He(o) {
|
|
490
|
+
if (r.value && i.value && (fe(), !i.value.collapsed && (o.inputType === "deleteContentBackward" || o.inputType === "deleteContentForward"))) {
|
|
478
491
|
o.preventDefault(), o.stopPropagation();
|
|
479
|
-
const t =
|
|
480
|
-
|
|
492
|
+
const t = he(r.value, i.value, "");
|
|
493
|
+
_(t, !0), B();
|
|
481
494
|
}
|
|
482
495
|
}
|
|
483
|
-
function
|
|
484
|
-
var
|
|
485
|
-
const t =
|
|
496
|
+
function Ve(o) {
|
|
497
|
+
var g;
|
|
498
|
+
const t = r.value;
|
|
486
499
|
if (!t) return;
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
500
|
+
const m = p.value ? W(t, p.value) : null, u = ge(t);
|
|
501
|
+
if (D.value && u && u.start === u.end && o.inputType === "insertText" && o.data !== "@" && !p.value) {
|
|
489
502
|
const d = U(t, { start: u.start - 1, end: u.end });
|
|
490
|
-
|
|
503
|
+
Be(t, d, D.value);
|
|
491
504
|
}
|
|
492
|
-
if (
|
|
505
|
+
if (D.value = "", ee(t), m && (p.value = U(t, m)), u && (t.innerHTML === "<br>" ? ((g = document.getSelection()) == null || g.setBaseAndExtent(t, 0, t, 0), t.focus()) : _(u)), !A.value && !p.value && o.data === "@" && o.inputType === "insertText") {
|
|
493
506
|
const d = document.getSelection();
|
|
494
507
|
if (!(d != null && d.anchorNode)) return;
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
const
|
|
498
|
-
|
|
508
|
+
const C = Ce(t, d.anchorNode, d.anchorOffset);
|
|
509
|
+
if (C.match(/(\s|^)@$/)) {
|
|
510
|
+
const y = C.length === 1 ? 0 : C.length - 1, O = C.length, R = { start: y, end: O };
|
|
511
|
+
p.value = U(t, R);
|
|
499
512
|
}
|
|
500
513
|
} else
|
|
501
|
-
|
|
502
|
-
|
|
514
|
+
ye();
|
|
515
|
+
B();
|
|
503
516
|
}
|
|
504
517
|
function Ne(o) {
|
|
505
|
-
|
|
518
|
+
s.value && xe(s.value) || (K.value = null, te.value = null, G.value = null), i.value = r.value ? xe(r.value) : null, ye();
|
|
506
519
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
if (!
|
|
512
|
-
if (!
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
520
|
+
return T(x, (o) => {
|
|
521
|
+
var t;
|
|
522
|
+
return o && ((t = l.onMention) == null ? void 0 : t.call(l, o));
|
|
523
|
+
}), Qe(() => {
|
|
524
|
+
if (document.addEventListener("selectionchange", Ne), !s.value) throw new Error("Root not referenced");
|
|
525
|
+
if (!r.value) throw new Error("Editor not referenced");
|
|
526
|
+
if (!c.value) throw new Error("Popup not referenced");
|
|
527
|
+
if (!a.value) throw new Error("List not referenced");
|
|
528
|
+
if (!f.value) throw new Error("Popup not referenced");
|
|
529
|
+
const o = s.value, t = r.value, m = c.value, u = a.value, g = f.value;
|
|
530
|
+
T(v, (d) => {
|
|
531
|
+
d !== e.value && (e.value = d);
|
|
532
|
+
}), T(e, (d) => {
|
|
533
|
+
if (d === v.value) return;
|
|
534
|
+
const C = `<html><body>${d}</body></html>`, y = new DOMParser().parseFromString(C, "text/html").body;
|
|
535
|
+
ee(y), t.replaceChildren(...y.childNodes), B();
|
|
536
|
+
}, { immediate: !0 }), T(P, (d) => {
|
|
521
537
|
oe.value = 0, d ? X && clearInterval(X) : X = setInterval(() => oe.value = oe.value + 1, 200);
|
|
522
|
-
}, { immediate: !0 }), T(
|
|
523
|
-
if (ne.value = (d == null ? void 0 : d.textContent) || "",
|
|
524
|
-
const
|
|
525
|
-
ee(t),
|
|
538
|
+
}, { immediate: !0 }), T(A, (d) => {
|
|
539
|
+
if (ne.value = (d == null ? void 0 : d.textContent) || "", S.value = (d == null ? void 0 : d.getAttribute("href")) || "", S.value === "http://__placeholder__/" && (d == null || d.setAttribute("href", ""), S.value = ""), !d) {
|
|
540
|
+
const C = ge(t);
|
|
541
|
+
ee(t), C && be(t, C), g.style.display = "none", g.style.top = "0", g.style.left = "0";
|
|
526
542
|
return;
|
|
527
543
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
|
|
544
|
+
Oe(() => {
|
|
545
|
+
g.style.display = "flex";
|
|
546
|
+
const C = o.getBoundingClientRect(), y = d.getBoundingClientRect(), O = t.getBoundingClientRect(), R = getComputedStyle(g), k = parseInt(R.width), j = parseInt(R.height), re = y.top - j - 6 > O.top, le = y.bottom + j + 3 < O.bottom, Q = y.left + k < O.right;
|
|
547
|
+
g.style.top = !le && re ? `${y.top - j - C.top - 6}px` : (
|
|
532
548
|
// over the link
|
|
533
|
-
`${
|
|
534
|
-
),
|
|
549
|
+
`${y.bottom - C.top + 3}px`
|
|
550
|
+
), g.style.left = Q ? `${y.left - C.left}px` : (
|
|
535
551
|
// right of the link
|
|
536
|
-
`${
|
|
552
|
+
`${O.right - k - C.left}px`
|
|
537
553
|
);
|
|
538
554
|
});
|
|
539
|
-
}, { immediate: !0 }), T([
|
|
540
|
-
if (d >=
|
|
541
|
-
if (!
|
|
542
|
-
|
|
555
|
+
}, { immediate: !0 }), T([h, p, M], ([d, C, y], [O = -1]) => {
|
|
556
|
+
if (d >= y.length && (d = Math.max(y.length - 1, 0)), h.value = d, !!m && u) {
|
|
557
|
+
if (!C) {
|
|
558
|
+
h.value = 0, m.style.display = "none", m.style.top = "0", m.style.left = "0", u.scrollTop = 0;
|
|
543
559
|
return;
|
|
544
560
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
const R = o.getBoundingClientRect(), k =
|
|
548
|
-
|
|
561
|
+
Oe(() => {
|
|
562
|
+
m.style.display = "block";
|
|
563
|
+
const R = o.getBoundingClientRect(), k = C.getBoundingClientRect(), j = t.getBoundingClientRect(), re = getComputedStyle(m), le = parseInt(re.width), Q = parseInt(re.height), Ue = k.top - Q - 6 > j.top, We = k.bottom + Q + 3 < j.bottom, Ke = k.left + le < j.right;
|
|
564
|
+
m.style.top = !We && Ue ? `${k.top - Q - R.top - 6}px` : (
|
|
549
565
|
// over the link
|
|
550
566
|
`${k.bottom - R.top + 3}px`
|
|
551
|
-
),
|
|
567
|
+
), m.style.left = Ke ? `${k.left - R.left}px` : (
|
|
552
568
|
// right of the link
|
|
553
|
-
`${
|
|
569
|
+
`${j.right - le - R.left}px`
|
|
554
570
|
);
|
|
555
|
-
const
|
|
556
|
-
if (!
|
|
557
|
-
const
|
|
558
|
-
d >
|
|
571
|
+
const ve = u.querySelectorAll("li")[h.value];
|
|
572
|
+
if (!ve) return;
|
|
573
|
+
const Te = getComputedStyle(ve), Ee = parseFloat(Te.getPropertyValue("border-top-width")) || 0, Re = parseFloat(Te.getPropertyValue("border-bottom-width")) || 0, Y = u.getBoundingClientRect(), pe = ve.getBoundingClientRect(), se = pe.top - Y.top, ke = pe.bottom - Y.bottom, Se = pe.bottom - Y.top;
|
|
574
|
+
d > O ? Se > Y.height ? u.scrollTop += ke - Re : se < 0 && (u.scrollTop += se + Ee) : se < 0 ? u.scrollTop += se + Ee : ke > 0 && (u.scrollTop += Se - Y.height - Re);
|
|
559
575
|
});
|
|
560
576
|
}
|
|
561
|
-
}, { immediate: !0 }), T(
|
|
577
|
+
}, { immediate: !0 }), T(i, (d) => {
|
|
562
578
|
d ? (K.value = ae(t, d, "a"), ue.value = ae(t, d, "b"), ce.value = ae(t, d, "i")) : (K.value = null, ue.value = null, ce.value = null);
|
|
563
579
|
}, { immediate: !0 });
|
|
564
|
-
}),
|
|
580
|
+
}), Ye(() => {
|
|
565
581
|
document.removeEventListener("selectionchange", Ne), X && clearInterval(X);
|
|
566
|
-
})
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
return N(), y("div", {
|
|
571
|
-
class: M(["juit-tiny-edit", { "-jte-editable": n.editable, "-jte-dark": n.dark }])
|
|
582
|
+
}), (o, t) => {
|
|
583
|
+
var m;
|
|
584
|
+
return w(), N("div", {
|
|
585
|
+
class: L(["juit-tiny-edit", { "-jte-editable": n.editable, "-jte-dark": n.dark }])
|
|
572
586
|
}, [
|
|
573
|
-
|
|
587
|
+
b("div", {
|
|
574
588
|
ref_key: "rootRef",
|
|
575
|
-
ref:
|
|
589
|
+
ref: s,
|
|
576
590
|
class: "-jte-root"
|
|
577
591
|
}, [
|
|
578
|
-
|
|
592
|
+
b("div", {
|
|
579
593
|
ref_key: "mentionsPopupRef",
|
|
580
|
-
ref:
|
|
594
|
+
ref: c,
|
|
581
595
|
class: "-jte-mentions-popup"
|
|
582
596
|
}, [
|
|
583
|
-
|
|
597
|
+
b("ul", {
|
|
584
598
|
ref_key: "mentionsListRef",
|
|
585
|
-
ref:
|
|
599
|
+
ref: a
|
|
586
600
|
}, [
|
|
587
|
-
(
|
|
588
|
-
key:
|
|
589
|
-
class:
|
|
590
|
-
onMousedown: (d) =>
|
|
601
|
+
(w(!0), N(Ze, null, et(M.value, (u, g) => (w(), N("li", {
|
|
602
|
+
key: g,
|
|
603
|
+
class: L({ "-jte-mentions-selected": h.value === g }),
|
|
604
|
+
onMousedown: (d) => we(u.name, u.value)
|
|
591
605
|
}, [
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
606
|
+
b("div", Rt, [
|
|
607
|
+
tt(H(u.value) + " ", 1),
|
|
608
|
+
b("span", kt, H(u.name), 1)
|
|
595
609
|
])
|
|
596
|
-
], 42,
|
|
610
|
+
], 42, Et))), 128))
|
|
597
611
|
], 512),
|
|
598
|
-
|
|
612
|
+
P.value ? M.value.length ? me("", !0) : (w(), N("div", Ot, H(x.value), 1)) : (w(), N("div", St, H(x.value) + H(Fe.value), 1))
|
|
599
613
|
], 512),
|
|
600
|
-
|
|
614
|
+
b("div", {
|
|
601
615
|
ref_key: "linksPopupRef",
|
|
602
|
-
ref:
|
|
616
|
+
ref: f,
|
|
603
617
|
class: "-jte-links-popup",
|
|
604
618
|
onClick: t[2] || (t[2] = (u) => G.value = te.value),
|
|
605
619
|
onFocusin: t[3] || (t[3] = (u) => G.value = te.value)
|
|
606
620
|
}, [
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
621
|
+
b("div", null, [
|
|
622
|
+
V($(Tt), { class: "-jte-icon" }),
|
|
623
|
+
je(b("input", {
|
|
610
624
|
"onUpdate:modelValue": t[0] || (t[0] = (u) => ne.value = u),
|
|
611
625
|
type: "text"
|
|
612
626
|
}, null, 512), [
|
|
613
|
-
[
|
|
627
|
+
[Le, ne.value]
|
|
614
628
|
])
|
|
615
629
|
]),
|
|
616
|
-
|
|
617
|
-
class:
|
|
630
|
+
b("div", {
|
|
631
|
+
class: L({ "-jte-error": !$e.value })
|
|
618
632
|
}, [
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
"onUpdate:modelValue": t[1] || (t[1] = (u) =>
|
|
633
|
+
V($(qe), { class: "-jte-icon" }),
|
|
634
|
+
je(b("input", {
|
|
635
|
+
"onUpdate:modelValue": t[1] || (t[1] = (u) => S.value = u),
|
|
622
636
|
type: "text"
|
|
623
637
|
}, null, 512), [
|
|
624
|
-
[
|
|
638
|
+
[Le, S.value]
|
|
625
639
|
])
|
|
626
640
|
], 2)
|
|
627
641
|
], 544),
|
|
628
|
-
n.placeholder && !
|
|
629
|
-
|
|
642
|
+
n.placeholder && !v.value ? (w(), N("div", jt, H(n.placeholder), 1)) : me("", !0),
|
|
643
|
+
b("div", {
|
|
630
644
|
ref_key: "editorRef",
|
|
631
|
-
ref:
|
|
645
|
+
ref: r,
|
|
632
646
|
class: "-jte-editor",
|
|
633
647
|
contenteditable: n.editable ? "plaintext-only" : "false",
|
|
634
|
-
onBeforeinput: t[4] || (t[4] = (u) =>
|
|
635
|
-
onInput: t[5] || (t[5] = (u) =>
|
|
636
|
-
onKeydown: t[6] || (t[6] = (u) =>
|
|
637
|
-
onPaste: t[7] || (t[7] = (u) =>
|
|
648
|
+
onBeforeinput: t[4] || (t[4] = (u) => He(u)),
|
|
649
|
+
onInput: t[5] || (t[5] = (u) => Ve(u)),
|
|
650
|
+
onKeydown: t[6] || (t[6] = (u) => _e(u)),
|
|
651
|
+
onPaste: t[7] || (t[7] = (u) => ze(u)),
|
|
638
652
|
onFocusin: t[8] || (t[8] = (u) => G.value = null)
|
|
639
|
-
}, null, 40,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
class:
|
|
643
|
-
onClick:
|
|
653
|
+
}, null, 40, Lt),
|
|
654
|
+
b("div", Mt, [
|
|
655
|
+
V($(bt), {
|
|
656
|
+
class: L(["-jte-icon -jte-icon-mention", { "-jte-disabled": !((m = i.value) != null && m.collapsed) }]),
|
|
657
|
+
onClick: Ae
|
|
644
658
|
}, null, 8, ["class"]),
|
|
645
|
-
|
|
646
|
-
class:
|
|
659
|
+
V($(ct), {
|
|
660
|
+
class: L(["-jte-icon -jte-icon-bold", de(ue.value, "b")]),
|
|
647
661
|
onClick: t[9] || (t[9] = (u) => J("b"))
|
|
648
662
|
}, null, 8, ["class"]),
|
|
649
|
-
|
|
650
|
-
class:
|
|
663
|
+
V($(vt), {
|
|
664
|
+
class: L(["-jte-icon -jte-icon-italic", de(ce.value, "i")]),
|
|
651
665
|
onClick: t[10] || (t[10] = (u) => J("i"))
|
|
652
666
|
}, null, 8, ["class"]),
|
|
653
|
-
|
|
654
|
-
class:
|
|
667
|
+
V($(qe), {
|
|
668
|
+
class: L(["-jte-icon -jte-icon-href", de(A.value)]),
|
|
655
669
|
onClick: t[11] || (t[11] = (u) => J("a", { href: "http://__placeholder__/" }))
|
|
656
670
|
}, null, 8, ["class"]),
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
671
|
+
n.onSubmit ? (w(), nt($(yt), {
|
|
672
|
+
key: 0,
|
|
673
|
+
class: L(["-jte-icon -jte-icon-send", { "-jte-disabled": !v.value, "-jte-active": !!v.value }]),
|
|
674
|
+
onClick: Ie
|
|
675
|
+
}, null, 8, ["class"])) : me("", !0)
|
|
661
676
|
])
|
|
662
677
|
], 512)
|
|
663
678
|
], 2);
|
|
@@ -665,6 +680,6 @@ const Et = { render: Tt }, Rt = ["onMousedown"], kt = { class: "-jte-mentions-en
|
|
|
665
680
|
}
|
|
666
681
|
});
|
|
667
682
|
export {
|
|
668
|
-
|
|
683
|
+
Bt as default
|
|
669
684
|
};
|
|
670
685
|
//# sourceMappingURL=index.js.map
|