@bygga.dev/editor 1.9.5 → 1.9.8
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 +12 -2
- package/{TextEditor-BWIxouVH.js → TextEditor-qRsQlXjR.js} +336 -336
- package/bygga-editor.js +1922 -1564
- package/element.d.ts +2 -0
- package/package.json +1 -1
- package/{urls-CtHNhbic.js → urls-pzaQIbvA.js} +210 -193
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, K as u, L as d, M as f, O as p, P as m, Q as h, R as g, S as _, V as v, W as y, X as ee, Y as te, Z as b, _t as x, ct as ne, dt as S, et as C, g as w, gt as re, j as T, k as E, mt as D, n as ie, nt as ae, o as oe, ot as se, pt as O, q as k, t as ce, ut as A, x as le } from "./providerKeys-ZUO3LJ3M.js";
|
|
2
|
-
import { $ as ue, At as
|
|
2
|
+
import { $ as ue, At as j, Cn as de, Ct as fe, D as M, Dn as pe, Dt as me, E as he, En as ge, Et as _e, F as ve, Ft as ye, It as be, Lt as xe, Mn as Se, Mt as N, N as Ce, Nt as P, On as we, Ot as Te, Pn as Ee, Pt as F, Rt as I, Sn as De, St as Oe, Tn as ke, Tt as Ae, _ as je, _t as L, bt as R, c as Me, ct as Ne, d as Pe, et as z, gt as Fe, h as Ie, ht as Le, j as B, jt as Re, kt as V, l as ze, lt as Be, m as Ve, mt as He, n as Ue, pt as We, r as Ge, s as Ke, t as qe, u as Je, vt as Ye, w as Xe, wn as Ze, wt as Qe, x as $e, xn as et, xt as tt, y as nt, yt as rt, zt as H } from "./urls-pzaQIbvA.js";
|
|
3
3
|
//#region ../core/src/render/TextShell.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var it = ["align"], at = /* @__PURE__ */ m({
|
|
5
5
|
__name: "TextShell",
|
|
6
6
|
props: {
|
|
7
7
|
width: { type: null },
|
|
@@ -11,24 +11,24 @@ var rt = ["align"], it = /* @__PURE__ */ m({
|
|
|
11
11
|
let n = e;
|
|
12
12
|
return (e, r) => n.width === "fit" ? (y(), t("div", {
|
|
13
13
|
key: 0,
|
|
14
|
-
style: re(O(
|
|
14
|
+
style: re(O(ue)(n.align ?? "left"))
|
|
15
15
|
}, [i("table", {
|
|
16
16
|
align: n.align ?? "left",
|
|
17
17
|
cellpadding: "0",
|
|
18
18
|
cellspacing: "0",
|
|
19
19
|
role: "presentation",
|
|
20
|
-
style: re(O(
|
|
21
|
-
}, [i("tbody", null, [i("tr", null, [i("td", null, [k(e.$slots, "default")])])])], 12,
|
|
20
|
+
style: re(O(z)())
|
|
21
|
+
}, [i("tbody", null, [i("tr", null, [i("td", null, [k(e.$slots, "default")])])])], 12, it)], 4)) : k(e.$slots, "default", { key: 1 });
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
26
|
-
function
|
|
27
|
-
return new
|
|
28
|
-
return new
|
|
26
|
+
function U(e = {}) {
|
|
27
|
+
return new N({ view(t) {
|
|
28
|
+
return new ot(t, e);
|
|
29
29
|
} });
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var ot = class {
|
|
32
32
|
constructor(e, t) {
|
|
33
33
|
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = [
|
|
34
34
|
"dragover",
|
|
@@ -104,7 +104,7 @@ var at = class {
|
|
|
104
104
|
if (t && !i) {
|
|
105
105
|
let e = t.pos;
|
|
106
106
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
107
|
-
let t =
|
|
107
|
+
let t = xe(this.editorView.state.doc, e, this.editorView.dragging.slice);
|
|
108
108
|
t != null && (e = t);
|
|
109
109
|
}
|
|
110
110
|
this.setCursor(e), this.scheduleRemoval(5e3);
|
|
@@ -119,16 +119,16 @@ var at = class {
|
|
|
119
119
|
dragleave(e) {
|
|
120
120
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, W = class e extends F {
|
|
123
123
|
constructor(e) {
|
|
124
124
|
super(e, e);
|
|
125
125
|
}
|
|
126
126
|
map(t, n) {
|
|
127
127
|
let r = t.resolve(n.map(this.head));
|
|
128
|
-
return e.valid(r) ? new e(r) :
|
|
128
|
+
return e.valid(r) ? new e(r) : F.near(r);
|
|
129
129
|
}
|
|
130
130
|
content() {
|
|
131
|
-
return
|
|
131
|
+
return H.empty;
|
|
132
132
|
}
|
|
133
133
|
eq(t) {
|
|
134
134
|
return t instanceof e && t.head == this.head;
|
|
@@ -144,11 +144,11 @@ var at = class {
|
|
|
144
144
|
return new e(t.resolve(n.pos));
|
|
145
145
|
}
|
|
146
146
|
getBookmark() {
|
|
147
|
-
return new
|
|
147
|
+
return new G(this.anchor);
|
|
148
148
|
}
|
|
149
149
|
static valid(e) {
|
|
150
150
|
let t = e.parent;
|
|
151
|
-
if (t.inlineContent || !
|
|
151
|
+
if (t.inlineContent || !ct(e) || !lt(e)) return !1;
|
|
152
152
|
let n = t.type.spec.allowGapCursor;
|
|
153
153
|
if (n != null) return n;
|
|
154
154
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
@@ -171,7 +171,7 @@ var at = class {
|
|
|
171
171
|
for (;;) {
|
|
172
172
|
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
173
173
|
if (!o) {
|
|
174
|
-
if (a.isAtom && !a.isText && !
|
|
174
|
+
if (a.isAtom && !a.isText && !Re.isSelectable(a)) {
|
|
175
175
|
t = t.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
176
176
|
continue search;
|
|
177
177
|
}
|
|
@@ -185,8 +185,8 @@ var at = class {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
var
|
|
188
|
+
W.prototype.visible = !1, W.findFrom = W.findGapCursorFrom, F.jsonID("gapcursor", W);
|
|
189
|
+
var G = class e {
|
|
190
190
|
constructor(e) {
|
|
191
191
|
this.pos = e;
|
|
192
192
|
}
|
|
@@ -195,13 +195,13 @@ var K = class e {
|
|
|
195
195
|
}
|
|
196
196
|
resolve(e) {
|
|
197
197
|
let t = e.resolve(this.pos);
|
|
198
|
-
return
|
|
198
|
+
return W.valid(t) ? new W(t) : F.near(t);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
function
|
|
201
|
+
function st(e) {
|
|
202
202
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ct(e) {
|
|
205
205
|
for (let t = e.depth; t >= 0; t--) {
|
|
206
206
|
let n = e.index(t), r = e.node(t);
|
|
207
207
|
if (n == 0) {
|
|
@@ -209,13 +209,13 @@ function st(e) {
|
|
|
209
209
|
continue;
|
|
210
210
|
}
|
|
211
211
|
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
212
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
212
|
+
if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
|
|
213
213
|
if (e.inlineContent) return !1;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
return !0;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function lt(e) {
|
|
219
219
|
for (let t = e.depth; t >= 0; t--) {
|
|
220
220
|
let n = e.indexAfter(t), r = e.node(t);
|
|
221
221
|
if (n == r.childCount) {
|
|
@@ -223,90 +223,90 @@ function ct(e) {
|
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
225
225
|
for (let e = r.child(n);; e = e.firstChild) {
|
|
226
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
226
|
+
if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
|
|
227
227
|
if (e.inlineContent) return !1;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
return !0;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
return new
|
|
234
|
-
decorations:
|
|
232
|
+
function ut() {
|
|
233
|
+
return new N({ props: {
|
|
234
|
+
decorations: mt,
|
|
235
235
|
createSelectionBetween(e, t, n) {
|
|
236
|
-
return t.pos == n.pos &&
|
|
236
|
+
return t.pos == n.pos && W.valid(n) ? new W(n) : null;
|
|
237
237
|
},
|
|
238
|
-
handleClick:
|
|
239
|
-
handleKeyDown:
|
|
240
|
-
handleDOMEvents: { beforeinput:
|
|
238
|
+
handleClick: ft,
|
|
239
|
+
handleKeyDown: dt,
|
|
240
|
+
handleDOMEvents: { beforeinput: pt }
|
|
241
241
|
} });
|
|
242
242
|
}
|
|
243
|
-
var
|
|
244
|
-
ArrowLeft:
|
|
245
|
-
ArrowRight:
|
|
246
|
-
ArrowUp:
|
|
247
|
-
ArrowDown:
|
|
243
|
+
var dt = Te({
|
|
244
|
+
ArrowLeft: K("horiz", -1),
|
|
245
|
+
ArrowRight: K("horiz", 1),
|
|
246
|
+
ArrowUp: K("vert", -1),
|
|
247
|
+
ArrowDown: K("vert", 1)
|
|
248
248
|
});
|
|
249
|
-
function
|
|
249
|
+
function K(e, t) {
|
|
250
250
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
251
251
|
return function(e, r, i) {
|
|
252
252
|
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
253
|
-
if (a instanceof
|
|
253
|
+
if (a instanceof ye) {
|
|
254
254
|
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
255
255
|
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
256
256
|
}
|
|
257
|
-
let c =
|
|
258
|
-
return c ? (r && r(e.tr.setSelection(new
|
|
257
|
+
let c = W.findGapCursorFrom(o, t, s);
|
|
258
|
+
return c ? (r && r(e.tr.setSelection(new W(c))), !0) : !1;
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function ft(e, t, n) {
|
|
262
262
|
if (!e || !e.editable) return !1;
|
|
263
263
|
let r = e.state.doc.resolve(t);
|
|
264
|
-
if (!
|
|
264
|
+
if (!W.valid(r)) return !1;
|
|
265
265
|
let i = e.posAtCoords({
|
|
266
266
|
left: n.clientX,
|
|
267
267
|
top: n.clientY
|
|
268
268
|
});
|
|
269
|
-
return i && i.inside > -1 &&
|
|
269
|
+
return i && i.inside > -1 && Re.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new W(r))), !0);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
271
|
+
function pt(e, t) {
|
|
272
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof W)) return !1;
|
|
273
273
|
let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
|
|
274
274
|
if (!r) return !1;
|
|
275
|
-
let i =
|
|
276
|
-
for (let e = r.length - 1; e >= 0; e--) i =
|
|
277
|
-
let a = e.state.tr.replace(n.pos, n.pos, new
|
|
278
|
-
return a.setSelection(
|
|
275
|
+
let i = I.empty;
|
|
276
|
+
for (let e = r.length - 1; e >= 0; e--) i = I.from(r[e].createAndFill(null, i));
|
|
277
|
+
let a = e.state.tr.replace(n.pos, n.pos, new H(i, 0, 0));
|
|
278
|
+
return a.setSelection(ye.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(e.selection instanceof
|
|
280
|
+
function mt(e) {
|
|
281
|
+
if (!(e.selection instanceof W)) return null;
|
|
282
282
|
let t = document.createElement("div");
|
|
283
|
-
return t.className = "ProseMirror-gapcursor",
|
|
283
|
+
return t.className = "ProseMirror-gapcursor", j.create(e.doc, [V.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
return e.length ? (e =
|
|
290
|
-
},
|
|
291
|
-
return e.length ?
|
|
292
|
-
},
|
|
293
|
-
return new
|
|
294
|
-
},
|
|
295
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
296
|
-
},
|
|
287
|
+
var ht = 200, q = function() {};
|
|
288
|
+
q.prototype.append = function(e) {
|
|
289
|
+
return e.length ? (e = q.from(e), !this.length && e || e.length < ht && this.leafAppend(e) || this.length < ht && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
290
|
+
}, q.prototype.prepend = function(e) {
|
|
291
|
+
return e.length ? q.from(e).append(this) : this;
|
|
292
|
+
}, q.prototype.appendInner = function(e) {
|
|
293
|
+
return new _t(this, e);
|
|
294
|
+
}, q.prototype.slice = function(e, t) {
|
|
295
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? q.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
296
|
+
}, q.prototype.get = function(e) {
|
|
297
297
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
298
|
-
},
|
|
298
|
+
}, q.prototype.forEach = function(e, t, n) {
|
|
299
299
|
t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
|
|
300
|
-
},
|
|
300
|
+
}, q.prototype.map = function(e, t, n) {
|
|
301
301
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
302
302
|
var r = [];
|
|
303
303
|
return this.forEach(function(t, n) {
|
|
304
304
|
return r.push(e(t, n));
|
|
305
305
|
}, t, n), r;
|
|
306
|
-
},
|
|
307
|
-
return e instanceof
|
|
306
|
+
}, q.from = function(e) {
|
|
307
|
+
return e instanceof q ? e : e && e.length ? new gt(e) : q.empty;
|
|
308
308
|
};
|
|
309
|
-
var
|
|
309
|
+
var gt = /* @__PURE__ */ function(e) {
|
|
310
310
|
function t(t) {
|
|
311
311
|
e.call(this), this.values = t;
|
|
312
312
|
}
|
|
@@ -326,17 +326,17 @@ var ht = /* @__PURE__ */ function(e) {
|
|
|
326
326
|
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
327
327
|
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
328
328
|
}, t.prototype.leafAppend = function(e) {
|
|
329
|
-
if (this.length + e.length <=
|
|
329
|
+
if (this.length + e.length <= ht) return new t(this.values.concat(e.flatten()));
|
|
330
330
|
}, t.prototype.leafPrepend = function(e) {
|
|
331
|
-
if (this.length + e.length <=
|
|
331
|
+
if (this.length + e.length <= ht) return new t(e.flatten().concat(this.values));
|
|
332
332
|
}, n.length.get = function() {
|
|
333
333
|
return this.values.length;
|
|
334
334
|
}, n.depth.get = function() {
|
|
335
335
|
return 0;
|
|
336
336
|
}, Object.defineProperties(t.prototype, n), t;
|
|
337
|
-
}(
|
|
338
|
-
|
|
339
|
-
var
|
|
337
|
+
}(q);
|
|
338
|
+
q.empty = new gt([]);
|
|
339
|
+
var _t = /* @__PURE__ */ function(e) {
|
|
340
340
|
function t(t, n) {
|
|
341
341
|
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
342
342
|
}
|
|
@@ -363,7 +363,7 @@ var gt = /* @__PURE__ */ function(e) {
|
|
|
363
363
|
}, t.prototype.appendInner = function(e) {
|
|
364
364
|
return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e);
|
|
365
365
|
}, t;
|
|
366
|
-
}(
|
|
366
|
+
}(q), J = 500, Y = class e {
|
|
367
367
|
constructor(e, t) {
|
|
368
368
|
this.items = e, this.eventCount = t;
|
|
369
369
|
}
|
|
@@ -383,9 +383,9 @@ var gt = /* @__PURE__ */ function(e) {
|
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
385
|
if (i) {
|
|
386
|
-
u.push(new
|
|
386
|
+
u.push(new X(t.map));
|
|
387
387
|
let e = t.step.map(i.slice(a)), n;
|
|
388
|
-
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new
|
|
388
|
+
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new X(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
|
|
389
389
|
} else o.maybeStep(t.step);
|
|
390
390
|
if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
|
|
391
391
|
}, this.items.length, 0), {
|
|
@@ -397,21 +397,21 @@ var gt = /* @__PURE__ */ function(e) {
|
|
|
397
397
|
addTransform(t, n, r, i) {
|
|
398
398
|
let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
|
|
399
399
|
for (let e = 0; e < t.steps.length; e++) {
|
|
400
|
-
let r = t.steps[e].invert(t.docs[e]), l = new
|
|
400
|
+
let r = t.steps[e].invert(t.docs[e]), l = new X(t.mapping.maps[e], r, n), u;
|
|
401
401
|
(u = c && c.merge(l)) && (l = u, e ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
|
|
402
402
|
}
|
|
403
403
|
let l = o - r.depth;
|
|
404
|
-
return l >
|
|
404
|
+
return l > yt && (s = vt(s, l), o -= l), new e(s.append(a), o);
|
|
405
405
|
}
|
|
406
406
|
remapping(e, t) {
|
|
407
|
-
let n = new
|
|
407
|
+
let n = new be();
|
|
408
408
|
return this.items.forEach((t, r) => {
|
|
409
409
|
let i = t.mirrorOffset != null && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
|
|
410
410
|
n.appendMap(t.map, i);
|
|
411
411
|
}, e, t), n;
|
|
412
412
|
}
|
|
413
413
|
addMaps(t) {
|
|
414
|
-
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new
|
|
414
|
+
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new X(e))), this.eventCount);
|
|
415
415
|
}
|
|
416
416
|
rebased(t, n) {
|
|
417
417
|
if (!this.eventCount) return this;
|
|
@@ -427,13 +427,13 @@ var gt = /* @__PURE__ */ function(e) {
|
|
|
427
427
|
let i = a.maps[n];
|
|
428
428
|
if (e.step) {
|
|
429
429
|
let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
|
|
430
|
-
l && s++, r.push(new
|
|
431
|
-
} else r.push(new
|
|
430
|
+
l && s++, r.push(new X(i, o, l));
|
|
431
|
+
} else r.push(new X(i));
|
|
432
432
|
}, i);
|
|
433
433
|
let l = [];
|
|
434
|
-
for (let e = n; e < o; e++) l.push(new
|
|
434
|
+
for (let e = n; e < o; e++) l.push(new X(a.maps[e]));
|
|
435
435
|
let u = new e(this.items.slice(0, i).append(l).append(r), s);
|
|
436
|
-
return u.emptyItemCount() >
|
|
436
|
+
return u.emptyItemCount() > J && (u = u.compress(this.items.length - r.length)), u;
|
|
437
437
|
}
|
|
438
438
|
emptyItemCount() {
|
|
439
439
|
let e = 0;
|
|
@@ -450,21 +450,21 @@ var gt = /* @__PURE__ */ function(e) {
|
|
|
450
450
|
if (r--, o && n.appendMap(o, r), t) {
|
|
451
451
|
let s = e.selection && e.selection.map(n.slice(r));
|
|
452
452
|
s && a++;
|
|
453
|
-
let c = new
|
|
453
|
+
let c = new X(o.invert(), t, s), l, u = i.length - 1;
|
|
454
454
|
(l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
|
|
455
455
|
}
|
|
456
456
|
} else e.map && r--;
|
|
457
|
-
}, this.items.length, 0), new e(
|
|
457
|
+
}, this.items.length, 0), new e(q.from(i.reverse()), a);
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
|
-
|
|
461
|
-
function
|
|
460
|
+
Y.empty = new Y(q.empty, 0);
|
|
461
|
+
function vt(e, t) {
|
|
462
462
|
let n;
|
|
463
463
|
return e.forEach((e, r) => {
|
|
464
464
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
465
465
|
}), e.slice(n);
|
|
466
466
|
}
|
|
467
|
-
var
|
|
467
|
+
var X = class e {
|
|
468
468
|
constructor(e, t, n, r) {
|
|
469
469
|
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
|
|
470
470
|
}
|
|
@@ -474,25 +474,25 @@ var Z = class e {
|
|
|
474
474
|
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, Z = class {
|
|
478
478
|
constructor(e, t, n, r, i) {
|
|
479
479
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
480
480
|
}
|
|
481
|
-
},
|
|
482
|
-
function
|
|
483
|
-
let i = n.getMeta(
|
|
481
|
+
}, yt = 20;
|
|
482
|
+
function bt(e, t, n, r) {
|
|
483
|
+
let i = n.getMeta(Q), a;
|
|
484
484
|
if (i) return i.historyState;
|
|
485
|
-
n.getMeta(
|
|
485
|
+
n.getMeta(Ot) && (e = new Z(e.done, e.undone, null, 0, -1));
|
|
486
486
|
let o = n.getMeta("appendedTransaction");
|
|
487
487
|
if (n.steps.length == 0) return e;
|
|
488
|
-
if (o && o.getMeta(
|
|
488
|
+
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r, Dt(t)), e.undone, St(n.mapping.maps), e.prevTime, e.prevComposition) : new Z(e.done, e.undone.addTransform(n, void 0, r, Dt(t)), null, e.prevTime, e.prevComposition);
|
|
489
489
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
490
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !
|
|
491
|
-
return new
|
|
492
|
-
} else if (a = n.getMeta("rebased")) return new
|
|
493
|
-
else return new
|
|
490
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !xt(n, e.prevRanges)), s = o ? Ct(e.prevRanges, n.mapping) : St(n.mapping.maps);
|
|
491
|
+
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Dt(t)), Y.empty, s, n.time, i ?? e.prevComposition);
|
|
492
|
+
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a), Ct(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
493
|
+
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Ct(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function xt(e, t) {
|
|
496
496
|
if (!t) return !1;
|
|
497
497
|
if (!e.docChanged) return !0;
|
|
498
498
|
let n = !1;
|
|
@@ -500,12 +500,12 @@ function bt(e, t) {
|
|
|
500
500
|
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
501
501
|
}), n;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function St(e) {
|
|
504
504
|
let t = [];
|
|
505
505
|
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
506
506
|
return t;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Ct(e, t) {
|
|
509
509
|
if (!e) return null;
|
|
510
510
|
let n = [];
|
|
511
511
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -514,62 +514,62 @@ function St(e, t) {
|
|
|
514
514
|
}
|
|
515
515
|
return n;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
518
|
-
let r =
|
|
517
|
+
function wt(e, t, n) {
|
|
518
|
+
let r = Dt(t), i = Q.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
519
519
|
if (!a) return null;
|
|
520
|
-
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new
|
|
521
|
-
return a.transform.setSelection(o).setMeta(
|
|
520
|
+
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new Z(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
521
|
+
return a.transform.setSelection(o).setMeta(Q, {
|
|
522
522
|
redo: n,
|
|
523
523
|
historyState: c
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
|
-
var
|
|
527
|
-
function
|
|
526
|
+
var Tt = !1, Et = null;
|
|
527
|
+
function Dt(e) {
|
|
528
528
|
let t = e.plugins;
|
|
529
|
-
if (
|
|
530
|
-
|
|
529
|
+
if (Et != t) {
|
|
530
|
+
Tt = !1, Et = t;
|
|
531
531
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
532
|
-
|
|
532
|
+
Tt = !0;
|
|
533
533
|
break;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
return
|
|
536
|
+
return Tt;
|
|
537
537
|
}
|
|
538
|
-
var
|
|
539
|
-
function
|
|
538
|
+
var Q = new P("history"), Ot = new P("closeHistory");
|
|
539
|
+
function kt(e = {}) {
|
|
540
540
|
return e = {
|
|
541
541
|
depth: e.depth || 100,
|
|
542
542
|
newGroupDelay: e.newGroupDelay || 500
|
|
543
|
-
}, new
|
|
544
|
-
key:
|
|
543
|
+
}, new N({
|
|
544
|
+
key: Q,
|
|
545
545
|
state: {
|
|
546
546
|
init() {
|
|
547
|
-
return new
|
|
547
|
+
return new Z(Y.empty, Y.empty, null, 0, -1);
|
|
548
548
|
},
|
|
549
549
|
apply(t, n, r) {
|
|
550
|
-
return
|
|
550
|
+
return bt(n, r, t, e);
|
|
551
551
|
}
|
|
552
552
|
},
|
|
553
553
|
config: e,
|
|
554
554
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
555
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
555
|
+
let n = t.inputType, r = n == "historyUndo" ? jt : n == "historyRedo" ? Mt : null;
|
|
556
556
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
557
557
|
} } }
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function At(e, t) {
|
|
561
561
|
return (n, r) => {
|
|
562
|
-
let i =
|
|
562
|
+
let i = Q.getState(n);
|
|
563
563
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
564
564
|
if (r) {
|
|
565
|
-
let a =
|
|
565
|
+
let a = wt(i, n, e);
|
|
566
566
|
a && r(t ? a.scrollIntoView() : a);
|
|
567
567
|
}
|
|
568
568
|
return !0;
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
var
|
|
572
|
-
|
|
571
|
+
var jt = At(!1, !0), Mt = At(!0, !0);
|
|
572
|
+
R.create({
|
|
573
573
|
name: "characterCount",
|
|
574
574
|
addOptions() {
|
|
575
575
|
return {
|
|
@@ -601,8 +601,8 @@ U.create({
|
|
|
601
601
|
},
|
|
602
602
|
addProseMirrorPlugins() {
|
|
603
603
|
let e = !1;
|
|
604
|
-
return [new
|
|
605
|
-
key: new
|
|
604
|
+
return [new N({
|
|
605
|
+
key: new P("characterCount"),
|
|
606
606
|
appendTransaction: (t, n, r) => {
|
|
607
607
|
if (e) return;
|
|
608
608
|
let i = this.options.limit, a = this.options.autoTrim;
|
|
@@ -630,7 +630,7 @@ U.create({
|
|
|
630
630
|
}
|
|
631
631
|
})];
|
|
632
632
|
}
|
|
633
|
-
}),
|
|
633
|
+
}), R.create({
|
|
634
634
|
name: "dropCursor",
|
|
635
635
|
addOptions() {
|
|
636
636
|
return {
|
|
@@ -640,9 +640,9 @@ U.create({
|
|
|
640
640
|
};
|
|
641
641
|
},
|
|
642
642
|
addProseMirrorPlugins() {
|
|
643
|
-
return [
|
|
643
|
+
return [U(this.options)];
|
|
644
644
|
}
|
|
645
|
-
}),
|
|
645
|
+
}), R.create({
|
|
646
646
|
name: "focus",
|
|
647
647
|
addOptions() {
|
|
648
648
|
return {
|
|
@@ -651,11 +651,11 @@ U.create({
|
|
|
651
651
|
};
|
|
652
652
|
},
|
|
653
653
|
addProseMirrorPlugins() {
|
|
654
|
-
return [new
|
|
655
|
-
key: new
|
|
654
|
+
return [new N({
|
|
655
|
+
key: new P("focus"),
|
|
656
656
|
props: { decorations: ({ doc: e, selection: t }) => {
|
|
657
657
|
let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
|
|
658
|
-
if (!n || !r) return
|
|
658
|
+
if (!n || !r) return j.create(e, []);
|
|
659
659
|
let o = 0;
|
|
660
660
|
this.options.mode === "deepest" && e.descendants((e, t) => {
|
|
661
661
|
if (!e.isText) {
|
|
@@ -667,28 +667,28 @@ U.create({
|
|
|
667
667
|
return e.descendants((e, t) => {
|
|
668
668
|
if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
669
669
|
if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
|
|
670
|
-
a.push(
|
|
671
|
-
}),
|
|
670
|
+
a.push(V.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
671
|
+
}), j.create(e, a);
|
|
672
672
|
} }
|
|
673
673
|
})];
|
|
674
674
|
}
|
|
675
|
-
}),
|
|
675
|
+
}), R.create({
|
|
676
676
|
name: "gapCursor",
|
|
677
677
|
addProseMirrorPlugins() {
|
|
678
|
-
return [
|
|
678
|
+
return [ut()];
|
|
679
679
|
},
|
|
680
680
|
extendNodeSchema(e) {
|
|
681
|
-
return { allowGapCursor:
|
|
681
|
+
return { allowGapCursor: Oe(Qe(e, "allowGapCursor", {
|
|
682
682
|
name: e.name,
|
|
683
683
|
options: e.options,
|
|
684
684
|
storage: e.storage
|
|
685
685
|
})) ?? null };
|
|
686
686
|
}
|
|
687
687
|
});
|
|
688
|
-
var
|
|
688
|
+
var Nt = "placeholder", $ = new P("tiptap__placeholder"), Pt = 200;
|
|
689
689
|
function Ft(e) {
|
|
690
690
|
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
691
|
-
return o && u.push(l),
|
|
691
|
+
return o && u.push(l), V.node(i, i + a.nodeSize, {
|
|
692
692
|
class: u.join(" "),
|
|
693
693
|
[r]: typeof n == "function" ? n({
|
|
694
694
|
editor: t,
|
|
@@ -706,7 +706,7 @@ function Lt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
706
706
|
let { anchor: a } = i, o = [], s = e.isEmpty;
|
|
707
707
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
708
708
|
let i = r.resolve(a), c = i.depth > 0 ? i.node(1) : i.nodeAfter, l = i.depth > 0 ? i.before(1) : a;
|
|
709
|
-
if (c && c.type.isTextblock &&
|
|
709
|
+
if (c && c.type.isTextblock && Ae(c)) {
|
|
710
710
|
let r = a >= l && a <= l + c.nodeSize;
|
|
711
711
|
o.push(Ft({
|
|
712
712
|
editor: e,
|
|
@@ -728,9 +728,9 @@ function Lt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
728
728
|
}));
|
|
729
729
|
}
|
|
730
730
|
} else {
|
|
731
|
-
let i =
|
|
731
|
+
let i = $.getState(e.state), c = i?.topPos ?? 0, l = i?.bottomPos ?? r.content.size;
|
|
732
732
|
r.nodesBetween(c, l, (r, i) => {
|
|
733
|
-
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf &&
|
|
733
|
+
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf && Ae(r);
|
|
734
734
|
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(Ft({
|
|
735
735
|
editor: e,
|
|
736
736
|
isEmptyDoc: s,
|
|
@@ -751,7 +751,7 @@ function Lt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
751
751
|
})), t.includeChildren;
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
|
-
return
|
|
754
|
+
return j.create(r, o);
|
|
755
755
|
}
|
|
756
756
|
function Rt(e) {
|
|
757
757
|
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
@@ -815,7 +815,7 @@ var Ut = {
|
|
|
815
815
|
};
|
|
816
816
|
},
|
|
817
817
|
apply(e, t) {
|
|
818
|
-
let n = e.getMeta(
|
|
818
|
+
let n = e.getMeta($);
|
|
819
819
|
return n?.positions ? {
|
|
820
820
|
topPos: n.positions.top,
|
|
821
821
|
bottomPos: n.positions.bottom
|
|
@@ -832,9 +832,9 @@ function Wt(e) {
|
|
|
832
832
|
scrollContainer: t
|
|
833
833
|
});
|
|
834
834
|
if (n === null) return;
|
|
835
|
-
let r =
|
|
835
|
+
let r = $.getState(e.state);
|
|
836
836
|
if (r?.topPos === n.top && r?.bottomPos === n.bottom) return;
|
|
837
|
-
let i = e.state.tr.setMeta(
|
|
837
|
+
let i = e.state.tr.setMeta($, { positions: n });
|
|
838
838
|
e.dispatch(i);
|
|
839
839
|
}, r = null, i = 0, a = () => {
|
|
840
840
|
r === null && (r = requestAnimationFrame(() => {
|
|
@@ -857,9 +857,9 @@ function Wt(e) {
|
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
859
|
function Gt({ editor: e, options: t }) {
|
|
860
|
-
let n = t.dataAttribute ? `data-${Rt(t.dataAttribute)}` : `data-${
|
|
861
|
-
return new
|
|
862
|
-
key:
|
|
860
|
+
let n = t.dataAttribute ? `data-${Rt(t.dataAttribute)}` : `data-${Nt}`;
|
|
861
|
+
return new N({
|
|
862
|
+
key: $,
|
|
863
863
|
state: Ut,
|
|
864
864
|
view: Wt,
|
|
865
865
|
props: { decorations: ({ doc: r, selection: i }) => Lt({
|
|
@@ -871,13 +871,13 @@ function Gt({ editor: e, options: t }) {
|
|
|
871
871
|
}) }
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
|
-
var Kt =
|
|
874
|
+
var Kt = R.create({
|
|
875
875
|
name: "placeholder",
|
|
876
876
|
addOptions() {
|
|
877
877
|
return {
|
|
878
878
|
emptyEditorClass: "is-editor-empty",
|
|
879
879
|
emptyNodeClass: "is-empty",
|
|
880
|
-
dataAttribute:
|
|
880
|
+
dataAttribute: Nt,
|
|
881
881
|
placeholder: "Write something …",
|
|
882
882
|
showOnlyWhenEditable: !0,
|
|
883
883
|
showOnlyCurrent: !0,
|
|
@@ -891,17 +891,17 @@ var Kt = U.create({
|
|
|
891
891
|
})];
|
|
892
892
|
}
|
|
893
893
|
}), qt = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
894
|
-
|
|
894
|
+
R.create({
|
|
895
895
|
name: "selection",
|
|
896
896
|
addOptions() {
|
|
897
897
|
return { className: "selection" };
|
|
898
898
|
},
|
|
899
899
|
addProseMirrorPlugins() {
|
|
900
900
|
let { editor: e, options: t } = this;
|
|
901
|
-
return e.options.injectCSS && typeof document < "u" &&
|
|
902
|
-
key: new
|
|
901
|
+
return e.options.injectCSS && typeof document < "u" && fe(qt, e.options.injectNonce, "selection"), [new N({
|
|
902
|
+
key: new P("selection"),
|
|
903
903
|
props: { decorations(n) {
|
|
904
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
904
|
+
return n.selection.empty || e.isFocused || !e.isEditable || _e(n.selection) || e.view.dragging ? null : j.create(n.doc, [V.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
905
905
|
} }
|
|
906
906
|
})];
|
|
907
907
|
}
|
|
@@ -909,7 +909,7 @@ U.create({
|
|
|
909
909
|
function Jt({ types: e, node: t }) {
|
|
910
910
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
911
911
|
}
|
|
912
|
-
|
|
912
|
+
R.create({
|
|
913
913
|
name: "trailingNode",
|
|
914
914
|
addOptions() {
|
|
915
915
|
return {
|
|
@@ -918,8 +918,8 @@ U.create({
|
|
|
918
918
|
};
|
|
919
919
|
},
|
|
920
920
|
addProseMirrorPlugins() {
|
|
921
|
-
let e = new
|
|
922
|
-
return [new
|
|
921
|
+
let e = new P(this.name), t = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, e]) => e).filter((e) => (this.options.notAfter || []).concat(t).includes(e.name));
|
|
922
|
+
return [new N({
|
|
923
923
|
key: e,
|
|
924
924
|
appendTransaction: (n, r, i) => {
|
|
925
925
|
let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
|
|
@@ -945,7 +945,7 @@ U.create({
|
|
|
945
945
|
})];
|
|
946
946
|
}
|
|
947
947
|
});
|
|
948
|
-
var Yt =
|
|
948
|
+
var Yt = R.create({
|
|
949
949
|
name: "undoRedo",
|
|
950
950
|
addOptions() {
|
|
951
951
|
return {
|
|
@@ -955,12 +955,12 @@ var Yt = U.create({
|
|
|
955
955
|
},
|
|
956
956
|
addCommands() {
|
|
957
957
|
return {
|
|
958
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
959
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
958
|
+
undo: () => ({ state: e, dispatch: t }) => jt(e, t),
|
|
959
|
+
redo: () => ({ state: e, dispatch: t }) => Mt(e, t)
|
|
960
960
|
};
|
|
961
961
|
},
|
|
962
962
|
addProseMirrorPlugins() {
|
|
963
|
-
return [
|
|
963
|
+
return [kt(this.options)];
|
|
964
964
|
},
|
|
965
965
|
addKeyboardShortcuts() {
|
|
966
966
|
return {
|
|
@@ -988,7 +988,7 @@ function Xt(e) {
|
|
|
988
988
|
}
|
|
989
989
|
}));
|
|
990
990
|
}
|
|
991
|
-
var Zt = class extends
|
|
991
|
+
var Zt = class extends rt {
|
|
992
992
|
constructor(e = {}) {
|
|
993
993
|
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = Xt(this.view.state), this.reactiveExtensionStorage = Xt(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
994
994
|
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
@@ -1171,7 +1171,7 @@ var nn = {
|
|
|
1171
1171
|
type: Object,
|
|
1172
1172
|
required: !0
|
|
1173
1173
|
}
|
|
1174
|
-
}, rn = class extends
|
|
1174
|
+
}, rn = class extends tt {
|
|
1175
1175
|
constructor(e, t, n) {
|
|
1176
1176
|
super(e, t, n), this.cachedExtensionWithSyncedStorage = null, this.handlePositionUpdate = () => {
|
|
1177
1177
|
let e = this.getPos();
|
|
@@ -1231,7 +1231,7 @@ var nn = {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
handleSelectionUpdate() {
|
|
1233
1233
|
let e = this.getPos();
|
|
1234
|
-
if (typeof e == "number") if (
|
|
1234
|
+
if (typeof e == "number") if (me({
|
|
1235
1235
|
selection: this.editor.state.selection,
|
|
1236
1236
|
pos: e,
|
|
1237
1237
|
nodeSize: this.node.nodeSize,
|
|
@@ -1364,7 +1364,7 @@ var ln = [
|
|
|
1364
1364
|
"aria-haspopup": "dialog",
|
|
1365
1365
|
"aria-expanded": p.value,
|
|
1366
1366
|
onMousedown: a[0] ||= _(() => {}, ["prevent"])
|
|
1367
|
-
}, [f(
|
|
1367
|
+
}, [f(M, {
|
|
1368
1368
|
name: "sparkles",
|
|
1369
1369
|
size: 16
|
|
1370
1370
|
})], 42, ln)) : E("", !0), e.actions.length ? (y(), t("div", {
|
|
@@ -1400,9 +1400,9 @@ var ln = [
|
|
|
1400
1400
|
__name: "MergeTagPicker",
|
|
1401
1401
|
emits: ["select"],
|
|
1402
1402
|
setup(e, { emit: o }) {
|
|
1403
|
-
let s = o, { t: c, locale: l } = Xe(), p = d($e, a(() => ({}))), m = a(() =>
|
|
1403
|
+
let s = o, { t: c, locale: l } = Xe(), p = d($e, a(() => ({}))), m = a(() => Ue(p.value).map((e) => ({
|
|
1404
1404
|
id: e,
|
|
1405
|
-
label:
|
|
1405
|
+
label: Ge(p.value, e, l.value)
|
|
1406
1406
|
}))), h = A(""), g = a(() => {
|
|
1407
1407
|
let e = h.value.trim().toLowerCase();
|
|
1408
1408
|
return e ? m.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : m.value;
|
|
@@ -1435,7 +1435,7 @@ var ln = [
|
|
|
1435
1435
|
"aria-haspopup": "dialog",
|
|
1436
1436
|
"aria-expanded": ee.value,
|
|
1437
1437
|
onMousedown: n[0] ||= _(() => {}, ["prevent"])
|
|
1438
|
-
}, [f(
|
|
1438
|
+
}, [f(M, {
|
|
1439
1439
|
name: "braces",
|
|
1440
1440
|
size: 16
|
|
1441
1441
|
})], 42, gn)) : E("", !0), m.value.length ? (y(), t("div", {
|
|
@@ -1474,7 +1474,7 @@ var ln = [
|
|
|
1474
1474
|
__name: "MergeTagView",
|
|
1475
1475
|
props: nn,
|
|
1476
1476
|
setup(e) {
|
|
1477
|
-
let t = e, { t: n, locale: r } = Xe(), i = d($e, a(() => ({}))), o = a(() => String(t.node.attrs.id ?? "")), s = a(() => i.value[o.value] !== void 0), c = a(() =>
|
|
1477
|
+
let t = e, { t: n, locale: r } = Xe(), i = d($e, a(() => ({}))), o = a(() => String(t.node.attrs.id ?? "")), s = a(() => i.value[o.value] !== void 0), c = a(() => Ge(i.value, o.value, r.value)), l = a(() => n("blocks.text.mergeTagChip", { name: c.value }));
|
|
1478
1478
|
return (e, t) => (y(), p(O($t), {
|
|
1479
1479
|
as: "span",
|
|
1480
1480
|
class: D(["merge-tag", { "is-unknown": !s.value }]),
|
|
@@ -1497,9 +1497,9 @@ var ln = [
|
|
|
1497
1497
|
//#endregion
|
|
1498
1498
|
//#region src/fontSizes.ts
|
|
1499
1499
|
function Tn(e) {
|
|
1500
|
-
return
|
|
1500
|
+
return Ce(e);
|
|
1501
1501
|
}
|
|
1502
|
-
var En = new Set(
|
|
1502
|
+
var En = new Set(Be.map(Tn));
|
|
1503
1503
|
function Dn(e) {
|
|
1504
1504
|
let t = e.trim();
|
|
1505
1505
|
return En.has(t) ? t : null;
|
|
@@ -1566,13 +1566,13 @@ function zn(e, t, n) {
|
|
|
1566
1566
|
if (r === "" || r === t.text) return;
|
|
1567
1567
|
let i = e.nodes[kn], a = i ? r.split("\n") : [r.replace(Nn, " ")], o = [];
|
|
1568
1568
|
for (let [n, r] of a.entries()) i && n > 0 && o.push(i.create()), o.push(...Bn(e, t, r));
|
|
1569
|
-
return
|
|
1569
|
+
return I.from(o);
|
|
1570
1570
|
}
|
|
1571
1571
|
function Bn(e, t, n) {
|
|
1572
|
-
let r = e.nodes[
|
|
1572
|
+
let r = e.nodes[Ye], i = [], a = 0;
|
|
1573
1573
|
for (let o of n.matchAll(jn)) {
|
|
1574
1574
|
let s = o[1] ?? "";
|
|
1575
|
-
r &&
|
|
1575
|
+
r && L.test(s) && (o.index > a && i.push(e.text(n.slice(a, o.index), t.marks)), i.push(r.create({ id: s }, null, t.tagMarks.get(s) ?? t.marks)), a = o.index + o[0].length);
|
|
1576
1576
|
}
|
|
1577
1577
|
return a < n.length && i.push(e.text(n.slice(a), t.marks)), i;
|
|
1578
1578
|
}
|
|
@@ -1591,15 +1591,15 @@ function Hn(e, t, n, r) {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
//#endregion
|
|
1593
1593
|
//#region src/panels/contentPanel/components/blocks/brandTypingStyle.ts
|
|
1594
|
-
var Un =
|
|
1594
|
+
var Un = R.create({
|
|
1595
1595
|
name: "brandTypingStyle",
|
|
1596
1596
|
addOptions() {
|
|
1597
1597
|
return { marks: () => [] };
|
|
1598
1598
|
},
|
|
1599
1599
|
addProseMirrorPlugins() {
|
|
1600
1600
|
let { marks: e } = this.options;
|
|
1601
|
-
return [new
|
|
1602
|
-
key: new
|
|
1601
|
+
return [new N({
|
|
1602
|
+
key: new P("brandTypingStyle"),
|
|
1603
1603
|
appendTransaction(t, n, r) {
|
|
1604
1604
|
let { selection: i, storedMarks: a, schema: o } = r;
|
|
1605
1605
|
if (a !== null || !i.empty) return null;
|
|
@@ -1636,13 +1636,13 @@ function Kn(e, t) {
|
|
|
1636
1636
|
var qn = /(?:\r\n?|\n)+/;
|
|
1637
1637
|
function Jn(e, t) {
|
|
1638
1638
|
let { schema: n, selection: r, storedMarks: i } = e, a = i ?? r.$from.marks(), o = Wn(e), s = t.split(qn).map((e) => o.type.create(o.attrs, e ? n.text(e, a) : null));
|
|
1639
|
-
return new
|
|
1639
|
+
return new H(I.from(s), 1, 1);
|
|
1640
1640
|
}
|
|
1641
1641
|
//#endregion
|
|
1642
1642
|
//#region src/panels/contentPanel/components/blocks/sanitizePastedFonts.ts
|
|
1643
1643
|
var Yn = "textStyle";
|
|
1644
1644
|
function Xn(e) {
|
|
1645
|
-
let t =
|
|
1645
|
+
let t = ke(e);
|
|
1646
1646
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1647
1647
|
}
|
|
1648
1648
|
function Zn(e, t) {
|
|
@@ -1662,30 +1662,30 @@ function $n(e, t) {
|
|
|
1662
1662
|
function er(e, t) {
|
|
1663
1663
|
let n = [];
|
|
1664
1664
|
for (let r = 0; r < e.childCount; r++) n.push($n(e.child(r), t));
|
|
1665
|
-
return
|
|
1665
|
+
return I.fromArray(n);
|
|
1666
1666
|
}
|
|
1667
1667
|
function tr(e, t) {
|
|
1668
|
-
return new
|
|
1668
|
+
return new H(er(e.content, t), e.openStart, e.openEnd);
|
|
1669
1669
|
}
|
|
1670
1670
|
//#endregion
|
|
1671
1671
|
//#region src/panels/contentPanel/components/blocks/selectAllText.ts
|
|
1672
|
-
var nr =
|
|
1672
|
+
var nr = R.create({
|
|
1673
1673
|
name: "selectAllText",
|
|
1674
1674
|
priority: 1e3,
|
|
1675
1675
|
addKeyboardShortcuts() {
|
|
1676
1676
|
return { "Mod-a": ({ editor: e }) => {
|
|
1677
1677
|
let { doc: t } = e.state;
|
|
1678
1678
|
return e.commands.setTextSelection({
|
|
1679
|
-
from:
|
|
1680
|
-
to:
|
|
1679
|
+
from: F.atStart(t).from,
|
|
1680
|
+
to: F.atEnd(t).to
|
|
1681
1681
|
});
|
|
1682
1682
|
} };
|
|
1683
1683
|
}
|
|
1684
|
-
}), rr =
|
|
1684
|
+
}), rr = R.create({
|
|
1685
1685
|
name: "keepEmptiedBlock",
|
|
1686
1686
|
addProseMirrorPlugins() {
|
|
1687
|
-
return [new
|
|
1688
|
-
key: new
|
|
1687
|
+
return [new N({
|
|
1688
|
+
key: new P("keepEmptiedBlock"),
|
|
1689
1689
|
filterTransaction(e) {
|
|
1690
1690
|
return e.docChanged && e.setMeta("preventClearDocument", !0), !0;
|
|
1691
1691
|
}
|
|
@@ -1758,28 +1758,28 @@ var nr = U.create({
|
|
|
1758
1758
|
"right",
|
|
1759
1759
|
"justify"
|
|
1760
1760
|
], ne = a(() => p(l.headerOnly ? "blocks.header.label" : "blocks.text.label")), S = en({
|
|
1761
|
-
...
|
|
1761
|
+
...Le,
|
|
1762
1762
|
editorProps: {
|
|
1763
1763
|
attributes: {
|
|
1764
1764
|
"aria-label": ne.value,
|
|
1765
1765
|
"aria-multiline": "true",
|
|
1766
1766
|
role: "textbox"
|
|
1767
1767
|
},
|
|
1768
|
-
transformPasted: (e) => tr(e,
|
|
1769
|
-
handlePaste: (e, t, n) =>
|
|
1768
|
+
transformPasted: (e) => tr(e, R.value),
|
|
1769
|
+
handlePaste: (e, t, n) => Y(t, n)
|
|
1770
1770
|
},
|
|
1771
|
-
content:
|
|
1771
|
+
content: de(o.value),
|
|
1772
1772
|
editable: l.editable,
|
|
1773
1773
|
extensions: [
|
|
1774
|
-
...(l.headerOnly ?
|
|
1774
|
+
...(l.headerOnly ? He : Fe).map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => an(wn) }) : e),
|
|
1775
1775
|
Yt,
|
|
1776
1776
|
nr,
|
|
1777
1777
|
rr,
|
|
1778
|
-
Un.configure({ marks:
|
|
1778
|
+
Un.configure({ marks: Ae }),
|
|
1779
1779
|
Kt.configure({ placeholder: () => p(l.headerOnly ? "blocks.header.placeholder" : "blocks.text.placeholder") })
|
|
1780
1780
|
],
|
|
1781
1781
|
onUpdate({ editor: e }) {
|
|
1782
|
-
o.value =
|
|
1782
|
+
o.value = et(e.getJSON()), N();
|
|
1783
1783
|
},
|
|
1784
1784
|
onSelectionUpdate() {
|
|
1785
1785
|
N();
|
|
@@ -1789,7 +1789,7 @@ var nr = U.create({
|
|
|
1789
1789
|
S.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1790
1790
|
}), h(o, (e) => {
|
|
1791
1791
|
let t = S.value;
|
|
1792
|
-
!t ||
|
|
1792
|
+
!t || De(e, et(t.getJSON())) || t.commands.setContent(de(e), { emitUpdate: !1 });
|
|
1793
1793
|
}), h(() => l.editable, (e) => S.value?.setEditable(e));
|
|
1794
1794
|
let w = b("root"), T = b("toolbar"), ae = b("content");
|
|
1795
1795
|
function se() {
|
|
@@ -1808,34 +1808,34 @@ var nr = U.create({
|
|
|
1808
1808
|
(r?.width !== n.width || r.height !== n.height) && (s.value = n);
|
|
1809
1809
|
}
|
|
1810
1810
|
let k, ue;
|
|
1811
|
-
function
|
|
1811
|
+
function j() {
|
|
1812
1812
|
let e = ae.value?.$el;
|
|
1813
1813
|
!(k && e) || e === ue || (ue && k.unobserve(ue), k.observe(e), ue = e);
|
|
1814
1814
|
}
|
|
1815
|
-
function
|
|
1815
|
+
function fe() {
|
|
1816
1816
|
n(() => {
|
|
1817
|
-
|
|
1817
|
+
j(), se();
|
|
1818
1818
|
});
|
|
1819
1819
|
}
|
|
1820
1820
|
c(() => {
|
|
1821
|
-
!l.editable || typeof ResizeObserver > "u" || (k = new ResizeObserver(se),
|
|
1821
|
+
!l.editable || typeof ResizeObserver > "u" || (k = new ResizeObserver(se), fe());
|
|
1822
1822
|
}), v(() => k?.disconnect()), h(() => [
|
|
1823
1823
|
l.width,
|
|
1824
1824
|
l.paragraphSpacing,
|
|
1825
1825
|
l.padding,
|
|
1826
1826
|
o.value
|
|
1827
|
-
],
|
|
1828
|
-
function
|
|
1827
|
+
], fe);
|
|
1828
|
+
function me() {
|
|
1829
1829
|
let e = T.value;
|
|
1830
1830
|
!e || e.matches(":popover-open") || (e.showPopover(), N());
|
|
1831
1831
|
}
|
|
1832
|
-
function
|
|
1832
|
+
function _e(e) {
|
|
1833
1833
|
let t = e.relatedTarget;
|
|
1834
1834
|
t instanceof Node && w.value?.contains(t) || T.value?.matches(":popover-open") && T.value.hidePopover();
|
|
1835
1835
|
}
|
|
1836
|
-
let
|
|
1837
|
-
function
|
|
1838
|
-
let e =
|
|
1836
|
+
let ye = d(ie, void 0);
|
|
1837
|
+
function xe() {
|
|
1838
|
+
let e = ye?.value?.getBoundingClientRect();
|
|
1839
1839
|
return {
|
|
1840
1840
|
top: Math.max(e?.top ?? 0, 0),
|
|
1841
1841
|
bottom: Math.min(e?.bottom ?? window.innerHeight, window.innerHeight)
|
|
@@ -1845,9 +1845,9 @@ var nr = U.create({
|
|
|
1845
1845
|
let e = S.value?.view, t = T.value, n = w.value;
|
|
1846
1846
|
if (!(e && t && n && t.matches(":popover-open"))) return;
|
|
1847
1847
|
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(Pr, window.innerWidth - Fr - Pr), o = Math.min(Math.max(i.left, Pr), a);
|
|
1848
|
-
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - Pr}px`, t.style.top = `${
|
|
1848
|
+
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - Pr}px`, t.style.top = `${Ve(i.top, t.offsetHeight, xe())}px`;
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1850
|
+
function Ce(e) {
|
|
1851
1851
|
let t = {
|
|
1852
1852
|
capture: !0,
|
|
1853
1853
|
passive: !0
|
|
@@ -1856,38 +1856,38 @@ var nr = U.create({
|
|
|
1856
1856
|
e ? window.addEventListener("resize", N) : window.removeEventListener("resize", N);
|
|
1857
1857
|
}
|
|
1858
1858
|
function P(e) {
|
|
1859
|
-
|
|
1859
|
+
Ce(e.newState === "open");
|
|
1860
1860
|
}
|
|
1861
|
-
v(() =>
|
|
1862
|
-
function
|
|
1861
|
+
v(() => Ce(!1));
|
|
1862
|
+
function Te() {
|
|
1863
1863
|
let e = S.value;
|
|
1864
1864
|
if (!e) return l.headerOnly ? "h1" : "paragraph";
|
|
1865
|
-
let t =
|
|
1865
|
+
let t = We.find((t) => e.isActive("heading", { level: t }));
|
|
1866
1866
|
return t ? `h${t}` : "paragraph";
|
|
1867
1867
|
}
|
|
1868
|
-
function
|
|
1868
|
+
function F(e) {
|
|
1869
1869
|
let { target: t } = e;
|
|
1870
1870
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1871
1871
|
let n = S.value?.chain().focus();
|
|
1872
1872
|
if (!n) return;
|
|
1873
|
-
let r =
|
|
1873
|
+
let r = We.find((e) => `h${e}` === t.value);
|
|
1874
1874
|
r ? n.setHeading({ level: r }).run() : l.headerOnly || n.setParagraph().run();
|
|
1875
1875
|
}
|
|
1876
|
-
let I = d(oe, a(() =>
|
|
1877
|
-
function
|
|
1878
|
-
let e =
|
|
1879
|
-
return
|
|
1876
|
+
let I = d(oe, a(() => Ze)), Oe = d(je, void 0);
|
|
1877
|
+
function Ae() {
|
|
1878
|
+
let e = Oe?.value;
|
|
1879
|
+
return ve(l.headerOnly ? e?.header : e?.text, I.value);
|
|
1880
1880
|
}
|
|
1881
|
-
let
|
|
1881
|
+
let L = Me(), R = a(() => new Set(L.value.map((e) => e.stack)));
|
|
1882
1882
|
function z(e) {
|
|
1883
1883
|
return `custom:${e}`;
|
|
1884
1884
|
}
|
|
1885
1885
|
function B(e) {
|
|
1886
1886
|
if (typeof e != "string") return I.value;
|
|
1887
|
-
let t =
|
|
1888
|
-
return t ? z(t.name) :
|
|
1887
|
+
let t = L.value.find((t) => t.stack === e);
|
|
1888
|
+
return t ? z(t.name) : ke(e)?.key ?? I.value;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Re() {
|
|
1891
1891
|
let e = S.value;
|
|
1892
1892
|
if (!e) return I.value;
|
|
1893
1893
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
@@ -1901,62 +1901,62 @@ var nr = U.create({
|
|
|
1901
1901
|
let a = Array.from(i);
|
|
1902
1902
|
return a.length > 1 ? "mixed" : a[0] ?? I.value;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function V(e) {
|
|
1905
1905
|
let { target: t } = e;
|
|
1906
1906
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1907
1907
|
let n = t.value, r = S.value?.chain().focus();
|
|
1908
1908
|
if (!r) return;
|
|
1909
|
-
let i =
|
|
1909
|
+
let i = L.value.find((e) => z(e.name) === n);
|
|
1910
1910
|
if (i) {
|
|
1911
1911
|
r.setFontFamily(i.stack).run();
|
|
1912
1912
|
return;
|
|
1913
1913
|
}
|
|
1914
|
-
|
|
1914
|
+
pe(n) && (n === I.value ? r.unsetFontFamily().run() : r.setFontFamily(ge(n)).run());
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function Ue(e) {
|
|
1917
1917
|
return typeof e == "string" && On(e) ? e : "";
|
|
1918
1918
|
}
|
|
1919
|
-
function
|
|
1919
|
+
function Ge() {
|
|
1920
1920
|
let e = S.value;
|
|
1921
1921
|
if (!e) return "";
|
|
1922
1922
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1923
|
-
if (r) return
|
|
1923
|
+
if (r) return Ue(e.getAttributes("textStyle").fontSize);
|
|
1924
1924
|
let i = /* @__PURE__ */ new Set();
|
|
1925
1925
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1926
1926
|
if (!e.isText) return;
|
|
1927
1927
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1928
|
-
i.add(
|
|
1928
|
+
i.add(Ue(t?.attrs.fontSize));
|
|
1929
1929
|
});
|
|
1930
1930
|
let a = Array.from(i);
|
|
1931
1931
|
return a.length > 1 ? "mixed" : a[0] ?? "";
|
|
1932
1932
|
}
|
|
1933
|
-
function
|
|
1933
|
+
function Qe(e) {
|
|
1934
1934
|
let { target: t } = e;
|
|
1935
1935
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1936
1936
|
let n = S.value?.chain().focus();
|
|
1937
1937
|
n && (t.value === "" ? n.unsetFontSize().run() : On(t.value) && n.setFontSize(t.value).run());
|
|
1938
1938
|
}
|
|
1939
|
-
let
|
|
1940
|
-
let e =
|
|
1941
|
-
return
|
|
1942
|
-
}),
|
|
1939
|
+
let $e = Ke(() => {
|
|
1940
|
+
let e = Re();
|
|
1941
|
+
return pe(e) ? e : void 0;
|
|
1942
|
+
}), tt = a({
|
|
1943
1943
|
get: () => {
|
|
1944
|
-
let e = S.value?.getAttributes("textStyle").color, t = typeof e == "string" ?
|
|
1944
|
+
let e = S.value?.getAttributes("textStyle").color, t = typeof e == "string" ? Se(e) : void 0;
|
|
1945
1945
|
return t ? {
|
|
1946
1946
|
type: "color",
|
|
1947
1947
|
...t
|
|
1948
|
-
} :
|
|
1948
|
+
} : we;
|
|
1949
1949
|
},
|
|
1950
1950
|
set: (e) => {
|
|
1951
|
-
e.type !== "transparent" && S.value?.chain().setColor(
|
|
1951
|
+
e.type !== "transparent" && S.value?.chain().setColor(Ee(e)).run();
|
|
1952
1952
|
}
|
|
1953
|
-
}),
|
|
1953
|
+
}), rt = {
|
|
1954
1954
|
left: "blocks.text.alignLeft",
|
|
1955
1955
|
center: "blocks.text.alignCenter",
|
|
1956
1956
|
right: "blocks.text.alignRight",
|
|
1957
1957
|
justify: "blocks.text.alignJustify"
|
|
1958
1958
|
};
|
|
1959
|
-
function
|
|
1959
|
+
function H(e) {
|
|
1960
1960
|
return (e === "justify" ? [
|
|
1961
1961
|
14,
|
|
1962
1962
|
14,
|
|
@@ -1976,85 +1976,85 @@ var nr = U.create({
|
|
|
1976
1976
|
};
|
|
1977
1977
|
});
|
|
1978
1978
|
}
|
|
1979
|
-
let
|
|
1980
|
-
function
|
|
1979
|
+
let it = te(), U = b("linkPopover"), ot = b("linkInput"), W = b("linkTrigger"), G = A(""), st = A(!1), ct = A(!1);
|
|
1980
|
+
function lt(e) {
|
|
1981
1981
|
if (e.newState !== "open") return;
|
|
1982
1982
|
let t = S.value?.getAttributes("link")?.href;
|
|
1983
|
-
|
|
1984
|
-
let n =
|
|
1983
|
+
G.value = typeof t == "string" ? t : "", ct.value = G.value !== "";
|
|
1984
|
+
let n = U.value, r = W.value?.getBoundingClientRect();
|
|
1985
1985
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1986
1986
|
}
|
|
1987
|
-
function
|
|
1988
|
-
if (
|
|
1989
|
-
let t =
|
|
1987
|
+
function ut(e) {
|
|
1988
|
+
if (st.value = e.newState === "open", e.newState !== "open") return;
|
|
1989
|
+
let t = U.value;
|
|
1990
1990
|
if (t) {
|
|
1991
1991
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1992
1992
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1993
1993
|
}
|
|
1994
1994
|
n(() => {
|
|
1995
|
-
|
|
1995
|
+
ot.value?.focus(), ot.value?.select();
|
|
1996
1996
|
});
|
|
1997
1997
|
}
|
|
1998
|
-
function
|
|
1999
|
-
let t = e.relatedTarget, n =
|
|
1998
|
+
function dt(e) {
|
|
1999
|
+
let t = e.relatedTarget, n = U.value;
|
|
2000
2000
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
2001
2001
|
}
|
|
2002
|
-
function
|
|
2002
|
+
function K() {
|
|
2003
2003
|
let e = S.value?.chain().focus();
|
|
2004
2004
|
if (!e) return;
|
|
2005
|
-
let t = qe(
|
|
2005
|
+
let t = qe(G.value);
|
|
2006
2006
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
2007
2007
|
href: t,
|
|
2008
2008
|
target: t.startsWith("#") ? null : "_blank"
|
|
2009
|
-
}).run(),
|
|
2009
|
+
}).run(), U.value?.hidePopover();
|
|
2010
2010
|
}
|
|
2011
|
-
let
|
|
2012
|
-
function
|
|
2013
|
-
e === "" ?
|
|
2011
|
+
let ft = d(ce, a(() => [])), pt = a(() => G.value.startsWith("#") && ft.value.includes(G.value.slice(1)) ? G.value.slice(1) : "");
|
|
2012
|
+
function mt(e) {
|
|
2013
|
+
e === "" ? G.value.startsWith("#") && (G.value = "") : G.value = `#${e}`;
|
|
2014
2014
|
}
|
|
2015
|
-
function
|
|
2016
|
-
S.value?.chain().focus().unsetLink().run(),
|
|
2015
|
+
function ht() {
|
|
2016
|
+
S.value?.chain().focus().unsetLink().run(), U.value?.hidePopover();
|
|
2017
2017
|
}
|
|
2018
|
-
let
|
|
2019
|
-
function
|
|
2020
|
-
let n = S.value, r =
|
|
2021
|
-
return n && r && i && Gn(n.state, t) ? (
|
|
2018
|
+
let q = b("pastePrompt"), gt = b("pasteKeep"), _t = te(), J;
|
|
2019
|
+
function Y(e, t) {
|
|
2020
|
+
let n = S.value, r = q.value, i = e.clipboardData?.getData("text/plain") ?? "";
|
|
2021
|
+
return n && r && i && Gn(n.state, t) ? (J = {
|
|
2022
2022
|
slice: t,
|
|
2023
2023
|
text: i
|
|
2024
|
-
}, r.showPopover(),
|
|
2024
|
+
}, r.showPopover(), vt(n.view, r), gt.value?.focus(), !0) : !1;
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function vt(e, t) {
|
|
2027
2027
|
let n = e.coordsAtPos(e.state.selection.from), r = Ie(n, window.innerHeight), i = window.innerWidth - t.offsetWidth - 8;
|
|
2028
2028
|
t.style.left = `${Math.max(8, Math.min(n.left, i))}px`, t.style.top = r.side === "below" ? `${r.offset + 4}px` : "auto", t.style.bottom = r.side === "above" ? `${r.offset + 4}px` : "auto";
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2031
|
-
let t =
|
|
2032
|
-
|
|
2030
|
+
function X(e) {
|
|
2031
|
+
let t = J;
|
|
2032
|
+
J = void 0;
|
|
2033
2033
|
let n = S.value;
|
|
2034
2034
|
if (t && n && !n.isDestroyed) {
|
|
2035
2035
|
let { view: r } = n;
|
|
2036
2036
|
r.focus(), r.dispatch(Kn(r.state, e ? t.slice : Jn(r.state, t.text)));
|
|
2037
2037
|
}
|
|
2038
|
-
|
|
2038
|
+
yt();
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2041
|
-
|
|
2040
|
+
function Z() {
|
|
2041
|
+
J = void 0, S.value?.view.focus(), yt();
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2044
|
-
|
|
2043
|
+
function yt() {
|
|
2044
|
+
q.value?.matches(":popover-open") && q.value.hidePopover();
|
|
2045
2045
|
}
|
|
2046
|
-
function
|
|
2046
|
+
function bt(e) {
|
|
2047
2047
|
let t = e.relatedTarget;
|
|
2048
|
-
t instanceof Node &&
|
|
2048
|
+
t instanceof Node && q.value?.contains(t) || (J = void 0, yt());
|
|
2049
2049
|
}
|
|
2050
|
-
let
|
|
2051
|
-
async function
|
|
2052
|
-
let t = S.value, n =
|
|
2053
|
-
if (!(t && n) ||
|
|
2050
|
+
let xt = d(nt), St = he(), Ct = a(() => cn(xt?.value?.ai)), wt = A(!1);
|
|
2051
|
+
async function Tt(e) {
|
|
2052
|
+
let t = S.value, n = xt?.value?.ai;
|
|
2053
|
+
if (!(t && n) || wt.value) return;
|
|
2054
2054
|
let r = In(t.state.doc, t.state.selection);
|
|
2055
2055
|
if (r.length === 0) return;
|
|
2056
|
-
|
|
2057
|
-
let i = new
|
|
2056
|
+
wt.value = !0;
|
|
2057
|
+
let i = new be(), a = ({ transaction: e, appendedTransactions: t }) => {
|
|
2058
2058
|
for (let n of [e, ...t]) i.appendMapping(n.mapping);
|
|
2059
2059
|
};
|
|
2060
2060
|
t.on("transaction", a);
|
|
@@ -2069,14 +2069,14 @@ var nr = U.create({
|
|
|
2069
2069
|
e && t.view.dispatch(e);
|
|
2070
2070
|
}
|
|
2071
2071
|
} catch (e) {
|
|
2072
|
-
console.error("[bygga-editor] the AI action failed —", e),
|
|
2072
|
+
console.error("[bygga-editor] the AI action failed —", e), St?.show(p("blocks.text.ai.failed"));
|
|
2073
2073
|
} finally {
|
|
2074
|
-
t.off("transaction", a),
|
|
2074
|
+
t.off("transaction", a), wt.value = !1;
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function Et(e) {
|
|
2078
2078
|
S.value?.chain().focus().insertContent({
|
|
2079
|
-
type:
|
|
2079
|
+
type: Ye,
|
|
2080
2080
|
attrs: { id: e }
|
|
2081
2081
|
}).run();
|
|
2082
2082
|
}
|
|
@@ -2087,10 +2087,10 @@ var nr = U.create({
|
|
|
2087
2087
|
position: "relative",
|
|
2088
2088
|
width: "100%"
|
|
2089
2089
|
},
|
|
2090
|
-
onFocusin:
|
|
2091
|
-
onFocusout:
|
|
2090
|
+
onFocusin: me,
|
|
2091
|
+
onFocusout: _e
|
|
2092
2092
|
}, [
|
|
2093
|
-
f(O(
|
|
2093
|
+
f(O(at), {
|
|
2094
2094
|
width: l.width,
|
|
2095
2095
|
align: l.align
|
|
2096
2096
|
}, {
|
|
@@ -2102,7 +2102,7 @@ var nr = U.create({
|
|
|
2102
2102
|
"text-spaced": l.paragraphSpacing !== void 0
|
|
2103
2103
|
}),
|
|
2104
2104
|
editor: O(S),
|
|
2105
|
-
style: re([O(
|
|
2105
|
+
style: re([O(Ne)(l), l.paragraphSpacing === void 0 ? void 0 : { "--bygga-paragraph-spacing": `${l.paragraphSpacing}px` }])
|
|
2106
2106
|
}, null, 8, [
|
|
2107
2107
|
"class",
|
|
2108
2108
|
"editor",
|
|
@@ -2121,13 +2121,13 @@ var nr = U.create({
|
|
|
2121
2121
|
i("span", ir, [i("select", {
|
|
2122
2122
|
"aria-label": O(p)("blocks.text.styleLabel"),
|
|
2123
2123
|
class: "style",
|
|
2124
|
-
value:
|
|
2125
|
-
onChange:
|
|
2124
|
+
value: Te(),
|
|
2125
|
+
onChange: F,
|
|
2126
2126
|
onMousedown: n[0] ||= _(() => {}, ["stop"])
|
|
2127
|
-
}, [l.headerOnly ? E("", !0) : (y(), t("option", or, x(O(p)("blocks.text.styleNormal")), 1)), (y(!0), t(r, null, u(O(
|
|
2127
|
+
}, [l.headerOnly ? E("", !0) : (y(), t("option", or, x(O(p)("blocks.text.styleNormal")), 1)), (y(!0), t(r, null, u(O(We), (e) => (y(), t("option", {
|
|
2128
2128
|
key: e,
|
|
2129
2129
|
value: `h${e}`
|
|
2130
|
-
}, x(O(p)("blocks.text.styleHeading", { level: e })), 9, sr))), 128))], 40, ar), f(
|
|
2130
|
+
}, x(O(p)("blocks.text.styleHeading", { level: e })), 9, sr))), 128))], 40, ar), f(M, {
|
|
2131
2131
|
class: "picker-chevron",
|
|
2132
2132
|
name: "chevron-down",
|
|
2133
2133
|
size: 12
|
|
@@ -2136,20 +2136,20 @@ var nr = U.create({
|
|
|
2136
2136
|
i("span", cr, [i("select", {
|
|
2137
2137
|
"aria-label": O(p)("blocks.text.font"),
|
|
2138
2138
|
class: "font",
|
|
2139
|
-
value:
|
|
2140
|
-
onChange:
|
|
2139
|
+
value: Re(),
|
|
2140
|
+
onChange: V,
|
|
2141
2141
|
onMousedown: n[1] ||= _(() => {}, ["stop"])
|
|
2142
2142
|
}, [
|
|
2143
2143
|
i("option", ur, x(O(p)("blocks.text.fontMixed")), 1),
|
|
2144
|
-
(y(!0), t(r, null, u(O(
|
|
2144
|
+
(y(!0), t(r, null, u(O($e), (e) => (y(), t("option", {
|
|
2145
2145
|
key: e.key,
|
|
2146
2146
|
value: e.key
|
|
2147
2147
|
}, x(e.name), 9, dr))), 128)),
|
|
2148
|
-
(y(!0), t(r, null, u(O(
|
|
2148
|
+
(y(!0), t(r, null, u(O(L), (e) => (y(), t("option", {
|
|
2149
2149
|
key: z(e.name),
|
|
2150
2150
|
value: z(e.name)
|
|
2151
2151
|
}, x(e.name), 9, fr))), 128))
|
|
2152
|
-
], 40, lr), f(
|
|
2152
|
+
], 40, lr), f(M, {
|
|
2153
2153
|
class: "picker-chevron",
|
|
2154
2154
|
name: "chevron-down",
|
|
2155
2155
|
size: 12
|
|
@@ -2157,24 +2157,24 @@ var nr = U.create({
|
|
|
2157
2157
|
i("span", pr, [i("select", {
|
|
2158
2158
|
"aria-label": O(p)("blocks.text.fontSize"),
|
|
2159
2159
|
class: "size",
|
|
2160
|
-
value:
|
|
2161
|
-
onChange:
|
|
2160
|
+
value: Ge(),
|
|
2161
|
+
onChange: Qe,
|
|
2162
2162
|
onMousedown: n[2] ||= _(() => {}, ["stop"])
|
|
2163
2163
|
}, [
|
|
2164
2164
|
i("option", hr, x(O(p)("blocks.text.fontMixed")), 1),
|
|
2165
2165
|
i("option", gr, x(O(p)("blocks.text.fontSizeDefault")), 1),
|
|
2166
|
-
(y(!0), t(r, null, u(O(
|
|
2166
|
+
(y(!0), t(r, null, u(O(Be), (e) => (y(), t("option", {
|
|
2167
2167
|
key: e,
|
|
2168
2168
|
value: O(Tn)(e)
|
|
2169
2169
|
}, x(e), 9, _r))), 128))
|
|
2170
|
-
], 40, mr), f(
|
|
2170
|
+
], 40, mr), f(M, {
|
|
2171
2171
|
class: "picker-chevron",
|
|
2172
2172
|
name: "chevron-down",
|
|
2173
2173
|
size: 12
|
|
2174
2174
|
})]),
|
|
2175
2175
|
f(Je, {
|
|
2176
|
-
modelValue:
|
|
2177
|
-
"onUpdate:modelValue": n[3] ||= (e) =>
|
|
2176
|
+
modelValue: tt.value,
|
|
2177
|
+
"onUpdate:modelValue": n[3] ||= (e) => tt.value = e,
|
|
2178
2178
|
"allow-transparent": !1,
|
|
2179
2179
|
label: O(p)("blocks.text.textColor"),
|
|
2180
2180
|
compact: "",
|
|
@@ -2208,55 +2208,55 @@ var nr = U.create({
|
|
|
2208
2208
|
}, [...n[23] ||= [i("u", null, "U", -1)]], 42, br),
|
|
2209
2209
|
i("button", {
|
|
2210
2210
|
ref_key: "linkTrigger",
|
|
2211
|
-
ref:
|
|
2211
|
+
ref: W,
|
|
2212
2212
|
class: D({ active: O(S)?.isActive("link") }),
|
|
2213
2213
|
type: "button",
|
|
2214
2214
|
title: O(p)("blocks.text.link"),
|
|
2215
|
-
popovertarget: O(
|
|
2215
|
+
popovertarget: O(it),
|
|
2216
2216
|
"aria-haspopup": "dialog",
|
|
2217
|
-
"aria-expanded":
|
|
2217
|
+
"aria-expanded": st.value,
|
|
2218
2218
|
onMousedown: n[11] ||= _(() => {}, ["prevent"])
|
|
2219
|
-
}, [f(
|
|
2219
|
+
}, [f(M, {
|
|
2220
2220
|
name: "link",
|
|
2221
2221
|
size: 16
|
|
2222
2222
|
})], 42, xr),
|
|
2223
2223
|
l.editable ? (y(), t("div", {
|
|
2224
2224
|
key: 0,
|
|
2225
|
-
id: O(
|
|
2225
|
+
id: O(it),
|
|
2226
2226
|
ref_key: "linkPopover",
|
|
2227
|
-
ref:
|
|
2227
|
+
ref: U,
|
|
2228
2228
|
class: "link-popover",
|
|
2229
2229
|
popover: "",
|
|
2230
2230
|
role: "dialog",
|
|
2231
2231
|
"aria-label": O(p)("blocks.text.link"),
|
|
2232
|
-
onBeforetoggle:
|
|
2233
|
-
onToggle:
|
|
2234
|
-
onFocusout:
|
|
2232
|
+
onBeforetoggle: lt,
|
|
2233
|
+
onToggle: ut,
|
|
2234
|
+
onFocusout: dt
|
|
2235
2235
|
}, [
|
|
2236
2236
|
i("span", Cr, [f(Pe, {
|
|
2237
2237
|
ref_key: "linkInput",
|
|
2238
|
-
ref:
|
|
2239
|
-
modelValue:
|
|
2240
|
-
"onUpdate:modelValue": n[12] ||= (e) =>
|
|
2238
|
+
ref: ot,
|
|
2239
|
+
modelValue: G.value,
|
|
2240
|
+
"onUpdate:modelValue": n[12] ||= (e) => G.value = e,
|
|
2241
2241
|
inputmode: "url",
|
|
2242
2242
|
spellcheck: "false",
|
|
2243
2243
|
autocomplete: "off",
|
|
2244
2244
|
placeholder: O(p)("blocks.text.linkPlaceholder"),
|
|
2245
2245
|
"aria-label": O(p)("blocks.text.linkPrompt"),
|
|
2246
|
-
onKeydown: le(_(
|
|
2246
|
+
onKeydown: le(_(K, ["prevent"]), ["enter"])
|
|
2247
2247
|
}, null, 8, [
|
|
2248
2248
|
"modelValue",
|
|
2249
2249
|
"placeholder",
|
|
2250
2250
|
"aria-label",
|
|
2251
2251
|
"onKeydown"
|
|
2252
2252
|
])]),
|
|
2253
|
-
O(
|
|
2253
|
+
O(ft).length ? (y(), t("span", wr, [f(ze, {
|
|
2254
2254
|
"aria-label": O(p)("blocks.common.anchorLink.label"),
|
|
2255
|
-
"model-value":
|
|
2256
|
-
"onUpdate:modelValue":
|
|
2255
|
+
"model-value": pt.value,
|
|
2256
|
+
"onUpdate:modelValue": mt,
|
|
2257
2257
|
onMousedown: n[13] ||= _(() => {}, ["stop"])
|
|
2258
2258
|
}, {
|
|
2259
|
-
default: C(() => [
|
|
2259
|
+
default: C(() => [pt.value ? (y(), t("option", Tr, x(O(p)("blocks.common.anchorLink.none")), 1)) : (y(), t("option", Er, x(O(p)("blocks.common.anchorLink.placeholder")), 1)), (y(!0), t(r, null, u(O(ft), (e) => (y(), t("option", {
|
|
2260
2260
|
key: e,
|
|
2261
2261
|
value: e
|
|
2262
2262
|
}, " #" + x(e), 9, Dr))), 128))]),
|
|
@@ -2265,37 +2265,37 @@ var nr = U.create({
|
|
|
2265
2265
|
i("button", {
|
|
2266
2266
|
class: "link-apply",
|
|
2267
2267
|
type: "button",
|
|
2268
|
-
onClick:
|
|
2268
|
+
onClick: K,
|
|
2269
2269
|
onMousedown: n[14] ||= _(() => {}, ["prevent"])
|
|
2270
2270
|
}, x(O(p)("blocks.text.linkApply")), 33),
|
|
2271
|
-
|
|
2271
|
+
ct.value ? (y(), t("button", {
|
|
2272
2272
|
key: 1,
|
|
2273
2273
|
class: "link-remove",
|
|
2274
2274
|
type: "button",
|
|
2275
2275
|
title: O(p)("blocks.text.linkRemove"),
|
|
2276
2276
|
"aria-label": O(p)("blocks.text.linkRemove"),
|
|
2277
|
-
onClick:
|
|
2277
|
+
onClick: ht,
|
|
2278
2278
|
onMousedown: n[15] ||= _(() => {}, ["prevent"])
|
|
2279
|
-
}, [f(
|
|
2279
|
+
}, [f(M, {
|
|
2280
2280
|
name: "trash",
|
|
2281
2281
|
size: 16
|
|
2282
2282
|
})], 40, Or)) : E("", !0)
|
|
2283
2283
|
], 40, Sr)) : E("", !0),
|
|
2284
|
-
f(Cn, { onSelect:
|
|
2284
|
+
f(Cn, { onSelect: Et }),
|
|
2285
2285
|
f(hn, {
|
|
2286
|
-
actions:
|
|
2287
|
-
pending:
|
|
2288
|
-
onSelect:
|
|
2286
|
+
actions: Ct.value,
|
|
2287
|
+
pending: wt.value,
|
|
2288
|
+
onSelect: Tt
|
|
2289
2289
|
}, null, 8, ["actions", "pending"]),
|
|
2290
2290
|
n[26] ||= i("span", { class: "divider" }, null, -1),
|
|
2291
2291
|
(y(), t(r, null, u(g, (e) => i("button", {
|
|
2292
2292
|
key: e,
|
|
2293
2293
|
class: D({ active: O(S)?.isActive({ textAlign: e }) }),
|
|
2294
|
-
title: O(p)(
|
|
2294
|
+
title: O(p)(rt[e]),
|
|
2295
2295
|
type: "button",
|
|
2296
2296
|
onClick: (t) => O(S)?.chain().focus().setTextAlign(e).run(),
|
|
2297
2297
|
onMousedown: n[16] ||= _(() => {}, ["prevent"])
|
|
2298
|
-
}, [(y(), t("svg", Ar, [(y(!0), t(r, null, u(
|
|
2298
|
+
}, [(y(), t("svg", Ar, [(y(!0), t(r, null, u(H(e), (e, n) => (y(), t("rect", {
|
|
2299
2299
|
key: n,
|
|
2300
2300
|
fill: "currentColor",
|
|
2301
2301
|
height: "1.5",
|
|
@@ -2308,28 +2308,28 @@ var nr = U.create({
|
|
|
2308
2308
|
l.editable ? (y(), t("div", {
|
|
2309
2309
|
key: 1,
|
|
2310
2310
|
ref_key: "pastePrompt",
|
|
2311
|
-
ref:
|
|
2311
|
+
ref: q,
|
|
2312
2312
|
popover: "manual",
|
|
2313
2313
|
class: "paste-prompt",
|
|
2314
2314
|
role: "dialog",
|
|
2315
2315
|
tabindex: "-1",
|
|
2316
|
-
"aria-labelledby": O(
|
|
2317
|
-
onKeydown: le(_(
|
|
2318
|
-
onFocusout:
|
|
2316
|
+
"aria-labelledby": O(_t),
|
|
2317
|
+
onKeydown: le(_(Z, ["stop", "prevent"]), ["esc"]),
|
|
2318
|
+
onFocusout: bt
|
|
2319
2319
|
}, [
|
|
2320
|
-
i("span", { id: O(
|
|
2320
|
+
i("span", { id: O(_t) }, x(O(p)("blocks.text.pastePrompt.question")), 9, Nr),
|
|
2321
2321
|
i("button", {
|
|
2322
2322
|
ref_key: "pasteKeep",
|
|
2323
|
-
ref:
|
|
2323
|
+
ref: gt,
|
|
2324
2324
|
class: "paste-keep",
|
|
2325
2325
|
type: "button",
|
|
2326
|
-
onClick: n[17] ||= (e) =>
|
|
2326
|
+
onClick: n[17] ||= (e) => X(!0),
|
|
2327
2327
|
onMousedown: n[18] ||= _(() => {}, ["prevent"])
|
|
2328
2328
|
}, x(O(p)("blocks.text.pastePrompt.keep")), 545),
|
|
2329
2329
|
i("button", {
|
|
2330
2330
|
class: "paste-plain",
|
|
2331
2331
|
type: "button",
|
|
2332
|
-
onClick: n[19] ||= (e) =>
|
|
2332
|
+
onClick: n[19] ||= (e) => X(!1),
|
|
2333
2333
|
onMousedown: n[20] ||= _(() => {}, ["prevent"])
|
|
2334
2334
|
}, x(O(p)("blocks.text.pastePrompt.plain")), 33)
|
|
2335
2335
|
], 40, Mr)) : E("", !0)
|