@bygga.dev/editor 1.8.0 → 1.8.3
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.
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as e, B as t, D as n, E as r, F as i, G as a, H as o, I as s, J as c, M as l, N as u, O as d, P as f, Q as p, R as ee, T as m, U as h, W as g, X as _, Y as v, Z as y, a as b, b as x, ct as S, dt as C, et as w, ft as T, ht as E, it as D, k as O, lt as te, m as k, mt as ne, ot as A, q as re, t as ie, w as j, x as M, y as ae, z as oe } from "./providerKeys-D5U1FqVd.js";
|
|
2
|
+
import { At as N, C as P, Ct as F, D as I, Dt as se, Et as ce, G as le, K as ue, Ot as de, S as fe, Sn as pe, St as L, Tt as R, _t as me, at as he, b as ge, bn as _e, bt as z, c as ve, ct as ye, d as be, dn as xe, dt as B, et as Se, fn as Ce, ft as we, g as Te, gn as Ee, gt as De, hn as Oe, ht as ke, kt as Ae, l as je, ln as Me, lt as Ne, mn as Pe, mt as Fe, n as Ie, ot as Le, pn as Re, pt as ze, r as Be, s as Ve, st as He, t as Ue, tt as We, u as Ge, un as Ke, ut as qe, v as Je, vt as V, wt as H, xt as U, yt as W } from "./urls-BsMrzVdc.js";
|
|
3
|
+
//#region ../core/src/render/TextShell.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var Ye = ["align"], Xe = /* @__PURE__ */ l({
|
|
5
|
+
__name: "TextShell",
|
|
6
|
+
props: {
|
|
7
|
+
width: { type: null },
|
|
8
|
+
align: { type: null }
|
|
9
|
+
},
|
|
10
|
+
setup(e) {
|
|
11
|
+
let t = e;
|
|
12
|
+
return (e, n) => t.width === "fit" ? (o(), d("div", {
|
|
13
|
+
key: 0,
|
|
14
|
+
style: ne(C(le)(t.align ?? "left"))
|
|
15
|
+
}, [m("table", {
|
|
16
|
+
align: t.align ?? "left",
|
|
17
|
+
cellpadding: "0",
|
|
18
|
+
cellspacing: "0",
|
|
19
|
+
role: "presentation",
|
|
20
|
+
style: ne(C(ue)())
|
|
21
|
+
}, [m("tbody", null, [m("tr", null, [m("td", null, [a(e.$slots, "default")])])])], 12, Ye)], 4)) : a(e.$slots, "default", { key: 1 });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
3
25
|
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
4
|
-
function
|
|
5
|
-
return new
|
|
6
|
-
return new
|
|
26
|
+
function Ze(e = {}) {
|
|
27
|
+
return new F({ view(t) {
|
|
28
|
+
return new Qe(t, e);
|
|
7
29
|
} });
|
|
8
30
|
}
|
|
9
|
-
var
|
|
31
|
+
var Qe = class {
|
|
10
32
|
constructor(e, t) {
|
|
11
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 = [
|
|
12
34
|
"dragover",
|
|
@@ -82,7 +104,7 @@ var qe = class {
|
|
|
82
104
|
if (t && !i) {
|
|
83
105
|
let e = t.pos;
|
|
84
106
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
85
|
-
let t =
|
|
107
|
+
let t = de(this.editorView.state.doc, e, this.editorView.dragging.slice);
|
|
86
108
|
t != null && (e = t);
|
|
87
109
|
}
|
|
88
110
|
this.setCursor(e), this.scheduleRemoval(5e3);
|
|
@@ -97,16 +119,16 @@ var qe = class {
|
|
|
97
119
|
dragleave(e) {
|
|
98
120
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
99
121
|
}
|
|
100
|
-
},
|
|
122
|
+
}, G = class e extends R {
|
|
101
123
|
constructor(e) {
|
|
102
124
|
super(e, e);
|
|
103
125
|
}
|
|
104
126
|
map(t, n) {
|
|
105
127
|
let r = t.resolve(n.map(this.head));
|
|
106
|
-
return e.valid(r) ? new e(r) :
|
|
128
|
+
return e.valid(r) ? new e(r) : R.near(r);
|
|
107
129
|
}
|
|
108
130
|
content() {
|
|
109
|
-
return
|
|
131
|
+
return N.empty;
|
|
110
132
|
}
|
|
111
133
|
eq(t) {
|
|
112
134
|
return t instanceof e && t.head == this.head;
|
|
@@ -122,11 +144,11 @@ var qe = class {
|
|
|
122
144
|
return new e(t.resolve(n.pos));
|
|
123
145
|
}
|
|
124
146
|
getBookmark() {
|
|
125
|
-
return new
|
|
147
|
+
return new $e(this.anchor);
|
|
126
148
|
}
|
|
127
149
|
static valid(e) {
|
|
128
150
|
let t = e.parent;
|
|
129
|
-
if (t.inlineContent || !
|
|
151
|
+
if (t.inlineContent || !tt(e) || !nt(e)) return !1;
|
|
130
152
|
let n = t.type.spec.allowGapCursor;
|
|
131
153
|
if (n != null) return n;
|
|
132
154
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
@@ -149,7 +171,7 @@ var qe = class {
|
|
|
149
171
|
for (;;) {
|
|
150
172
|
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
151
173
|
if (!o) {
|
|
152
|
-
if (a.isAtom && !a.isText && !
|
|
174
|
+
if (a.isAtom && !a.isText && !L.isSelectable(a)) {
|
|
153
175
|
t = t.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
154
176
|
continue search;
|
|
155
177
|
}
|
|
@@ -163,8 +185,8 @@ var qe = class {
|
|
|
163
185
|
}
|
|
164
186
|
}
|
|
165
187
|
};
|
|
166
|
-
|
|
167
|
-
var
|
|
188
|
+
G.prototype.visible = !1, G.findFrom = G.findGapCursorFrom, R.jsonID("gapcursor", G);
|
|
189
|
+
var $e = class e {
|
|
168
190
|
constructor(e) {
|
|
169
191
|
this.pos = e;
|
|
170
192
|
}
|
|
@@ -173,13 +195,13 @@ var Je = class e {
|
|
|
173
195
|
}
|
|
174
196
|
resolve(e) {
|
|
175
197
|
let t = e.resolve(this.pos);
|
|
176
|
-
return
|
|
198
|
+
return G.valid(t) ? new G(t) : R.near(t);
|
|
177
199
|
}
|
|
178
200
|
};
|
|
179
|
-
function
|
|
201
|
+
function et(e) {
|
|
180
202
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
181
203
|
}
|
|
182
|
-
function
|
|
204
|
+
function tt(e) {
|
|
183
205
|
for (let t = e.depth; t >= 0; t--) {
|
|
184
206
|
let n = e.index(t), r = e.node(t);
|
|
185
207
|
if (n == 0) {
|
|
@@ -187,13 +209,13 @@ function Xe(e) {
|
|
|
187
209
|
continue;
|
|
188
210
|
}
|
|
189
211
|
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
190
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
212
|
+
if (e.childCount == 0 && !e.inlineContent || et(e.type)) return !0;
|
|
191
213
|
if (e.inlineContent) return !1;
|
|
192
214
|
}
|
|
193
215
|
}
|
|
194
216
|
return !0;
|
|
195
217
|
}
|
|
196
|
-
function
|
|
218
|
+
function nt(e) {
|
|
197
219
|
for (let t = e.depth; t >= 0; t--) {
|
|
198
220
|
let n = e.indexAfter(t), r = e.node(t);
|
|
199
221
|
if (n == r.childCount) {
|
|
@@ -201,24 +223,24 @@ function Ze(e) {
|
|
|
201
223
|
continue;
|
|
202
224
|
}
|
|
203
225
|
for (let e = r.child(n);; e = e.firstChild) {
|
|
204
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
226
|
+
if (e.childCount == 0 && !e.inlineContent || et(e.type)) return !0;
|
|
205
227
|
if (e.inlineContent) return !1;
|
|
206
228
|
}
|
|
207
229
|
}
|
|
208
230
|
return !0;
|
|
209
231
|
}
|
|
210
|
-
function
|
|
211
|
-
return new
|
|
212
|
-
decorations:
|
|
232
|
+
function rt() {
|
|
233
|
+
return new F({ props: {
|
|
234
|
+
decorations: q,
|
|
213
235
|
createSelectionBetween(e, t, n) {
|
|
214
|
-
return t.pos == n.pos &&
|
|
236
|
+
return t.pos == n.pos && G.valid(n) ? new G(n) : null;
|
|
215
237
|
},
|
|
216
|
-
handleClick:
|
|
217
|
-
handleKeyDown:
|
|
218
|
-
handleDOMEvents: { beforeinput:
|
|
238
|
+
handleClick: at,
|
|
239
|
+
handleKeyDown: it,
|
|
240
|
+
handleDOMEvents: { beforeinput: ot }
|
|
219
241
|
} });
|
|
220
242
|
}
|
|
221
|
-
var
|
|
243
|
+
var it = W({
|
|
222
244
|
ArrowLeft: K("horiz", -1),
|
|
223
245
|
ArrowRight: K("horiz", 1),
|
|
224
246
|
ArrowUp: K("vert", -1),
|
|
@@ -228,47 +250,47 @@ function K(e, t) {
|
|
|
228
250
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
229
251
|
return function(e, r, i) {
|
|
230
252
|
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
231
|
-
if (a instanceof
|
|
253
|
+
if (a instanceof ce) {
|
|
232
254
|
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
233
255
|
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
234
256
|
}
|
|
235
|
-
let c =
|
|
236
|
-
return c ? (r && r(e.tr.setSelection(new
|
|
257
|
+
let c = G.findGapCursorFrom(o, t, s);
|
|
258
|
+
return c ? (r && r(e.tr.setSelection(new G(c))), !0) : !1;
|
|
237
259
|
};
|
|
238
260
|
}
|
|
239
|
-
function
|
|
261
|
+
function at(e, t, n) {
|
|
240
262
|
if (!e || !e.editable) return !1;
|
|
241
263
|
let r = e.state.doc.resolve(t);
|
|
242
|
-
if (!
|
|
264
|
+
if (!G.valid(r)) return !1;
|
|
243
265
|
let i = e.posAtCoords({
|
|
244
266
|
left: n.clientX,
|
|
245
267
|
top: n.clientY
|
|
246
268
|
});
|
|
247
|
-
return i && i.inside > -1 &&
|
|
269
|
+
return i && i.inside > -1 && L.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new G(r))), !0);
|
|
248
270
|
}
|
|
249
|
-
function
|
|
250
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
271
|
+
function ot(e, t) {
|
|
272
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof G)) return !1;
|
|
251
273
|
let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
|
|
252
274
|
if (!r) return !1;
|
|
253
|
-
let i =
|
|
254
|
-
for (let e = r.length - 1; e >= 0; e--) i =
|
|
255
|
-
let a = e.state.tr.replace(n.pos, n.pos, new
|
|
256
|
-
return a.setSelection(
|
|
275
|
+
let i = Ae.empty;
|
|
276
|
+
for (let e = r.length - 1; e >= 0; e--) i = Ae.from(r[e].createAndFill(null, i));
|
|
277
|
+
let a = e.state.tr.replace(n.pos, n.pos, new N(i, 0, 0));
|
|
278
|
+
return a.setSelection(ce.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
257
279
|
}
|
|
258
|
-
function
|
|
259
|
-
if (!(e.selection instanceof
|
|
280
|
+
function q(e) {
|
|
281
|
+
if (!(e.selection instanceof G)) return null;
|
|
260
282
|
let t = document.createElement("div");
|
|
261
|
-
return t.className = "ProseMirror-gapcursor",
|
|
283
|
+
return t.className = "ProseMirror-gapcursor", U.create(e.doc, [z.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
262
284
|
}
|
|
263
285
|
//#endregion
|
|
264
286
|
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
265
|
-
var
|
|
287
|
+
var st = 200, J = function() {};
|
|
266
288
|
J.prototype.append = function(e) {
|
|
267
|
-
return e.length ? (e = J.from(e), !this.length && e || e.length <
|
|
289
|
+
return e.length ? (e = J.from(e), !this.length && e || e.length < st && this.leafAppend(e) || this.length < st && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
268
290
|
}, J.prototype.prepend = function(e) {
|
|
269
291
|
return e.length ? J.from(e).append(this) : this;
|
|
270
292
|
}, J.prototype.appendInner = function(e) {
|
|
271
|
-
return new
|
|
293
|
+
return new lt(this, e);
|
|
272
294
|
}, J.prototype.slice = function(e, t) {
|
|
273
295
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? J.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
274
296
|
}, J.prototype.get = function(e) {
|
|
@@ -282,9 +304,9 @@ J.prototype.append = function(e) {
|
|
|
282
304
|
return r.push(e(t, n));
|
|
283
305
|
}, t, n), r;
|
|
284
306
|
}, J.from = function(e) {
|
|
285
|
-
return e instanceof J ? e : e && e.length ? new
|
|
307
|
+
return e instanceof J ? e : e && e.length ? new ct(e) : J.empty;
|
|
286
308
|
};
|
|
287
|
-
var
|
|
309
|
+
var ct = /* @__PURE__ */ function(e) {
|
|
288
310
|
function t(t) {
|
|
289
311
|
e.call(this), this.values = t;
|
|
290
312
|
}
|
|
@@ -304,17 +326,17 @@ var nt = /* @__PURE__ */ function(e) {
|
|
|
304
326
|
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
305
327
|
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
306
328
|
}, t.prototype.leafAppend = function(e) {
|
|
307
|
-
if (this.length + e.length <=
|
|
329
|
+
if (this.length + e.length <= st) return new t(this.values.concat(e.flatten()));
|
|
308
330
|
}, t.prototype.leafPrepend = function(e) {
|
|
309
|
-
if (this.length + e.length <=
|
|
331
|
+
if (this.length + e.length <= st) return new t(e.flatten().concat(this.values));
|
|
310
332
|
}, n.length.get = function() {
|
|
311
333
|
return this.values.length;
|
|
312
334
|
}, n.depth.get = function() {
|
|
313
335
|
return 0;
|
|
314
336
|
}, Object.defineProperties(t.prototype, n), t;
|
|
315
337
|
}(J);
|
|
316
|
-
J.empty = new
|
|
317
|
-
var
|
|
338
|
+
J.empty = new ct([]);
|
|
339
|
+
var lt = /* @__PURE__ */ function(e) {
|
|
318
340
|
function t(t, n) {
|
|
319
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;
|
|
320
342
|
}
|
|
@@ -341,7 +363,7 @@ var rt = /* @__PURE__ */ function(e) {
|
|
|
341
363
|
}, t.prototype.appendInner = function(e) {
|
|
342
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);
|
|
343
365
|
}, t;
|
|
344
|
-
}(J),
|
|
366
|
+
}(J), ut = 500, Y = class e {
|
|
345
367
|
constructor(e, t) {
|
|
346
368
|
this.items = e, this.eventCount = t;
|
|
347
369
|
}
|
|
@@ -379,10 +401,10 @@ var rt = /* @__PURE__ */ function(e) {
|
|
|
379
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);
|
|
380
402
|
}
|
|
381
403
|
let l = o - r.depth;
|
|
382
|
-
return l >
|
|
404
|
+
return l > ft && (s = dt(s, l), o -= l), new e(s.append(a), o);
|
|
383
405
|
}
|
|
384
406
|
remapping(e, t) {
|
|
385
|
-
let n = new
|
|
407
|
+
let n = new se();
|
|
386
408
|
return this.items.forEach((t, r) => {
|
|
387
409
|
let i = t.mirrorOffset != null && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
|
|
388
410
|
n.appendMap(t.map, i);
|
|
@@ -411,7 +433,7 @@ var rt = /* @__PURE__ */ function(e) {
|
|
|
411
433
|
let l = [];
|
|
412
434
|
for (let e = n; e < o; e++) l.push(new X(a.maps[e]));
|
|
413
435
|
let u = new e(this.items.slice(0, i).append(l).append(r), s);
|
|
414
|
-
return u.emptyItemCount() >
|
|
436
|
+
return u.emptyItemCount() > ut && (u = u.compress(this.items.length - r.length)), u;
|
|
415
437
|
}
|
|
416
438
|
emptyItemCount() {
|
|
417
439
|
let e = 0;
|
|
@@ -436,7 +458,7 @@ var rt = /* @__PURE__ */ function(e) {
|
|
|
436
458
|
}
|
|
437
459
|
};
|
|
438
460
|
Y.empty = new Y(J.empty, 0);
|
|
439
|
-
function
|
|
461
|
+
function dt(e, t) {
|
|
440
462
|
let n;
|
|
441
463
|
return e.forEach((e, r) => {
|
|
442
464
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
@@ -456,21 +478,21 @@ var X = class e {
|
|
|
456
478
|
constructor(e, t, n, r, i) {
|
|
457
479
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
458
480
|
}
|
|
459
|
-
},
|
|
460
|
-
function
|
|
481
|
+
}, ft = 20;
|
|
482
|
+
function pt(e, t, n, r) {
|
|
461
483
|
let i = n.getMeta(Q), a;
|
|
462
484
|
if (i) return i.historyState;
|
|
463
|
-
n.getMeta(
|
|
485
|
+
n.getMeta(xt) && (e = new Z(e.done, e.undone, null, 0, -1));
|
|
464
486
|
let o = n.getMeta("appendedTransaction");
|
|
465
487
|
if (n.steps.length == 0) return e;
|
|
466
|
-
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r,
|
|
488
|
+
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r, bt(t)), e.undone, ht(n.mapping.maps), e.prevTime, e.prevComposition) : new Z(e.done, e.undone.addTransform(n, void 0, r, bt(t)), null, e.prevTime, e.prevComposition);
|
|
467
489
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
468
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !
|
|
469
|
-
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r,
|
|
470
|
-
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a),
|
|
471
|
-
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps),
|
|
490
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !mt(n, e.prevRanges)), s = o ? gt(e.prevRanges, n.mapping) : ht(n.mapping.maps);
|
|
491
|
+
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, bt(t)), Y.empty, s, n.time, i ?? e.prevComposition);
|
|
492
|
+
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a), gt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
493
|
+
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), gt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
472
494
|
}
|
|
473
|
-
function
|
|
495
|
+
function mt(e, t) {
|
|
474
496
|
if (!t) return !1;
|
|
475
497
|
if (!e.docChanged) return !0;
|
|
476
498
|
let n = !1;
|
|
@@ -478,12 +500,12 @@ function ct(e, t) {
|
|
|
478
500
|
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
479
501
|
}), n;
|
|
480
502
|
}
|
|
481
|
-
function
|
|
503
|
+
function ht(e) {
|
|
482
504
|
let t = [];
|
|
483
505
|
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
484
506
|
return t;
|
|
485
507
|
}
|
|
486
|
-
function
|
|
508
|
+
function gt(e, t) {
|
|
487
509
|
if (!e) return null;
|
|
488
510
|
let n = [];
|
|
489
511
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -492,8 +514,8 @@ function ut(e, t) {
|
|
|
492
514
|
}
|
|
493
515
|
return n;
|
|
494
516
|
}
|
|
495
|
-
function
|
|
496
|
-
let r =
|
|
517
|
+
function _t(e, t, n) {
|
|
518
|
+
let r = bt(t), i = Q.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
497
519
|
if (!a) return null;
|
|
498
520
|
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new Z(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
499
521
|
return a.transform.setSelection(o).setMeta(Q, {
|
|
@@ -501,53 +523,53 @@ function dt(e, t, n) {
|
|
|
501
523
|
historyState: c
|
|
502
524
|
});
|
|
503
525
|
}
|
|
504
|
-
var
|
|
505
|
-
function
|
|
526
|
+
var vt = !1, yt = null;
|
|
527
|
+
function bt(e) {
|
|
506
528
|
let t = e.plugins;
|
|
507
|
-
if (
|
|
508
|
-
|
|
529
|
+
if (yt != t) {
|
|
530
|
+
vt = !1, yt = t;
|
|
509
531
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
510
|
-
|
|
532
|
+
vt = !0;
|
|
511
533
|
break;
|
|
512
534
|
}
|
|
513
535
|
}
|
|
514
|
-
return
|
|
536
|
+
return vt;
|
|
515
537
|
}
|
|
516
|
-
var Q = new H("history"),
|
|
517
|
-
function
|
|
538
|
+
var Q = new H("history"), xt = new H("closeHistory");
|
|
539
|
+
function St(e = {}) {
|
|
518
540
|
return e = {
|
|
519
541
|
depth: e.depth || 100,
|
|
520
542
|
newGroupDelay: e.newGroupDelay || 500
|
|
521
|
-
}, new
|
|
543
|
+
}, new F({
|
|
522
544
|
key: Q,
|
|
523
545
|
state: {
|
|
524
546
|
init() {
|
|
525
547
|
return new Z(Y.empty, Y.empty, null, 0, -1);
|
|
526
548
|
},
|
|
527
549
|
apply(t, n, r) {
|
|
528
|
-
return
|
|
550
|
+
return pt(n, r, t, e);
|
|
529
551
|
}
|
|
530
552
|
},
|
|
531
553
|
config: e,
|
|
532
554
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
533
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
555
|
+
let n = t.inputType, r = n == "historyUndo" ? wt : n == "historyRedo" ? Tt : null;
|
|
534
556
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
535
557
|
} } }
|
|
536
558
|
});
|
|
537
559
|
}
|
|
538
|
-
function
|
|
560
|
+
function Ct(e, t) {
|
|
539
561
|
return (n, r) => {
|
|
540
562
|
let i = Q.getState(n);
|
|
541
563
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
542
564
|
if (r) {
|
|
543
|
-
let a =
|
|
565
|
+
let a = _t(i, n, e);
|
|
544
566
|
a && r(t ? a.scrollIntoView() : a);
|
|
545
567
|
}
|
|
546
568
|
return !0;
|
|
547
569
|
};
|
|
548
570
|
}
|
|
549
|
-
var
|
|
550
|
-
|
|
571
|
+
var wt = Ct(!1, !0), Tt = Ct(!0, !0);
|
|
572
|
+
B.create({
|
|
551
573
|
name: "characterCount",
|
|
552
574
|
addOptions() {
|
|
553
575
|
return {
|
|
@@ -579,7 +601,7 @@ F.create({
|
|
|
579
601
|
},
|
|
580
602
|
addProseMirrorPlugins() {
|
|
581
603
|
let e = !1;
|
|
582
|
-
return [new
|
|
604
|
+
return [new F({
|
|
583
605
|
key: new H("characterCount"),
|
|
584
606
|
appendTransaction: (t, n, r) => {
|
|
585
607
|
if (e) return;
|
|
@@ -608,7 +630,7 @@ F.create({
|
|
|
608
630
|
}
|
|
609
631
|
})];
|
|
610
632
|
}
|
|
611
|
-
}),
|
|
633
|
+
}), B.create({
|
|
612
634
|
name: "dropCursor",
|
|
613
635
|
addOptions() {
|
|
614
636
|
return {
|
|
@@ -618,9 +640,9 @@ F.create({
|
|
|
618
640
|
};
|
|
619
641
|
},
|
|
620
642
|
addProseMirrorPlugins() {
|
|
621
|
-
return [
|
|
643
|
+
return [Ze(this.options)];
|
|
622
644
|
}
|
|
623
|
-
}),
|
|
645
|
+
}), B.create({
|
|
624
646
|
name: "focus",
|
|
625
647
|
addOptions() {
|
|
626
648
|
return {
|
|
@@ -629,11 +651,11 @@ F.create({
|
|
|
629
651
|
};
|
|
630
652
|
},
|
|
631
653
|
addProseMirrorPlugins() {
|
|
632
|
-
return [new
|
|
654
|
+
return [new F({
|
|
633
655
|
key: new H("focus"),
|
|
634
656
|
props: { decorations: ({ doc: e, selection: t }) => {
|
|
635
657
|
let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
|
|
636
|
-
if (!n || !r) return
|
|
658
|
+
if (!n || !r) return U.create(e, []);
|
|
637
659
|
let o = 0;
|
|
638
660
|
this.options.mode === "deepest" && e.descendants((e, t) => {
|
|
639
661
|
if (!e.isText) {
|
|
@@ -646,25 +668,25 @@ F.create({
|
|
|
646
668
|
if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
647
669
|
if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
|
|
648
670
|
a.push(z.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
649
|
-
}),
|
|
671
|
+
}), U.create(e, a);
|
|
650
672
|
} }
|
|
651
673
|
})];
|
|
652
674
|
}
|
|
653
|
-
}),
|
|
675
|
+
}), B.create({
|
|
654
676
|
name: "gapCursor",
|
|
655
677
|
addProseMirrorPlugins() {
|
|
656
|
-
return [
|
|
678
|
+
return [rt()];
|
|
657
679
|
},
|
|
658
680
|
extendNodeSchema(e) {
|
|
659
|
-
return { allowGapCursor:
|
|
681
|
+
return { allowGapCursor: ze(ke(e, "allowGapCursor", {
|
|
660
682
|
name: e.name,
|
|
661
683
|
options: e.options,
|
|
662
684
|
storage: e.storage
|
|
663
685
|
})) ?? null };
|
|
664
686
|
}
|
|
665
687
|
});
|
|
666
|
-
var
|
|
667
|
-
function
|
|
688
|
+
var Et = "placeholder", $ = new H("tiptap__placeholder"), Dt = 200;
|
|
689
|
+
function Ot(e) {
|
|
668
690
|
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
669
691
|
return o && u.push(l), z.node(i, i + a.nodeSize, {
|
|
670
692
|
class: u.join(" "),
|
|
@@ -676,17 +698,17 @@ function St(e) {
|
|
|
676
698
|
}) : n
|
|
677
699
|
});
|
|
678
700
|
}
|
|
679
|
-
function
|
|
701
|
+
function kt(e, t) {
|
|
680
702
|
return typeof e == "function" ? e(t) : e;
|
|
681
703
|
}
|
|
682
|
-
function
|
|
704
|
+
function At({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
683
705
|
if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
|
|
684
706
|
let { anchor: a } = i, o = [], s = e.isEmpty;
|
|
685
707
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
686
708
|
let i = r.resolve(a), c = i.depth > 0 ? i.node(1) : i.nodeAfter, l = i.depth > 0 ? i.before(1) : a;
|
|
687
|
-
if (c && c.type.isTextblock &&
|
|
709
|
+
if (c && c.type.isTextblock && De(c)) {
|
|
688
710
|
let r = a >= l && a <= l + c.nodeSize;
|
|
689
|
-
o.push(
|
|
711
|
+
o.push(Ot({
|
|
690
712
|
editor: e,
|
|
691
713
|
isEmptyDoc: s,
|
|
692
714
|
dataAttribute: n,
|
|
@@ -694,7 +716,7 @@ function wt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
694
716
|
placeholder: t.placeholder,
|
|
695
717
|
classes: {
|
|
696
718
|
emptyEditor: t.emptyEditorClass,
|
|
697
|
-
emptyNode:
|
|
719
|
+
emptyNode: kt(t.emptyNodeClass, {
|
|
698
720
|
editor: e,
|
|
699
721
|
node: c,
|
|
700
722
|
pos: l,
|
|
@@ -708,8 +730,8 @@ function wt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
708
730
|
} else {
|
|
709
731
|
let i = $.getState(e.state), c = i?.topPos ?? 0, l = i?.bottomPos ?? r.content.size;
|
|
710
732
|
r.nodesBetween(c, l, (r, i) => {
|
|
711
|
-
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf &&
|
|
712
|
-
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(
|
|
733
|
+
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf && De(r);
|
|
734
|
+
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(Ot({
|
|
713
735
|
editor: e,
|
|
714
736
|
isEmptyDoc: s,
|
|
715
737
|
dataAttribute: n,
|
|
@@ -717,7 +739,7 @@ function wt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
717
739
|
placeholder: t.placeholder,
|
|
718
740
|
classes: {
|
|
719
741
|
emptyEditor: t.emptyEditorClass,
|
|
720
|
-
emptyNode:
|
|
742
|
+
emptyNode: kt(t.emptyNodeClass, {
|
|
721
743
|
editor: e,
|
|
722
744
|
node: r,
|
|
723
745
|
pos: i,
|
|
@@ -729,19 +751,19 @@ function wt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
729
751
|
})), t.includeChildren;
|
|
730
752
|
});
|
|
731
753
|
}
|
|
732
|
-
return
|
|
754
|
+
return U.create(r, o);
|
|
733
755
|
}
|
|
734
|
-
function
|
|
756
|
+
function jt(e) {
|
|
735
757
|
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
736
758
|
}
|
|
737
|
-
function
|
|
759
|
+
function Mt(e) {
|
|
738
760
|
let t = getComputedStyle(e), n = `${t.overflow} ${t.overflowY} ${t.overflowX}`;
|
|
739
761
|
return /auto|scroll|overlay/.test(n);
|
|
740
762
|
}
|
|
741
|
-
function
|
|
763
|
+
function Nt(e) {
|
|
742
764
|
let t = e;
|
|
743
765
|
for (; t;) {
|
|
744
|
-
if (
|
|
766
|
+
if (Mt(t)) return t;
|
|
745
767
|
let e = t.parentElement;
|
|
746
768
|
if (!e) {
|
|
747
769
|
let e = t.getRootNode();
|
|
@@ -755,19 +777,19 @@ function Dt(e) {
|
|
|
755
777
|
}
|
|
756
778
|
return window;
|
|
757
779
|
}
|
|
758
|
-
function
|
|
780
|
+
function Pt(e) {
|
|
759
781
|
return e === window ? {
|
|
760
782
|
top: 0,
|
|
761
783
|
bottom: window.innerHeight
|
|
762
784
|
} : e.getBoundingClientRect();
|
|
763
785
|
}
|
|
764
|
-
function
|
|
786
|
+
function Ft({ view: e, scrollContainer: t }) {
|
|
765
787
|
let n = e.dom.getBoundingClientRect();
|
|
766
788
|
if (n.width <= 0 || n.height <= 0) return null;
|
|
767
|
-
let r = t ?
|
|
789
|
+
let r = t ? Pt(t) : {
|
|
768
790
|
top: 0,
|
|
769
791
|
bottom: window.innerHeight
|
|
770
|
-
}, i = Math.max(n.top, r.top) -
|
|
792
|
+
}, i = Math.max(n.top, r.top) - Dt, a = Math.min(n.bottom, r.bottom) + Dt;
|
|
771
793
|
if (i >= a) return null;
|
|
772
794
|
let o = n.left + 1, s = n.right - 1;
|
|
773
795
|
if (o > s) return null;
|
|
@@ -785,7 +807,7 @@ function kt({ view: e, scrollContainer: t }) {
|
|
|
785
807
|
bottom: p.pos
|
|
786
808
|
};
|
|
787
809
|
}
|
|
788
|
-
var
|
|
810
|
+
var It = {
|
|
789
811
|
init() {
|
|
790
812
|
return {
|
|
791
813
|
topPos: null,
|
|
@@ -803,9 +825,9 @@ var At = {
|
|
|
803
825
|
} : t;
|
|
804
826
|
}
|
|
805
827
|
};
|
|
806
|
-
function
|
|
807
|
-
let t =
|
|
808
|
-
let n =
|
|
828
|
+
function Lt(e) {
|
|
829
|
+
let t = Nt(e.dom), n = () => {
|
|
830
|
+
let n = Ft({
|
|
809
831
|
view: e,
|
|
810
832
|
scrollContainer: t
|
|
811
833
|
});
|
|
@@ -834,13 +856,13 @@ function jt(e) {
|
|
|
834
856
|
}
|
|
835
857
|
};
|
|
836
858
|
}
|
|
837
|
-
function
|
|
838
|
-
let n = t.dataAttribute ? `data-${
|
|
839
|
-
return new
|
|
859
|
+
function Rt({ editor: e, options: t }) {
|
|
860
|
+
let n = t.dataAttribute ? `data-${jt(t.dataAttribute)}` : `data-${Et}`;
|
|
861
|
+
return new F({
|
|
840
862
|
key: $,
|
|
841
|
-
state:
|
|
842
|
-
view:
|
|
843
|
-
props: { decorations: ({ doc: r, selection: i }) =>
|
|
863
|
+
state: It,
|
|
864
|
+
view: Lt,
|
|
865
|
+
props: { decorations: ({ doc: r, selection: i }) => At({
|
|
844
866
|
editor: e,
|
|
845
867
|
options: t,
|
|
846
868
|
dataAttribute: n,
|
|
@@ -849,13 +871,13 @@ function Mt({ editor: e, options: t }) {
|
|
|
849
871
|
}) }
|
|
850
872
|
});
|
|
851
873
|
}
|
|
852
|
-
var
|
|
874
|
+
var zt = B.create({
|
|
853
875
|
name: "placeholder",
|
|
854
876
|
addOptions() {
|
|
855
877
|
return {
|
|
856
878
|
emptyEditorClass: "is-editor-empty",
|
|
857
879
|
emptyNodeClass: "is-empty",
|
|
858
|
-
dataAttribute:
|
|
880
|
+
dataAttribute: Et,
|
|
859
881
|
placeholder: "Write something …",
|
|
860
882
|
showOnlyWhenEditable: !0,
|
|
861
883
|
showOnlyCurrent: !0,
|
|
@@ -863,31 +885,31 @@ var Nt = F.create({
|
|
|
863
885
|
};
|
|
864
886
|
},
|
|
865
887
|
addProseMirrorPlugins() {
|
|
866
|
-
return [
|
|
888
|
+
return [Rt({
|
|
867
889
|
editor: this.editor,
|
|
868
890
|
options: this.options
|
|
869
891
|
})];
|
|
870
892
|
}
|
|
871
|
-
}),
|
|
872
|
-
|
|
893
|
+
}), Bt = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
894
|
+
B.create({
|
|
873
895
|
name: "selection",
|
|
874
896
|
addOptions() {
|
|
875
897
|
return { className: "selection" };
|
|
876
898
|
},
|
|
877
899
|
addProseMirrorPlugins() {
|
|
878
900
|
let { editor: e, options: t } = this;
|
|
879
|
-
return e.options.injectCSS && typeof document < "u" &&
|
|
901
|
+
return e.options.injectCSS && typeof document < "u" && Fe(Bt, e.options.injectNonce, "selection"), [new F({
|
|
880
902
|
key: new H("selection"),
|
|
881
903
|
props: { decorations(n) {
|
|
882
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
904
|
+
return n.selection.empty || e.isFocused || !e.isEditable || me(n.selection) || e.view.dragging ? null : U.create(n.doc, [z.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
883
905
|
} }
|
|
884
906
|
})];
|
|
885
907
|
}
|
|
886
908
|
});
|
|
887
|
-
function
|
|
909
|
+
function Vt({ types: e, node: t }) {
|
|
888
910
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
889
911
|
}
|
|
890
|
-
|
|
912
|
+
B.create({
|
|
891
913
|
name: "trailingNode",
|
|
892
914
|
addOptions() {
|
|
893
915
|
return {
|
|
@@ -897,7 +919,7 @@ F.create({
|
|
|
897
919
|
},
|
|
898
920
|
addProseMirrorPlugins() {
|
|
899
921
|
let e = new H(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));
|
|
900
|
-
return [new
|
|
922
|
+
return [new F({
|
|
901
923
|
key: e,
|
|
902
924
|
appendTransaction: (n, r, i) => {
|
|
903
925
|
let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
|
|
@@ -906,7 +928,7 @@ F.create({
|
|
|
906
928
|
state: {
|
|
907
929
|
init: (e, t) => {
|
|
908
930
|
let r = t.tr.doc.lastChild;
|
|
909
|
-
return !
|
|
931
|
+
return !Vt({
|
|
910
932
|
node: r,
|
|
911
933
|
types: n
|
|
912
934
|
});
|
|
@@ -914,7 +936,7 @@ F.create({
|
|
|
914
936
|
apply: (e, t) => {
|
|
915
937
|
if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
|
|
916
938
|
let r = e.doc.lastChild;
|
|
917
|
-
return !
|
|
939
|
+
return !Vt({
|
|
918
940
|
node: r,
|
|
919
941
|
types: n
|
|
920
942
|
});
|
|
@@ -923,7 +945,7 @@ F.create({
|
|
|
923
945
|
})];
|
|
924
946
|
}
|
|
925
947
|
});
|
|
926
|
-
var
|
|
948
|
+
var Ht = B.create({
|
|
927
949
|
name: "undoRedo",
|
|
928
950
|
addOptions() {
|
|
929
951
|
return {
|
|
@@ -933,12 +955,12 @@ var It = F.create({
|
|
|
933
955
|
},
|
|
934
956
|
addCommands() {
|
|
935
957
|
return {
|
|
936
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
937
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
958
|
+
undo: () => ({ state: e, dispatch: t }) => wt(e, t),
|
|
959
|
+
redo: () => ({ state: e, dispatch: t }) => Tt(e, t)
|
|
938
960
|
};
|
|
939
961
|
},
|
|
940
962
|
addProseMirrorPlugins() {
|
|
941
|
-
return [
|
|
963
|
+
return [St(this.options)];
|
|
942
964
|
},
|
|
943
965
|
addKeyboardShortcuts() {
|
|
944
966
|
return {
|
|
@@ -952,13 +974,13 @@ var It = F.create({
|
|
|
952
974
|
});
|
|
953
975
|
//#endregion
|
|
954
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
|
|
955
|
-
function
|
|
956
|
-
return
|
|
977
|
+
function Ut(e) {
|
|
978
|
+
return w((t, n) => ({
|
|
957
979
|
get() {
|
|
958
|
-
return
|
|
980
|
+
return t(), e;
|
|
959
981
|
},
|
|
960
|
-
set(
|
|
961
|
-
|
|
982
|
+
set(t) {
|
|
983
|
+
e = t, requestAnimationFrame(() => {
|
|
962
984
|
requestAnimationFrame(() => {
|
|
963
985
|
n();
|
|
964
986
|
});
|
|
@@ -966,11 +988,11 @@ function Lt(t) {
|
|
|
966
988
|
}
|
|
967
989
|
}));
|
|
968
990
|
}
|
|
969
|
-
var
|
|
991
|
+
var Wt = class extends qe {
|
|
970
992
|
constructor(e = {}) {
|
|
971
|
-
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState =
|
|
993
|
+
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = Ut(this.view.state), this.reactiveExtensionStorage = Ut(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
972
994
|
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
973
|
-
}),
|
|
995
|
+
}), D(this);
|
|
974
996
|
}
|
|
975
997
|
get state() {
|
|
976
998
|
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
@@ -986,36 +1008,36 @@ var Rt = class extends Te {
|
|
|
986
1008
|
let t = super.unregisterPlugin(e);
|
|
987
1009
|
return this.reactiveState && t && (this.reactiveState.value = t), t;
|
|
988
1010
|
}
|
|
989
|
-
},
|
|
1011
|
+
}, Gt = l({
|
|
990
1012
|
name: "EditorContent",
|
|
991
1013
|
props: { editor: {
|
|
992
1014
|
default: null,
|
|
993
1015
|
type: Object
|
|
994
1016
|
} },
|
|
995
1017
|
setup(e) {
|
|
996
|
-
let t =
|
|
997
|
-
return
|
|
1018
|
+
let t = S(), n = u();
|
|
1019
|
+
return y(() => {
|
|
998
1020
|
let r = e.editor;
|
|
999
|
-
r && r.options.element && t.value &&
|
|
1021
|
+
r && r.options.element && t.value && ee(() => {
|
|
1000
1022
|
if (!t.value || !r.view.dom?.parentNode) return;
|
|
1001
|
-
let e =
|
|
1023
|
+
let e = C(t.value);
|
|
1002
1024
|
t.value.append(...r.view.dom.parentNode.childNodes), r.contentComponent = n.ctx._, n && (r.appContext = {
|
|
1003
1025
|
...n.appContext,
|
|
1004
1026
|
provides: n.provides
|
|
1005
1027
|
}), r.setOptions({ element: e }), r.createNodeViews();
|
|
1006
1028
|
});
|
|
1007
|
-
}),
|
|
1029
|
+
}), oe(() => {
|
|
1008
1030
|
let t = e.editor;
|
|
1009
1031
|
t && (t.contentComponent = null, t.appContext = null);
|
|
1010
1032
|
}), { rootEl: t };
|
|
1011
1033
|
},
|
|
1012
1034
|
render() {
|
|
1013
|
-
return
|
|
1035
|
+
return f("div", { ref: (e) => {
|
|
1014
1036
|
this.rootEl = e;
|
|
1015
1037
|
} });
|
|
1016
1038
|
}
|
|
1017
1039
|
});
|
|
1018
|
-
|
|
1040
|
+
l({
|
|
1019
1041
|
name: "NodeViewContent",
|
|
1020
1042
|
props: { as: {
|
|
1021
1043
|
type: String,
|
|
@@ -1031,13 +1053,13 @@ C({
|
|
|
1031
1053
|
e && e(null);
|
|
1032
1054
|
},
|
|
1033
1055
|
render() {
|
|
1034
|
-
return
|
|
1056
|
+
return f(this.as, {
|
|
1035
1057
|
style: { whiteSpace: "pre-wrap" },
|
|
1036
1058
|
"data-node-view-content": ""
|
|
1037
1059
|
});
|
|
1038
1060
|
}
|
|
1039
1061
|
});
|
|
1040
|
-
var
|
|
1062
|
+
var Kt = l({
|
|
1041
1063
|
name: "NodeViewWrapper",
|
|
1042
1064
|
props: { as: {
|
|
1043
1065
|
type: String,
|
|
@@ -1046,24 +1068,24 @@ var Bt = C({
|
|
|
1046
1068
|
inject: ["onDragStart", "decorationClasses"],
|
|
1047
1069
|
render() {
|
|
1048
1070
|
var e;
|
|
1049
|
-
return
|
|
1071
|
+
return f(this.as, {
|
|
1050
1072
|
class: this.decorationClasses,
|
|
1051
1073
|
style: { whiteSpace: "normal" },
|
|
1052
1074
|
"data-node-view-wrapper": "",
|
|
1053
1075
|
onDragstart: this.onDragStart
|
|
1054
1076
|
}, (e = this.$slots).default?.call(e));
|
|
1055
1077
|
}
|
|
1056
|
-
}),
|
|
1057
|
-
let
|
|
1058
|
-
return
|
|
1059
|
-
|
|
1060
|
-
}),
|
|
1078
|
+
}), qt = (e = {}) => {
|
|
1079
|
+
let n = te();
|
|
1080
|
+
return t(() => {
|
|
1081
|
+
n.value = new Wt(e);
|
|
1082
|
+
}), oe(() => {
|
|
1061
1083
|
var e;
|
|
1062
|
-
(e =
|
|
1063
|
-
}),
|
|
1064
|
-
},
|
|
1084
|
+
(e = n.value) == null || e.destroy();
|
|
1085
|
+
}), n;
|
|
1086
|
+
}, Jt = class {
|
|
1065
1087
|
constructor(e, { props: t = {}, editor: n }) {
|
|
1066
|
-
this.destroyed = !1, this.editor = n, this.component =
|
|
1088
|
+
this.destroyed = !1, this.editor = n, this.component = D(e), this.el = document.createElement("div"), this.props = A(t), this.renderedComponent = this.renderComponent();
|
|
1067
1089
|
}
|
|
1068
1090
|
get element() {
|
|
1069
1091
|
return this.renderedComponent.el;
|
|
@@ -1073,11 +1095,11 @@ var Bt = C({
|
|
|
1073
1095
|
}
|
|
1074
1096
|
renderComponent() {
|
|
1075
1097
|
if (this.destroyed) return this.renderedComponent;
|
|
1076
|
-
let e =
|
|
1077
|
-
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el &&
|
|
1098
|
+
let e = f(this.component, this.props);
|
|
1099
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && k(e, this.el), {
|
|
1078
1100
|
vNode: e,
|
|
1079
1101
|
destroy: () => {
|
|
1080
|
-
this.el &&
|
|
1102
|
+
this.el && k(null, this.el), this.el = null, e = null;
|
|
1081
1103
|
},
|
|
1082
1104
|
el: this.el ? this.el.firstElementChild : null
|
|
1083
1105
|
};
|
|
@@ -1091,20 +1113,20 @@ var Bt = C({
|
|
|
1091
1113
|
this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
|
|
1092
1114
|
}
|
|
1093
1115
|
};
|
|
1094
|
-
|
|
1116
|
+
l({
|
|
1095
1117
|
name: "MarkViewContent",
|
|
1096
1118
|
props: { as: {
|
|
1097
1119
|
type: String,
|
|
1098
1120
|
default: "span"
|
|
1099
1121
|
} },
|
|
1100
1122
|
render() {
|
|
1101
|
-
return
|
|
1123
|
+
return f(this.as, {
|
|
1102
1124
|
style: { whiteSpace: "inherit" },
|
|
1103
1125
|
"data-mark-view-content": ""
|
|
1104
1126
|
});
|
|
1105
1127
|
}
|
|
1106
1128
|
});
|
|
1107
|
-
var
|
|
1129
|
+
var Yt = {
|
|
1108
1130
|
editor: {
|
|
1109
1131
|
type: Object,
|
|
1110
1132
|
required: !0
|
|
@@ -1149,7 +1171,7 @@ var Ut = {
|
|
|
1149
1171
|
type: Object,
|
|
1150
1172
|
required: !0
|
|
1151
1173
|
}
|
|
1152
|
-
},
|
|
1174
|
+
}, Xt = class extends we {
|
|
1153
1175
|
constructor(e, t, n) {
|
|
1154
1176
|
super(e, t, n), this.cachedExtensionWithSyncedStorage = null, this.handlePositionUpdate = () => {
|
|
1155
1177
|
let e = this.getPos();
|
|
@@ -1179,14 +1201,14 @@ var Ut = {
|
|
|
1179
1201
|
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
1180
1202
|
deleteNode: () => this.deleteNode()
|
|
1181
1203
|
}, t = e, n = this.onDragStart.bind(this);
|
|
1182
|
-
this.decorationClasses =
|
|
1183
|
-
let r =
|
|
1204
|
+
this.decorationClasses = S(this.getDecorationClasses());
|
|
1205
|
+
let r = l({
|
|
1184
1206
|
extends: { ...this.component },
|
|
1185
1207
|
props: Object.keys(e),
|
|
1186
1208
|
template: this.component.template,
|
|
1187
1209
|
setup: (e) => {
|
|
1188
1210
|
var t;
|
|
1189
|
-
return
|
|
1211
|
+
return h("onDragStart", n), h("decorationClasses", this.decorationClasses), h("nodeViewContentRef", (e) => {
|
|
1190
1212
|
this.contentDOMElement && e && e.firstChild !== this.contentDOMElement && e.appendChild(this.contentDOMElement);
|
|
1191
1213
|
}), (t = this.component).setup?.call(t, e, { expose: () => void 0 });
|
|
1192
1214
|
},
|
|
@@ -1195,7 +1217,7 @@ var Ut = {
|
|
|
1195
1217
|
__name: this.component.__name,
|
|
1196
1218
|
__file: this.component.__file
|
|
1197
1219
|
});
|
|
1198
|
-
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.currentPos = this.getPos(), this.node.isLeaf || (this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.style.whiteSpace = "inherit", this.contentDOMElement.dataset.nodeViewContentVue = ""), this.renderer = new
|
|
1220
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.currentPos = this.getPos(), this.node.isLeaf || (this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement.style.whiteSpace = "inherit", this.contentDOMElement.dataset.nodeViewContentVue = ""), this.renderer = new Jt(r, {
|
|
1199
1221
|
editor: this.editor,
|
|
1200
1222
|
props: t
|
|
1201
1223
|
});
|
|
@@ -1209,7 +1231,7 @@ var Ut = {
|
|
|
1209
1231
|
}
|
|
1210
1232
|
handleSelectionUpdate() {
|
|
1211
1233
|
let e = this.getPos();
|
|
1212
|
-
if (typeof e == "number") if (
|
|
1234
|
+
if (typeof e == "number") if (V({
|
|
1213
1235
|
selection: this.editor.state.selection,
|
|
1214
1236
|
pos: e,
|
|
1215
1237
|
nodeSize: this.node.nodeSize,
|
|
@@ -1267,44 +1289,44 @@ var Ut = {
|
|
|
1267
1289
|
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null;
|
|
1268
1290
|
}
|
|
1269
1291
|
};
|
|
1270
|
-
function
|
|
1271
|
-
return (n) => n.editor.contentComponent ? new
|
|
1292
|
+
function Zt(e, t) {
|
|
1293
|
+
return (n) => n.editor.contentComponent ? new Xt(typeof e == "function" && "__vccOpts" in e ? e.__vccOpts : e, n, t) : {};
|
|
1272
1294
|
}
|
|
1273
1295
|
//#endregion
|
|
1274
1296
|
//#region src/ai.ts
|
|
1275
|
-
var
|
|
1297
|
+
var Qt = [
|
|
1276
1298
|
"proofread",
|
|
1277
1299
|
"rewrite",
|
|
1278
1300
|
"shorten",
|
|
1279
1301
|
"expand"
|
|
1280
1302
|
];
|
|
1281
|
-
function
|
|
1303
|
+
function $t(e) {
|
|
1282
1304
|
console.warn(`[bygga-editor] ${e}`);
|
|
1283
1305
|
}
|
|
1284
|
-
function
|
|
1306
|
+
function en(e) {
|
|
1285
1307
|
if (!e) return [];
|
|
1286
|
-
if (typeof e.run != "function") return
|
|
1287
|
-
if (!Array.isArray(e.actions)) return
|
|
1308
|
+
if (typeof e.run != "function") return $t("config.ai: `run` must be a function — ignoring the AI configuration."), [];
|
|
1309
|
+
if (!Array.isArray(e.actions)) return $t("config.ai: `actions` must be an array — offering no AI actions."), [];
|
|
1288
1310
|
let t = /* @__PURE__ */ new Set();
|
|
1289
1311
|
for (let n of e.actions) {
|
|
1290
|
-
if (!
|
|
1291
|
-
|
|
1312
|
+
if (!Qt.includes(n)) {
|
|
1313
|
+
$t(`config.ai: "${String(n)}" is not a known AI action — ignoring it.`);
|
|
1292
1314
|
continue;
|
|
1293
1315
|
}
|
|
1294
1316
|
t.add(n);
|
|
1295
1317
|
}
|
|
1296
|
-
return e.actions.length > 0 && t.size === 0 &&
|
|
1318
|
+
return e.actions.length > 0 && t.size === 0 && $t("config.ai: no usable actions — offering no AI controls."), Qt.filter((e) => t.has(e));
|
|
1297
1319
|
}
|
|
1298
1320
|
//#endregion
|
|
1299
1321
|
//#region src/components/AiActionPicker.vue?vue&type=script&setup=true&lang.ts
|
|
1300
|
-
var
|
|
1322
|
+
var tn = [
|
|
1301
1323
|
"disabled",
|
|
1302
1324
|
"aria-busy",
|
|
1303
1325
|
"title",
|
|
1304
1326
|
"aria-label",
|
|
1305
1327
|
"popovertarget",
|
|
1306
1328
|
"aria-expanded"
|
|
1307
|
-
],
|
|
1329
|
+
], nn = ["id", "aria-label"], rn = { class: "ai-list" }, an = ["onClick"], on = { class: "ai-option-label" }, sn = { class: "ai-option-hint" }, cn = /*#__PURE__*/ I(/* @__PURE__ */ l({
|
|
1308
1330
|
__name: "AiActionPicker",
|
|
1309
1331
|
props: {
|
|
1310
1332
|
actions: { type: Array },
|
|
@@ -1314,155 +1336,155 @@ var Yt = [
|
|
|
1314
1336
|
}
|
|
1315
1337
|
},
|
|
1316
1338
|
emits: ["select"],
|
|
1317
|
-
setup(
|
|
1318
|
-
let
|
|
1319
|
-
function
|
|
1339
|
+
setup(t, { emit: r }) {
|
|
1340
|
+
let i = r, { t: a } = ge(), s = re(), c = v("trigger"), l = v("popover"), u = j(() => l.value?.matches(":popover-open") ?? !1);
|
|
1341
|
+
function f(e) {
|
|
1320
1342
|
if (e.newState !== "open") return;
|
|
1321
|
-
let t =
|
|
1343
|
+
let t = l.value, n = c.value?.getBoundingClientRect();
|
|
1322
1344
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1323
1345
|
}
|
|
1324
|
-
function
|
|
1325
|
-
let t = e.relatedTarget, n =
|
|
1346
|
+
function p(e) {
|
|
1347
|
+
let t = e.relatedTarget, n = l.value;
|
|
1326
1348
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1327
1349
|
}
|
|
1328
|
-
function
|
|
1329
|
-
|
|
1350
|
+
function ee(e) {
|
|
1351
|
+
i("select", e), l.value?.hidePopover();
|
|
1330
1352
|
}
|
|
1331
|
-
return (
|
|
1353
|
+
return (r, i) => (o(), d(M, null, [t.actions.length ? (o(), d("button", {
|
|
1332
1354
|
key: 0,
|
|
1333
1355
|
ref_key: "trigger",
|
|
1334
|
-
ref:
|
|
1356
|
+
ref: c,
|
|
1335
1357
|
type: "button",
|
|
1336
|
-
class:
|
|
1337
|
-
disabled:
|
|
1338
|
-
"aria-busy":
|
|
1339
|
-
title:
|
|
1340
|
-
"aria-label":
|
|
1341
|
-
popovertarget:
|
|
1358
|
+
class: T(["ai-trigger", { active: u.value }]),
|
|
1359
|
+
disabled: t.pending,
|
|
1360
|
+
"aria-busy": t.pending,
|
|
1361
|
+
title: C(a)("blocks.text.ai.label"),
|
|
1362
|
+
"aria-label": C(a)("blocks.text.ai.label"),
|
|
1363
|
+
popovertarget: C(s),
|
|
1342
1364
|
"aria-haspopup": "dialog",
|
|
1343
|
-
"aria-expanded":
|
|
1344
|
-
onMousedown: i[0] ||=
|
|
1345
|
-
}, [
|
|
1365
|
+
"aria-expanded": u.value,
|
|
1366
|
+
onMousedown: i[0] ||= x(() => {}, ["prevent"])
|
|
1367
|
+
}, [e(P, {
|
|
1346
1368
|
name: "sparkles",
|
|
1347
1369
|
size: 16
|
|
1348
|
-
})], 42,
|
|
1370
|
+
})], 42, tn)) : n("", !0), t.actions.length ? (o(), d("div", {
|
|
1349
1371
|
key: 1,
|
|
1350
|
-
id:
|
|
1372
|
+
id: C(s),
|
|
1351
1373
|
ref_key: "popover",
|
|
1352
|
-
ref:
|
|
1374
|
+
ref: l,
|
|
1353
1375
|
class: "ai-popover",
|
|
1354
1376
|
popover: "",
|
|
1355
1377
|
role: "dialog",
|
|
1356
|
-
"aria-label":
|
|
1357
|
-
onBeforetoggle:
|
|
1358
|
-
onFocusout:
|
|
1359
|
-
}, [
|
|
1378
|
+
"aria-label": C(a)("blocks.text.ai.label"),
|
|
1379
|
+
onBeforetoggle: f,
|
|
1380
|
+
onFocusout: p
|
|
1381
|
+
}, [m("ul", rn, [(o(!0), d(M, null, g(t.actions, (e) => (o(), d("li", { key: e }, [m("button", {
|
|
1360
1382
|
type: "button",
|
|
1361
1383
|
class: "ai-option",
|
|
1362
|
-
onClick: (t) =>
|
|
1363
|
-
onMousedown: i[1] ||=
|
|
1364
|
-
}, [
|
|
1384
|
+
onClick: (t) => ee(e),
|
|
1385
|
+
onMousedown: i[1] ||= x(() => {}, ["prevent"])
|
|
1386
|
+
}, [m("span", on, E(C(a)(`blocks.text.ai.actions.${e}.label`)), 1), m("span", sn, E(C(a)(`blocks.text.ai.actions.${e}.hint`)), 1)], 40, an)]))), 128))])], 40, nn)) : n("", !0)], 64));
|
|
1365
1387
|
}
|
|
1366
|
-
}), [["styles", [".ai-trigger[data-v-abcd3caa]{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}.ai-trigger[data-v-abcd3caa]:hover:not(:disabled){background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.ai-trigger.active[data-v-abcd3caa]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.ai-trigger[data-v-abcd3caa]:disabled{cursor:default;opacity:.5}.ai-popover[data-v-abcd3caa]{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-abcd3caa]:popover-open{display:flex}.ai-list[data-v-abcd3caa]{flex-direction:column;gap:.15em;margin:0;padding:0;list-style:none;display:flex}.ai-option[data-v-abcd3caa]{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-abcd3caa]:hover,.ai-option[data-v-abcd3caa]:focus-visible{background:var(--bygga-color-track);color:var(--bygga-color-accent);outline:none}.ai-option-hint[data-v-abcd3caa]{color:var(--bygga-color-text-muted);font-size:.85em}"]], ["__scopeId", "data-v-abcd3caa"]]),
|
|
1388
|
+
}), [["styles", [".ai-trigger[data-v-abcd3caa]{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}.ai-trigger[data-v-abcd3caa]:hover:not(:disabled){background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.ai-trigger.active[data-v-abcd3caa]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.ai-trigger[data-v-abcd3caa]:disabled{cursor:default;opacity:.5}.ai-popover[data-v-abcd3caa]{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-abcd3caa]:popover-open{display:flex}.ai-list[data-v-abcd3caa]{flex-direction:column;gap:.15em;margin:0;padding:0;list-style:none;display:flex}.ai-option[data-v-abcd3caa]{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-abcd3caa]:hover,.ai-option[data-v-abcd3caa]:focus-visible{background:var(--bygga-color-track);color:var(--bygga-color-accent);outline:none}.ai-option-hint[data-v-abcd3caa]{color:var(--bygga-color-text-muted);font-size:.85em}"]], ["__scopeId", "data-v-abcd3caa"]]), ln = [
|
|
1367
1389
|
"title",
|
|
1368
1390
|
"aria-label",
|
|
1369
1391
|
"popovertarget",
|
|
1370
1392
|
"aria-expanded"
|
|
1371
|
-
],
|
|
1393
|
+
], un = ["id", "aria-label"], dn = {
|
|
1372
1394
|
key: 0,
|
|
1373
1395
|
class: "merge-tag-list"
|
|
1374
|
-
},
|
|
1396
|
+
}, fn = ["onClick"], pn = { class: "merge-tag-option-label" }, mn = { class: "merge-tag-option-id" }, hn = {
|
|
1375
1397
|
key: 1,
|
|
1376
1398
|
class: "merge-tag-empty"
|
|
1377
|
-
},
|
|
1399
|
+
}, gn = /*#__PURE__*/ I(/* @__PURE__ */ l({
|
|
1378
1400
|
__name: "MergeTagPicker",
|
|
1379
1401
|
emits: ["select"],
|
|
1380
|
-
setup(
|
|
1381
|
-
let a =
|
|
1402
|
+
setup(t, { emit: r }) {
|
|
1403
|
+
let a = r, { t: s, locale: c } = ge(), l = i(Je, j(() => ({}))), u = j(() => Ie(l.value).map((e) => ({
|
|
1382
1404
|
id: e,
|
|
1383
|
-
label:
|
|
1384
|
-
}))),
|
|
1385
|
-
let e =
|
|
1386
|
-
return e ?
|
|
1387
|
-
}),
|
|
1388
|
-
function
|
|
1405
|
+
label: Be(l.value, e, c.value)
|
|
1406
|
+
}))), f = S(""), p = j(() => {
|
|
1407
|
+
let e = f.value.trim().toLowerCase();
|
|
1408
|
+
return e ? u.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : u.value;
|
|
1409
|
+
}), h = re(), _ = j(() => b.value?.matches(":popover-open") ?? !1), y = v("trigger"), b = v("popover"), w = v("filterInput");
|
|
1410
|
+
function D(e) {
|
|
1389
1411
|
if (e.newState !== "open") return;
|
|
1390
|
-
|
|
1391
|
-
let t = b.value, n =
|
|
1412
|
+
f.value = "";
|
|
1413
|
+
let t = b.value, n = y.value?.getBoundingClientRect();
|
|
1392
1414
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1393
1415
|
}
|
|
1394
|
-
function
|
|
1395
|
-
e.newState === "open" &&
|
|
1416
|
+
function O(e) {
|
|
1417
|
+
e.newState === "open" && ee(() => w.value?.focus());
|
|
1396
1418
|
}
|
|
1397
|
-
function
|
|
1419
|
+
function te(e) {
|
|
1398
1420
|
let t = e.relatedTarget, n = b.value;
|
|
1399
1421
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1400
1422
|
}
|
|
1401
|
-
function
|
|
1423
|
+
function k(e) {
|
|
1402
1424
|
a("select", e), b.value?.hidePopover();
|
|
1403
1425
|
}
|
|
1404
|
-
return (
|
|
1426
|
+
return (t, r) => (o(), d(M, null, [u.value.length ? (o(), d("button", {
|
|
1405
1427
|
key: 0,
|
|
1406
1428
|
ref_key: "trigger",
|
|
1407
|
-
ref:
|
|
1429
|
+
ref: y,
|
|
1408
1430
|
type: "button",
|
|
1409
|
-
class:
|
|
1410
|
-
title:
|
|
1411
|
-
"aria-label":
|
|
1412
|
-
popovertarget:
|
|
1431
|
+
class: T(["merge-tag-trigger", { active: _.value }]),
|
|
1432
|
+
title: C(s)("blocks.text.mergeTag"),
|
|
1433
|
+
"aria-label": C(s)("blocks.text.mergeTag"),
|
|
1434
|
+
popovertarget: C(h),
|
|
1413
1435
|
"aria-haspopup": "dialog",
|
|
1414
|
-
"aria-expanded":
|
|
1415
|
-
onMousedown:
|
|
1416
|
-
}, [
|
|
1436
|
+
"aria-expanded": _.value,
|
|
1437
|
+
onMousedown: r[0] ||= x(() => {}, ["prevent"])
|
|
1438
|
+
}, [e(P, {
|
|
1417
1439
|
name: "braces",
|
|
1418
1440
|
size: 16
|
|
1419
|
-
})], 42,
|
|
1441
|
+
})], 42, ln)) : n("", !0), u.value.length ? (o(), d("div", {
|
|
1420
1442
|
key: 1,
|
|
1421
|
-
id:
|
|
1443
|
+
id: C(h),
|
|
1422
1444
|
ref_key: "popover",
|
|
1423
1445
|
ref: b,
|
|
1424
1446
|
class: "merge-tag-popover",
|
|
1425
1447
|
popover: "",
|
|
1426
1448
|
role: "dialog",
|
|
1427
|
-
"aria-label":
|
|
1428
|
-
onBeforetoggle:
|
|
1429
|
-
onToggle:
|
|
1430
|
-
onFocusout:
|
|
1431
|
-
}, [
|
|
1449
|
+
"aria-label": C(s)("blocks.text.mergeTag"),
|
|
1450
|
+
onBeforetoggle: D,
|
|
1451
|
+
onToggle: O,
|
|
1452
|
+
onFocusout: te
|
|
1453
|
+
}, [e(be, {
|
|
1432
1454
|
ref_key: "filterInput",
|
|
1433
|
-
ref:
|
|
1434
|
-
modelValue:
|
|
1435
|
-
"onUpdate:modelValue":
|
|
1455
|
+
ref: w,
|
|
1456
|
+
modelValue: f.value,
|
|
1457
|
+
"onUpdate:modelValue": r[1] ||= (e) => f.value = e,
|
|
1436
1458
|
autocomplete: "off",
|
|
1437
|
-
placeholder:
|
|
1438
|
-
"aria-label":
|
|
1459
|
+
placeholder: C(s)("blocks.text.mergeTagSearch"),
|
|
1460
|
+
"aria-label": C(s)("blocks.text.mergeTagSearch"),
|
|
1439
1461
|
spellcheck: "false"
|
|
1440
1462
|
}, null, 8, [
|
|
1441
1463
|
"modelValue",
|
|
1442
1464
|
"placeholder",
|
|
1443
1465
|
"aria-label"
|
|
1444
|
-
]),
|
|
1466
|
+
]), p.value.length ? (o(), d("ul", dn, [(o(!0), d(M, null, g(p.value, (e) => (o(), d("li", { key: e.id }, [m("button", {
|
|
1445
1467
|
type: "button",
|
|
1446
1468
|
class: "merge-tag-option",
|
|
1447
|
-
onClick: (t) =>
|
|
1448
|
-
onMousedown:
|
|
1449
|
-
}, [
|
|
1469
|
+
onClick: (t) => k(e.id),
|
|
1470
|
+
onMousedown: r[2] ||= x(() => {}, ["prevent"])
|
|
1471
|
+
}, [m("span", pn, E(e.label), 1), m("span", mn, E(e.id), 1)], 40, fn)]))), 128))])) : (o(), d("p", hn, E(C(s)("blocks.text.mergeTagEmpty")), 1))], 40, un)) : n("", !0)], 64));
|
|
1450
1472
|
}
|
|
1451
|
-
}), [["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"]]),
|
|
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"]]), _n = /* @__PURE__ */ l({
|
|
1452
1474
|
__name: "MergeTagView",
|
|
1453
|
-
props:
|
|
1475
|
+
props: Yt,
|
|
1454
1476
|
setup(e) {
|
|
1455
|
-
let
|
|
1456
|
-
return (e, t) => (
|
|
1477
|
+
let t = e, { t: n, locale: a } = ge(), s = i(Je, j(() => ({}))), c = j(() => String(t.node.attrs.id ?? "")), l = j(() => s.value[c.value] !== void 0), u = j(() => Be(s.value, c.value, a.value)), d = j(() => n("blocks.text.mergeTagChip", { name: u.value }));
|
|
1478
|
+
return (e, t) => (o(), r(C(Kt), {
|
|
1457
1479
|
as: "span",
|
|
1458
|
-
class:
|
|
1459
|
-
"data-merge-tag":
|
|
1480
|
+
class: T(["merge-tag", { "is-unknown": !l.value }]),
|
|
1481
|
+
"data-merge-tag": c.value,
|
|
1460
1482
|
contenteditable: "false",
|
|
1461
1483
|
role: "img",
|
|
1462
|
-
"aria-label":
|
|
1463
|
-
title:
|
|
1484
|
+
"aria-label": d.value,
|
|
1485
|
+
title: d.value
|
|
1464
1486
|
}, {
|
|
1465
|
-
default:
|
|
1487
|
+
default: p(() => [O(E(u.value), 1)]),
|
|
1466
1488
|
_: 1
|
|
1467
1489
|
}, 8, [
|
|
1468
1490
|
"class",
|
|
@@ -1474,83 +1496,86 @@ var Yt = [
|
|
|
1474
1496
|
});
|
|
1475
1497
|
//#endregion
|
|
1476
1498
|
//#region src/fontSizes.ts
|
|
1477
|
-
function
|
|
1499
|
+
function vn(e) {
|
|
1478
1500
|
return `${e}px`;
|
|
1479
1501
|
}
|
|
1480
|
-
var
|
|
1481
|
-
function
|
|
1502
|
+
var yn = new Set(We.map(vn));
|
|
1503
|
+
function bn(e) {
|
|
1482
1504
|
let t = e.trim();
|
|
1483
|
-
return
|
|
1505
|
+
return yn.has(t) ? t : null;
|
|
1484
1506
|
}
|
|
1485
|
-
function
|
|
1486
|
-
return
|
|
1507
|
+
function xn(e) {
|
|
1508
|
+
return yn.has(e);
|
|
1487
1509
|
}
|
|
1488
1510
|
//#endregion
|
|
1489
1511
|
//#region src/panels/contentPanel/components/blocks/sanitizePastedFonts.ts
|
|
1490
|
-
var
|
|
1491
|
-
function
|
|
1492
|
-
let t =
|
|
1512
|
+
var Sn = "textStyle";
|
|
1513
|
+
function Cn(e) {
|
|
1514
|
+
let t = Re(e);
|
|
1493
1515
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1494
1516
|
}
|
|
1495
|
-
function
|
|
1496
|
-
if (e.type.name !==
|
|
1517
|
+
function wn(e, t) {
|
|
1518
|
+
if (e.type.name !== Sn) return e;
|
|
1497
1519
|
let n = { ...e.attrs };
|
|
1498
|
-
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily =
|
|
1520
|
+
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily = Cn(n.fontFamily)), typeof n.fontSize == "string" && (n.fontSize = bn(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;
|
|
1499
1521
|
}
|
|
1500
|
-
function
|
|
1522
|
+
function Tn(e, t) {
|
|
1501
1523
|
return e.flatMap((e) => {
|
|
1502
|
-
let n =
|
|
1524
|
+
let n = wn(e, t);
|
|
1503
1525
|
return n ? [n] : [];
|
|
1504
1526
|
});
|
|
1505
1527
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return e.isText ? e.mark(
|
|
1528
|
+
function En(e, t) {
|
|
1529
|
+
return e.isText ? e.mark(Tn(e.marks, t)) : e.copy(Dn(e.content, t)).mark(Tn(e.marks, t));
|
|
1508
1530
|
}
|
|
1509
|
-
function
|
|
1531
|
+
function Dn(e, t) {
|
|
1510
1532
|
let n = [];
|
|
1511
|
-
for (let r = 0; r < e.childCount; r++) n.push(
|
|
1512
|
-
return
|
|
1533
|
+
for (let r = 0; r < e.childCount; r++) n.push(En(e.child(r), t));
|
|
1534
|
+
return Ae.fromArray(n);
|
|
1513
1535
|
}
|
|
1514
|
-
function
|
|
1515
|
-
return new
|
|
1536
|
+
function On(e, t) {
|
|
1537
|
+
return new N(Dn(e.content, t), e.openStart, e.openEnd);
|
|
1516
1538
|
}
|
|
1517
1539
|
//#endregion
|
|
1518
1540
|
//#region src/panels/contentPanel/components/blocks/TextEditor.vue?vue&type=script&setup=true&lang.ts
|
|
1519
|
-
var
|
|
1541
|
+
var kn = { class: "picker" }, An = ["aria-label", "value"], jn = {
|
|
1542
|
+
key: 0,
|
|
1543
|
+
value: "paragraph"
|
|
1544
|
+
}, Mn = ["value"], Nn = { class: "picker" }, Pn = ["aria-label", "value"], Fn = {
|
|
1520
1545
|
value: "mixed",
|
|
1521
1546
|
disabled: "",
|
|
1522
1547
|
hidden: ""
|
|
1523
|
-
},
|
|
1548
|
+
}, In = ["value"], Ln = ["value"], Rn = { class: "picker" }, zn = ["aria-label", "value"], Bn = {
|
|
1524
1549
|
value: "mixed",
|
|
1525
1550
|
disabled: "",
|
|
1526
1551
|
hidden: ""
|
|
1527
|
-
},
|
|
1552
|
+
}, Vn = { value: "" }, Hn = ["value"], Un = ["title", "aria-label"], Wn = ["title", "aria-label"], Gn = ["title", "aria-label"], Kn = [
|
|
1528
1553
|
"title",
|
|
1529
1554
|
"popovertarget",
|
|
1530
1555
|
"aria-expanded"
|
|
1531
|
-
],
|
|
1556
|
+
], qn = ["id", "aria-label"], Jn = { class: "link-field" }, Yn = {
|
|
1532
1557
|
key: 0,
|
|
1533
1558
|
class: "link-anchor"
|
|
1534
|
-
},
|
|
1559
|
+
}, Xn = {
|
|
1535
1560
|
key: 0,
|
|
1536
1561
|
value: ""
|
|
1537
|
-
},
|
|
1562
|
+
}, Zn = {
|
|
1538
1563
|
key: 1,
|
|
1539
1564
|
value: "",
|
|
1540
1565
|
disabled: "",
|
|
1541
1566
|
hidden: ""
|
|
1542
|
-
},
|
|
1567
|
+
}, Qn = ["value"], $n = ["title", "aria-label"], er = ["title", "onClick"], tr = {
|
|
1543
1568
|
"aria-hidden": "true",
|
|
1544
1569
|
height: "16",
|
|
1545
1570
|
viewBox: "0 0 16 16",
|
|
1546
1571
|
width: "16"
|
|
1547
|
-
},
|
|
1572
|
+
}, nr = [
|
|
1548
1573
|
"width",
|
|
1549
1574
|
"x",
|
|
1550
1575
|
"y"
|
|
1551
|
-
],
|
|
1576
|
+
], rr = 8, ir = 220, ar = /*#__PURE__*/ I(/* @__PURE__ */ l({
|
|
1552
1577
|
__name: "TextEditor",
|
|
1553
|
-
props: /*@__PURE__*/
|
|
1578
|
+
props: /*@__PURE__*/ s({
|
|
1554
1579
|
editable: {
|
|
1555
1580
|
type: Boolean,
|
|
1556
1581
|
default: !1
|
|
@@ -1559,157 +1584,197 @@ var Cn = { class: "picker" }, wn = ["aria-label", "value"], Tn = { value: "parag
|
|
|
1559
1584
|
padding: { type: null },
|
|
1560
1585
|
borderRadius: { type: null },
|
|
1561
1586
|
border: { type: null },
|
|
1587
|
+
height: { type: Number },
|
|
1588
|
+
width: { type: null },
|
|
1589
|
+
align: { type: null },
|
|
1590
|
+
paragraphSpacing: { type: Number },
|
|
1591
|
+
headerOnly: { type: Boolean },
|
|
1562
1592
|
availableWidth: { type: Number },
|
|
1563
1593
|
outerVmlBackground: { type: Boolean }
|
|
1564
1594
|
}, {
|
|
1565
1595
|
text: { required: !0 },
|
|
1566
|
-
textModifiers: {}
|
|
1596
|
+
textModifiers: {},
|
|
1597
|
+
fitSize: {},
|
|
1598
|
+
fitSizeModifiers: {}
|
|
1567
1599
|
}),
|
|
1568
|
-
emits: ["update:text"],
|
|
1569
|
-
setup(
|
|
1570
|
-
let
|
|
1600
|
+
emits: ["update:text", "update:fitSize"],
|
|
1601
|
+
setup(r) {
|
|
1602
|
+
let a = c(r, "text"), s = c(r, "fitSize"), l = r, { t: u, locale: f } = ge(), h = [
|
|
1571
1603
|
"left",
|
|
1572
1604
|
"center",
|
|
1573
1605
|
"right",
|
|
1574
1606
|
"justify"
|
|
1575
|
-
],
|
|
1576
|
-
...
|
|
1607
|
+
], y = j(() => u(l.headerOnly ? "blocks.header.label" : "blocks.text.label")), w = qt({
|
|
1608
|
+
...He,
|
|
1577
1609
|
editorProps: {
|
|
1578
1610
|
attributes: {
|
|
1579
|
-
"aria-label":
|
|
1611
|
+
"aria-label": y.value,
|
|
1580
1612
|
"aria-multiline": "true",
|
|
1581
1613
|
role: "textbox"
|
|
1582
1614
|
},
|
|
1583
|
-
transformPasted: (e) =>
|
|
1615
|
+
transformPasted: (e) => On(e, me.value)
|
|
1584
1616
|
},
|
|
1585
|
-
content:
|
|
1586
|
-
editable:
|
|
1617
|
+
content: xe(a.value),
|
|
1618
|
+
editable: l.editable,
|
|
1587
1619
|
extensions: [
|
|
1588
|
-
...
|
|
1589
|
-
|
|
1590
|
-
|
|
1620
|
+
...(l.headerOnly ? Le : ye).map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => Zt(_n) }) : e),
|
|
1621
|
+
Ht,
|
|
1622
|
+
zt.configure({ placeholder: () => u(l.headerOnly ? "blocks.header.placeholder" : "blocks.text.placeholder") })
|
|
1591
1623
|
],
|
|
1592
1624
|
onUpdate({ editor: e }) {
|
|
1593
|
-
|
|
1625
|
+
a.value = Me(e.getJSON()), le();
|
|
1594
1626
|
},
|
|
1595
1627
|
onSelectionUpdate() {
|
|
1596
|
-
|
|
1628
|
+
le();
|
|
1597
1629
|
}
|
|
1598
1630
|
});
|
|
1599
|
-
y
|
|
1600
|
-
|
|
1601
|
-
}),
|
|
1602
|
-
let t =
|
|
1603
|
-
!t ||
|
|
1604
|
-
}),
|
|
1605
|
-
let
|
|
1606
|
-
function
|
|
1607
|
-
let e =
|
|
1608
|
-
!
|
|
1631
|
+
_(y, (e) => {
|
|
1632
|
+
w.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1633
|
+
}), _(a, (e) => {
|
|
1634
|
+
let t = w.value;
|
|
1635
|
+
!t || Ke(e, Me(t.getJSON())) || t.commands.setContent(xe(e), { emitUpdate: !1 });
|
|
1636
|
+
}), _(() => l.editable, (e) => w.value?.setEditable(e));
|
|
1637
|
+
let D = v("root"), O = v("toolbar"), te = v("content");
|
|
1638
|
+
function k() {
|
|
1639
|
+
let e = te.value?.$el;
|
|
1640
|
+
if (!(l.editable && e)) return;
|
|
1641
|
+
if (l.width !== "fit") {
|
|
1642
|
+
s.value !== void 0 && (s.value = void 0);
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
let t = e.getBoundingClientRect(), n = {
|
|
1646
|
+
width: Math.ceil(t.width),
|
|
1647
|
+
height: Math.ceil(t.height)
|
|
1648
|
+
};
|
|
1649
|
+
if (n.width < 1 || n.height < 1) return;
|
|
1650
|
+
let r = s.value;
|
|
1651
|
+
(r?.width !== n.width || r.height !== n.height) && (s.value = n);
|
|
1652
|
+
}
|
|
1653
|
+
let A, N;
|
|
1654
|
+
function F() {
|
|
1655
|
+
let e = te.value?.$el;
|
|
1656
|
+
!(A && e) || e === N || (N && A.unobserve(N), A.observe(e), N = e);
|
|
1657
|
+
}
|
|
1658
|
+
function I() {
|
|
1659
|
+
ee(() => {
|
|
1660
|
+
F(), k();
|
|
1661
|
+
});
|
|
1609
1662
|
}
|
|
1610
|
-
|
|
1663
|
+
t(() => {
|
|
1664
|
+
!l.editable || typeof ResizeObserver > "u" || (A = new ResizeObserver(k), I());
|
|
1665
|
+
}), oe(() => A?.disconnect()), _(() => [
|
|
1666
|
+
l.width,
|
|
1667
|
+
l.paragraphSpacing,
|
|
1668
|
+
l.padding,
|
|
1669
|
+
a.value
|
|
1670
|
+
], I);
|
|
1671
|
+
function se() {
|
|
1672
|
+
let e = O.value;
|
|
1673
|
+
!e || e.matches(":popover-open") || (e.showPopover(), le());
|
|
1674
|
+
}
|
|
1675
|
+
function ce(e) {
|
|
1611
1676
|
let t = e.relatedTarget;
|
|
1612
|
-
t instanceof Node &&
|
|
1677
|
+
t instanceof Node && D.value?.contains(t) || O.value?.matches(":popover-open") && O.value.hidePopover();
|
|
1613
1678
|
}
|
|
1614
|
-
function
|
|
1615
|
-
let e =
|
|
1679
|
+
function le() {
|
|
1680
|
+
let e = w.value?.view, t = O.value, n = D.value;
|
|
1616
1681
|
if (!(e && t && n && t.matches(":popover-open"))) return;
|
|
1617
|
-
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(
|
|
1618
|
-
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o -
|
|
1682
|
+
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(rr, window.innerWidth - ir - rr), o = Math.min(Math.max(i.left, rr), a);
|
|
1683
|
+
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - rr}px`, t.style.top = `${i.top}px`;
|
|
1619
1684
|
}
|
|
1620
|
-
function
|
|
1621
|
-
let e =
|
|
1622
|
-
if (!e) return "paragraph";
|
|
1623
|
-
let t =
|
|
1685
|
+
function ue() {
|
|
1686
|
+
let e = w.value;
|
|
1687
|
+
if (!e) return l.headerOnly ? "h1" : "paragraph";
|
|
1688
|
+
let t = he.find((t) => e.isActive("heading", { level: t }));
|
|
1624
1689
|
return t ? `h${t}` : "paragraph";
|
|
1625
1690
|
}
|
|
1626
|
-
function
|
|
1691
|
+
function de(e) {
|
|
1627
1692
|
let { target: t } = e;
|
|
1628
1693
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1629
|
-
let n =
|
|
1694
|
+
let n = w.value?.chain().focus();
|
|
1630
1695
|
if (!n) return;
|
|
1631
|
-
let r =
|
|
1632
|
-
r ? n.setHeading({ level: r }).run() : n.setParagraph().run();
|
|
1696
|
+
let r = he.find((e) => `h${e}` === t.value);
|
|
1697
|
+
r ? n.setHeading({ level: r }).run() : l.headerOnly || n.setParagraph().run();
|
|
1633
1698
|
}
|
|
1634
|
-
let
|
|
1635
|
-
function
|
|
1699
|
+
let L = i(b, j(() => Ce)), R = ve(), me = j(() => new Set(R.value.map((e) => e.stack)));
|
|
1700
|
+
function z(e) {
|
|
1636
1701
|
return `custom:${e}`;
|
|
1637
1702
|
}
|
|
1638
|
-
function
|
|
1639
|
-
if (typeof e != "string") return
|
|
1640
|
-
let t =
|
|
1641
|
-
return t ?
|
|
1703
|
+
function B(e) {
|
|
1704
|
+
if (typeof e != "string") return L.value;
|
|
1705
|
+
let t = R.value.find((t) => t.stack === e);
|
|
1706
|
+
return t ? z(t.name) : Re(e)?.key ?? L.value;
|
|
1642
1707
|
}
|
|
1643
|
-
function
|
|
1644
|
-
let e =
|
|
1645
|
-
if (!e) return
|
|
1708
|
+
function we() {
|
|
1709
|
+
let e = w.value;
|
|
1710
|
+
if (!e) return L.value;
|
|
1646
1711
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1647
|
-
if (r) return
|
|
1712
|
+
if (r) return B(e.getAttributes("textStyle").fontFamily);
|
|
1648
1713
|
let i = /* @__PURE__ */ new Set();
|
|
1649
1714
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1650
1715
|
if (!e.isText) return;
|
|
1651
1716
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1652
|
-
i.add(
|
|
1717
|
+
i.add(B(t?.attrs.fontFamily));
|
|
1653
1718
|
});
|
|
1654
1719
|
let a = Array.from(i);
|
|
1655
|
-
return a.length > 1 ? "mixed" : a[0] ??
|
|
1720
|
+
return a.length > 1 ? "mixed" : a[0] ?? L.value;
|
|
1656
1721
|
}
|
|
1657
|
-
function
|
|
1722
|
+
function De(e) {
|
|
1658
1723
|
let { target: t } = e;
|
|
1659
1724
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1660
|
-
let n = t.value, r =
|
|
1725
|
+
let n = t.value, r = w.value?.chain().focus();
|
|
1661
1726
|
if (!r) return;
|
|
1662
|
-
let i =
|
|
1727
|
+
let i = R.value.find((e) => z(e.name) === n);
|
|
1663
1728
|
if (i) {
|
|
1664
1729
|
r.setFontFamily(i.stack).run();
|
|
1665
1730
|
return;
|
|
1666
1731
|
}
|
|
1667
|
-
|
|
1732
|
+
Oe(n) && (n === L.value ? r.unsetFontFamily().run() : r.setFontFamily(Pe(n)).run());
|
|
1668
1733
|
}
|
|
1669
|
-
function
|
|
1670
|
-
return typeof e == "string" &&
|
|
1734
|
+
function ke(e) {
|
|
1735
|
+
return typeof e == "string" && xn(e) ? e : "";
|
|
1671
1736
|
}
|
|
1672
|
-
function
|
|
1673
|
-
let e =
|
|
1737
|
+
function Ae() {
|
|
1738
|
+
let e = w.value;
|
|
1674
1739
|
if (!e) return "";
|
|
1675
1740
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1676
|
-
if (r) return
|
|
1741
|
+
if (r) return ke(e.getAttributes("textStyle").fontSize);
|
|
1677
1742
|
let i = /* @__PURE__ */ new Set();
|
|
1678
1743
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1679
1744
|
if (!e.isText) return;
|
|
1680
1745
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1681
|
-
i.add(
|
|
1746
|
+
i.add(ke(t?.attrs.fontSize));
|
|
1682
1747
|
});
|
|
1683
1748
|
let a = Array.from(i);
|
|
1684
1749
|
return a.length > 1 ? "mixed" : a[0] ?? "";
|
|
1685
1750
|
}
|
|
1686
|
-
function
|
|
1751
|
+
function Fe(e) {
|
|
1687
1752
|
let { target: t } = e;
|
|
1688
1753
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1689
|
-
let n =
|
|
1690
|
-
n && (t.value === "" ? n.unsetFontSize().run() :
|
|
1754
|
+
let n = w.value?.chain().focus();
|
|
1755
|
+
n && (t.value === "" ? n.unsetFontSize().run() : xn(t.value) && n.setFontSize(t.value).run());
|
|
1691
1756
|
}
|
|
1692
|
-
let
|
|
1693
|
-
let e =
|
|
1694
|
-
return
|
|
1695
|
-
}),
|
|
1757
|
+
let Ie = Ve(() => {
|
|
1758
|
+
let e = we();
|
|
1759
|
+
return Oe(e) ? e : void 0;
|
|
1760
|
+
}), ze = j({
|
|
1696
1761
|
get: () => {
|
|
1697
|
-
let e =
|
|
1762
|
+
let e = w.value?.getAttributes("textStyle").color, t = typeof e == "string" ? _e(e) : void 0;
|
|
1698
1763
|
return t ? {
|
|
1699
1764
|
type: "color",
|
|
1700
1765
|
...t
|
|
1701
|
-
} :
|
|
1766
|
+
} : Ee;
|
|
1702
1767
|
},
|
|
1703
1768
|
set: (e) => {
|
|
1704
|
-
e.type !== "transparent" &&
|
|
1769
|
+
e.type !== "transparent" && w.value?.chain().setColor(pe(e)).run();
|
|
1705
1770
|
}
|
|
1706
|
-
}),
|
|
1771
|
+
}), Be = {
|
|
1707
1772
|
left: "blocks.text.alignLeft",
|
|
1708
1773
|
center: "blocks.text.alignCenter",
|
|
1709
1774
|
right: "blocks.text.alignRight",
|
|
1710
1775
|
justify: "blocks.text.alignJustify"
|
|
1711
1776
|
};
|
|
1712
|
-
function
|
|
1777
|
+
function qe(e) {
|
|
1713
1778
|
return (e === "justify" ? [
|
|
1714
1779
|
14,
|
|
1715
1780
|
14,
|
|
@@ -1729,47 +1794,47 @@ var Cn = { class: "picker" }, wn = ["aria-label", "value"], Tn = { value: "parag
|
|
|
1729
1794
|
};
|
|
1730
1795
|
});
|
|
1731
1796
|
}
|
|
1732
|
-
let
|
|
1733
|
-
function
|
|
1797
|
+
let Je = re(), V = v("linkPopover"), H = v("linkInput"), U = v("linkTrigger"), W = S(""), Ye = S(!1), Ze = S(!1);
|
|
1798
|
+
function Qe(e) {
|
|
1734
1799
|
if (e.newState !== "open") return;
|
|
1735
|
-
let t =
|
|
1736
|
-
|
|
1737
|
-
let n =
|
|
1800
|
+
let t = w.value?.getAttributes("link")?.href;
|
|
1801
|
+
W.value = typeof t == "string" ? t : "", Ze.value = W.value !== "";
|
|
1802
|
+
let n = V.value, r = U.value?.getBoundingClientRect();
|
|
1738
1803
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1739
1804
|
}
|
|
1740
|
-
function
|
|
1741
|
-
if (
|
|
1742
|
-
let t =
|
|
1805
|
+
function G(e) {
|
|
1806
|
+
if (Ye.value = e.newState === "open", e.newState !== "open") return;
|
|
1807
|
+
let t = V.value;
|
|
1743
1808
|
if (t) {
|
|
1744
1809
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1745
1810
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1746
1811
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1812
|
+
ee(() => {
|
|
1813
|
+
H.value?.focus(), H.value?.select();
|
|
1749
1814
|
});
|
|
1750
1815
|
}
|
|
1751
|
-
function
|
|
1752
|
-
let t = e.relatedTarget, n =
|
|
1816
|
+
function $e(e) {
|
|
1817
|
+
let t = e.relatedTarget, n = V.value;
|
|
1753
1818
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
1754
1819
|
}
|
|
1755
|
-
function
|
|
1756
|
-
let e =
|
|
1820
|
+
function et() {
|
|
1821
|
+
let e = w.value?.chain().focus();
|
|
1757
1822
|
if (!e) return;
|
|
1758
|
-
let t =
|
|
1823
|
+
let t = Ue(W.value);
|
|
1759
1824
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
1760
1825
|
href: t,
|
|
1761
1826
|
target: t.startsWith("#") ? null : "_blank"
|
|
1762
|
-
}).run(),
|
|
1827
|
+
}).run(), V.value?.hidePopover();
|
|
1763
1828
|
}
|
|
1764
|
-
let
|
|
1765
|
-
function
|
|
1766
|
-
e === "" ?
|
|
1829
|
+
let tt = i(ie, j(() => [])), nt = j(() => W.value.startsWith("#") && tt.value.includes(W.value.slice(1)) ? W.value.slice(1) : "");
|
|
1830
|
+
function rt(e) {
|
|
1831
|
+
e === "" ? W.value.startsWith("#") && (W.value = "") : W.value = `#${e}`;
|
|
1767
1832
|
}
|
|
1768
|
-
function
|
|
1769
|
-
|
|
1833
|
+
function it() {
|
|
1834
|
+
w.value?.chain().focus().unsetLink().run(), V.value?.hidePopover();
|
|
1770
1835
|
}
|
|
1771
|
-
let
|
|
1772
|
-
function
|
|
1836
|
+
let K = i(Te), at = fe(), ot = j(() => en(K?.value?.ai)), q = S(!1);
|
|
1837
|
+
function st(e) {
|
|
1773
1838
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1774
1839
|
if (!r) return {
|
|
1775
1840
|
from: t,
|
|
@@ -1781,16 +1846,16 @@ var Cn = { class: "picker" }, wn = ["aria-label", "value"], Tn = { value: "parag
|
|
|
1781
1846
|
to: i.content.size
|
|
1782
1847
|
};
|
|
1783
1848
|
}
|
|
1784
|
-
let
|
|
1785
|
-
function
|
|
1849
|
+
let J = (e, t, n) => e.state.doc.textBetween(t, n, " ", (e) => e.type.name === "mergeTag" ? `{{${e.attrs.id}}}` : ""), ct = /\{\{([A-Za-z0-9._-]+)\}\}/g;
|
|
1850
|
+
function lt(e) {
|
|
1786
1851
|
let t = [], n = 0;
|
|
1787
|
-
for (let r of e.matchAll(
|
|
1852
|
+
for (let r of e.matchAll(ct)) {
|
|
1788
1853
|
let i = r[1];
|
|
1789
1854
|
i !== void 0 && (r.index > n && t.push({
|
|
1790
1855
|
type: "text",
|
|
1791
1856
|
text: e.slice(n, r.index)
|
|
1792
1857
|
}), t.push({
|
|
1793
|
-
type:
|
|
1858
|
+
type: Ne,
|
|
1794
1859
|
attrs: { id: i }
|
|
1795
1860
|
}), n = r.index + r[0].length);
|
|
1796
1861
|
}
|
|
@@ -1799,231 +1864,247 @@ var Cn = { class: "picker" }, wn = ["aria-label", "value"], Tn = { value: "parag
|
|
|
1799
1864
|
text: e.slice(n)
|
|
1800
1865
|
}), t;
|
|
1801
1866
|
}
|
|
1802
|
-
async function
|
|
1803
|
-
let t =
|
|
1804
|
-
if (!(t && n) ||
|
|
1805
|
-
let { from: r, to: i } =
|
|
1867
|
+
async function ut(e) {
|
|
1868
|
+
let t = w.value, n = K?.value?.ai;
|
|
1869
|
+
if (!(t && n) || q.value) return;
|
|
1870
|
+
let { from: r, to: i } = st(t), a = J(t, r, i);
|
|
1806
1871
|
if (a.trim() !== "") {
|
|
1807
|
-
|
|
1872
|
+
q.value = !0;
|
|
1808
1873
|
try {
|
|
1809
1874
|
let t = await n.run({
|
|
1810
1875
|
action: e,
|
|
1811
1876
|
text: a,
|
|
1812
|
-
locale:
|
|
1877
|
+
locale: f.value
|
|
1813
1878
|
});
|
|
1814
|
-
typeof t == "string" && t !== "" &&
|
|
1879
|
+
typeof t == "string" && t !== "" && w.value && w.value.chain().focus().insertContentAt({
|
|
1815
1880
|
from: r,
|
|
1816
1881
|
to: i
|
|
1817
|
-
},
|
|
1882
|
+
}, lt(t)).run();
|
|
1818
1883
|
} catch (e) {
|
|
1819
|
-
console.error("[bygga-editor] the AI action failed —", e),
|
|
1884
|
+
console.error("[bygga-editor] the AI action failed —", e), at?.show(u("blocks.text.ai.failed"));
|
|
1820
1885
|
} finally {
|
|
1821
|
-
|
|
1886
|
+
q.value = !1;
|
|
1822
1887
|
}
|
|
1823
1888
|
}
|
|
1824
1889
|
}
|
|
1825
|
-
function
|
|
1826
|
-
|
|
1827
|
-
type:
|
|
1890
|
+
function Y(e) {
|
|
1891
|
+
w.value?.chain().focus().insertContent({
|
|
1892
|
+
type: Ne,
|
|
1828
1893
|
attrs: { id: e }
|
|
1829
1894
|
}).run();
|
|
1830
1895
|
}
|
|
1831
|
-
return (
|
|
1896
|
+
return (t, r) => (o(), d("div", {
|
|
1832
1897
|
ref_key: "root",
|
|
1833
|
-
ref:
|
|
1898
|
+
ref: D,
|
|
1834
1899
|
style: {
|
|
1835
1900
|
position: "relative",
|
|
1836
1901
|
width: "100%"
|
|
1837
1902
|
},
|
|
1838
|
-
onFocusin:
|
|
1839
|
-
onFocusout:
|
|
1840
|
-
}, [
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1903
|
+
onFocusin: se,
|
|
1904
|
+
onFocusout: ce
|
|
1905
|
+
}, [e(C(Xe), {
|
|
1906
|
+
width: l.width,
|
|
1907
|
+
align: l.align
|
|
1908
|
+
}, {
|
|
1909
|
+
default: p(() => [e(C(Gt), {
|
|
1910
|
+
ref_key: "content",
|
|
1911
|
+
ref: te,
|
|
1912
|
+
class: T({
|
|
1913
|
+
"text-input": l.editable,
|
|
1914
|
+
"text-spaced": l.paragraphSpacing !== void 0
|
|
1915
|
+
}),
|
|
1916
|
+
editor: C(w),
|
|
1917
|
+
style: ne([C(Se)(l), l.paragraphSpacing === void 0 ? void 0 : { "--bygga-paragraph-spacing": `${l.paragraphSpacing}px` }])
|
|
1918
|
+
}, null, 8, [
|
|
1919
|
+
"class",
|
|
1920
|
+
"editor",
|
|
1921
|
+
"style"
|
|
1922
|
+
])]),
|
|
1923
|
+
_: 1
|
|
1924
|
+
}, 8, ["width", "align"]), l.editable ? (o(), d("div", {
|
|
1844
1925
|
key: 0,
|
|
1845
1926
|
ref_key: "toolbar",
|
|
1846
|
-
ref:
|
|
1927
|
+
ref: O,
|
|
1847
1928
|
popover: "manual",
|
|
1848
1929
|
class: "toolbar"
|
|
1849
1930
|
}, [
|
|
1850
|
-
|
|
1851
|
-
"aria-label":
|
|
1931
|
+
m("span", kn, [m("select", {
|
|
1932
|
+
"aria-label": C(u)("blocks.text.styleLabel"),
|
|
1852
1933
|
class: "style",
|
|
1853
|
-
value:
|
|
1854
|
-
onChange:
|
|
1855
|
-
onMousedown:
|
|
1856
|
-
}, [
|
|
1934
|
+
value: ue(),
|
|
1935
|
+
onChange: de,
|
|
1936
|
+
onMousedown: r[0] ||= x(() => {}, ["stop"])
|
|
1937
|
+
}, [l.headerOnly ? n("", !0) : (o(), d("option", jn, E(C(u)("blocks.text.styleNormal")), 1)), (o(!0), d(M, null, g(C(he), (e) => (o(), d("option", {
|
|
1857
1938
|
key: e,
|
|
1858
1939
|
value: `h${e}`
|
|
1859
|
-
},
|
|
1940
|
+
}, E(C(u)("blocks.text.styleHeading", { level: e })), 9, Mn))), 128))], 40, An), e(P, {
|
|
1860
1941
|
class: "picker-chevron",
|
|
1861
1942
|
name: "chevron-down",
|
|
1862
1943
|
size: 12
|
|
1863
1944
|
})]),
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
"aria-label":
|
|
1945
|
+
r[20] ||= m("span", { class: "divider" }, null, -1),
|
|
1946
|
+
m("span", Nn, [m("select", {
|
|
1947
|
+
"aria-label": C(u)("blocks.text.font"),
|
|
1867
1948
|
class: "font",
|
|
1868
|
-
value:
|
|
1869
|
-
onChange:
|
|
1870
|
-
onMousedown:
|
|
1949
|
+
value: we(),
|
|
1950
|
+
onChange: De,
|
|
1951
|
+
onMousedown: r[1] ||= x(() => {}, ["stop"])
|
|
1871
1952
|
}, [
|
|
1872
|
-
|
|
1873
|
-
(
|
|
1953
|
+
m("option", Fn, E(C(u)("blocks.text.fontMixed")), 1),
|
|
1954
|
+
(o(!0), d(M, null, g(C(Ie), (e) => (o(), d("option", {
|
|
1874
1955
|
key: e.key,
|
|
1875
1956
|
value: e.key
|
|
1876
|
-
},
|
|
1877
|
-
(
|
|
1878
|
-
key:
|
|
1879
|
-
value:
|
|
1880
|
-
},
|
|
1881
|
-
], 40,
|
|
1957
|
+
}, E(e.name), 9, In))), 128)),
|
|
1958
|
+
(o(!0), d(M, null, g(C(R), (e) => (o(), d("option", {
|
|
1959
|
+
key: z(e.name),
|
|
1960
|
+
value: z(e.name)
|
|
1961
|
+
}, E(e.name), 9, Ln))), 128))
|
|
1962
|
+
], 40, Pn), e(P, {
|
|
1882
1963
|
class: "picker-chevron",
|
|
1883
1964
|
name: "chevron-down",
|
|
1884
1965
|
size: 12
|
|
1885
1966
|
})]),
|
|
1886
|
-
|
|
1887
|
-
"aria-label":
|
|
1967
|
+
m("span", Rn, [m("select", {
|
|
1968
|
+
"aria-label": C(u)("blocks.text.fontSize"),
|
|
1888
1969
|
class: "size",
|
|
1889
|
-
value:
|
|
1890
|
-
onChange:
|
|
1891
|
-
onMousedown:
|
|
1970
|
+
value: Ae(),
|
|
1971
|
+
onChange: Fe,
|
|
1972
|
+
onMousedown: r[2] ||= x(() => {}, ["stop"])
|
|
1892
1973
|
}, [
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
(
|
|
1974
|
+
m("option", Bn, E(C(u)("blocks.text.fontMixed")), 1),
|
|
1975
|
+
m("option", Vn, E(C(u)("blocks.text.fontSizeDefault")), 1),
|
|
1976
|
+
(o(!0), d(M, null, g(C(We), (e) => (o(), d("option", {
|
|
1896
1977
|
key: e,
|
|
1897
|
-
value:
|
|
1898
|
-
},
|
|
1899
|
-
], 40,
|
|
1978
|
+
value: C(vn)(e)
|
|
1979
|
+
}, E(e), 9, Hn))), 128))
|
|
1980
|
+
], 40, zn), e(P, {
|
|
1900
1981
|
class: "picker-chevron",
|
|
1901
1982
|
name: "chevron-down",
|
|
1902
1983
|
size: 12
|
|
1903
1984
|
})]),
|
|
1904
|
-
|
|
1905
|
-
modelValue:
|
|
1906
|
-
"onUpdate:modelValue":
|
|
1985
|
+
e(Ge, {
|
|
1986
|
+
modelValue: ze.value,
|
|
1987
|
+
"onUpdate:modelValue": r[3] ||= (e) => ze.value = e,
|
|
1907
1988
|
"allow-transparent": !1,
|
|
1908
|
-
label:
|
|
1989
|
+
label: C(u)("blocks.text.textColor"),
|
|
1909
1990
|
compact: "",
|
|
1910
|
-
onMousedown:
|
|
1991
|
+
onMousedown: r[4] ||= x(() => {}, ["stop"])
|
|
1911
1992
|
}, null, 8, ["modelValue", "label"]),
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
class:
|
|
1993
|
+
r[21] ||= m("span", { class: "divider" }, null, -1),
|
|
1994
|
+
m("button", {
|
|
1995
|
+
class: T({ active: C(w)?.isActive("bold") }),
|
|
1915
1996
|
type: "button",
|
|
1916
|
-
title:
|
|
1917
|
-
"aria-label":
|
|
1918
|
-
onClick:
|
|
1919
|
-
onMousedown:
|
|
1920
|
-
}, [...
|
|
1921
|
-
|
|
1922
|
-
class:
|
|
1997
|
+
title: C(u)("blocks.text.bold"),
|
|
1998
|
+
"aria-label": C(u)("blocks.text.bold"),
|
|
1999
|
+
onClick: r[5] ||= (e) => C(w)?.chain().focus().toggleBold().run(),
|
|
2000
|
+
onMousedown: r[6] ||= x(() => {}, ["prevent"])
|
|
2001
|
+
}, [...r[17] ||= [m("b", null, "B", -1)]], 42, Un),
|
|
2002
|
+
m("button", {
|
|
2003
|
+
class: T({ active: C(w)?.isActive("italic") }),
|
|
1923
2004
|
type: "button",
|
|
1924
|
-
title:
|
|
1925
|
-
"aria-label":
|
|
1926
|
-
onClick:
|
|
1927
|
-
onMousedown:
|
|
1928
|
-
}, [...
|
|
1929
|
-
|
|
1930
|
-
class:
|
|
2005
|
+
title: C(u)("blocks.text.italic"),
|
|
2006
|
+
"aria-label": C(u)("blocks.text.italic"),
|
|
2007
|
+
onClick: r[7] ||= (e) => C(w)?.chain().focus().toggleItalic().run(),
|
|
2008
|
+
onMousedown: r[8] ||= x(() => {}, ["prevent"])
|
|
2009
|
+
}, [...r[18] ||= [m("i", null, "I", -1)]], 42, Wn),
|
|
2010
|
+
m("button", {
|
|
2011
|
+
class: T({ active: C(w)?.isActive("underline") }),
|
|
1931
2012
|
type: "button",
|
|
1932
|
-
title:
|
|
1933
|
-
"aria-label":
|
|
1934
|
-
onClick:
|
|
1935
|
-
onMousedown:
|
|
1936
|
-
}, [...
|
|
1937
|
-
|
|
2013
|
+
title: C(u)("blocks.text.underline"),
|
|
2014
|
+
"aria-label": C(u)("blocks.text.underline"),
|
|
2015
|
+
onClick: r[9] ||= (e) => C(w)?.chain().focus().toggleUnderline().run(),
|
|
2016
|
+
onMousedown: r[10] ||= x(() => {}, ["prevent"])
|
|
2017
|
+
}, [...r[19] ||= [m("u", null, "U", -1)]], 42, Gn),
|
|
2018
|
+
m("button", {
|
|
1938
2019
|
ref_key: "linkTrigger",
|
|
1939
|
-
ref:
|
|
1940
|
-
class:
|
|
2020
|
+
ref: U,
|
|
2021
|
+
class: T({ active: C(w)?.isActive("link") }),
|
|
1941
2022
|
type: "button",
|
|
1942
|
-
title:
|
|
1943
|
-
popovertarget:
|
|
2023
|
+
title: C(u)("blocks.text.link"),
|
|
2024
|
+
popovertarget: C(Je),
|
|
1944
2025
|
"aria-haspopup": "dialog",
|
|
1945
|
-
"aria-expanded":
|
|
1946
|
-
onMousedown:
|
|
1947
|
-
}, [
|
|
2026
|
+
"aria-expanded": Ye.value,
|
|
2027
|
+
onMousedown: r[11] ||= x(() => {}, ["prevent"])
|
|
2028
|
+
}, [e(P, {
|
|
1948
2029
|
name: "link",
|
|
1949
2030
|
size: 16
|
|
1950
|
-
})], 42,
|
|
1951
|
-
|
|
2031
|
+
})], 42, Kn),
|
|
2032
|
+
l.editable ? (o(), d("div", {
|
|
1952
2033
|
key: 0,
|
|
1953
|
-
id:
|
|
2034
|
+
id: C(Je),
|
|
1954
2035
|
ref_key: "linkPopover",
|
|
1955
|
-
ref:
|
|
2036
|
+
ref: V,
|
|
1956
2037
|
class: "link-popover",
|
|
1957
2038
|
popover: "",
|
|
1958
2039
|
role: "dialog",
|
|
1959
|
-
"aria-label":
|
|
1960
|
-
onBeforetoggle:
|
|
1961
|
-
onToggle:
|
|
1962
|
-
onFocusout:
|
|
2040
|
+
"aria-label": C(u)("blocks.text.link"),
|
|
2041
|
+
onBeforetoggle: Qe,
|
|
2042
|
+
onToggle: G,
|
|
2043
|
+
onFocusout: $e
|
|
1963
2044
|
}, [
|
|
1964
|
-
|
|
2045
|
+
m("span", Jn, [e(be, {
|
|
1965
2046
|
ref_key: "linkInput",
|
|
1966
|
-
ref:
|
|
1967
|
-
modelValue:
|
|
1968
|
-
"onUpdate:modelValue":
|
|
2047
|
+
ref: H,
|
|
2048
|
+
modelValue: W.value,
|
|
2049
|
+
"onUpdate:modelValue": r[12] ||= (e) => W.value = e,
|
|
1969
2050
|
inputmode: "url",
|
|
1970
2051
|
spellcheck: "false",
|
|
1971
2052
|
autocomplete: "off",
|
|
1972
|
-
placeholder:
|
|
1973
|
-
"aria-label":
|
|
1974
|
-
onKeydown:
|
|
2053
|
+
placeholder: C(u)("blocks.text.linkPlaceholder"),
|
|
2054
|
+
"aria-label": C(u)("blocks.text.linkPrompt"),
|
|
2055
|
+
onKeydown: ae(x(et, ["prevent"]), ["enter"])
|
|
1975
2056
|
}, null, 8, [
|
|
1976
2057
|
"modelValue",
|
|
1977
2058
|
"placeholder",
|
|
1978
2059
|
"aria-label",
|
|
1979
2060
|
"onKeydown"
|
|
1980
2061
|
])]),
|
|
1981
|
-
|
|
1982
|
-
"aria-label":
|
|
1983
|
-
"model-value":
|
|
1984
|
-
"onUpdate:modelValue":
|
|
1985
|
-
onMousedown:
|
|
2062
|
+
C(tt).length ? (o(), d("span", Yn, [e(je, {
|
|
2063
|
+
"aria-label": C(u)("blocks.common.anchorLink.label"),
|
|
2064
|
+
"model-value": nt.value,
|
|
2065
|
+
"onUpdate:modelValue": rt,
|
|
2066
|
+
onMousedown: r[13] ||= x(() => {}, ["stop"])
|
|
1986
2067
|
}, {
|
|
1987
|
-
default:
|
|
2068
|
+
default: p(() => [nt.value ? (o(), d("option", Xn, E(C(u)("blocks.common.anchorLink.none")), 1)) : (o(), d("option", Zn, E(C(u)("blocks.common.anchorLink.placeholder")), 1)), (o(!0), d(M, null, g(C(tt), (e) => (o(), d("option", {
|
|
1988
2069
|
key: e,
|
|
1989
2070
|
value: e
|
|
1990
|
-
}, " #" +
|
|
2071
|
+
}, " #" + E(e), 9, Qn))), 128))]),
|
|
1991
2072
|
_: 1
|
|
1992
|
-
}, 8, ["aria-label", "model-value"])])) :
|
|
1993
|
-
|
|
2073
|
+
}, 8, ["aria-label", "model-value"])])) : n("", !0),
|
|
2074
|
+
m("button", {
|
|
1994
2075
|
class: "link-apply",
|
|
1995
2076
|
type: "button",
|
|
1996
|
-
onClick:
|
|
1997
|
-
onMousedown:
|
|
1998
|
-
},
|
|
1999
|
-
|
|
2077
|
+
onClick: et,
|
|
2078
|
+
onMousedown: r[14] ||= x(() => {}, ["prevent"])
|
|
2079
|
+
}, E(C(u)("blocks.text.linkApply")), 33),
|
|
2080
|
+
Ze.value ? (o(), d("button", {
|
|
2000
2081
|
key: 1,
|
|
2001
2082
|
class: "link-remove",
|
|
2002
2083
|
type: "button",
|
|
2003
|
-
title:
|
|
2004
|
-
"aria-label":
|
|
2005
|
-
onClick:
|
|
2006
|
-
onMousedown:
|
|
2007
|
-
}, [
|
|
2084
|
+
title: C(u)("blocks.text.linkRemove"),
|
|
2085
|
+
"aria-label": C(u)("blocks.text.linkRemove"),
|
|
2086
|
+
onClick: it,
|
|
2087
|
+
onMousedown: r[15] ||= x(() => {}, ["prevent"])
|
|
2088
|
+
}, [e(P, {
|
|
2008
2089
|
name: "trash",
|
|
2009
2090
|
size: 16
|
|
2010
|
-
})], 40,
|
|
2011
|
-
], 40,
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
actions:
|
|
2015
|
-
pending:
|
|
2016
|
-
onSelect:
|
|
2091
|
+
})], 40, $n)) : n("", !0)
|
|
2092
|
+
], 40, qn)) : n("", !0),
|
|
2093
|
+
e(gn, { onSelect: Y }),
|
|
2094
|
+
e(cn, {
|
|
2095
|
+
actions: ot.value,
|
|
2096
|
+
pending: q.value,
|
|
2097
|
+
onSelect: ut
|
|
2017
2098
|
}, null, 8, ["actions", "pending"]),
|
|
2018
|
-
|
|
2019
|
-
(
|
|
2099
|
+
r[22] ||= m("span", { class: "divider" }, null, -1),
|
|
2100
|
+
(o(), d(M, null, g(h, (e) => m("button", {
|
|
2020
2101
|
key: e,
|
|
2021
|
-
class:
|
|
2022
|
-
title:
|
|
2102
|
+
class: T({ active: C(w)?.isActive({ textAlign: e }) }),
|
|
2103
|
+
title: C(u)(Be[e]),
|
|
2023
2104
|
type: "button",
|
|
2024
|
-
onClick: (t) =>
|
|
2025
|
-
onMousedown:
|
|
2026
|
-
}, [(
|
|
2105
|
+
onClick: (t) => C(w)?.chain().focus().setTextAlign(e).run(),
|
|
2106
|
+
onMousedown: r[16] ||= x(() => {}, ["prevent"])
|
|
2107
|
+
}, [(o(), d("svg", tr, [(o(!0), d(M, null, g(qe(e), (e, t) => (o(), d("rect", {
|
|
2027
2108
|
key: t,
|
|
2028
2109
|
fill: "currentColor",
|
|
2029
2110
|
height: "1.5",
|
|
@@ -2031,9 +2112,9 @@ var Cn = { class: "picker" }, wn = ["aria-label", "value"], Tn = { value: "parag
|
|
|
2031
2112
|
width: e.w,
|
|
2032
2113
|
x: e.x,
|
|
2033
2114
|
y: e.y
|
|
2034
|
-
}, null, 8,
|
|
2035
|
-
], 512)) :
|
|
2115
|
+
}, null, 8, nr))), 128))]))], 42, er)), 64))
|
|
2116
|
+
], 512)) : n("", !0)], 544));
|
|
2036
2117
|
}
|
|
2037
|
-
}), [["styles", [".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-
|
|
2118
|
+
}), [["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-9371cb9e]{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-9371cb9e]:popover-open{display:flex}.toolbar>button[data-v-9371cb9e]{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-9371cb9e]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.toolbar>button.active[data-v-9371cb9e]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.toolbar .picker[data-v-9371cb9e]{align-items:center;display:inline-flex;position:relative}.toolbar .style[data-v-9371cb9e],.toolbar .font[data-v-9371cb9e],.toolbar .size[data-v-9371cb9e]{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-9371cb9e]:hover,.toolbar .font[data-v-9371cb9e]:hover,.toolbar .size[data-v-9371cb9e]:hover{background:color-mix(in srgb, var(--bygga-color-text) 7%, transparent)}.toolbar .picker-chevron[data-v-9371cb9e]{color:var(--bygga-color-text);pointer-events:none;position:absolute;right:5px}.toolbar .divider[data-v-9371cb9e]{background:var(--bygga-color-divider);width:1px;height:24px;margin:0 4px}.link-popover[data-v-9371cb9e]{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-9371cb9e]:popover-open{display:flex}.link-field[data-v-9371cb9e]{width:18em}.link-anchor[data-v-9371cb9e]{width:10em}.link-apply[data-v-9371cb9e]{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-9371cb9e]{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-9371cb9e]:hover{background:var(--bygga-color-track);color:var(--bygga-color-accent)}"]], ["__scopeId", "data-v-9371cb9e"]]);
|
|
2038
2119
|
//#endregion
|
|
2039
|
-
export {
|
|
2120
|
+
export { ar as default };
|