@bygga.dev/editor 1.9.11 → 1.9.12
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 +9 -3
- package/{TextEditor-DoE89_QB.js → TextEditor-DQ9MlOvk.js} +560 -545
- package/bygga-editor.js +1526 -1531
- package/package.json +1 -1
- package/{urls-CkV6bAHz.js → urls-DQuXPDSt.js} +180 -173
|
@@ -1,7 +1,7 @@
|
|
|
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 ee, S as g, V as _, W as v, X as te, Y as ne, Z as y, _t as b, ct as
|
|
2
|
-
import {
|
|
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 ee, S as g, V as _, W as v, X as te, Y as ne, Z as y, _t as b, ct as re, dt as x, et as S, g as C, gt as ie, j as w, k as T, mt as E, n as ae, nt as oe, o as se, ot as ce, pt as D, q as O, t as le, ut as k, x as ue } from "./providerKeys-ZUO3LJ3M.js";
|
|
2
|
+
import { An as de, At as A, Bt as j, Cn as fe, Ct as pe, D as M, Dn as me, Dt as he, E as ge, En as _e, Et as ve, Ft as N, I as ye, In as be, It as P, Lt as F, Mt as I, Nt as xe, On as Se, Ot as Ce, P as we, Pn as Te, Pt as L, Rt as Ee, St as R, Tn as De, Tt as Oe, Vt as z, _ as ke, _t as Ae, bt as je, c as Me, d as Ne, et as Pe, gt as Fe, h as Ie, ht as Le, j as B, jt as V, kn as Re, kt as ze, l as Be, lt as Ve, m as He, n as Ue, r as We, s as Ge, t as Ke, tt as qe, u as Je, ut as Ye, vt as Xe, w as Ze, wn as Qe, wt as $e, x as et, xt as tt, y as nt, yt as rt, zt as it } from "./urls-DQuXPDSt.js";
|
|
3
3
|
//#region ../core/src/render/TextShell.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var at = ["align"], ot = /* @__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" ? (v(), t("div", {
|
|
13
13
|
key: 0,
|
|
14
|
-
style:
|
|
14
|
+
style: ie(D(Pe)(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:
|
|
21
|
-
}, [i("tbody", null, [i("tr", null, [i("td", null, [
|
|
20
|
+
style: ie(D(qe)())
|
|
21
|
+
}, [i("tbody", null, [i("tr", null, [i("td", null, [O(e.$slots, "default")])])])], 12, at)], 4)) : O(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
|
|
26
|
+
function H(e = {}) {
|
|
27
27
|
return new L({ view(t) {
|
|
28
|
-
return new
|
|
28
|
+
return new st(t, e);
|
|
29
29
|
} });
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var st = 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 = it(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
|
+
}, U = class e extends P {
|
|
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) : P.near(r);
|
|
129
129
|
}
|
|
130
130
|
content() {
|
|
131
|
-
return
|
|
131
|
+
return z.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 W(this.anchor);
|
|
148
148
|
}
|
|
149
149
|
static valid(e) {
|
|
150
150
|
let t = e.parent;
|
|
151
|
-
if (t.inlineContent || !
|
|
151
|
+
if (t.inlineContent || !lt(e) || !ut(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 && !xe.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
|
+
U.prototype.visible = !1, U.findFrom = U.findGapCursorFrom, P.jsonID("gapcursor", U);
|
|
189
|
+
var W = 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 U.valid(t) ? new U(t) : P.near(t);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
function
|
|
201
|
+
function ct(e) {
|
|
202
202
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function lt(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 || ct(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 ut(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 || ct(e.type)) return !0;
|
|
227
227
|
if (e.inlineContent) return !1;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
return !0;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function dt() {
|
|
233
233
|
return new L({ props: {
|
|
234
|
-
decorations:
|
|
234
|
+
decorations: ht,
|
|
235
235
|
createSelectionBetween(e, t, n) {
|
|
236
|
-
return t.pos == n.pos &&
|
|
236
|
+
return t.pos == n.pos && U.valid(n) ? new U(n) : null;
|
|
237
237
|
},
|
|
238
|
-
handleClick:
|
|
239
|
-
handleKeyDown:
|
|
240
|
-
handleDOMEvents: { beforeinput:
|
|
238
|
+
handleClick: pt,
|
|
239
|
+
handleKeyDown: ft,
|
|
240
|
+
handleDOMEvents: { beforeinput: mt }
|
|
241
241
|
} });
|
|
242
242
|
}
|
|
243
|
-
var
|
|
244
|
-
ArrowLeft:
|
|
245
|
-
ArrowRight:
|
|
246
|
-
ArrowUp:
|
|
247
|
-
ArrowDown:
|
|
243
|
+
var ft = A({
|
|
244
|
+
ArrowLeft: G("horiz", -1),
|
|
245
|
+
ArrowRight: G("horiz", 1),
|
|
246
|
+
ArrowUp: G("vert", -1),
|
|
247
|
+
ArrowDown: G("vert", 1)
|
|
248
248
|
});
|
|
249
|
-
function
|
|
249
|
+
function G(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 F) {
|
|
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 = U.findGapCursorFrom(o, t, s);
|
|
258
|
+
return c ? (r && r(e.tr.setSelection(new U(c))), !0) : !1;
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function pt(e, t, n) {
|
|
262
262
|
if (!e || !e.editable) return !1;
|
|
263
263
|
let r = e.state.doc.resolve(t);
|
|
264
|
-
if (!
|
|
264
|
+
if (!U.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 && xe.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new U(r))), !0);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
271
|
+
function mt(e, t) {
|
|
272
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof U)) 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 = j.empty;
|
|
276
|
+
for (let e = r.length - 1; e >= 0; e--) i = j.from(r[e].createAndFill(null, i));
|
|
277
|
+
let a = e.state.tr.replace(n.pos, n.pos, new z(i, 0, 0));
|
|
278
|
+
return a.setSelection(F.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(e.selection instanceof
|
|
280
|
+
function ht(e) {
|
|
281
|
+
if (!(e.selection instanceof U)) return null;
|
|
282
282
|
let t = document.createElement("div");
|
|
283
|
-
return t.className = "ProseMirror-gapcursor",
|
|
283
|
+
return t.className = "ProseMirror-gapcursor", I.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 gt = 200, K = function() {};
|
|
288
|
+
K.prototype.append = function(e) {
|
|
289
|
+
return e.length ? (e = K.from(e), !this.length && e || e.length < gt && this.leafAppend(e) || this.length < gt && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
290
|
+
}, K.prototype.prepend = function(e) {
|
|
291
|
+
return e.length ? K.from(e).append(this) : this;
|
|
292
|
+
}, K.prototype.appendInner = function(e) {
|
|
293
|
+
return new vt(this, e);
|
|
294
|
+
}, K.prototype.slice = function(e, t) {
|
|
295
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? K.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
296
|
+
}, K.prototype.get = function(e) {
|
|
297
297
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
298
|
-
},
|
|
298
|
+
}, K.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
|
+
}, K.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
|
+
}, K.from = function(e) {
|
|
307
|
+
return e instanceof K ? e : e && e.length ? new _t(e) : K.empty;
|
|
308
308
|
};
|
|
309
|
-
var
|
|
309
|
+
var _t = /* @__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 <= gt) 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 <= gt) 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
|
+
}(K);
|
|
338
|
+
K.empty = new _t([]);
|
|
339
|
+
var vt = /* @__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
|
+
}(K), q = 500, J = 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 Y(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 Y(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 Y(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 > bt && (s = yt(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 Ee();
|
|
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 Y(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 Y(i, o, l));
|
|
431
|
+
} else r.push(new Y(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 Y(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() > q && (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 Y(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(K.from(i.reverse()), a);
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
|
-
|
|
461
|
-
function
|
|
460
|
+
J.empty = new J(K.empty, 0);
|
|
461
|
+
function yt(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 Y = 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
|
+
}, X = 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
|
+
}, bt = 20;
|
|
482
|
+
function xt(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 X(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 X(e.done.addTransform(n, void 0, r, Dt(t)), e.undone, Ct(n.mapping.maps), e.prevTime, e.prevComposition) : new X(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 || !St(n, e.prevRanges)), s = o ? wt(e.prevRanges, n.mapping) : Ct(n.mapping.maps);
|
|
491
|
+
return new X(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Dt(t)), J.empty, s, n.time, i ?? e.prevComposition);
|
|
492
|
+
} else if (a = n.getMeta("rebased")) return new X(e.done.rebased(n, a), e.undone.rebased(n, a), wt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
493
|
+
else return new X(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), wt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function St(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 Ct(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 wt(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 Z(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 X(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 N("history"), Ot = new N("closeHistory");
|
|
539
|
+
function kt(e = {}) {
|
|
540
540
|
return e = {
|
|
541
541
|
depth: e.depth || 100,
|
|
542
542
|
newGroupDelay: e.newGroupDelay || 500
|
|
543
543
|
}, new L({
|
|
544
|
-
key:
|
|
544
|
+
key: Q,
|
|
545
545
|
state: {
|
|
546
546
|
init() {
|
|
547
|
-
return new
|
|
547
|
+
return new X(J.empty, J.empty, null, 0, -1);
|
|
548
548
|
},
|
|
549
549
|
apply(t, n, r) {
|
|
550
|
-
return
|
|
550
|
+
return xt(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 = Z(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 {
|
|
@@ -602,7 +602,7 @@ H.create({
|
|
|
602
602
|
addProseMirrorPlugins() {
|
|
603
603
|
let e = !1;
|
|
604
604
|
return [new L({
|
|
605
|
-
key: new
|
|
605
|
+
key: new N("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 @@ H.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 @@ H.create({
|
|
|
640
640
|
};
|
|
641
641
|
},
|
|
642
642
|
addProseMirrorPlugins() {
|
|
643
|
-
return [
|
|
643
|
+
return [H(this.options)];
|
|
644
644
|
}
|
|
645
|
-
}),
|
|
645
|
+
}), R.create({
|
|
646
646
|
name: "focus",
|
|
647
647
|
addOptions() {
|
|
648
648
|
return {
|
|
@@ -652,10 +652,10 @@ H.create({
|
|
|
652
652
|
},
|
|
653
653
|
addProseMirrorPlugins() {
|
|
654
654
|
return [new L({
|
|
655
|
-
key: new
|
|
655
|
+
key: new N("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 I.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 @@ H.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
|
+
}), I.create(e, a);
|
|
672
672
|
} }
|
|
673
673
|
})];
|
|
674
674
|
}
|
|
675
|
-
}),
|
|
675
|
+
}), R.create({
|
|
676
676
|
name: "gapCursor",
|
|
677
677
|
addProseMirrorPlugins() {
|
|
678
|
-
return [
|
|
678
|
+
return [dt()];
|
|
679
679
|
},
|
|
680
680
|
extendNodeSchema(e) {
|
|
681
|
-
return { allowGapCursor:
|
|
681
|
+
return { allowGapCursor: $e(ve(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 N("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 && he(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 && he(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 I.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-${
|
|
860
|
+
let n = t.dataAttribute ? `data-${Rt(t.dataAttribute)}` : `data-${Nt}`;
|
|
861
861
|
return new L({
|
|
862
|
-
key:
|
|
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 = H.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" && Oe(qt, e.options.injectNonce, "selection"), [new L({
|
|
902
|
+
key: new N("selection"),
|
|
903
903
|
props: { decorations(n) {
|
|
904
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
904
|
+
return n.selection.empty || e.isFocused || !e.isEditable || Ce(n.selection) || e.view.dragging ? null : I.create(n.doc, [V.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
905
905
|
} }
|
|
906
906
|
})];
|
|
907
907
|
}
|
|
@@ -909,7 +909,7 @@ H.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,7 +918,7 @@ H.create({
|
|
|
918
918
|
};
|
|
919
919
|
},
|
|
920
920
|
addProseMirrorPlugins() {
|
|
921
|
-
let e = new
|
|
921
|
+
let e = new N(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
922
|
return [new L({
|
|
923
923
|
key: e,
|
|
924
924
|
appendTransaction: (n, r, i) => {
|
|
@@ -945,7 +945,7 @@ H.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 = H.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 {
|
|
@@ -975,7 +975,7 @@ var Yt = H.create({
|
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region ../../node_modules/.pnpm/@tiptap+vue-3@3.27.1_@floating-ui+dom@1.7.6_@tiptap+core@3.27.1_@tiptap+pm@3.27.1__@tip_533afe27a0e41f53f3674ff5bfd0331c/node_modules/@tiptap/vue-3/dist/index.js
|
|
977
977
|
function Xt(e) {
|
|
978
|
-
return
|
|
978
|
+
return oe((t, n) => ({
|
|
979
979
|
get() {
|
|
980
980
|
return t(), e;
|
|
981
981
|
},
|
|
@@ -988,11 +988,11 @@ function Xt(e) {
|
|
|
988
988
|
}
|
|
989
989
|
}));
|
|
990
990
|
}
|
|
991
|
-
var Zt = class extends
|
|
991
|
+
var Zt = class extends tt {
|
|
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;
|
|
995
|
-
}),
|
|
995
|
+
}), ce(this);
|
|
996
996
|
}
|
|
997
997
|
get state() {
|
|
998
998
|
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
@@ -1015,12 +1015,12 @@ var Zt = class extends je {
|
|
|
1015
1015
|
type: Object
|
|
1016
1016
|
} },
|
|
1017
1017
|
setup(t) {
|
|
1018
|
-
let r =
|
|
1018
|
+
let r = k(), i = o();
|
|
1019
1019
|
return e(() => {
|
|
1020
1020
|
let e = t.editor;
|
|
1021
1021
|
e && e.options.element && r.value && n(() => {
|
|
1022
1022
|
if (!r.value || !e.view.dom?.parentNode) return;
|
|
1023
|
-
let t =
|
|
1023
|
+
let t = D(r.value);
|
|
1024
1024
|
r.value.append(...e.view.dom.parentNode.childNodes), e.contentComponent = i.ctx._, i && (e.appContext = {
|
|
1025
1025
|
...i.appContext,
|
|
1026
1026
|
provides: i.provides
|
|
@@ -1076,7 +1076,7 @@ var $t = m({
|
|
|
1076
1076
|
}, (e = this.$slots).default?.call(e));
|
|
1077
1077
|
}
|
|
1078
1078
|
}), en = (e = {}) => {
|
|
1079
|
-
let t =
|
|
1079
|
+
let t = x();
|
|
1080
1080
|
return c(() => {
|
|
1081
1081
|
t.value = new Zt(e);
|
|
1082
1082
|
}), _(() => {
|
|
@@ -1085,7 +1085,7 @@ var $t = m({
|
|
|
1085
1085
|
}), t;
|
|
1086
1086
|
}, tn = class {
|
|
1087
1087
|
constructor(e, { props: t = {}, editor: n }) {
|
|
1088
|
-
this.destroyed = !1, this.editor = n, this.component =
|
|
1088
|
+
this.destroyed = !1, this.editor = n, this.component = ce(e), this.el = document.createElement("div"), this.props = re(t), this.renderedComponent = this.renderComponent();
|
|
1089
1089
|
}
|
|
1090
1090
|
get element() {
|
|
1091
1091
|
return this.renderedComponent.el;
|
|
@@ -1096,10 +1096,10 @@ var $t = m({
|
|
|
1096
1096
|
renderComponent() {
|
|
1097
1097
|
if (this.destroyed) return this.renderedComponent;
|
|
1098
1098
|
let e = l(this.component, this.props);
|
|
1099
|
-
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el &&
|
|
1099
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && C(e, this.el), {
|
|
1100
1100
|
vNode: e,
|
|
1101
1101
|
destroy: () => {
|
|
1102
|
-
this.el &&
|
|
1102
|
+
this.el && C(null, this.el), this.el = null, e = null;
|
|
1103
1103
|
},
|
|
1104
1104
|
el: this.el ? this.el.firstElementChild : null
|
|
1105
1105
|
};
|
|
@@ -1171,7 +1171,7 @@ var nn = {
|
|
|
1171
1171
|
type: Object,
|
|
1172
1172
|
required: !0
|
|
1173
1173
|
}
|
|
1174
|
-
}, rn = class extends
|
|
1174
|
+
}, rn = class extends pe {
|
|
1175
1175
|
constructor(e, t, n) {
|
|
1176
1176
|
super(e, t, n), this.cachedExtensionWithSyncedStorage = null, this.handlePositionUpdate = () => {
|
|
1177
1177
|
let e = this.getPos();
|
|
@@ -1201,7 +1201,7 @@ var nn = {
|
|
|
1201
1201
|
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
1202
1202
|
deleteNode: () => this.deleteNode()
|
|
1203
1203
|
}, t = e, n = this.onDragStart.bind(this);
|
|
1204
|
-
this.decorationClasses =
|
|
1204
|
+
this.decorationClasses = k(this.getDecorationClasses());
|
|
1205
1205
|
let r = m({
|
|
1206
1206
|
extends: { ...this.component },
|
|
1207
1207
|
props: Object.keys(e),
|
|
@@ -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 (ze({
|
|
1235
1235
|
selection: this.editor.state.selection,
|
|
1236
1236
|
pos: e,
|
|
1237
1237
|
nodeSize: this.node.nodeSize,
|
|
@@ -1326,7 +1326,12 @@ var ln = [
|
|
|
1326
1326
|
"aria-label",
|
|
1327
1327
|
"popovertarget",
|
|
1328
1328
|
"aria-expanded"
|
|
1329
|
-
], un =
|
|
1329
|
+
], un = {
|
|
1330
|
+
key: 0,
|
|
1331
|
+
class: "ai-progress",
|
|
1332
|
+
viewBox: "0 0 24 24",
|
|
1333
|
+
"aria-hidden": "true"
|
|
1334
|
+
}, dn = ["id", "aria-label"], fn = { class: "ai-list" }, pn = ["onClick"], mn = { class: "ai-option-label" }, hn = { class: "ai-option-hint" }, gn = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1330
1335
|
__name: "AiActionPicker",
|
|
1331
1336
|
props: {
|
|
1332
1337
|
actions: { type: Array },
|
|
@@ -1355,136 +1360,143 @@ var ln = [
|
|
|
1355
1360
|
ref_key: "trigger",
|
|
1356
1361
|
ref: l,
|
|
1357
1362
|
type: "button",
|
|
1358
|
-
class:
|
|
1363
|
+
class: E(["ai-trigger", {
|
|
1364
|
+
active: p.value,
|
|
1365
|
+
busy: e.pending
|
|
1366
|
+
}]),
|
|
1359
1367
|
disabled: e.pending,
|
|
1360
1368
|
"aria-busy": e.pending,
|
|
1361
|
-
title:
|
|
1362
|
-
"aria-label":
|
|
1363
|
-
popovertarget:
|
|
1369
|
+
title: e.pending ? D(s)("blocks.text.ai.working") : D(s)("blocks.text.ai.label"),
|
|
1370
|
+
"aria-label": D(s)("blocks.text.ai.label"),
|
|
1371
|
+
popovertarget: D(c),
|
|
1364
1372
|
"aria-haspopup": "dialog",
|
|
1365
1373
|
"aria-expanded": p.value,
|
|
1366
1374
|
onMousedown: a[0] ||= g(() => {}, ["prevent"])
|
|
1367
|
-
}, [f(
|
|
1375
|
+
}, [f(M, {
|
|
1368
1376
|
name: "sparkles",
|
|
1369
1377
|
size: 16
|
|
1370
|
-
})
|
|
1378
|
+
}), e.pending ? (v(), t("svg", un, [...a[2] ||= [i("circle", {
|
|
1379
|
+
cx: "12",
|
|
1380
|
+
cy: "12",
|
|
1381
|
+
r: "10.5"
|
|
1382
|
+
}, null, -1)]])) : T("", !0)], 42, ln)) : T("", !0), e.actions.length ? (v(), t("div", {
|
|
1371
1383
|
key: 1,
|
|
1372
|
-
id:
|
|
1384
|
+
id: D(c),
|
|
1373
1385
|
ref_key: "popover",
|
|
1374
1386
|
ref: d,
|
|
1375
1387
|
class: "ai-popover",
|
|
1376
1388
|
popover: "",
|
|
1377
1389
|
role: "dialog",
|
|
1378
|
-
"aria-label":
|
|
1390
|
+
"aria-label": D(s)("blocks.text.ai.label"),
|
|
1379
1391
|
onBeforetoggle: m,
|
|
1380
1392
|
onFocusout: h
|
|
1381
|
-
}, [i("ul",
|
|
1393
|
+
}, [i("ul", fn, [(v(!0), t(r, null, u(e.actions, (e) => (v(), t("li", { key: e }, [i("button", {
|
|
1382
1394
|
type: "button",
|
|
1383
1395
|
class: "ai-option",
|
|
1384
1396
|
onClick: (t) => ee(e),
|
|
1385
1397
|
onMousedown: a[1] ||= g(() => {}, ["prevent"])
|
|
1386
|
-
}, [i("span",
|
|
1398
|
+
}, [i("span", mn, b(D(s)(`blocks.text.ai.actions.${e}.label`)), 1), i("span", hn, b(D(s)(`blocks.text.ai.actions.${e}.hint`)), 1)], 40, pn)]))), 128))])], 40, dn)) : T("", !0)], 64));
|
|
1387
1399
|
}
|
|
1388
|
-
}), [["styles", [".ai-trigger[data-v-
|
|
1400
|
+
}), [["styles", [".ai-trigger[data-v-70f94c37]{color:var(--bygga-color-text);cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:30px;height:30px;padding:0;display:inline-flex;position:relative}.ai-trigger[data-v-70f94c37]:hover:not(:disabled){background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.ai-trigger.active[data-v-70f94c37]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.ai-trigger.busy[data-v-70f94c37]{color:var(--bygga-color-accent);cursor:progress}.ai-progress[data-v-70f94c37]{fill:none;pointer-events:none;stroke:currentColor;stroke-dasharray:18 48;stroke-linecap:round;stroke-width:1.5px;width:24px;height:24px;margin:auto;animation:.9s linear infinite ai-progress-turn-70f94c37;position:absolute;inset:0}@keyframes ai-progress-turn-70f94c37{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.ai-progress[data-v-70f94c37]{animation-duration:2.4s}}.ai-popover[data-v-70f94c37]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);box-sizing:border-box;flex-direction:column;width:16em;margin:0;padding:.4em;position:fixed;inset:auto}.ai-popover[data-v-70f94c37]:popover-open{display:flex}.ai-list[data-v-70f94c37]{flex-direction:column;gap:.15em;margin:0;padding:0;list-style:none;display:flex}.ai-option[data-v-70f94c37]{border-radius:var(--bygga-radius-sm);color:var(--bygga-color-text);cursor:pointer;text-align:start;background:0 0;border:none;flex-direction:column;gap:.1em;width:100%;padding:.35em .5em;display:flex}.ai-option[data-v-70f94c37]:hover,.ai-option[data-v-70f94c37]:focus-visible{background:var(--bygga-color-track);color:var(--bygga-color-accent);outline:none}.ai-option-hint[data-v-70f94c37]{color:var(--bygga-color-text-muted);font-size:.85em}"]], ["__scopeId", "data-v-70f94c37"]]), _n = [
|
|
1389
1401
|
"title",
|
|
1390
1402
|
"aria-label",
|
|
1391
1403
|
"popovertarget",
|
|
1392
1404
|
"aria-expanded"
|
|
1393
|
-
],
|
|
1405
|
+
], vn = ["id", "aria-label"], yn = {
|
|
1394
1406
|
key: 0,
|
|
1395
1407
|
class: "merge-tag-list"
|
|
1396
|
-
},
|
|
1408
|
+
}, bn = ["onClick"], xn = { class: "merge-tag-option-label" }, Sn = { class: "merge-tag-option-id" }, Cn = {
|
|
1397
1409
|
key: 1,
|
|
1398
1410
|
class: "merge-tag-empty"
|
|
1399
|
-
},
|
|
1411
|
+
}, wn = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1400
1412
|
__name: "MergeTagPicker",
|
|
1401
1413
|
emits: ["select"],
|
|
1402
1414
|
setup(e, { emit: o }) {
|
|
1403
|
-
let s = o, { t: c, locale: l } = Ze(), p = d(et, a(() => ({}))), m = a(() =>
|
|
1415
|
+
let s = o, { t: c, locale: l } = Ze(), p = d(et, a(() => ({}))), m = a(() => Ue(p.value).map((e) => ({
|
|
1404
1416
|
id: e,
|
|
1405
|
-
label:
|
|
1406
|
-
}))), h =
|
|
1417
|
+
label: We(p.value, e, l.value)
|
|
1418
|
+
}))), h = k(""), ee = a(() => {
|
|
1407
1419
|
let e = h.value.trim().toLowerCase();
|
|
1408
1420
|
return e ? m.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : m.value;
|
|
1409
|
-
}), _ = ne(), te = a(() =>
|
|
1410
|
-
function
|
|
1421
|
+
}), _ = ne(), te = a(() => x.value?.matches(":popover-open") ?? !1), re = y("trigger"), x = y("popover"), S = y("filterInput");
|
|
1422
|
+
function C(e) {
|
|
1411
1423
|
if (e.newState !== "open") return;
|
|
1412
1424
|
h.value = "";
|
|
1413
|
-
let t =
|
|
1425
|
+
let t = x.value, n = re.value?.getBoundingClientRect();
|
|
1414
1426
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1415
1427
|
}
|
|
1416
|
-
function
|
|
1417
|
-
e.newState === "open" && n(() =>
|
|
1428
|
+
function ie(e) {
|
|
1429
|
+
e.newState === "open" && n(() => S.value?.focus());
|
|
1418
1430
|
}
|
|
1419
|
-
function
|
|
1420
|
-
let t = e.relatedTarget, n =
|
|
1431
|
+
function w(e) {
|
|
1432
|
+
let t = e.relatedTarget, n = x.value;
|
|
1421
1433
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1422
1434
|
}
|
|
1423
|
-
function
|
|
1424
|
-
s("select", e),
|
|
1435
|
+
function ae(e) {
|
|
1436
|
+
s("select", e), x.value?.hidePopover();
|
|
1425
1437
|
}
|
|
1426
1438
|
return (e, n) => (v(), t(r, null, [m.value.length ? (v(), t("button", {
|
|
1427
1439
|
key: 0,
|
|
1428
1440
|
ref_key: "trigger",
|
|
1429
|
-
ref:
|
|
1441
|
+
ref: re,
|
|
1430
1442
|
type: "button",
|
|
1431
|
-
class:
|
|
1432
|
-
title:
|
|
1433
|
-
"aria-label":
|
|
1434
|
-
popovertarget:
|
|
1443
|
+
class: E(["merge-tag-trigger", { active: te.value }]),
|
|
1444
|
+
title: D(c)("blocks.text.mergeTag"),
|
|
1445
|
+
"aria-label": D(c)("blocks.text.mergeTag"),
|
|
1446
|
+
popovertarget: D(_),
|
|
1435
1447
|
"aria-haspopup": "dialog",
|
|
1436
1448
|
"aria-expanded": te.value,
|
|
1437
1449
|
onMousedown: n[0] ||= g(() => {}, ["prevent"])
|
|
1438
|
-
}, [f(
|
|
1450
|
+
}, [f(M, {
|
|
1439
1451
|
name: "braces",
|
|
1440
1452
|
size: 16
|
|
1441
|
-
})], 42,
|
|
1453
|
+
})], 42, _n)) : T("", !0), m.value.length ? (v(), t("div", {
|
|
1442
1454
|
key: 1,
|
|
1443
|
-
id:
|
|
1455
|
+
id: D(_),
|
|
1444
1456
|
ref_key: "popover",
|
|
1445
|
-
ref:
|
|
1457
|
+
ref: x,
|
|
1446
1458
|
class: "merge-tag-popover",
|
|
1447
1459
|
popover: "",
|
|
1448
1460
|
role: "dialog",
|
|
1449
|
-
"aria-label":
|
|
1450
|
-
onBeforetoggle:
|
|
1451
|
-
onToggle:
|
|
1452
|
-
onFocusout:
|
|
1453
|
-
}, [f(
|
|
1461
|
+
"aria-label": D(c)("blocks.text.mergeTag"),
|
|
1462
|
+
onBeforetoggle: C,
|
|
1463
|
+
onToggle: ie,
|
|
1464
|
+
onFocusout: w
|
|
1465
|
+
}, [f(Ne, {
|
|
1454
1466
|
ref_key: "filterInput",
|
|
1455
|
-
ref:
|
|
1467
|
+
ref: S,
|
|
1456
1468
|
modelValue: h.value,
|
|
1457
1469
|
"onUpdate:modelValue": n[1] ||= (e) => h.value = e,
|
|
1458
1470
|
autocomplete: "off",
|
|
1459
|
-
placeholder:
|
|
1460
|
-
"aria-label":
|
|
1471
|
+
placeholder: D(c)("blocks.text.mergeTagSearch"),
|
|
1472
|
+
"aria-label": D(c)("blocks.text.mergeTagSearch"),
|
|
1461
1473
|
spellcheck: "false"
|
|
1462
1474
|
}, null, 8, [
|
|
1463
1475
|
"modelValue",
|
|
1464
1476
|
"placeholder",
|
|
1465
1477
|
"aria-label"
|
|
1466
|
-
]), ee.value.length ? (v(), t("ul",
|
|
1478
|
+
]), ee.value.length ? (v(), t("ul", yn, [(v(!0), t(r, null, u(ee.value, (e) => (v(), t("li", { key: e.id }, [i("button", {
|
|
1467
1479
|
type: "button",
|
|
1468
1480
|
class: "merge-tag-option",
|
|
1469
|
-
onClick: (t) =>
|
|
1481
|
+
onClick: (t) => ae(e.id),
|
|
1470
1482
|
onMousedown: n[2] ||= g(() => {}, ["prevent"])
|
|
1471
|
-
}, [i("span",
|
|
1483
|
+
}, [i("span", xn, b(e.label), 1), i("span", Sn, b(e.id), 1)], 40, bn)]))), 128))])) : (v(), t("p", Cn, b(D(c)("blocks.text.mergeTagEmpty")), 1))], 40, vn)) : T("", !0)], 64));
|
|
1472
1484
|
}
|
|
1473
|
-
}), [["styles", [".merge-tag-trigger[data-v-72cf1690]{color:var(--bygga-color-text);cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:30px;height:30px;padding:0;display:inline-flex}.merge-tag-trigger[data-v-72cf1690]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.merge-tag-trigger.active[data-v-72cf1690]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.merge-tag-popover[data-v-72cf1690]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);box-sizing:border-box;flex-direction:column;gap:.35em;width:15em;margin:0;padding:.4em;position:fixed;inset:auto}.merge-tag-popover[data-v-72cf1690]:popover-open{display:flex}.merge-tag-list[data-v-72cf1690]{flex-direction:column;gap:.15em;max-height:14em;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.merge-tag-option[data-v-72cf1690]{border-radius:var(--bygga-radius-sm);color:var(--bygga-color-text);cursor:pointer;text-align:start;background:0 0;border:none;justify-content:space-between;align-items:baseline;gap:.5em;width:100%;padding:.35em .5em;display:flex}.merge-tag-option[data-v-72cf1690]:hover,.merge-tag-option[data-v-72cf1690]:focus-visible{background:var(--bygga-color-track);color:var(--bygga-color-accent);outline:none}.merge-tag-option-id[data-v-72cf1690]{color:var(--bygga-color-text-muted);font-variant-numeric:tabular-nums;font-size:.85em}.merge-tag-empty[data-v-72cf1690]{color:var(--bygga-color-text-muted);margin:0;padding:.35em .5em}"]], ["__scopeId", "data-v-72cf1690"]]),
|
|
1485
|
+
}), [["styles", [".merge-tag-trigger[data-v-72cf1690]{color:var(--bygga-color-text);cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:30px;height:30px;padding:0;display:inline-flex}.merge-tag-trigger[data-v-72cf1690]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.merge-tag-trigger.active[data-v-72cf1690]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.merge-tag-popover[data-v-72cf1690]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);box-sizing:border-box;flex-direction:column;gap:.35em;width:15em;margin:0;padding:.4em;position:fixed;inset:auto}.merge-tag-popover[data-v-72cf1690]:popover-open{display:flex}.merge-tag-list[data-v-72cf1690]{flex-direction:column;gap:.15em;max-height:14em;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.merge-tag-option[data-v-72cf1690]{border-radius:var(--bygga-radius-sm);color:var(--bygga-color-text);cursor:pointer;text-align:start;background:0 0;border:none;justify-content:space-between;align-items:baseline;gap:.5em;width:100%;padding:.35em .5em;display:flex}.merge-tag-option[data-v-72cf1690]:hover,.merge-tag-option[data-v-72cf1690]:focus-visible{background:var(--bygga-color-track);color:var(--bygga-color-accent);outline:none}.merge-tag-option-id[data-v-72cf1690]{color:var(--bygga-color-text-muted);font-variant-numeric:tabular-nums;font-size:.85em}.merge-tag-empty[data-v-72cf1690]{color:var(--bygga-color-text-muted);margin:0;padding:.35em .5em}"]], ["__scopeId", "data-v-72cf1690"]]), Tn = /* @__PURE__ */ m({
|
|
1474
1486
|
__name: "MergeTagView",
|
|
1475
1487
|
props: nn,
|
|
1476
1488
|
setup(e) {
|
|
1477
|
-
let t = e, { t: n, locale: r } = Ze(), i = d(et, a(() => ({}))), o = a(() => String(t.node.attrs.id ?? "")), s = a(() => i.value[o.value] !== void 0), c = a(() =>
|
|
1478
|
-
return (e, t) => (v(), p(
|
|
1489
|
+
let t = e, { t: n, locale: r } = Ze(), i = d(et, a(() => ({}))), o = a(() => String(t.node.attrs.id ?? "")), s = a(() => i.value[o.value] !== void 0), c = a(() => We(i.value, o.value, r.value)), l = a(() => n("blocks.text.mergeTagChip", { name: c.value }));
|
|
1490
|
+
return (e, t) => (v(), p(D($t), {
|
|
1479
1491
|
as: "span",
|
|
1480
|
-
class:
|
|
1492
|
+
class: E(["merge-tag", { "is-unknown": !s.value }]),
|
|
1481
1493
|
"data-merge-tag": o.value,
|
|
1482
1494
|
contenteditable: "false",
|
|
1483
1495
|
role: "img",
|
|
1484
1496
|
"aria-label": l.value,
|
|
1485
1497
|
title: l.value
|
|
1486
1498
|
}, {
|
|
1487
|
-
default:
|
|
1499
|
+
default: S(() => [w(b(c.value), 1)]),
|
|
1488
1500
|
_: 1
|
|
1489
1501
|
}, 8, [
|
|
1490
1502
|
"class",
|
|
@@ -1496,53 +1508,53 @@ var ln = [
|
|
|
1496
1508
|
});
|
|
1497
1509
|
//#endregion
|
|
1498
1510
|
//#region src/fontSizes.ts
|
|
1499
|
-
function
|
|
1500
|
-
return
|
|
1511
|
+
function En(e) {
|
|
1512
|
+
return we(e);
|
|
1501
1513
|
}
|
|
1502
|
-
var
|
|
1503
|
-
function
|
|
1514
|
+
var Dn = new Set(Ye.map(En));
|
|
1515
|
+
function On(e) {
|
|
1504
1516
|
let t = e.trim();
|
|
1505
|
-
return
|
|
1517
|
+
return Dn.has(t) ? t : null;
|
|
1506
1518
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return
|
|
1519
|
+
function kn(e) {
|
|
1520
|
+
return Dn.has(e);
|
|
1509
1521
|
}
|
|
1510
1522
|
//#endregion
|
|
1511
1523
|
//#region src/panels/contentPanel/components/blocks/aiEdit.ts
|
|
1512
|
-
var
|
|
1513
|
-
function
|
|
1514
|
-
return e.textBetween(t, n, "",
|
|
1524
|
+
var An = "hardBreak", jn = "link", Mn = /\{\{([^{}]*)\}\}/g, Nn = /\r\n?/g, Pn = /\s*\n\s*/g;
|
|
1525
|
+
function Fn(e, t, n) {
|
|
1526
|
+
return e.textBetween(t, n, "", In);
|
|
1515
1527
|
}
|
|
1516
|
-
function
|
|
1517
|
-
return e.type.name === "mergeTag" ? `{{${e.attrs.id}}}` : e.type.name ===
|
|
1528
|
+
function In(e) {
|
|
1529
|
+
return e.type.name === "mergeTag" ? `{{${e.attrs.id}}}` : e.type.name === An ? "\n" : "";
|
|
1518
1530
|
}
|
|
1519
|
-
function
|
|
1531
|
+
function Ln(e, t) {
|
|
1520
1532
|
let { from: n, to: r } = t.empty ? {
|
|
1521
1533
|
from: 0,
|
|
1522
1534
|
to: e.content.size
|
|
1523
1535
|
} : t, i = [];
|
|
1524
1536
|
return e.nodesBetween(n, r, (t, a) => {
|
|
1525
1537
|
if (!t.isTextblock) return !0;
|
|
1526
|
-
let o =
|
|
1538
|
+
let o = Rn(e, Math.max(n, a + 1), Math.min(r, a + 1 + t.content.size));
|
|
1527
1539
|
return o && i.push(o), !1;
|
|
1528
1540
|
}), i;
|
|
1529
1541
|
}
|
|
1530
|
-
function
|
|
1531
|
-
let r =
|
|
1542
|
+
function Rn(e, t, n) {
|
|
1543
|
+
let r = Fn(e, t, n), i = r.trim();
|
|
1532
1544
|
if (i === "") return;
|
|
1533
1545
|
let a = t + r.length - r.trimStart().length, o = n - (r.length - r.trimEnd().length);
|
|
1534
1546
|
return {
|
|
1535
1547
|
from: a,
|
|
1536
1548
|
to: o,
|
|
1537
1549
|
text: i,
|
|
1538
|
-
...
|
|
1550
|
+
...zn(e, a, o)
|
|
1539
1551
|
};
|
|
1540
1552
|
}
|
|
1541
|
-
function
|
|
1553
|
+
function zn(e, t, n) {
|
|
1542
1554
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = [];
|
|
1543
1555
|
e.nodesBetween(t, n, (e, o) => {
|
|
1544
1556
|
if (e.isText) {
|
|
1545
|
-
let i = e.marks.filter((e) => e.type.name !==
|
|
1557
|
+
let i = e.marks.filter((e) => e.type.name !== jn), a = JSON.stringify(i.map((e) => e.toJSON())), s = Math.min(n, o + e.nodeSize) - Math.max(t, o);
|
|
1546
1558
|
r.set(a, {
|
|
1547
1559
|
marks: i,
|
|
1548
1560
|
chars: (r.get(a)?.chars ?? 0) + s
|
|
@@ -1551,7 +1563,7 @@ function Rn(e, t, n) {
|
|
|
1551
1563
|
let t = String(e.attrs.id);
|
|
1552
1564
|
i.set(t, i.get(t) ?? e.marks);
|
|
1553
1565
|
} else return !0;
|
|
1554
|
-
return a.push(e.marks.find((e) => e.type.name ===
|
|
1566
|
+
return a.push(e.marks.find((e) => e.type.name === jn)), !1;
|
|
1555
1567
|
});
|
|
1556
1568
|
let o = [], s = 0;
|
|
1557
1569
|
for (let { marks: e, chars: t } of r.values()) t > s && (o = e, s = t);
|
|
@@ -1561,37 +1573,37 @@ function Rn(e, t, n) {
|
|
|
1561
1573
|
tagMarks: i
|
|
1562
1574
|
};
|
|
1563
1575
|
}
|
|
1564
|
-
function
|
|
1565
|
-
let r = n.replace(
|
|
1576
|
+
function Bn(e, t, n) {
|
|
1577
|
+
let r = n.replace(Nn, "\n").trim();
|
|
1566
1578
|
if (r === "" || r === t.text) return;
|
|
1567
|
-
let i = e.nodes[
|
|
1568
|
-
for (let [n, r] of a.entries()) i && n > 0 && o.push(i.create()), o.push(...
|
|
1569
|
-
return
|
|
1579
|
+
let i = e.nodes[An], a = i ? r.split("\n") : [r.replace(Pn, " ")], o = [];
|
|
1580
|
+
for (let [n, r] of a.entries()) i && n > 0 && o.push(i.create()), o.push(...Vn(e, t, r));
|
|
1581
|
+
return j.from(o);
|
|
1570
1582
|
}
|
|
1571
|
-
function
|
|
1572
|
-
let r = e.nodes[
|
|
1573
|
-
for (let o of n.matchAll(
|
|
1583
|
+
function Vn(e, t, n) {
|
|
1584
|
+
let r = e.nodes[je], i = [], a = 0;
|
|
1585
|
+
for (let o of n.matchAll(Mn)) {
|
|
1574
1586
|
let s = o[1] ?? "";
|
|
1575
|
-
r &&
|
|
1587
|
+
r && rt.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
1588
|
}
|
|
1577
1589
|
return a < n.length && i.push(e.text(n.slice(a), t.marks)), i;
|
|
1578
1590
|
}
|
|
1579
|
-
function
|
|
1591
|
+
function Hn(e, t, n, r) {
|
|
1580
1592
|
let { tr: i } = e;
|
|
1581
1593
|
for (let [a, o] of [...t.entries()].reverse()) {
|
|
1582
|
-
let t = n[a], s = r.map(o.from, 1), c = r.map(o.to, -1), l = typeof t == "string" &&
|
|
1594
|
+
let t = n[a], s = r.map(o.from, 1), c = r.map(o.to, -1), l = typeof t == "string" && Un(e.doc, s, c, o.text) ? Bn(e.schema, o, t) : void 0;
|
|
1583
1595
|
l && i.replaceWith(s, c, l);
|
|
1584
1596
|
}
|
|
1585
1597
|
return i.docChanged ? i : void 0;
|
|
1586
1598
|
}
|
|
1587
|
-
function
|
|
1599
|
+
function Un(e, t, n, r) {
|
|
1588
1600
|
if (t >= n || n > e.content.size) return !1;
|
|
1589
1601
|
let i = e.resolve(t);
|
|
1590
|
-
return i.parent.isTextblock && i.sameParent(e.resolve(n)) &&
|
|
1602
|
+
return i.parent.isTextblock && i.sameParent(e.resolve(n)) && Fn(e, t, n) === r;
|
|
1591
1603
|
}
|
|
1592
1604
|
//#endregion
|
|
1593
1605
|
//#region src/panels/contentPanel/components/blocks/brandTypingStyle.ts
|
|
1594
|
-
var
|
|
1606
|
+
var Wn = R.create({
|
|
1595
1607
|
name: "brandTypingStyle",
|
|
1596
1608
|
addOptions() {
|
|
1597
1609
|
return { marks: () => [] };
|
|
@@ -1599,7 +1611,7 @@ var Un = H.create({
|
|
|
1599
1611
|
addProseMirrorPlugins() {
|
|
1600
1612
|
let { marks: e } = this.options;
|
|
1601
1613
|
return [new L({
|
|
1602
|
-
key: new
|
|
1614
|
+
key: new N("brandTypingStyle"),
|
|
1603
1615
|
appendTransaction(t, n, r) {
|
|
1604
1616
|
let { selection: i, storedMarks: a, schema: o } = r;
|
|
1605
1617
|
if (a !== null || !i.empty) return null;
|
|
@@ -1613,7 +1625,7 @@ var Un = H.create({
|
|
|
1613
1625
|
});
|
|
1614
1626
|
//#endregion
|
|
1615
1627
|
//#region src/panels/contentPanel/components/blocks/pasteFormatting.ts
|
|
1616
|
-
function
|
|
1628
|
+
function Gn(e) {
|
|
1617
1629
|
let { paragraph: t } = e.schema.nodes;
|
|
1618
1630
|
if (t) return {
|
|
1619
1631
|
type: t,
|
|
@@ -1625,108 +1637,108 @@ function Wn(e) {
|
|
|
1625
1637
|
attrs: n.attrs
|
|
1626
1638
|
};
|
|
1627
1639
|
}
|
|
1628
|
-
function
|
|
1629
|
-
let n =
|
|
1640
|
+
function Kn(e, t) {
|
|
1641
|
+
let n = Gn(e), r = !1;
|
|
1630
1642
|
return t.content.descendants((e) => r ? !1 : (e.isText ? r = e.marks.length > 0 : e.isTextblock ? r = !e.hasMarkup(n.type, n.attrs) : e.isInline && (r = e.type.name !== "hardBreak"), !r)), r;
|
|
1631
1643
|
}
|
|
1632
|
-
function
|
|
1644
|
+
function qn(e, t) {
|
|
1633
1645
|
let n = t.openStart === 0 && t.openEnd === 0 && t.content.childCount === 1 ? t.content.firstChild : null;
|
|
1634
1646
|
return (n ? e.tr.replaceSelectionWith(n, !1) : e.tr.replaceSelection(t)).scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste");
|
|
1635
1647
|
}
|
|
1636
|
-
var
|
|
1637
|
-
function
|
|
1638
|
-
let { schema: n, selection: r, storedMarks: i } = e, a = i ?? r.$from.marks(), o =
|
|
1639
|
-
return new
|
|
1648
|
+
var Jn = /(?:\r\n?|\n)+/;
|
|
1649
|
+
function Yn(e, t) {
|
|
1650
|
+
let { schema: n, selection: r, storedMarks: i } = e, a = i ?? r.$from.marks(), o = Gn(e), s = t.split(Jn).map((e) => o.type.create(o.attrs, e ? n.text(e, a) : null));
|
|
1651
|
+
return new z(j.from(s), 1, 1);
|
|
1640
1652
|
}
|
|
1641
1653
|
//#endregion
|
|
1642
1654
|
//#region src/panels/contentPanel/components/blocks/sanitizePastedFonts.ts
|
|
1643
|
-
var
|
|
1644
|
-
function
|
|
1645
|
-
let t =
|
|
1655
|
+
var Xn = "textStyle";
|
|
1656
|
+
function Zn(e) {
|
|
1657
|
+
let t = me(e);
|
|
1646
1658
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1647
1659
|
}
|
|
1648
|
-
function
|
|
1649
|
-
if (e.type.name !==
|
|
1660
|
+
function Qn(e, t) {
|
|
1661
|
+
if (e.type.name !== Xn) return e;
|
|
1650
1662
|
let n = { ...e.attrs };
|
|
1651
|
-
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily =
|
|
1663
|
+
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily = Zn(n.fontFamily)), typeof n.fontSize == "string" && (n.fontSize = On(n.fontSize)), n.fontFamily === e.attrs.fontFamily && n.fontSize === e.attrs.fontSize ? e : Object.values(n).some((e) => e !== null) ? e.type.create(n) : void 0;
|
|
1652
1664
|
}
|
|
1653
|
-
function
|
|
1665
|
+
function $n(e, t) {
|
|
1654
1666
|
return e.flatMap((e) => {
|
|
1655
|
-
let n =
|
|
1667
|
+
let n = Qn(e, t);
|
|
1656
1668
|
return n ? [n] : [];
|
|
1657
1669
|
});
|
|
1658
1670
|
}
|
|
1659
|
-
function $n(e, t) {
|
|
1660
|
-
return e.isText ? e.mark(Qn(e.marks, t)) : e.copy(er(e.content, t)).mark(Qn(e.marks, t));
|
|
1661
|
-
}
|
|
1662
1671
|
function er(e, t) {
|
|
1663
|
-
|
|
1664
|
-
for (let r = 0; r < e.childCount; r++) n.push($n(e.child(r), t));
|
|
1665
|
-
return U.fromArray(n);
|
|
1672
|
+
return e.isText ? e.mark($n(e.marks, t)) : e.copy(tr(e.content, t)).mark($n(e.marks, t));
|
|
1666
1673
|
}
|
|
1667
1674
|
function tr(e, t) {
|
|
1668
|
-
|
|
1675
|
+
let n = [];
|
|
1676
|
+
for (let r = 0; r < e.childCount; r++) n.push(er(e.child(r), t));
|
|
1677
|
+
return j.fromArray(n);
|
|
1678
|
+
}
|
|
1679
|
+
function nr(e, t) {
|
|
1680
|
+
return new z(tr(e.content, t), e.openStart, e.openEnd);
|
|
1669
1681
|
}
|
|
1670
1682
|
//#endregion
|
|
1671
1683
|
//#region src/panels/contentPanel/components/blocks/selectAllText.ts
|
|
1672
|
-
var
|
|
1684
|
+
var rr = R.create({
|
|
1673
1685
|
name: "selectAllText",
|
|
1674
1686
|
priority: 1e3,
|
|
1675
1687
|
addKeyboardShortcuts() {
|
|
1676
1688
|
return { "Mod-a": ({ editor: e }) => {
|
|
1677
1689
|
let { doc: t } = e.state;
|
|
1678
1690
|
return e.commands.setTextSelection({
|
|
1679
|
-
from:
|
|
1680
|
-
to:
|
|
1691
|
+
from: P.atStart(t).from,
|
|
1692
|
+
to: P.atEnd(t).to
|
|
1681
1693
|
});
|
|
1682
1694
|
} };
|
|
1683
1695
|
}
|
|
1684
|
-
}),
|
|
1696
|
+
}), ir = R.create({
|
|
1685
1697
|
name: "keepEmptiedBlock",
|
|
1686
1698
|
addProseMirrorPlugins() {
|
|
1687
1699
|
return [new L({
|
|
1688
|
-
key: new
|
|
1700
|
+
key: new N("keepEmptiedBlock"),
|
|
1689
1701
|
filterTransaction(e) {
|
|
1690
1702
|
return e.docChanged && e.setMeta("preventClearDocument", !0), !0;
|
|
1691
1703
|
}
|
|
1692
1704
|
})];
|
|
1693
1705
|
}
|
|
1694
|
-
}),
|
|
1706
|
+
}), ar = { class: "picker" }, or = ["aria-label", "value"], sr = {
|
|
1695
1707
|
key: 0,
|
|
1696
1708
|
value: "paragraph"
|
|
1697
|
-
},
|
|
1709
|
+
}, cr = ["value"], lr = { class: "picker" }, ur = ["aria-label", "value"], dr = {
|
|
1698
1710
|
value: "mixed",
|
|
1699
1711
|
disabled: "",
|
|
1700
1712
|
hidden: ""
|
|
1701
|
-
},
|
|
1713
|
+
}, fr = ["value"], pr = ["value"], mr = { class: "picker" }, hr = ["aria-label", "value"], gr = {
|
|
1702
1714
|
value: "mixed",
|
|
1703
1715
|
disabled: "",
|
|
1704
1716
|
hidden: ""
|
|
1705
|
-
},
|
|
1717
|
+
}, _r = { value: "" }, vr = ["value"], yr = ["title", "aria-label"], br = ["title", "aria-label"], xr = ["title", "aria-label"], Sr = [
|
|
1706
1718
|
"title",
|
|
1707
1719
|
"popovertarget",
|
|
1708
1720
|
"aria-expanded"
|
|
1709
|
-
],
|
|
1721
|
+
], Cr = ["id", "aria-label"], wr = { class: "link-field" }, Tr = {
|
|
1710
1722
|
key: 0,
|
|
1711
1723
|
class: "link-anchor"
|
|
1712
|
-
},
|
|
1724
|
+
}, Er = {
|
|
1713
1725
|
key: 0,
|
|
1714
1726
|
value: ""
|
|
1715
|
-
},
|
|
1727
|
+
}, Dr = {
|
|
1716
1728
|
key: 1,
|
|
1717
1729
|
value: "",
|
|
1718
1730
|
disabled: "",
|
|
1719
1731
|
hidden: ""
|
|
1720
|
-
},
|
|
1732
|
+
}, Or = ["value"], kr = ["title", "aria-label"], Ar = ["title", "onClick"], jr = {
|
|
1721
1733
|
"aria-hidden": "true",
|
|
1722
1734
|
height: "16",
|
|
1723
1735
|
viewBox: "0 0 16 16",
|
|
1724
1736
|
width: "16"
|
|
1725
|
-
},
|
|
1737
|
+
}, Mr = [
|
|
1726
1738
|
"width",
|
|
1727
1739
|
"x",
|
|
1728
1740
|
"y"
|
|
1729
|
-
],
|
|
1741
|
+
], Nr = ["aria-labelledby", "onKeydown"], Pr = ["id"], Fr = 8, Ir = 220, Lr = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1730
1742
|
__name: "TextEditor",
|
|
1731
1743
|
props: /*@__PURE__*/ ee({
|
|
1732
1744
|
editable: {
|
|
@@ -1758,43 +1770,43 @@ var nr = H.create({
|
|
|
1758
1770
|
"center",
|
|
1759
1771
|
"right",
|
|
1760
1772
|
"justify"
|
|
1761
|
-
],
|
|
1762
|
-
...
|
|
1773
|
+
], re = a(() => p(l.headerOnly ? "blocks.header.label" : "blocks.text.label")), x = en({
|
|
1774
|
+
...Ae,
|
|
1763
1775
|
editorProps: {
|
|
1764
1776
|
attributes: {
|
|
1765
|
-
"aria-label":
|
|
1777
|
+
"aria-label": re.value,
|
|
1766
1778
|
"aria-multiline": "true",
|
|
1767
1779
|
role: "textbox"
|
|
1768
1780
|
},
|
|
1769
|
-
transformPasted: (e) =>
|
|
1770
|
-
handlePaste: (e, t, n) =>
|
|
1781
|
+
transformPasted: (e) => nr(e, Pe.value),
|
|
1782
|
+
handlePaste: (e, t, n) => J(t, n)
|
|
1771
1783
|
},
|
|
1772
|
-
content:
|
|
1784
|
+
content: De(o.value),
|
|
1773
1785
|
editable: l.editable,
|
|
1774
1786
|
extensions: [
|
|
1775
|
-
...(l.headerOnly ?
|
|
1787
|
+
...(l.headerOnly ? Fe : Xe).map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => an(Tn) }) : e),
|
|
1776
1788
|
Yt,
|
|
1777
|
-
nr,
|
|
1778
1789
|
rr,
|
|
1779
|
-
|
|
1790
|
+
ir,
|
|
1791
|
+
Wn.configure({ marks: Oe }),
|
|
1780
1792
|
Kt.configure({ placeholder: () => p(l.headerOnly ? "blocks.header.placeholder" : "blocks.text.placeholder") })
|
|
1781
1793
|
],
|
|
1782
1794
|
onUpdate({ editor: e }) {
|
|
1783
|
-
o.value =
|
|
1795
|
+
o.value = fe(e.getJSON()), F();
|
|
1784
1796
|
},
|
|
1785
1797
|
onSelectionUpdate() {
|
|
1786
|
-
|
|
1798
|
+
F();
|
|
1787
1799
|
}
|
|
1788
1800
|
});
|
|
1789
|
-
h(
|
|
1790
|
-
|
|
1801
|
+
h(re, (e) => {
|
|
1802
|
+
x.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1791
1803
|
}), h(o, (e) => {
|
|
1792
|
-
let t =
|
|
1793
|
-
!t ||
|
|
1794
|
-
}), h(() => l.editable, (e) =>
|
|
1795
|
-
let
|
|
1796
|
-
function
|
|
1797
|
-
let e =
|
|
1804
|
+
let t = x.value;
|
|
1805
|
+
!t || Qe(e, fe(t.getJSON())) || t.commands.setContent(De(e), { emitUpdate: !1 });
|
|
1806
|
+
}), h(() => l.editable, (e) => x.value?.setEditable(e));
|
|
1807
|
+
let C = y("root"), w = y("toolbar"), oe = y("content");
|
|
1808
|
+
function ce() {
|
|
1809
|
+
let e = oe.value?.$el;
|
|
1798
1810
|
if (!(l.editable && e)) return;
|
|
1799
1811
|
if (l.width !== "fit") {
|
|
1800
1812
|
s.value !== void 0 && (s.value = void 0);
|
|
@@ -1808,157 +1820,157 @@ var nr = H.create({
|
|
|
1808
1820
|
let r = s.value;
|
|
1809
1821
|
(r?.width !== n.width || r.height !== n.height) && (s.value = n);
|
|
1810
1822
|
}
|
|
1811
|
-
let
|
|
1812
|
-
function
|
|
1813
|
-
let e =
|
|
1814
|
-
!(
|
|
1823
|
+
let O, A;
|
|
1824
|
+
function j() {
|
|
1825
|
+
let e = oe.value?.$el;
|
|
1826
|
+
!(O && e) || e === A || (A && O.unobserve(A), O.observe(e), A = e);
|
|
1815
1827
|
}
|
|
1816
|
-
function
|
|
1828
|
+
function pe() {
|
|
1817
1829
|
n(() => {
|
|
1818
|
-
|
|
1830
|
+
j(), ce();
|
|
1819
1831
|
});
|
|
1820
1832
|
}
|
|
1821
1833
|
c(() => {
|
|
1822
|
-
!l.editable || typeof ResizeObserver > "u" || (
|
|
1823
|
-
}), _(() =>
|
|
1834
|
+
!l.editable || typeof ResizeObserver > "u" || (O = new ResizeObserver(ce), pe());
|
|
1835
|
+
}), _(() => O?.disconnect()), h(() => [
|
|
1824
1836
|
l.width,
|
|
1825
1837
|
l.paragraphSpacing,
|
|
1826
1838
|
l.lineHeight,
|
|
1827
1839
|
l.padding,
|
|
1828
1840
|
o.value
|
|
1829
|
-
],
|
|
1830
|
-
function
|
|
1831
|
-
let e =
|
|
1832
|
-
!e || e.matches(":popover-open") || (e.showPopover(),
|
|
1841
|
+
], pe);
|
|
1842
|
+
function he() {
|
|
1843
|
+
let e = w.value;
|
|
1844
|
+
!e || e.matches(":popover-open") || (e.showPopover(), F());
|
|
1833
1845
|
}
|
|
1834
|
-
function
|
|
1846
|
+
function ve(e) {
|
|
1835
1847
|
let t = e.relatedTarget;
|
|
1836
|
-
t instanceof Node &&
|
|
1848
|
+
t instanceof Node && C.value?.contains(t) || w.value?.matches(":popover-open") && w.value.hidePopover();
|
|
1837
1849
|
}
|
|
1838
|
-
let
|
|
1839
|
-
function
|
|
1840
|
-
let e =
|
|
1850
|
+
let N = d(ae, void 0);
|
|
1851
|
+
function P() {
|
|
1852
|
+
let e = N?.value?.getBoundingClientRect();
|
|
1841
1853
|
return {
|
|
1842
1854
|
top: Math.max(e?.top ?? 0, 0),
|
|
1843
1855
|
bottom: Math.min(e?.bottom ?? window.innerHeight, window.innerHeight)
|
|
1844
1856
|
};
|
|
1845
1857
|
}
|
|
1846
|
-
function
|
|
1847
|
-
let e =
|
|
1858
|
+
function F() {
|
|
1859
|
+
let e = x.value?.view, t = w.value, n = C.value;
|
|
1848
1860
|
if (!(e && t && n && t.matches(":popover-open"))) return;
|
|
1849
|
-
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(
|
|
1850
|
-
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o -
|
|
1861
|
+
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(Fr, window.innerWidth - Ir - Fr), o = Math.min(Math.max(i.left, Fr), a);
|
|
1862
|
+
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - Fr}px`, t.style.top = `${He(i.top, t.offsetHeight, P())}px`;
|
|
1851
1863
|
}
|
|
1852
|
-
function
|
|
1864
|
+
function I(e) {
|
|
1853
1865
|
let t = {
|
|
1854
1866
|
capture: !0,
|
|
1855
1867
|
passive: !0
|
|
1856
|
-
}, n =
|
|
1857
|
-
for (let r of [window, n instanceof ShadowRoot ? n : null]) e ? r?.addEventListener("scroll",
|
|
1858
|
-
e ? window.addEventListener("resize",
|
|
1868
|
+
}, n = C.value?.getRootNode();
|
|
1869
|
+
for (let r of [window, n instanceof ShadowRoot ? n : null]) e ? r?.addEventListener("scroll", F, t) : r?.removeEventListener("scroll", F, t);
|
|
1870
|
+
e ? window.addEventListener("resize", F) : window.removeEventListener("resize", F);
|
|
1859
1871
|
}
|
|
1860
1872
|
function xe(e) {
|
|
1861
|
-
|
|
1873
|
+
I(e.newState === "open");
|
|
1862
1874
|
}
|
|
1863
|
-
_(() =>
|
|
1864
|
-
function
|
|
1865
|
-
let e =
|
|
1875
|
+
_(() => I(!1));
|
|
1876
|
+
function Ce() {
|
|
1877
|
+
let e = x.value;
|
|
1866
1878
|
if (!e) return l.headerOnly ? "h1" : "paragraph";
|
|
1867
|
-
let t =
|
|
1879
|
+
let t = Le.find((t) => e.isActive("heading", { level: t }));
|
|
1868
1880
|
return t ? `h${t}` : "paragraph";
|
|
1869
1881
|
}
|
|
1870
1882
|
function we(e) {
|
|
1871
1883
|
let { target: t } = e;
|
|
1872
1884
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1873
|
-
let n =
|
|
1885
|
+
let n = x.value?.chain().focus();
|
|
1874
1886
|
if (!n) return;
|
|
1875
|
-
let r =
|
|
1887
|
+
let r = Le.find((e) => `h${e}` === t.value);
|
|
1876
1888
|
r ? n.setHeading({ level: r }).run() : l.headerOnly || n.setParagraph().run();
|
|
1877
1889
|
}
|
|
1878
|
-
let
|
|
1879
|
-
function
|
|
1880
|
-
let e =
|
|
1881
|
-
return
|
|
1890
|
+
let L = d(se, a(() => _e)), R = d(ke, void 0);
|
|
1891
|
+
function Oe() {
|
|
1892
|
+
let e = R?.value;
|
|
1893
|
+
return ye(l.headerOnly ? e?.header : e?.text, L.value);
|
|
1882
1894
|
}
|
|
1883
|
-
let z = Me(),
|
|
1895
|
+
let z = Me(), Pe = a(() => new Set(z.value.map((e) => e.stack)));
|
|
1884
1896
|
function B(e) {
|
|
1885
1897
|
return `custom:${e}`;
|
|
1886
1898
|
}
|
|
1887
|
-
function
|
|
1888
|
-
if (typeof e != "string") return
|
|
1899
|
+
function V(e) {
|
|
1900
|
+
if (typeof e != "string") return L.value;
|
|
1889
1901
|
let t = z.value.find((t) => t.stack === e);
|
|
1890
|
-
return t ? B(t.name) :
|
|
1902
|
+
return t ? B(t.name) : me(e)?.key ?? L.value;
|
|
1891
1903
|
}
|
|
1892
|
-
function
|
|
1893
|
-
let e =
|
|
1894
|
-
if (!e) return
|
|
1904
|
+
function ze() {
|
|
1905
|
+
let e = x.value;
|
|
1906
|
+
if (!e) return L.value;
|
|
1895
1907
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1896
|
-
if (r) return
|
|
1908
|
+
if (r) return V(e.getAttributes("textStyle").fontFamily);
|
|
1897
1909
|
let i = /* @__PURE__ */ new Set();
|
|
1898
1910
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1899
1911
|
if (!e.isText) return;
|
|
1900
1912
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1901
|
-
i.add(
|
|
1913
|
+
i.add(V(t?.attrs.fontFamily));
|
|
1902
1914
|
});
|
|
1903
1915
|
let a = Array.from(i);
|
|
1904
|
-
return a.length > 1 ? "mixed" : a[0] ??
|
|
1916
|
+
return a.length > 1 ? "mixed" : a[0] ?? L.value;
|
|
1905
1917
|
}
|
|
1906
|
-
function
|
|
1918
|
+
function Ue(e) {
|
|
1907
1919
|
let { target: t } = e;
|
|
1908
1920
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1909
|
-
let n = t.value, r =
|
|
1921
|
+
let n = t.value, r = x.value?.chain().focus();
|
|
1910
1922
|
if (!r) return;
|
|
1911
1923
|
let i = z.value.find((e) => B(e.name) === n);
|
|
1912
1924
|
if (i) {
|
|
1913
1925
|
r.setFontFamily(i.stack).run();
|
|
1914
1926
|
return;
|
|
1915
1927
|
}
|
|
1916
|
-
|
|
1928
|
+
Re(n) && (n === L.value ? r.unsetFontFamily().run() : r.setFontFamily(Se(n)).run());
|
|
1917
1929
|
}
|
|
1918
|
-
function
|
|
1919
|
-
return typeof e == "string" &&
|
|
1930
|
+
function We(e) {
|
|
1931
|
+
return typeof e == "string" && kn(e) ? e : "";
|
|
1920
1932
|
}
|
|
1921
|
-
function
|
|
1922
|
-
let e =
|
|
1933
|
+
function qe() {
|
|
1934
|
+
let e = x.value;
|
|
1923
1935
|
if (!e) return "";
|
|
1924
1936
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1925
|
-
if (r) return
|
|
1937
|
+
if (r) return We(e.getAttributes("textStyle").fontSize);
|
|
1926
1938
|
let i = /* @__PURE__ */ new Set();
|
|
1927
1939
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1928
1940
|
if (!e.isText) return;
|
|
1929
1941
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1930
|
-
i.add(
|
|
1942
|
+
i.add(We(t?.attrs.fontSize));
|
|
1931
1943
|
});
|
|
1932
1944
|
let a = Array.from(i);
|
|
1933
1945
|
return a.length > 1 ? "mixed" : a[0] ?? "";
|
|
1934
1946
|
}
|
|
1935
|
-
function
|
|
1947
|
+
function $e(e) {
|
|
1936
1948
|
let { target: t } = e;
|
|
1937
1949
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1938
|
-
let n =
|
|
1939
|
-
n && (t.value === "" ? n.unsetFontSize().run() :
|
|
1950
|
+
let n = x.value?.chain().focus();
|
|
1951
|
+
n && (t.value === "" ? n.unsetFontSize().run() : kn(t.value) && n.setFontSize(t.value).run());
|
|
1940
1952
|
}
|
|
1941
|
-
let
|
|
1942
|
-
let e =
|
|
1943
|
-
return
|
|
1944
|
-
}),
|
|
1953
|
+
let et = Ge(() => {
|
|
1954
|
+
let e = ze();
|
|
1955
|
+
return Re(e) ? e : void 0;
|
|
1956
|
+
}), tt = a({
|
|
1945
1957
|
get: () => {
|
|
1946
|
-
let e =
|
|
1958
|
+
let e = x.value?.getAttributes("textStyle").color, t = typeof e == "string" ? Te(e) : void 0;
|
|
1947
1959
|
return t ? {
|
|
1948
1960
|
type: "color",
|
|
1949
1961
|
...t
|
|
1950
|
-
} :
|
|
1962
|
+
} : de;
|
|
1951
1963
|
},
|
|
1952
1964
|
set: (e) => {
|
|
1953
|
-
e.type !== "transparent" &&
|
|
1965
|
+
e.type !== "transparent" && x.value?.chain().setColor(be(e)).run();
|
|
1954
1966
|
}
|
|
1955
|
-
}),
|
|
1967
|
+
}), rt = {
|
|
1956
1968
|
left: "blocks.text.alignLeft",
|
|
1957
1969
|
center: "blocks.text.alignCenter",
|
|
1958
1970
|
right: "blocks.text.alignRight",
|
|
1959
1971
|
justify: "blocks.text.alignJustify"
|
|
1960
1972
|
};
|
|
1961
|
-
function
|
|
1973
|
+
function it(e) {
|
|
1962
1974
|
return (e === "justify" ? [
|
|
1963
1975
|
14,
|
|
1964
1976
|
14,
|
|
@@ -1978,85 +1990,85 @@ var nr = H.create({
|
|
|
1978
1990
|
};
|
|
1979
1991
|
});
|
|
1980
1992
|
}
|
|
1981
|
-
let
|
|
1982
|
-
function
|
|
1993
|
+
let at = ne(), H = y("linkPopover"), st = y("linkInput"), U = y("linkTrigger"), W = k(""), ct = k(!1), lt = k(!1);
|
|
1994
|
+
function ut(e) {
|
|
1983
1995
|
if (e.newState !== "open") return;
|
|
1984
|
-
let t =
|
|
1985
|
-
|
|
1986
|
-
let n =
|
|
1996
|
+
let t = x.value?.getAttributes("link")?.href;
|
|
1997
|
+
W.value = typeof t == "string" ? t : "", lt.value = W.value !== "";
|
|
1998
|
+
let n = H.value, r = U.value?.getBoundingClientRect();
|
|
1987
1999
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1988
2000
|
}
|
|
1989
|
-
function
|
|
1990
|
-
if (
|
|
1991
|
-
let t =
|
|
2001
|
+
function dt(e) {
|
|
2002
|
+
if (ct.value = e.newState === "open", e.newState !== "open") return;
|
|
2003
|
+
let t = H.value;
|
|
1992
2004
|
if (t) {
|
|
1993
2005
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1994
2006
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1995
2007
|
}
|
|
1996
2008
|
n(() => {
|
|
1997
|
-
|
|
2009
|
+
st.value?.focus(), st.value?.select();
|
|
1998
2010
|
});
|
|
1999
2011
|
}
|
|
2000
|
-
function
|
|
2001
|
-
let t = e.relatedTarget, n =
|
|
2012
|
+
function ft(e) {
|
|
2013
|
+
let t = e.relatedTarget, n = H.value;
|
|
2002
2014
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
2003
2015
|
}
|
|
2004
|
-
function
|
|
2005
|
-
let e =
|
|
2016
|
+
function G() {
|
|
2017
|
+
let e = x.value?.chain().focus();
|
|
2006
2018
|
if (!e) return;
|
|
2007
|
-
let t =
|
|
2019
|
+
let t = Ke(W.value);
|
|
2008
2020
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
2009
2021
|
href: t,
|
|
2010
2022
|
target: t.startsWith("#") ? null : "_blank"
|
|
2011
|
-
}).run(),
|
|
2023
|
+
}).run(), H.value?.hidePopover();
|
|
2012
2024
|
}
|
|
2013
|
-
let
|
|
2014
|
-
function
|
|
2015
|
-
e === "" ?
|
|
2025
|
+
let pt = d(le, a(() => [])), mt = a(() => W.value.startsWith("#") && pt.value.includes(W.value.slice(1)) ? W.value.slice(1) : "");
|
|
2026
|
+
function ht(e) {
|
|
2027
|
+
e === "" ? W.value.startsWith("#") && (W.value = "") : W.value = `#${e}`;
|
|
2016
2028
|
}
|
|
2017
|
-
function
|
|
2018
|
-
|
|
2029
|
+
function gt() {
|
|
2030
|
+
x.value?.chain().focus().unsetLink().run(), H.value?.hidePopover();
|
|
2019
2031
|
}
|
|
2020
|
-
let
|
|
2021
|
-
function
|
|
2022
|
-
let n =
|
|
2023
|
-
return n && r && i &&
|
|
2032
|
+
let K = y("pastePrompt"), _t = y("pasteKeep"), vt = ne(), q;
|
|
2033
|
+
function J(e, t) {
|
|
2034
|
+
let n = x.value, r = K.value, i = e.clipboardData?.getData("text/plain") ?? "";
|
|
2035
|
+
return n && r && i && Kn(n.state, t) ? (q = {
|
|
2024
2036
|
slice: t,
|
|
2025
2037
|
text: i
|
|
2026
|
-
}, r.showPopover(),
|
|
2038
|
+
}, r.showPopover(), yt(n.view, r), _t.value?.focus(), !0) : !1;
|
|
2027
2039
|
}
|
|
2028
|
-
function
|
|
2040
|
+
function yt(e, t) {
|
|
2029
2041
|
let n = e.coordsAtPos(e.state.selection.from), r = Ie(n, window.innerHeight), i = window.innerWidth - t.offsetWidth - 8;
|
|
2030
2042
|
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";
|
|
2031
2043
|
}
|
|
2032
|
-
function
|
|
2033
|
-
let t =
|
|
2034
|
-
|
|
2035
|
-
let n =
|
|
2044
|
+
function Y(e) {
|
|
2045
|
+
let t = q;
|
|
2046
|
+
q = void 0;
|
|
2047
|
+
let n = x.value;
|
|
2036
2048
|
if (t && n && !n.isDestroyed) {
|
|
2037
2049
|
let { view: r } = n;
|
|
2038
|
-
r.focus(), r.dispatch(
|
|
2050
|
+
r.focus(), r.dispatch(qn(r.state, e ? t.slice : Yn(r.state, t.text)));
|
|
2039
2051
|
}
|
|
2040
|
-
|
|
2052
|
+
bt();
|
|
2041
2053
|
}
|
|
2042
|
-
function
|
|
2043
|
-
|
|
2054
|
+
function X() {
|
|
2055
|
+
q = void 0, x.value?.view.focus(), bt();
|
|
2044
2056
|
}
|
|
2045
|
-
function
|
|
2046
|
-
|
|
2057
|
+
function bt() {
|
|
2058
|
+
K.value?.matches(":popover-open") && K.value.hidePopover();
|
|
2047
2059
|
}
|
|
2048
|
-
function
|
|
2060
|
+
function xt(e) {
|
|
2049
2061
|
let t = e.relatedTarget;
|
|
2050
|
-
t instanceof Node &&
|
|
2062
|
+
t instanceof Node && K.value?.contains(t) || (q = void 0, bt());
|
|
2051
2063
|
}
|
|
2052
|
-
let
|
|
2053
|
-
async function
|
|
2054
|
-
let t =
|
|
2055
|
-
if (!(t && n) ||
|
|
2056
|
-
let r =
|
|
2064
|
+
let St = d(nt), Ct = ge(), wt = a(() => cn(St?.value?.ai)), Z = k(!1);
|
|
2065
|
+
async function Tt(e) {
|
|
2066
|
+
let t = x.value, n = St?.value?.ai;
|
|
2067
|
+
if (!(t && n) || Z.value) return;
|
|
2068
|
+
let r = Ln(t.state.doc, t.state.selection);
|
|
2057
2069
|
if (r.length === 0) return;
|
|
2058
|
-
|
|
2059
|
-
let i = new
|
|
2070
|
+
Z.value = !0;
|
|
2071
|
+
let i = new Ee(), a = ({ transaction: e, appendedTransactions: t }) => {
|
|
2060
2072
|
for (let n of [e, ...t]) i.appendMapping(n.mapping);
|
|
2061
2073
|
};
|
|
2062
2074
|
t.on("transaction", a);
|
|
@@ -2067,47 +2079,50 @@ var nr = H.create({
|
|
|
2067
2079
|
locale: m.value
|
|
2068
2080
|
})));
|
|
2069
2081
|
if (!t.isDestroyed) {
|
|
2070
|
-
let e =
|
|
2082
|
+
let e = Hn(t.state, r, a, i);
|
|
2071
2083
|
e && t.view.dispatch(e);
|
|
2072
2084
|
}
|
|
2073
2085
|
} catch (e) {
|
|
2074
|
-
console.error("[bygga-editor] the AI action failed —", e),
|
|
2086
|
+
console.error("[bygga-editor] the AI action failed —", e), Ct?.show(p("blocks.text.ai.failed"));
|
|
2075
2087
|
} finally {
|
|
2076
|
-
t.off("transaction", a),
|
|
2088
|
+
t.off("transaction", a), Z.value = !1;
|
|
2077
2089
|
}
|
|
2078
2090
|
}
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2081
|
-
type:
|
|
2091
|
+
function Et(e) {
|
|
2092
|
+
x.value?.chain().focus().insertContent({
|
|
2093
|
+
type: je,
|
|
2082
2094
|
attrs: { id: e }
|
|
2083
2095
|
}).run();
|
|
2084
2096
|
}
|
|
2085
2097
|
return (e, n) => (v(), t("div", {
|
|
2086
2098
|
ref_key: "root",
|
|
2087
|
-
ref:
|
|
2099
|
+
ref: C,
|
|
2088
2100
|
style: {
|
|
2089
2101
|
position: "relative",
|
|
2090
2102
|
width: "100%"
|
|
2091
2103
|
},
|
|
2092
|
-
onFocusin:
|
|
2093
|
-
onFocusout:
|
|
2104
|
+
onFocusin: he,
|
|
2105
|
+
onFocusout: ve
|
|
2094
2106
|
}, [
|
|
2095
|
-
f(
|
|
2107
|
+
f(D(ot), {
|
|
2096
2108
|
width: l.width,
|
|
2097
2109
|
align: l.align
|
|
2098
2110
|
}, {
|
|
2099
|
-
default:
|
|
2111
|
+
default: S(() => [f(D(Qt), {
|
|
2100
2112
|
ref_key: "content",
|
|
2101
|
-
ref:
|
|
2102
|
-
class:
|
|
2113
|
+
ref: oe,
|
|
2114
|
+
class: E({
|
|
2103
2115
|
"text-input": l.editable,
|
|
2104
2116
|
"text-spaced": l.paragraphSpacing !== void 0
|
|
2105
2117
|
}),
|
|
2106
|
-
editor:
|
|
2107
|
-
style:
|
|
2108
|
-
|
|
2118
|
+
editor: D(x),
|
|
2119
|
+
style: ie([
|
|
2120
|
+
D(Ve)(l),
|
|
2109
2121
|
l.paragraphSpacing === void 0 ? void 0 : { "--bygga-paragraph-spacing": `${l.paragraphSpacing}px` },
|
|
2110
|
-
|
|
2122
|
+
{
|
|
2123
|
+
fontSize: `${D(16)}px`,
|
|
2124
|
+
lineHeight: l.lineHeight === void 0 ? "normal" : String(l.lineHeight)
|
|
2125
|
+
}
|
|
2111
2126
|
])
|
|
2112
2127
|
}, null, 8, [
|
|
2113
2128
|
"class",
|
|
@@ -2119,189 +2134,189 @@ var nr = H.create({
|
|
|
2119
2134
|
l.editable ? (v(), t("div", {
|
|
2120
2135
|
key: 0,
|
|
2121
2136
|
ref_key: "toolbar",
|
|
2122
|
-
ref:
|
|
2137
|
+
ref: w,
|
|
2123
2138
|
popover: "manual",
|
|
2124
2139
|
class: "toolbar",
|
|
2125
2140
|
onToggle: xe
|
|
2126
2141
|
}, [
|
|
2127
|
-
i("span",
|
|
2128
|
-
"aria-label":
|
|
2142
|
+
i("span", ar, [i("select", {
|
|
2143
|
+
"aria-label": D(p)("blocks.text.styleLabel"),
|
|
2129
2144
|
class: "style",
|
|
2130
|
-
value:
|
|
2145
|
+
value: Ce(),
|
|
2131
2146
|
onChange: we,
|
|
2132
2147
|
onMousedown: n[0] ||= g(() => {}, ["stop"])
|
|
2133
|
-
}, [l.headerOnly ?
|
|
2148
|
+
}, [l.headerOnly ? T("", !0) : (v(), t("option", sr, b(D(p)("blocks.text.styleNormal")), 1)), (v(!0), t(r, null, u(D(Le), (e) => (v(), t("option", {
|
|
2134
2149
|
key: e,
|
|
2135
2150
|
value: `h${e}`
|
|
2136
|
-
}, b(
|
|
2151
|
+
}, b(D(p)("blocks.text.styleHeading", { level: e })), 9, cr))), 128))], 40, or), f(M, {
|
|
2137
2152
|
class: "picker-chevron",
|
|
2138
2153
|
name: "chevron-down",
|
|
2139
2154
|
size: 12
|
|
2140
2155
|
})]),
|
|
2141
2156
|
n[24] ||= i("span", { class: "divider" }, null, -1),
|
|
2142
|
-
i("span",
|
|
2143
|
-
"aria-label":
|
|
2157
|
+
i("span", lr, [i("select", {
|
|
2158
|
+
"aria-label": D(p)("blocks.text.font"),
|
|
2144
2159
|
class: "font",
|
|
2145
|
-
value:
|
|
2146
|
-
onChange:
|
|
2160
|
+
value: ze(),
|
|
2161
|
+
onChange: Ue,
|
|
2147
2162
|
onMousedown: n[1] ||= g(() => {}, ["stop"])
|
|
2148
2163
|
}, [
|
|
2149
|
-
i("option",
|
|
2150
|
-
(v(!0), t(r, null, u(
|
|
2164
|
+
i("option", dr, b(D(p)("blocks.text.fontMixed")), 1),
|
|
2165
|
+
(v(!0), t(r, null, u(D(et), (e) => (v(), t("option", {
|
|
2151
2166
|
key: e.key,
|
|
2152
2167
|
value: e.key
|
|
2153
|
-
}, b(e.name), 9,
|
|
2154
|
-
(v(!0), t(r, null, u(
|
|
2168
|
+
}, b(e.name), 9, fr))), 128)),
|
|
2169
|
+
(v(!0), t(r, null, u(D(z), (e) => (v(), t("option", {
|
|
2155
2170
|
key: B(e.name),
|
|
2156
2171
|
value: B(e.name)
|
|
2157
|
-
}, b(e.name), 9,
|
|
2158
|
-
], 40,
|
|
2172
|
+
}, b(e.name), 9, pr))), 128))
|
|
2173
|
+
], 40, ur), f(M, {
|
|
2159
2174
|
class: "picker-chevron",
|
|
2160
2175
|
name: "chevron-down",
|
|
2161
2176
|
size: 12
|
|
2162
2177
|
})]),
|
|
2163
|
-
i("span",
|
|
2164
|
-
"aria-label":
|
|
2178
|
+
i("span", mr, [i("select", {
|
|
2179
|
+
"aria-label": D(p)("blocks.text.fontSize"),
|
|
2165
2180
|
class: "size",
|
|
2166
|
-
value:
|
|
2167
|
-
onChange:
|
|
2181
|
+
value: qe(),
|
|
2182
|
+
onChange: $e,
|
|
2168
2183
|
onMousedown: n[2] ||= g(() => {}, ["stop"])
|
|
2169
2184
|
}, [
|
|
2170
|
-
i("option",
|
|
2171
|
-
i("option",
|
|
2172
|
-
(v(!0), t(r, null, u(
|
|
2185
|
+
i("option", gr, b(D(p)("blocks.text.fontMixed")), 1),
|
|
2186
|
+
i("option", _r, b(D(p)("blocks.text.fontSizeDefault")), 1),
|
|
2187
|
+
(v(!0), t(r, null, u(D(Ye), (e) => (v(), t("option", {
|
|
2173
2188
|
key: e,
|
|
2174
|
-
value:
|
|
2175
|
-
}, b(e), 9,
|
|
2176
|
-
], 40,
|
|
2189
|
+
value: D(En)(e)
|
|
2190
|
+
}, b(e), 9, vr))), 128))
|
|
2191
|
+
], 40, hr), f(M, {
|
|
2177
2192
|
class: "picker-chevron",
|
|
2178
2193
|
name: "chevron-down",
|
|
2179
2194
|
size: 12
|
|
2180
2195
|
})]),
|
|
2181
|
-
f(
|
|
2182
|
-
modelValue:
|
|
2183
|
-
"onUpdate:modelValue": n[3] ||= (e) =>
|
|
2196
|
+
f(Je, {
|
|
2197
|
+
modelValue: tt.value,
|
|
2198
|
+
"onUpdate:modelValue": n[3] ||= (e) => tt.value = e,
|
|
2184
2199
|
"allow-transparent": !1,
|
|
2185
|
-
label:
|
|
2200
|
+
label: D(p)("blocks.text.textColor"),
|
|
2186
2201
|
compact: "",
|
|
2187
2202
|
"keep-focus": "",
|
|
2188
2203
|
onMousedown: n[4] ||= g(() => {}, ["stop"])
|
|
2189
2204
|
}, null, 8, ["modelValue", "label"]),
|
|
2190
2205
|
n[25] ||= i("span", { class: "divider" }, null, -1),
|
|
2191
2206
|
i("button", {
|
|
2192
|
-
class:
|
|
2207
|
+
class: E({ active: D(x)?.isActive("bold") }),
|
|
2193
2208
|
type: "button",
|
|
2194
|
-
title:
|
|
2195
|
-
"aria-label":
|
|
2196
|
-
onClick: n[5] ||= (e) =>
|
|
2209
|
+
title: D(p)("blocks.text.bold"),
|
|
2210
|
+
"aria-label": D(p)("blocks.text.bold"),
|
|
2211
|
+
onClick: n[5] ||= (e) => D(x)?.chain().focus().toggleBold().run(),
|
|
2197
2212
|
onMousedown: n[6] ||= g(() => {}, ["prevent"])
|
|
2198
|
-
}, [...n[21] ||= [i("b", null, "B", -1)]], 42,
|
|
2213
|
+
}, [...n[21] ||= [i("b", null, "B", -1)]], 42, yr),
|
|
2199
2214
|
i("button", {
|
|
2200
|
-
class:
|
|
2215
|
+
class: E({ active: D(x)?.isActive("italic") }),
|
|
2201
2216
|
type: "button",
|
|
2202
|
-
title:
|
|
2203
|
-
"aria-label":
|
|
2204
|
-
onClick: n[7] ||= (e) =>
|
|
2217
|
+
title: D(p)("blocks.text.italic"),
|
|
2218
|
+
"aria-label": D(p)("blocks.text.italic"),
|
|
2219
|
+
onClick: n[7] ||= (e) => D(x)?.chain().focus().toggleItalic().run(),
|
|
2205
2220
|
onMousedown: n[8] ||= g(() => {}, ["prevent"])
|
|
2206
|
-
}, [...n[22] ||= [i("i", null, "I", -1)]], 42,
|
|
2221
|
+
}, [...n[22] ||= [i("i", null, "I", -1)]], 42, br),
|
|
2207
2222
|
i("button", {
|
|
2208
|
-
class:
|
|
2223
|
+
class: E({ active: D(x)?.isActive("underline") }),
|
|
2209
2224
|
type: "button",
|
|
2210
|
-
title:
|
|
2211
|
-
"aria-label":
|
|
2212
|
-
onClick: n[9] ||= (e) =>
|
|
2225
|
+
title: D(p)("blocks.text.underline"),
|
|
2226
|
+
"aria-label": D(p)("blocks.text.underline"),
|
|
2227
|
+
onClick: n[9] ||= (e) => D(x)?.chain().focus().toggleUnderline().run(),
|
|
2213
2228
|
onMousedown: n[10] ||= g(() => {}, ["prevent"])
|
|
2214
|
-
}, [...n[23] ||= [i("u", null, "U", -1)]], 42,
|
|
2229
|
+
}, [...n[23] ||= [i("u", null, "U", -1)]], 42, xr),
|
|
2215
2230
|
i("button", {
|
|
2216
2231
|
ref_key: "linkTrigger",
|
|
2217
|
-
ref:
|
|
2218
|
-
class:
|
|
2232
|
+
ref: U,
|
|
2233
|
+
class: E({ active: D(x)?.isActive("link") }),
|
|
2219
2234
|
type: "button",
|
|
2220
|
-
title:
|
|
2221
|
-
popovertarget:
|
|
2235
|
+
title: D(p)("blocks.text.link"),
|
|
2236
|
+
popovertarget: D(at),
|
|
2222
2237
|
"aria-haspopup": "dialog",
|
|
2223
|
-
"aria-expanded":
|
|
2238
|
+
"aria-expanded": ct.value,
|
|
2224
2239
|
onMousedown: n[11] ||= g(() => {}, ["prevent"])
|
|
2225
|
-
}, [f(
|
|
2240
|
+
}, [f(M, {
|
|
2226
2241
|
name: "link",
|
|
2227
2242
|
size: 16
|
|
2228
|
-
})], 42,
|
|
2243
|
+
})], 42, Sr),
|
|
2229
2244
|
l.editable ? (v(), t("div", {
|
|
2230
2245
|
key: 0,
|
|
2231
|
-
id:
|
|
2246
|
+
id: D(at),
|
|
2232
2247
|
ref_key: "linkPopover",
|
|
2233
|
-
ref:
|
|
2248
|
+
ref: H,
|
|
2234
2249
|
class: "link-popover",
|
|
2235
2250
|
popover: "",
|
|
2236
2251
|
role: "dialog",
|
|
2237
|
-
"aria-label":
|
|
2238
|
-
onBeforetoggle:
|
|
2239
|
-
onToggle:
|
|
2240
|
-
onFocusout:
|
|
2252
|
+
"aria-label": D(p)("blocks.text.link"),
|
|
2253
|
+
onBeforetoggle: ut,
|
|
2254
|
+
onToggle: dt,
|
|
2255
|
+
onFocusout: ft
|
|
2241
2256
|
}, [
|
|
2242
|
-
i("span",
|
|
2257
|
+
i("span", wr, [f(Ne, {
|
|
2243
2258
|
ref_key: "linkInput",
|
|
2244
|
-
ref:
|
|
2245
|
-
modelValue:
|
|
2246
|
-
"onUpdate:modelValue": n[12] ||= (e) =>
|
|
2259
|
+
ref: st,
|
|
2260
|
+
modelValue: W.value,
|
|
2261
|
+
"onUpdate:modelValue": n[12] ||= (e) => W.value = e,
|
|
2247
2262
|
inputmode: "url",
|
|
2248
2263
|
spellcheck: "false",
|
|
2249
2264
|
autocomplete: "off",
|
|
2250
|
-
placeholder:
|
|
2251
|
-
"aria-label":
|
|
2252
|
-
onKeydown:
|
|
2265
|
+
placeholder: D(p)("blocks.text.linkPlaceholder"),
|
|
2266
|
+
"aria-label": D(p)("blocks.text.linkPrompt"),
|
|
2267
|
+
onKeydown: ue(g(G, ["prevent"]), ["enter"])
|
|
2253
2268
|
}, null, 8, [
|
|
2254
2269
|
"modelValue",
|
|
2255
2270
|
"placeholder",
|
|
2256
2271
|
"aria-label",
|
|
2257
2272
|
"onKeydown"
|
|
2258
2273
|
])]),
|
|
2259
|
-
|
|
2260
|
-
"aria-label":
|
|
2261
|
-
"model-value":
|
|
2262
|
-
"onUpdate:modelValue":
|
|
2274
|
+
D(pt).length ? (v(), t("span", Tr, [f(Be, {
|
|
2275
|
+
"aria-label": D(p)("blocks.common.anchorLink.label"),
|
|
2276
|
+
"model-value": mt.value,
|
|
2277
|
+
"onUpdate:modelValue": ht,
|
|
2263
2278
|
onMousedown: n[13] ||= g(() => {}, ["stop"])
|
|
2264
2279
|
}, {
|
|
2265
|
-
default:
|
|
2280
|
+
default: S(() => [mt.value ? (v(), t("option", Er, b(D(p)("blocks.common.anchorLink.none")), 1)) : (v(), t("option", Dr, b(D(p)("blocks.common.anchorLink.placeholder")), 1)), (v(!0), t(r, null, u(D(pt), (e) => (v(), t("option", {
|
|
2266
2281
|
key: e,
|
|
2267
2282
|
value: e
|
|
2268
|
-
}, " #" + b(e), 9,
|
|
2283
|
+
}, " #" + b(e), 9, Or))), 128))]),
|
|
2269
2284
|
_: 1
|
|
2270
|
-
}, 8, ["aria-label", "model-value"])])) :
|
|
2285
|
+
}, 8, ["aria-label", "model-value"])])) : T("", !0),
|
|
2271
2286
|
i("button", {
|
|
2272
2287
|
class: "link-apply",
|
|
2273
2288
|
type: "button",
|
|
2274
|
-
onClick:
|
|
2289
|
+
onClick: G,
|
|
2275
2290
|
onMousedown: n[14] ||= g(() => {}, ["prevent"])
|
|
2276
|
-
}, b(
|
|
2277
|
-
|
|
2291
|
+
}, b(D(p)("blocks.text.linkApply")), 33),
|
|
2292
|
+
lt.value ? (v(), t("button", {
|
|
2278
2293
|
key: 1,
|
|
2279
2294
|
class: "link-remove",
|
|
2280
2295
|
type: "button",
|
|
2281
|
-
title:
|
|
2282
|
-
"aria-label":
|
|
2283
|
-
onClick:
|
|
2296
|
+
title: D(p)("blocks.text.linkRemove"),
|
|
2297
|
+
"aria-label": D(p)("blocks.text.linkRemove"),
|
|
2298
|
+
onClick: gt,
|
|
2284
2299
|
onMousedown: n[15] ||= g(() => {}, ["prevent"])
|
|
2285
|
-
}, [f(
|
|
2300
|
+
}, [f(M, {
|
|
2286
2301
|
name: "trash",
|
|
2287
2302
|
size: 16
|
|
2288
|
-
})], 40,
|
|
2289
|
-
], 40,
|
|
2290
|
-
f(
|
|
2291
|
-
f(
|
|
2292
|
-
actions:
|
|
2293
|
-
pending:
|
|
2294
|
-
onSelect:
|
|
2303
|
+
})], 40, kr)) : T("", !0)
|
|
2304
|
+
], 40, Cr)) : T("", !0),
|
|
2305
|
+
f(wn, { onSelect: Et }),
|
|
2306
|
+
f(gn, {
|
|
2307
|
+
actions: wt.value,
|
|
2308
|
+
pending: Z.value,
|
|
2309
|
+
onSelect: Tt
|
|
2295
2310
|
}, null, 8, ["actions", "pending"]),
|
|
2296
2311
|
n[26] ||= i("span", { class: "divider" }, null, -1),
|
|
2297
2312
|
(v(), t(r, null, u(ee, (e) => i("button", {
|
|
2298
2313
|
key: e,
|
|
2299
|
-
class:
|
|
2300
|
-
title:
|
|
2314
|
+
class: E({ active: D(x)?.isActive({ textAlign: e }) }),
|
|
2315
|
+
title: D(p)(rt[e]),
|
|
2301
2316
|
type: "button",
|
|
2302
|
-
onClick: (t) =>
|
|
2317
|
+
onClick: (t) => D(x)?.chain().focus().setTextAlign(e).run(),
|
|
2303
2318
|
onMousedown: n[16] ||= g(() => {}, ["prevent"])
|
|
2304
|
-
}, [(v(), t("svg",
|
|
2319
|
+
}, [(v(), t("svg", jr, [(v(!0), t(r, null, u(it(e), (e, n) => (v(), t("rect", {
|
|
2305
2320
|
key: n,
|
|
2306
2321
|
fill: "currentColor",
|
|
2307
2322
|
height: "1.5",
|
|
@@ -2309,38 +2324,38 @@ var nr = H.create({
|
|
|
2309
2324
|
width: e.w,
|
|
2310
2325
|
x: e.x,
|
|
2311
2326
|
y: e.y
|
|
2312
|
-
}, null, 8,
|
|
2313
|
-
], 544)) :
|
|
2327
|
+
}, null, 8, Mr))), 128))]))], 42, Ar)), 64))
|
|
2328
|
+
], 544)) : T("", !0),
|
|
2314
2329
|
l.editable ? (v(), t("div", {
|
|
2315
2330
|
key: 1,
|
|
2316
2331
|
ref_key: "pastePrompt",
|
|
2317
|
-
ref:
|
|
2332
|
+
ref: K,
|
|
2318
2333
|
popover: "manual",
|
|
2319
2334
|
class: "paste-prompt",
|
|
2320
2335
|
role: "dialog",
|
|
2321
2336
|
tabindex: "-1",
|
|
2322
|
-
"aria-labelledby":
|
|
2323
|
-
onKeydown:
|
|
2324
|
-
onFocusout:
|
|
2337
|
+
"aria-labelledby": D(vt),
|
|
2338
|
+
onKeydown: ue(g(X, ["stop", "prevent"]), ["esc"]),
|
|
2339
|
+
onFocusout: xt
|
|
2325
2340
|
}, [
|
|
2326
|
-
i("span", { id:
|
|
2341
|
+
i("span", { id: D(vt) }, b(D(p)("blocks.text.pastePrompt.question")), 9, Pr),
|
|
2327
2342
|
i("button", {
|
|
2328
2343
|
ref_key: "pasteKeep",
|
|
2329
|
-
ref:
|
|
2344
|
+
ref: _t,
|
|
2330
2345
|
class: "paste-keep",
|
|
2331
2346
|
type: "button",
|
|
2332
|
-
onClick: n[17] ||= (e) =>
|
|
2347
|
+
onClick: n[17] ||= (e) => Y(!0),
|
|
2333
2348
|
onMousedown: n[18] ||= g(() => {}, ["prevent"])
|
|
2334
|
-
}, b(
|
|
2349
|
+
}, b(D(p)("blocks.text.pastePrompt.keep")), 545),
|
|
2335
2350
|
i("button", {
|
|
2336
2351
|
class: "paste-plain",
|
|
2337
2352
|
type: "button",
|
|
2338
|
-
onClick: n[19] ||= (e) =>
|
|
2353
|
+
onClick: n[19] ||= (e) => Y(!1),
|
|
2339
2354
|
onMousedown: n[20] ||= g(() => {}, ["prevent"])
|
|
2340
|
-
}, b(
|
|
2341
|
-
], 40,
|
|
2355
|
+
}, b(D(p)("blocks.text.pastePrompt.plain")), 33)
|
|
2356
|
+
], 40, Nr)) : T("", !0)
|
|
2342
2357
|
], 544));
|
|
2343
2358
|
}
|
|
2344
|
-
}), [["styles", [".text-spaced .tiptap :is(p,h1,h2,h3,h4,h5,h6){margin:var(--bygga-paragraph-spacing) 0}.tiptap{font-feature-settings:\"liga\" 0;font-variant-ligatures:none;overflow-wrap:break-word;white-space:pre-wrap;position:relative}.text-input .tiptap:focus,.text-input .tiptap:focus-visible{outline:none}.text-input .tiptap .is-editor-empty:first-child{position:relative}.text-input .tiptap .is-editor-empty:first-child:before{color:var(--bygga-color-text-muted);content:attr(data-placeholder);pointer-events:none;text-overflow:ellipsis;inset-inline:0;white-space:nowrap;position:absolute;top:0;overflow:hidden}.merge-tag{background:var(--bygga-color-track);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);color:var(--bygga-color-accent);cursor:default;white-space:nowrap;-webkit-user-select:all;user-select:all;padding:0 .3em;font-size:.9em}.merge-tag.is-unknown{color:var(--bygga-color-text-muted);border-style:dashed}.merge-tag.ProseMirror-selectednode{outline:2px solid var(--bygga-color-accent);outline-offset:1px}", ".toolbar[data-v-
|
|
2359
|
+
}), [["styles", [".text-spaced .tiptap :is(p,h1,h2,h3,h4,h5,h6){margin:var(--bygga-paragraph-spacing) 0}.tiptap{font-feature-settings:\"liga\" 0;font-variant-ligatures:none;overflow-wrap:break-word;white-space:pre-wrap;position:relative}.text-input .tiptap:focus,.text-input .tiptap:focus-visible{outline:none}.text-input .tiptap .is-editor-empty:first-child{position:relative}.text-input .tiptap .is-editor-empty:first-child:before{color:var(--bygga-color-text-muted);content:attr(data-placeholder);pointer-events:none;text-overflow:ellipsis;inset-inline:0;white-space:nowrap;position:absolute;top:0;overflow:hidden}.merge-tag{background:var(--bygga-color-track);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);color:var(--bygga-color-accent);cursor:default;white-space:nowrap;-webkit-user-select:all;user-select:all;padding:0 .3em;font-size:.9em}.merge-tag.is-unknown{color:var(--bygga-color-text-muted);border-style:dashed}.merge-tag.ProseMirror-selectednode{outline:2px solid var(--bygga-color-accent);outline-offset:1px}", ".toolbar[data-v-9cb2449a]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border-subtle);box-shadow:var(--bygga-shadow-card);white-space:nowrap;font-family:var(--bygga-font-family);direction:ltr;border-radius:0;flex-wrap:wrap;align-items:center;gap:3px;margin:0;padding:6px 4px;font-size:13px;font-weight:400;position:fixed;inset:auto;transform:translateY(-100%)}.toolbar[data-v-9cb2449a]:popover-open{display:flex}.toolbar>button[data-v-9cb2449a]{color:var(--bygga-color-text);cursor:pointer;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:30px;height:30px;padding:0;display:inline-flex}.toolbar>button[data-v-9cb2449a]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.toolbar>button.active[data-v-9cb2449a]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.toolbar .picker[data-v-9cb2449a]{align-items:center;display:inline-flex;position:relative}.toolbar .style[data-v-9cb2449a],.toolbar .font[data-v-9cb2449a],.toolbar .size[data-v-9cb2449a]{appearance:none;color:var(--bygga-color-text);cursor:pointer;font:inherit;text-align-last:right;background:0 0;border:none;border-radius:4px;height:30px;padding:0 21px 0 6px}.toolbar .style[data-v-9cb2449a]:hover,.toolbar .font[data-v-9cb2449a]:hover,.toolbar .size[data-v-9cb2449a]:hover{background:color-mix(in srgb, var(--bygga-color-text) 7%, transparent)}.toolbar .picker-chevron[data-v-9cb2449a]{color:var(--bygga-color-text);pointer-events:none;position:absolute;right:5px}.toolbar .divider[data-v-9cb2449a]{background:var(--bygga-color-divider);width:1px;height:24px;margin:0 4px}.link-popover[data-v-9cb2449a]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);align-items:center;gap:.25em;margin:0;padding:.25em;position:fixed;inset:auto}.link-popover[data-v-9cb2449a]:popover-open{display:flex}.link-field[data-v-9cb2449a]{width:18em}.link-anchor[data-v-9cb2449a]{width:10em}.link-apply[data-v-9cb2449a]{background:var(--bygga-color-accent);border-radius:var(--bygga-radius-sm);color:var(--bygga-color-surface);cursor:pointer;border:none;padding:.4em .8em}.link-remove[data-v-9cb2449a]{border-radius:var(--bygga-radius-sm);color:var(--bygga-color-text-muted);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;min-width:1.8em;height:1.8em;padding:0;display:inline-flex}.link-remove[data-v-9cb2449a]:hover{background:var(--bygga-color-track);color:var(--bygga-color-accent)}.paste-prompt[data-v-9cb2449a]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);color:var(--bygga-color-text);font-family:var(--bygga-font-family);white-space:nowrap;direction:ltr;align-items:center;gap:8px;margin:0;padding:6px 6px 6px 10px;font-size:13px;font-weight:400;position:fixed;inset:auto}.paste-prompt[data-v-9cb2449a]:popover-open{display:flex}.paste-keep[data-v-9cb2449a],.paste-plain[data-v-9cb2449a]{border-radius:var(--bygga-radius-sm);cursor:pointer;font:inherit;padding:.4em .8em}.paste-keep[data-v-9cb2449a]{background:var(--bygga-color-accent);border:1px solid var(--bygga-color-accent);color:var(--bygga-color-surface)}.paste-plain[data-v-9cb2449a]{border:1px solid var(--bygga-color-border);color:var(--bygga-color-text);background:0 0}"]], ["__scopeId", "data-v-9cb2449a"]]);
|
|
2345
2360
|
//#endregion
|
|
2346
|
-
export {
|
|
2361
|
+
export { Lr as default };
|