@bygga.dev/editor 1.9.4 → 1.9.7
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,34 +1,34 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n,
|
|
2
|
-
import { At as
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, K as u, L as d, M as f, O as p, P as m, Q as h, R as g, S as _, V as v, W as y, X as ee, Y as te, Z as b, _t as x, ct as ne, dt as S, et as C, g as w, gt as re, j as T, k as E, mt as D, n as ie, nt as ae, o as oe, ot as se, pt as O, q as k, t as ce, ut as A, x as le } from "./providerKeys-ZUO3LJ3M.js";
|
|
2
|
+
import { $ as ue, At as j, Cn as de, Ct as fe, D as M, Dn as pe, Dt as me, E as he, En as ge, Et as _e, F as ve, Ft as ye, It as be, Lt as xe, Mn as Se, Mt as N, N as Ce, Nt as P, On as we, Ot as Te, Pn as Ee, Pt as F, Rt as I, Sn as De, St as Oe, Tn as ke, Tt as Ae, _ as je, _t as L, bt as R, c as Me, ct as Ne, d as Pe, et as z, gt as Fe, h as Ie, ht as Le, j as B, jt as Re, kt as V, l as ze, lt as Be, m as Ve, mt as He, n as Ue, pt as We, r as Ge, s as Ke, t as qe, u as Je, vt as Ye, w as Xe, wn as Ze, wt as Qe, x as $e, xn as et, xt as tt, y as nt, yt as rt, zt as H } from "./urls-BY2YcayU.js";
|
|
3
3
|
//#region ../core/src/render/TextShell.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var it = ["align"], at = /* @__PURE__ */ m({
|
|
5
5
|
__name: "TextShell",
|
|
6
6
|
props: {
|
|
7
7
|
width: { type: null },
|
|
8
8
|
align: { type: null }
|
|
9
9
|
},
|
|
10
10
|
setup(e) {
|
|
11
|
-
let
|
|
12
|
-
return (e,
|
|
11
|
+
let n = e;
|
|
12
|
+
return (e, r) => n.width === "fit" ? (y(), t("div", {
|
|
13
13
|
key: 0,
|
|
14
|
-
style: re(
|
|
14
|
+
style: re(O(ue)(n.align ?? "left"))
|
|
15
15
|
}, [i("table", {
|
|
16
|
-
align:
|
|
16
|
+
align: n.align ?? "left",
|
|
17
17
|
cellpadding: "0",
|
|
18
18
|
cellspacing: "0",
|
|
19
19
|
role: "presentation",
|
|
20
|
-
style: re(
|
|
21
|
-
}, [i("tbody", null, [i("tr", null, [i("td", null, [
|
|
20
|
+
style: re(O(z)())
|
|
21
|
+
}, [i("tbody", null, [i("tr", null, [i("td", null, [k(e.$slots, "default")])])])], 12, it)], 4)) : k(e.$slots, "default", { key: 1 });
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
26
|
-
function
|
|
27
|
-
return new
|
|
28
|
-
return new
|
|
26
|
+
function U(e = {}) {
|
|
27
|
+
return new N({ view(t) {
|
|
28
|
+
return new ot(t, e);
|
|
29
29
|
} });
|
|
30
30
|
}
|
|
31
|
-
var
|
|
31
|
+
var ot = class {
|
|
32
32
|
constructor(e, t) {
|
|
33
33
|
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = [
|
|
34
34
|
"dragover",
|
|
@@ -104,7 +104,7 @@ var tt = class {
|
|
|
104
104
|
if (t && !i) {
|
|
105
105
|
let e = t.pos;
|
|
106
106
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
107
|
-
let t =
|
|
107
|
+
let t = xe(this.editorView.state.doc, e, this.editorView.dragging.slice);
|
|
108
108
|
t != null && (e = t);
|
|
109
109
|
}
|
|
110
110
|
this.setCursor(e), this.scheduleRemoval(5e3);
|
|
@@ -119,16 +119,16 @@ var tt = class {
|
|
|
119
119
|
dragleave(e) {
|
|
120
120
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, W = class e extends F {
|
|
123
123
|
constructor(e) {
|
|
124
124
|
super(e, e);
|
|
125
125
|
}
|
|
126
126
|
map(t, n) {
|
|
127
127
|
let r = t.resolve(n.map(this.head));
|
|
128
|
-
return e.valid(r) ? new e(r) :
|
|
128
|
+
return e.valid(r) ? new e(r) : F.near(r);
|
|
129
129
|
}
|
|
130
130
|
content() {
|
|
131
|
-
return
|
|
131
|
+
return H.empty;
|
|
132
132
|
}
|
|
133
133
|
eq(t) {
|
|
134
134
|
return t instanceof e && t.head == this.head;
|
|
@@ -144,11 +144,11 @@ var tt = class {
|
|
|
144
144
|
return new e(t.resolve(n.pos));
|
|
145
145
|
}
|
|
146
146
|
getBookmark() {
|
|
147
|
-
return new
|
|
147
|
+
return new G(this.anchor);
|
|
148
148
|
}
|
|
149
149
|
static valid(e) {
|
|
150
150
|
let t = e.parent;
|
|
151
|
-
if (t.inlineContent || !
|
|
151
|
+
if (t.inlineContent || !ct(e) || !lt(e)) return !1;
|
|
152
152
|
let n = t.type.spec.allowGapCursor;
|
|
153
153
|
if (n != null) return n;
|
|
154
154
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
@@ -171,7 +171,7 @@ var tt = class {
|
|
|
171
171
|
for (;;) {
|
|
172
172
|
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
173
173
|
if (!o) {
|
|
174
|
-
if (a.isAtom && !a.isText && !
|
|
174
|
+
if (a.isAtom && !a.isText && !Re.isSelectable(a)) {
|
|
175
175
|
t = t.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
176
176
|
continue search;
|
|
177
177
|
}
|
|
@@ -185,8 +185,8 @@ var tt = class {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
var
|
|
188
|
+
W.prototype.visible = !1, W.findFrom = W.findGapCursorFrom, F.jsonID("gapcursor", W);
|
|
189
|
+
var G = class e {
|
|
190
190
|
constructor(e) {
|
|
191
191
|
this.pos = e;
|
|
192
192
|
}
|
|
@@ -195,13 +195,13 @@ var nt = class e {
|
|
|
195
195
|
}
|
|
196
196
|
resolve(e) {
|
|
197
197
|
let t = e.resolve(this.pos);
|
|
198
|
-
return
|
|
198
|
+
return W.valid(t) ? new W(t) : F.near(t);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
function
|
|
201
|
+
function st(e) {
|
|
202
202
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ct(e) {
|
|
205
205
|
for (let t = e.depth; t >= 0; t--) {
|
|
206
206
|
let n = e.index(t), r = e.node(t);
|
|
207
207
|
if (n == 0) {
|
|
@@ -209,13 +209,13 @@ function it(e) {
|
|
|
209
209
|
continue;
|
|
210
210
|
}
|
|
211
211
|
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
212
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
212
|
+
if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
|
|
213
213
|
if (e.inlineContent) return !1;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
return !0;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function lt(e) {
|
|
219
219
|
for (let t = e.depth; t >= 0; t--) {
|
|
220
220
|
let n = e.indexAfter(t), r = e.node(t);
|
|
221
221
|
if (n == r.childCount) {
|
|
@@ -223,90 +223,90 @@ function at(e) {
|
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
225
225
|
for (let e = r.child(n);; e = e.firstChild) {
|
|
226
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
226
|
+
if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
|
|
227
227
|
if (e.inlineContent) return !1;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
return !0;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
return new
|
|
234
|
-
decorations:
|
|
232
|
+
function ut() {
|
|
233
|
+
return new N({ props: {
|
|
234
|
+
decorations: mt,
|
|
235
235
|
createSelectionBetween(e, t, n) {
|
|
236
|
-
return t.pos == n.pos &&
|
|
236
|
+
return t.pos == n.pos && W.valid(n) ? new W(n) : null;
|
|
237
237
|
},
|
|
238
|
-
handleClick:
|
|
239
|
-
handleKeyDown:
|
|
240
|
-
handleDOMEvents: { beforeinput:
|
|
238
|
+
handleClick: ft,
|
|
239
|
+
handleKeyDown: dt,
|
|
240
|
+
handleDOMEvents: { beforeinput: pt }
|
|
241
241
|
} });
|
|
242
242
|
}
|
|
243
|
-
var
|
|
244
|
-
ArrowLeft:
|
|
245
|
-
ArrowRight:
|
|
246
|
-
ArrowUp:
|
|
247
|
-
ArrowDown:
|
|
243
|
+
var dt = Te({
|
|
244
|
+
ArrowLeft: K("horiz", -1),
|
|
245
|
+
ArrowRight: K("horiz", 1),
|
|
246
|
+
ArrowUp: K("vert", -1),
|
|
247
|
+
ArrowDown: K("vert", 1)
|
|
248
248
|
});
|
|
249
|
-
function
|
|
249
|
+
function K(e, t) {
|
|
250
250
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
251
251
|
return function(e, r, i) {
|
|
252
252
|
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
253
|
-
if (a instanceof
|
|
253
|
+
if (a instanceof ye) {
|
|
254
254
|
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
255
255
|
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
256
256
|
}
|
|
257
|
-
let c =
|
|
258
|
-
return c ? (r && r(e.tr.setSelection(new
|
|
257
|
+
let c = W.findGapCursorFrom(o, t, s);
|
|
258
|
+
return c ? (r && r(e.tr.setSelection(new W(c))), !0) : !1;
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function ft(e, t, n) {
|
|
262
262
|
if (!e || !e.editable) return !1;
|
|
263
263
|
let r = e.state.doc.resolve(t);
|
|
264
|
-
if (!
|
|
264
|
+
if (!W.valid(r)) return !1;
|
|
265
265
|
let i = e.posAtCoords({
|
|
266
266
|
left: n.clientX,
|
|
267
267
|
top: n.clientY
|
|
268
268
|
});
|
|
269
|
-
return i && i.inside > -1 &&
|
|
269
|
+
return i && i.inside > -1 && Re.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new W(r))), !0);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
271
|
+
function pt(e, t) {
|
|
272
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof W)) return !1;
|
|
273
273
|
let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
|
|
274
274
|
if (!r) return !1;
|
|
275
|
-
let i =
|
|
276
|
-
for (let e = r.length - 1; e >= 0; e--) i =
|
|
277
|
-
let a = e.state.tr.replace(n.pos, n.pos, new
|
|
278
|
-
return a.setSelection(
|
|
275
|
+
let i = I.empty;
|
|
276
|
+
for (let e = r.length - 1; e >= 0; e--) i = I.from(r[e].createAndFill(null, i));
|
|
277
|
+
let a = e.state.tr.replace(n.pos, n.pos, new H(i, 0, 0));
|
|
278
|
+
return a.setSelection(ye.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!(e.selection instanceof
|
|
280
|
+
function mt(e) {
|
|
281
|
+
if (!(e.selection instanceof W)) return null;
|
|
282
282
|
let t = document.createElement("div");
|
|
283
|
-
return t.className = "ProseMirror-gapcursor",
|
|
283
|
+
return t.className = "ProseMirror-gapcursor", j.create(e.doc, [V.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
return e.length ? (e =
|
|
290
|
-
},
|
|
291
|
-
return e.length ?
|
|
292
|
-
},
|
|
293
|
-
return new
|
|
294
|
-
},
|
|
295
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
296
|
-
},
|
|
287
|
+
var ht = 200, q = function() {};
|
|
288
|
+
q.prototype.append = function(e) {
|
|
289
|
+
return e.length ? (e = q.from(e), !this.length && e || e.length < ht && this.leafAppend(e) || this.length < ht && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
290
|
+
}, q.prototype.prepend = function(e) {
|
|
291
|
+
return e.length ? q.from(e).append(this) : this;
|
|
292
|
+
}, q.prototype.appendInner = function(e) {
|
|
293
|
+
return new _t(this, e);
|
|
294
|
+
}, q.prototype.slice = function(e, t) {
|
|
295
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? q.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
296
|
+
}, q.prototype.get = function(e) {
|
|
297
297
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
298
|
-
},
|
|
298
|
+
}, q.prototype.forEach = function(e, t, n) {
|
|
299
299
|
t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
|
|
300
|
-
},
|
|
300
|
+
}, q.prototype.map = function(e, t, n) {
|
|
301
301
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
302
302
|
var r = [];
|
|
303
303
|
return this.forEach(function(t, n) {
|
|
304
304
|
return r.push(e(t, n));
|
|
305
305
|
}, t, n), r;
|
|
306
|
-
},
|
|
307
|
-
return e instanceof
|
|
306
|
+
}, q.from = function(e) {
|
|
307
|
+
return e instanceof q ? e : e && e.length ? new gt(e) : q.empty;
|
|
308
308
|
};
|
|
309
|
-
var
|
|
309
|
+
var gt = /* @__PURE__ */ function(e) {
|
|
310
310
|
function t(t) {
|
|
311
311
|
e.call(this), this.values = t;
|
|
312
312
|
}
|
|
@@ -326,17 +326,17 @@ var dt = /* @__PURE__ */ function(e) {
|
|
|
326
326
|
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
327
327
|
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
328
328
|
}, t.prototype.leafAppend = function(e) {
|
|
329
|
-
if (this.length + e.length <=
|
|
329
|
+
if (this.length + e.length <= ht) return new t(this.values.concat(e.flatten()));
|
|
330
330
|
}, t.prototype.leafPrepend = function(e) {
|
|
331
|
-
if (this.length + e.length <=
|
|
331
|
+
if (this.length + e.length <= ht) return new t(e.flatten().concat(this.values));
|
|
332
332
|
}, n.length.get = function() {
|
|
333
333
|
return this.values.length;
|
|
334
334
|
}, n.depth.get = function() {
|
|
335
335
|
return 0;
|
|
336
336
|
}, Object.defineProperties(t.prototype, n), t;
|
|
337
|
-
}(
|
|
338
|
-
|
|
339
|
-
var
|
|
337
|
+
}(q);
|
|
338
|
+
q.empty = new gt([]);
|
|
339
|
+
var _t = /* @__PURE__ */ function(e) {
|
|
340
340
|
function t(t, n) {
|
|
341
341
|
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
342
342
|
}
|
|
@@ -363,7 +363,7 @@ var ft = /* @__PURE__ */ function(e) {
|
|
|
363
363
|
}, t.prototype.appendInner = function(e) {
|
|
364
364
|
return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e);
|
|
365
365
|
}, t;
|
|
366
|
-
}(
|
|
366
|
+
}(q), J = 500, Y = class e {
|
|
367
367
|
constructor(e, t) {
|
|
368
368
|
this.items = e, this.eventCount = t;
|
|
369
369
|
}
|
|
@@ -383,9 +383,9 @@ var ft = /* @__PURE__ */ function(e) {
|
|
|
383
383
|
return;
|
|
384
384
|
}
|
|
385
385
|
if (i) {
|
|
386
|
-
u.push(new
|
|
386
|
+
u.push(new X(t.map));
|
|
387
387
|
let e = t.step.map(i.slice(a)), n;
|
|
388
|
-
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new
|
|
388
|
+
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new X(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
|
|
389
389
|
} else o.maybeStep(t.step);
|
|
390
390
|
if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
|
|
391
391
|
}, this.items.length, 0), {
|
|
@@ -397,21 +397,21 @@ var ft = /* @__PURE__ */ function(e) {
|
|
|
397
397
|
addTransform(t, n, r, i) {
|
|
398
398
|
let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
|
|
399
399
|
for (let e = 0; e < t.steps.length; e++) {
|
|
400
|
-
let r = t.steps[e].invert(t.docs[e]), l = new
|
|
400
|
+
let r = t.steps[e].invert(t.docs[e]), l = new X(t.mapping.maps[e], r, n), u;
|
|
401
401
|
(u = c && c.merge(l)) && (l = u, e ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
|
|
402
402
|
}
|
|
403
403
|
let l = o - r.depth;
|
|
404
|
-
return l >
|
|
404
|
+
return l > yt && (s = vt(s, l), o -= l), new e(s.append(a), o);
|
|
405
405
|
}
|
|
406
406
|
remapping(e, t) {
|
|
407
|
-
let n = new
|
|
407
|
+
let n = new be();
|
|
408
408
|
return this.items.forEach((t, r) => {
|
|
409
409
|
let i = t.mirrorOffset != null && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
|
|
410
410
|
n.appendMap(t.map, i);
|
|
411
411
|
}, e, t), n;
|
|
412
412
|
}
|
|
413
413
|
addMaps(t) {
|
|
414
|
-
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new
|
|
414
|
+
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new X(e))), this.eventCount);
|
|
415
415
|
}
|
|
416
416
|
rebased(t, n) {
|
|
417
417
|
if (!this.eventCount) return this;
|
|
@@ -427,13 +427,13 @@ var ft = /* @__PURE__ */ function(e) {
|
|
|
427
427
|
let i = a.maps[n];
|
|
428
428
|
if (e.step) {
|
|
429
429
|
let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
|
|
430
|
-
l && s++, r.push(new
|
|
431
|
-
} else r.push(new
|
|
430
|
+
l && s++, r.push(new X(i, o, l));
|
|
431
|
+
} else r.push(new X(i));
|
|
432
432
|
}, i);
|
|
433
433
|
let l = [];
|
|
434
|
-
for (let e = n; e < o; e++) l.push(new
|
|
434
|
+
for (let e = n; e < o; e++) l.push(new X(a.maps[e]));
|
|
435
435
|
let u = new e(this.items.slice(0, i).append(l).append(r), s);
|
|
436
|
-
return u.emptyItemCount() >
|
|
436
|
+
return u.emptyItemCount() > J && (u = u.compress(this.items.length - r.length)), u;
|
|
437
437
|
}
|
|
438
438
|
emptyItemCount() {
|
|
439
439
|
let e = 0;
|
|
@@ -450,21 +450,21 @@ var ft = /* @__PURE__ */ function(e) {
|
|
|
450
450
|
if (r--, o && n.appendMap(o, r), t) {
|
|
451
451
|
let s = e.selection && e.selection.map(n.slice(r));
|
|
452
452
|
s && a++;
|
|
453
|
-
let c = new
|
|
453
|
+
let c = new X(o.invert(), t, s), l, u = i.length - 1;
|
|
454
454
|
(l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
|
|
455
455
|
}
|
|
456
456
|
} else e.map && r--;
|
|
457
|
-
}, this.items.length, 0), new e(
|
|
457
|
+
}, this.items.length, 0), new e(q.from(i.reverse()), a);
|
|
458
458
|
}
|
|
459
459
|
};
|
|
460
|
-
|
|
461
|
-
function
|
|
460
|
+
Y.empty = new Y(q.empty, 0);
|
|
461
|
+
function vt(e, t) {
|
|
462
462
|
let n;
|
|
463
463
|
return e.forEach((e, r) => {
|
|
464
464
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
465
465
|
}), e.slice(n);
|
|
466
466
|
}
|
|
467
|
-
var
|
|
467
|
+
var X = class e {
|
|
468
468
|
constructor(e, t, n, r) {
|
|
469
469
|
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
|
|
470
470
|
}
|
|
@@ -474,25 +474,25 @@ var Z = class e {
|
|
|
474
474
|
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, Z = class {
|
|
478
478
|
constructor(e, t, n, r, i) {
|
|
479
479
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
480
480
|
}
|
|
481
|
-
},
|
|
482
|
-
function
|
|
483
|
-
let i = n.getMeta(
|
|
481
|
+
}, yt = 20;
|
|
482
|
+
function bt(e, t, n, r) {
|
|
483
|
+
let i = n.getMeta(Q), a;
|
|
484
484
|
if (i) return i.historyState;
|
|
485
|
-
n.getMeta(
|
|
485
|
+
n.getMeta(Ot) && (e = new Z(e.done, e.undone, null, 0, -1));
|
|
486
486
|
let o = n.getMeta("appendedTransaction");
|
|
487
487
|
if (n.steps.length == 0) return e;
|
|
488
|
-
if (o && o.getMeta(
|
|
488
|
+
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r, Dt(t)), e.undone, St(n.mapping.maps), e.prevTime, e.prevComposition) : new Z(e.done, e.undone.addTransform(n, void 0, r, Dt(t)), null, e.prevTime, e.prevComposition);
|
|
489
489
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
490
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !
|
|
491
|
-
return new
|
|
492
|
-
} else if (a = n.getMeta("rebased")) return new
|
|
493
|
-
else return new
|
|
490
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !xt(n, e.prevRanges)), s = o ? Ct(e.prevRanges, n.mapping) : St(n.mapping.maps);
|
|
491
|
+
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Dt(t)), Y.empty, s, n.time, i ?? e.prevComposition);
|
|
492
|
+
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a), Ct(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
493
|
+
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Ct(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function xt(e, t) {
|
|
496
496
|
if (!t) return !1;
|
|
497
497
|
if (!e.docChanged) return !0;
|
|
498
498
|
let n = !1;
|
|
@@ -500,12 +500,12 @@ function _t(e, t) {
|
|
|
500
500
|
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
501
501
|
}), n;
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function St(e) {
|
|
504
504
|
let t = [];
|
|
505
505
|
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
506
506
|
return t;
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Ct(e, t) {
|
|
509
509
|
if (!e) return null;
|
|
510
510
|
let n = [];
|
|
511
511
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -514,62 +514,62 @@ function yt(e, t) {
|
|
|
514
514
|
}
|
|
515
515
|
return n;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
518
|
-
let r =
|
|
517
|
+
function wt(e, t, n) {
|
|
518
|
+
let r = Dt(t), i = Q.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
519
519
|
if (!a) return null;
|
|
520
|
-
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new
|
|
521
|
-
return a.transform.setSelection(o).setMeta(
|
|
520
|
+
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new Z(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
521
|
+
return a.transform.setSelection(o).setMeta(Q, {
|
|
522
522
|
redo: n,
|
|
523
523
|
historyState: c
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
|
-
var
|
|
527
|
-
function
|
|
526
|
+
var Tt = !1, Et = null;
|
|
527
|
+
function Dt(e) {
|
|
528
528
|
let t = e.plugins;
|
|
529
|
-
if (
|
|
530
|
-
|
|
529
|
+
if (Et != t) {
|
|
530
|
+
Tt = !1, Et = t;
|
|
531
531
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
532
|
-
|
|
532
|
+
Tt = !0;
|
|
533
533
|
break;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
return
|
|
536
|
+
return Tt;
|
|
537
537
|
}
|
|
538
|
-
var
|
|
539
|
-
function
|
|
538
|
+
var Q = new P("history"), Ot = new P("closeHistory");
|
|
539
|
+
function kt(e = {}) {
|
|
540
540
|
return e = {
|
|
541
541
|
depth: e.depth || 100,
|
|
542
542
|
newGroupDelay: e.newGroupDelay || 500
|
|
543
|
-
}, new
|
|
544
|
-
key:
|
|
543
|
+
}, new N({
|
|
544
|
+
key: Q,
|
|
545
545
|
state: {
|
|
546
546
|
init() {
|
|
547
|
-
return new
|
|
547
|
+
return new Z(Y.empty, Y.empty, null, 0, -1);
|
|
548
548
|
},
|
|
549
549
|
apply(t, n, r) {
|
|
550
|
-
return
|
|
550
|
+
return bt(n, r, t, e);
|
|
551
551
|
}
|
|
552
552
|
},
|
|
553
553
|
config: e,
|
|
554
554
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
555
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
555
|
+
let n = t.inputType, r = n == "historyUndo" ? jt : n == "historyRedo" ? Mt : null;
|
|
556
556
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
557
557
|
} } }
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function At(e, t) {
|
|
561
561
|
return (n, r) => {
|
|
562
|
-
let i =
|
|
562
|
+
let i = Q.getState(n);
|
|
563
563
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
564
564
|
if (r) {
|
|
565
|
-
let a =
|
|
565
|
+
let a = wt(i, n, e);
|
|
566
566
|
a && r(t ? a.scrollIntoView() : a);
|
|
567
567
|
}
|
|
568
568
|
return !0;
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
var
|
|
572
|
-
|
|
571
|
+
var jt = At(!1, !0), Mt = At(!0, !0);
|
|
572
|
+
R.create({
|
|
573
573
|
name: "characterCount",
|
|
574
574
|
addOptions() {
|
|
575
575
|
return {
|
|
@@ -601,8 +601,8 @@ B.create({
|
|
|
601
601
|
},
|
|
602
602
|
addProseMirrorPlugins() {
|
|
603
603
|
let e = !1;
|
|
604
|
-
return [new
|
|
605
|
-
key: new
|
|
604
|
+
return [new N({
|
|
605
|
+
key: new P("characterCount"),
|
|
606
606
|
appendTransaction: (t, n, r) => {
|
|
607
607
|
if (e) return;
|
|
608
608
|
let i = this.options.limit, a = this.options.autoTrim;
|
|
@@ -630,7 +630,7 @@ B.create({
|
|
|
630
630
|
}
|
|
631
631
|
})];
|
|
632
632
|
}
|
|
633
|
-
}),
|
|
633
|
+
}), R.create({
|
|
634
634
|
name: "dropCursor",
|
|
635
635
|
addOptions() {
|
|
636
636
|
return {
|
|
@@ -640,9 +640,9 @@ B.create({
|
|
|
640
640
|
};
|
|
641
641
|
},
|
|
642
642
|
addProseMirrorPlugins() {
|
|
643
|
-
return [
|
|
643
|
+
return [U(this.options)];
|
|
644
644
|
}
|
|
645
|
-
}),
|
|
645
|
+
}), R.create({
|
|
646
646
|
name: "focus",
|
|
647
647
|
addOptions() {
|
|
648
648
|
return {
|
|
@@ -651,11 +651,11 @@ B.create({
|
|
|
651
651
|
};
|
|
652
652
|
},
|
|
653
653
|
addProseMirrorPlugins() {
|
|
654
|
-
return [new
|
|
655
|
-
key: new
|
|
654
|
+
return [new N({
|
|
655
|
+
key: new P("focus"),
|
|
656
656
|
props: { decorations: ({ doc: e, selection: t }) => {
|
|
657
657
|
let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
|
|
658
|
-
if (!n || !r) return
|
|
658
|
+
if (!n || !r) return j.create(e, []);
|
|
659
659
|
let o = 0;
|
|
660
660
|
this.options.mode === "deepest" && e.descendants((e, t) => {
|
|
661
661
|
if (!e.isText) {
|
|
@@ -667,28 +667,28 @@ B.create({
|
|
|
667
667
|
return e.descendants((e, t) => {
|
|
668
668
|
if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
669
669
|
if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
|
|
670
|
-
a.push(
|
|
671
|
-
}),
|
|
670
|
+
a.push(V.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
671
|
+
}), j.create(e, a);
|
|
672
672
|
} }
|
|
673
673
|
})];
|
|
674
674
|
}
|
|
675
|
-
}),
|
|
675
|
+
}), R.create({
|
|
676
676
|
name: "gapCursor",
|
|
677
677
|
addProseMirrorPlugins() {
|
|
678
|
-
return [
|
|
678
|
+
return [ut()];
|
|
679
679
|
},
|
|
680
680
|
extendNodeSchema(e) {
|
|
681
|
-
return { allowGapCursor: Qe(
|
|
681
|
+
return { allowGapCursor: Oe(Qe(e, "allowGapCursor", {
|
|
682
682
|
name: e.name,
|
|
683
683
|
options: e.options,
|
|
684
684
|
storage: e.storage
|
|
685
685
|
})) ?? null };
|
|
686
686
|
}
|
|
687
687
|
});
|
|
688
|
-
var
|
|
689
|
-
function
|
|
688
|
+
var Nt = "placeholder", $ = new P("tiptap__placeholder"), Pt = 200;
|
|
689
|
+
function Ft(e) {
|
|
690
690
|
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
691
|
-
return o && u.push(l),
|
|
691
|
+
return o && u.push(l), V.node(i, i + a.nodeSize, {
|
|
692
692
|
class: u.join(" "),
|
|
693
693
|
[r]: typeof n == "function" ? n({
|
|
694
694
|
editor: t,
|
|
@@ -698,17 +698,17 @@ function Mt(e) {
|
|
|
698
698
|
}) : n
|
|
699
699
|
});
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function It(e, t) {
|
|
702
702
|
return typeof e == "function" ? e(t) : e;
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function Lt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
705
705
|
if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
|
|
706
706
|
let { anchor: a } = i, o = [], s = e.isEmpty;
|
|
707
707
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
708
708
|
let i = r.resolve(a), c = i.depth > 0 ? i.node(1) : i.nodeAfter, l = i.depth > 0 ? i.before(1) : a;
|
|
709
|
-
if (c && c.type.isTextblock &&
|
|
709
|
+
if (c && c.type.isTextblock && Ae(c)) {
|
|
710
710
|
let r = a >= l && a <= l + c.nodeSize;
|
|
711
|
-
o.push(
|
|
711
|
+
o.push(Ft({
|
|
712
712
|
editor: e,
|
|
713
713
|
isEmptyDoc: s,
|
|
714
714
|
dataAttribute: n,
|
|
@@ -716,7 +716,7 @@ function Pt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
716
716
|
placeholder: t.placeholder,
|
|
717
717
|
classes: {
|
|
718
718
|
emptyEditor: t.emptyEditorClass,
|
|
719
|
-
emptyNode:
|
|
719
|
+
emptyNode: It(t.emptyNodeClass, {
|
|
720
720
|
editor: e,
|
|
721
721
|
node: c,
|
|
722
722
|
pos: l,
|
|
@@ -728,10 +728,10 @@ function Pt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
728
728
|
}));
|
|
729
729
|
}
|
|
730
730
|
} else {
|
|
731
|
-
let i =
|
|
731
|
+
let i = $.getState(e.state), c = i?.topPos ?? 0, l = i?.bottomPos ?? r.content.size;
|
|
732
732
|
r.nodesBetween(c, l, (r, i) => {
|
|
733
|
-
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf &&
|
|
734
|
-
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(
|
|
733
|
+
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf && Ae(r);
|
|
734
|
+
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(Ft({
|
|
735
735
|
editor: e,
|
|
736
736
|
isEmptyDoc: s,
|
|
737
737
|
dataAttribute: n,
|
|
@@ -739,7 +739,7 @@ function Pt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
739
739
|
placeholder: t.placeholder,
|
|
740
740
|
classes: {
|
|
741
741
|
emptyEditor: t.emptyEditorClass,
|
|
742
|
-
emptyNode:
|
|
742
|
+
emptyNode: It(t.emptyNodeClass, {
|
|
743
743
|
editor: e,
|
|
744
744
|
node: r,
|
|
745
745
|
pos: i,
|
|
@@ -751,19 +751,19 @@ function Pt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
751
751
|
})), t.includeChildren;
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
|
-
return
|
|
754
|
+
return j.create(r, o);
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function Rt(e) {
|
|
757
757
|
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
758
758
|
}
|
|
759
|
-
function
|
|
759
|
+
function zt(e) {
|
|
760
760
|
let t = getComputedStyle(e), n = `${t.overflow} ${t.overflowY} ${t.overflowX}`;
|
|
761
761
|
return /auto|scroll|overlay/.test(n);
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function Bt(e) {
|
|
764
764
|
let t = e;
|
|
765
765
|
for (; t;) {
|
|
766
|
-
if (
|
|
766
|
+
if (zt(t)) return t;
|
|
767
767
|
let e = t.parentElement;
|
|
768
768
|
if (!e) {
|
|
769
769
|
let e = t.getRootNode();
|
|
@@ -777,19 +777,19 @@ function Lt(e) {
|
|
|
777
777
|
}
|
|
778
778
|
return window;
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Vt(e) {
|
|
781
781
|
return e === window ? {
|
|
782
782
|
top: 0,
|
|
783
783
|
bottom: window.innerHeight
|
|
784
784
|
} : e.getBoundingClientRect();
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Ht({ view: e, scrollContainer: t }) {
|
|
787
787
|
let n = e.dom.getBoundingClientRect();
|
|
788
788
|
if (n.width <= 0 || n.height <= 0) return null;
|
|
789
|
-
let r = t ?
|
|
789
|
+
let r = t ? Vt(t) : {
|
|
790
790
|
top: 0,
|
|
791
791
|
bottom: window.innerHeight
|
|
792
|
-
}, i = Math.max(n.top, r.top) -
|
|
792
|
+
}, i = Math.max(n.top, r.top) - Pt, a = Math.min(n.bottom, r.bottom) + Pt;
|
|
793
793
|
if (i >= a) return null;
|
|
794
794
|
let o = n.left + 1, s = n.right - 1;
|
|
795
795
|
if (o > s) return null;
|
|
@@ -807,7 +807,7 @@ function zt({ view: e, scrollContainer: t }) {
|
|
|
807
807
|
bottom: p.pos
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
|
-
var
|
|
810
|
+
var Ut = {
|
|
811
811
|
init() {
|
|
812
812
|
return {
|
|
813
813
|
topPos: null,
|
|
@@ -815,7 +815,7 @@ var Bt = {
|
|
|
815
815
|
};
|
|
816
816
|
},
|
|
817
817
|
apply(e, t) {
|
|
818
|
-
let n = e.getMeta(
|
|
818
|
+
let n = e.getMeta($);
|
|
819
819
|
return n?.positions ? {
|
|
820
820
|
topPos: n.positions.top,
|
|
821
821
|
bottomPos: n.positions.bottom
|
|
@@ -825,16 +825,16 @@ var Bt = {
|
|
|
825
825
|
} : t;
|
|
826
826
|
}
|
|
827
827
|
};
|
|
828
|
-
function
|
|
829
|
-
let t =
|
|
830
|
-
let n =
|
|
828
|
+
function Wt(e) {
|
|
829
|
+
let t = Bt(e.dom), n = () => {
|
|
830
|
+
let n = Ht({
|
|
831
831
|
view: e,
|
|
832
832
|
scrollContainer: t
|
|
833
833
|
});
|
|
834
834
|
if (n === null) return;
|
|
835
|
-
let r =
|
|
835
|
+
let r = $.getState(e.state);
|
|
836
836
|
if (r?.topPos === n.top && r?.bottomPos === n.bottom) return;
|
|
837
|
-
let i = e.state.tr.setMeta(
|
|
837
|
+
let i = e.state.tr.setMeta($, { positions: n });
|
|
838
838
|
e.dispatch(i);
|
|
839
839
|
}, r = null, i = 0, a = () => {
|
|
840
840
|
r === null && (r = requestAnimationFrame(() => {
|
|
@@ -856,13 +856,13 @@ function Vt(e) {
|
|
|
856
856
|
}
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
let n = t.dataAttribute ? `data-${
|
|
861
|
-
return new
|
|
862
|
-
key:
|
|
863
|
-
state:
|
|
864
|
-
view:
|
|
865
|
-
props: { decorations: ({ doc: r, selection: i }) =>
|
|
859
|
+
function Gt({ editor: e, options: t }) {
|
|
860
|
+
let n = t.dataAttribute ? `data-${Rt(t.dataAttribute)}` : `data-${Nt}`;
|
|
861
|
+
return new N({
|
|
862
|
+
key: $,
|
|
863
|
+
state: Ut,
|
|
864
|
+
view: Wt,
|
|
865
|
+
props: { decorations: ({ doc: r, selection: i }) => Lt({
|
|
866
866
|
editor: e,
|
|
867
867
|
options: t,
|
|
868
868
|
dataAttribute: n,
|
|
@@ -871,13 +871,13 @@ function Ht({ editor: e, options: t }) {
|
|
|
871
871
|
}) }
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
|
-
var
|
|
874
|
+
var Kt = R.create({
|
|
875
875
|
name: "placeholder",
|
|
876
876
|
addOptions() {
|
|
877
877
|
return {
|
|
878
878
|
emptyEditorClass: "is-editor-empty",
|
|
879
879
|
emptyNodeClass: "is-empty",
|
|
880
|
-
dataAttribute:
|
|
880
|
+
dataAttribute: Nt,
|
|
881
881
|
placeholder: "Write something …",
|
|
882
882
|
showOnlyWhenEditable: !0,
|
|
883
883
|
showOnlyCurrent: !0,
|
|
@@ -885,31 +885,31 @@ var Ut = B.create({
|
|
|
885
885
|
};
|
|
886
886
|
},
|
|
887
887
|
addProseMirrorPlugins() {
|
|
888
|
-
return [
|
|
888
|
+
return [Gt({
|
|
889
889
|
editor: this.editor,
|
|
890
890
|
options: this.options
|
|
891
891
|
})];
|
|
892
892
|
}
|
|
893
|
-
}),
|
|
894
|
-
|
|
893
|
+
}), qt = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
894
|
+
R.create({
|
|
895
895
|
name: "selection",
|
|
896
896
|
addOptions() {
|
|
897
897
|
return { className: "selection" };
|
|
898
898
|
},
|
|
899
899
|
addProseMirrorPlugins() {
|
|
900
900
|
let { editor: e, options: t } = this;
|
|
901
|
-
return e.options.injectCSS && typeof document < "u" &&
|
|
902
|
-
key: new
|
|
901
|
+
return e.options.injectCSS && typeof document < "u" && fe(qt, e.options.injectNonce, "selection"), [new N({
|
|
902
|
+
key: new P("selection"),
|
|
903
903
|
props: { decorations(n) {
|
|
904
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
904
|
+
return n.selection.empty || e.isFocused || !e.isEditable || _e(n.selection) || e.view.dragging ? null : j.create(n.doc, [V.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
905
905
|
} }
|
|
906
906
|
})];
|
|
907
907
|
}
|
|
908
908
|
});
|
|
909
|
-
function
|
|
909
|
+
function Jt({ types: e, node: t }) {
|
|
910
910
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
911
911
|
}
|
|
912
|
-
|
|
912
|
+
R.create({
|
|
913
913
|
name: "trailingNode",
|
|
914
914
|
addOptions() {
|
|
915
915
|
return {
|
|
@@ -918,8 +918,8 @@ B.create({
|
|
|
918
918
|
};
|
|
919
919
|
},
|
|
920
920
|
addProseMirrorPlugins() {
|
|
921
|
-
let e = new
|
|
922
|
-
return [new
|
|
921
|
+
let e = new P(this.name), t = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, e]) => e).filter((e) => (this.options.notAfter || []).concat(t).includes(e.name));
|
|
922
|
+
return [new N({
|
|
923
923
|
key: e,
|
|
924
924
|
appendTransaction: (n, r, i) => {
|
|
925
925
|
let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
|
|
@@ -928,7 +928,7 @@ B.create({
|
|
|
928
928
|
state: {
|
|
929
929
|
init: (e, t) => {
|
|
930
930
|
let r = t.tr.doc.lastChild;
|
|
931
|
-
return !
|
|
931
|
+
return !Jt({
|
|
932
932
|
node: r,
|
|
933
933
|
types: n
|
|
934
934
|
});
|
|
@@ -936,7 +936,7 @@ B.create({
|
|
|
936
936
|
apply: (e, t) => {
|
|
937
937
|
if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
|
|
938
938
|
let r = e.doc.lastChild;
|
|
939
|
-
return !
|
|
939
|
+
return !Jt({
|
|
940
940
|
node: r,
|
|
941
941
|
types: n
|
|
942
942
|
});
|
|
@@ -945,7 +945,7 @@ B.create({
|
|
|
945
945
|
})];
|
|
946
946
|
}
|
|
947
947
|
});
|
|
948
|
-
var
|
|
948
|
+
var Yt = R.create({
|
|
949
949
|
name: "undoRedo",
|
|
950
950
|
addOptions() {
|
|
951
951
|
return {
|
|
@@ -955,12 +955,12 @@ var Kt = B.create({
|
|
|
955
955
|
},
|
|
956
956
|
addCommands() {
|
|
957
957
|
return {
|
|
958
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
959
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
958
|
+
undo: () => ({ state: e, dispatch: t }) => jt(e, t),
|
|
959
|
+
redo: () => ({ state: e, dispatch: t }) => Mt(e, t)
|
|
960
960
|
};
|
|
961
961
|
},
|
|
962
962
|
addProseMirrorPlugins() {
|
|
963
|
-
return [
|
|
963
|
+
return [kt(this.options)];
|
|
964
964
|
},
|
|
965
965
|
addKeyboardShortcuts() {
|
|
966
966
|
return {
|
|
@@ -974,8 +974,8 @@ var Kt = B.create({
|
|
|
974
974
|
});
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region ../../node_modules/.pnpm/@tiptap+vue-3@3.27.1_@floating-ui+dom@1.7.6_@tiptap+core@3.27.1_@tiptap+pm@3.27.1__@tip_533afe27a0e41f53f3674ff5bfd0331c/node_modules/@tiptap/vue-3/dist/index.js
|
|
977
|
-
function
|
|
978
|
-
return
|
|
977
|
+
function Xt(e) {
|
|
978
|
+
return ae((t, n) => ({
|
|
979
979
|
get() {
|
|
980
980
|
return t(), e;
|
|
981
981
|
},
|
|
@@ -988,11 +988,11 @@ function qt(e) {
|
|
|
988
988
|
}
|
|
989
989
|
}));
|
|
990
990
|
}
|
|
991
|
-
var
|
|
991
|
+
var Zt = class extends rt {
|
|
992
992
|
constructor(e = {}) {
|
|
993
|
-
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState =
|
|
993
|
+
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = Xt(this.view.state), this.reactiveExtensionStorage = Xt(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
994
994
|
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
995
|
-
}),
|
|
995
|
+
}), se(this);
|
|
996
996
|
}
|
|
997
997
|
get state() {
|
|
998
998
|
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
@@ -1008,36 +1008,36 @@ var Jt = class extends Oe {
|
|
|
1008
1008
|
let t = super.unregisterPlugin(e);
|
|
1009
1009
|
return this.reactiveState && t && (this.reactiveState.value = t), t;
|
|
1010
1010
|
}
|
|
1011
|
-
},
|
|
1011
|
+
}, Qt = m({
|
|
1012
1012
|
name: "EditorContent",
|
|
1013
1013
|
props: { editor: {
|
|
1014
1014
|
default: null,
|
|
1015
1015
|
type: Object
|
|
1016
1016
|
} },
|
|
1017
|
-
setup(
|
|
1018
|
-
let
|
|
1019
|
-
return
|
|
1020
|
-
let
|
|
1021
|
-
|
|
1022
|
-
if (!
|
|
1023
|
-
let
|
|
1024
|
-
|
|
1025
|
-
...
|
|
1026
|
-
provides:
|
|
1027
|
-
}),
|
|
1017
|
+
setup(t) {
|
|
1018
|
+
let r = A(), i = o();
|
|
1019
|
+
return e(() => {
|
|
1020
|
+
let e = t.editor;
|
|
1021
|
+
e && e.options.element && r.value && n(() => {
|
|
1022
|
+
if (!r.value || !e.view.dom?.parentNode) return;
|
|
1023
|
+
let t = O(r.value);
|
|
1024
|
+
r.value.append(...e.view.dom.parentNode.childNodes), e.contentComponent = i.ctx._, i && (e.appContext = {
|
|
1025
|
+
...i.appContext,
|
|
1026
|
+
provides: i.provides
|
|
1027
|
+
}), e.setOptions({ element: t }), e.createNodeViews();
|
|
1028
1028
|
});
|
|
1029
|
-
}),
|
|
1030
|
-
let
|
|
1031
|
-
|
|
1032
|
-
}), { rootEl:
|
|
1029
|
+
}), v(() => {
|
|
1030
|
+
let e = t.editor;
|
|
1031
|
+
e && (e.contentComponent = null, e.appContext = null);
|
|
1032
|
+
}), { rootEl: r };
|
|
1033
1033
|
},
|
|
1034
1034
|
render() {
|
|
1035
|
-
return
|
|
1035
|
+
return l("div", { ref: (e) => {
|
|
1036
1036
|
this.rootEl = e;
|
|
1037
1037
|
} });
|
|
1038
1038
|
}
|
|
1039
1039
|
});
|
|
1040
|
-
|
|
1040
|
+
m({
|
|
1041
1041
|
name: "NodeViewContent",
|
|
1042
1042
|
props: { as: {
|
|
1043
1043
|
type: String,
|
|
@@ -1053,13 +1053,13 @@ d({
|
|
|
1053
1053
|
e && e(null);
|
|
1054
1054
|
},
|
|
1055
1055
|
render() {
|
|
1056
|
-
return
|
|
1056
|
+
return l(this.as, {
|
|
1057
1057
|
style: { whiteSpace: "pre-wrap" },
|
|
1058
1058
|
"data-node-view-content": ""
|
|
1059
1059
|
});
|
|
1060
1060
|
}
|
|
1061
1061
|
});
|
|
1062
|
-
var
|
|
1062
|
+
var $t = m({
|
|
1063
1063
|
name: "NodeViewWrapper",
|
|
1064
1064
|
props: { as: {
|
|
1065
1065
|
type: String,
|
|
@@ -1068,24 +1068,24 @@ var Xt = d({
|
|
|
1068
1068
|
inject: ["onDragStart", "decorationClasses"],
|
|
1069
1069
|
render() {
|
|
1070
1070
|
var e;
|
|
1071
|
-
return
|
|
1071
|
+
return l(this.as, {
|
|
1072
1072
|
class: this.decorationClasses,
|
|
1073
1073
|
style: { whiteSpace: "normal" },
|
|
1074
1074
|
"data-node-view-wrapper": "",
|
|
1075
1075
|
onDragstart: this.onDragStart
|
|
1076
1076
|
}, (e = this.$slots).default?.call(e));
|
|
1077
1077
|
}
|
|
1078
|
-
}),
|
|
1079
|
-
let t =
|
|
1080
|
-
return
|
|
1081
|
-
t.value = new
|
|
1082
|
-
}),
|
|
1078
|
+
}), en = (e = {}) => {
|
|
1079
|
+
let t = S();
|
|
1080
|
+
return c(() => {
|
|
1081
|
+
t.value = new Zt(e);
|
|
1082
|
+
}), v(() => {
|
|
1083
1083
|
var e;
|
|
1084
1084
|
(e = t.value) == null || e.destroy();
|
|
1085
1085
|
}), t;
|
|
1086
|
-
},
|
|
1086
|
+
}, tn = class {
|
|
1087
1087
|
constructor(e, { props: t = {}, editor: n }) {
|
|
1088
|
-
this.destroyed = !1, this.editor = n, this.component =
|
|
1088
|
+
this.destroyed = !1, this.editor = n, this.component = se(e), this.el = document.createElement("div"), this.props = ne(t), this.renderedComponent = this.renderComponent();
|
|
1089
1089
|
}
|
|
1090
1090
|
get element() {
|
|
1091
1091
|
return this.renderedComponent.el;
|
|
@@ -1095,11 +1095,11 @@ var Xt = d({
|
|
|
1095
1095
|
}
|
|
1096
1096
|
renderComponent() {
|
|
1097
1097
|
if (this.destroyed) return this.renderedComponent;
|
|
1098
|
-
let e =
|
|
1099
|
-
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el &&
|
|
1098
|
+
let e = l(this.component, this.props);
|
|
1099
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && w(e, this.el), {
|
|
1100
1100
|
vNode: e,
|
|
1101
1101
|
destroy: () => {
|
|
1102
|
-
this.el &&
|
|
1102
|
+
this.el && w(null, this.el), this.el = null, e = null;
|
|
1103
1103
|
},
|
|
1104
1104
|
el: this.el ? this.el.firstElementChild : null
|
|
1105
1105
|
};
|
|
@@ -1113,20 +1113,20 @@ var Xt = d({
|
|
|
1113
1113
|
this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
|
|
1114
1114
|
}
|
|
1115
1115
|
};
|
|
1116
|
-
|
|
1116
|
+
m({
|
|
1117
1117
|
name: "MarkViewContent",
|
|
1118
1118
|
props: { as: {
|
|
1119
1119
|
type: String,
|
|
1120
1120
|
default: "span"
|
|
1121
1121
|
} },
|
|
1122
1122
|
render() {
|
|
1123
|
-
return
|
|
1123
|
+
return l(this.as, {
|
|
1124
1124
|
style: { whiteSpace: "inherit" },
|
|
1125
1125
|
"data-mark-view-content": ""
|
|
1126
1126
|
});
|
|
1127
1127
|
}
|
|
1128
1128
|
});
|
|
1129
|
-
var
|
|
1129
|
+
var nn = {
|
|
1130
1130
|
editor: {
|
|
1131
1131
|
type: Object,
|
|
1132
1132
|
required: !0
|
|
@@ -1171,7 +1171,7 @@ var $t = {
|
|
|
1171
1171
|
type: Object,
|
|
1172
1172
|
required: !0
|
|
1173
1173
|
}
|
|
1174
|
-
},
|
|
1174
|
+
}, rn = class extends tt {
|
|
1175
1175
|
constructor(e, t, n) {
|
|
1176
1176
|
super(e, t, n), this.cachedExtensionWithSyncedStorage = null, this.handlePositionUpdate = () => {
|
|
1177
1177
|
let e = this.getPos();
|
|
@@ -1201,14 +1201,14 @@ var $t = {
|
|
|
1201
1201
|
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
1202
1202
|
deleteNode: () => this.deleteNode()
|
|
1203
1203
|
}, t = e, n = this.onDragStart.bind(this);
|
|
1204
|
-
this.decorationClasses =
|
|
1205
|
-
let r =
|
|
1204
|
+
this.decorationClasses = A(this.getDecorationClasses());
|
|
1205
|
+
let r = m({
|
|
1206
1206
|
extends: { ...this.component },
|
|
1207
1207
|
props: Object.keys(e),
|
|
1208
1208
|
template: this.component.template,
|
|
1209
1209
|
setup: (e) => {
|
|
1210
1210
|
var t;
|
|
1211
|
-
return
|
|
1211
|
+
return s("onDragStart", n), s("decorationClasses", this.decorationClasses), s("nodeViewContentRef", (e) => {
|
|
1212
1212
|
this.contentDOMElement && e && e.firstChild !== this.contentDOMElement && e.appendChild(this.contentDOMElement);
|
|
1213
1213
|
}), (t = this.component).setup?.call(t, e, { expose: () => void 0 });
|
|
1214
1214
|
},
|
|
@@ -1217,7 +1217,7 @@ var $t = {
|
|
|
1217
1217
|
__name: this.component.__name,
|
|
1218
1218
|
__file: this.component.__file
|
|
1219
1219
|
});
|
|
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
|
|
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 tn(r, {
|
|
1221
1221
|
editor: this.editor,
|
|
1222
1222
|
props: t
|
|
1223
1223
|
});
|
|
@@ -1231,7 +1231,7 @@ var $t = {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
handleSelectionUpdate() {
|
|
1233
1233
|
let e = this.getPos();
|
|
1234
|
-
if (typeof e == "number") if (
|
|
1234
|
+
if (typeof e == "number") if (me({
|
|
1235
1235
|
selection: this.editor.state.selection,
|
|
1236
1236
|
pos: e,
|
|
1237
1237
|
nodeSize: this.node.nodeSize,
|
|
@@ -1289,44 +1289,44 @@ var $t = {
|
|
|
1289
1289
|
this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.options.trackNodeViewPosition && this.editor.off("update", this.handlePositionUpdate), this.contentDOMElement = null;
|
|
1290
1290
|
}
|
|
1291
1291
|
};
|
|
1292
|
-
function
|
|
1293
|
-
return (n) => n.editor.contentComponent ? new
|
|
1292
|
+
function an(e, t) {
|
|
1293
|
+
return (n) => n.editor.contentComponent ? new rn(typeof e == "function" && "__vccOpts" in e ? e.__vccOpts : e, n, t) : {};
|
|
1294
1294
|
}
|
|
1295
1295
|
//#endregion
|
|
1296
1296
|
//#region src/ai.ts
|
|
1297
|
-
var
|
|
1297
|
+
var on = [
|
|
1298
1298
|
"proofread",
|
|
1299
1299
|
"rewrite",
|
|
1300
1300
|
"shorten",
|
|
1301
1301
|
"expand"
|
|
1302
1302
|
];
|
|
1303
|
-
function
|
|
1303
|
+
function sn(e) {
|
|
1304
1304
|
console.warn(`[bygga-editor] ${e}`);
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function cn(e) {
|
|
1307
1307
|
if (!e) return [];
|
|
1308
|
-
if (typeof e.run != "function") return
|
|
1309
|
-
if (!Array.isArray(e.actions)) return
|
|
1308
|
+
if (typeof e.run != "function") return sn("config.ai: `run` must be a function — ignoring the AI configuration."), [];
|
|
1309
|
+
if (!Array.isArray(e.actions)) return sn("config.ai: `actions` must be an array — offering no AI actions."), [];
|
|
1310
1310
|
let t = /* @__PURE__ */ new Set();
|
|
1311
1311
|
for (let n of e.actions) {
|
|
1312
|
-
if (!
|
|
1313
|
-
|
|
1312
|
+
if (!on.includes(n)) {
|
|
1313
|
+
sn(`config.ai: "${String(n)}" is not a known AI action — ignoring it.`);
|
|
1314
1314
|
continue;
|
|
1315
1315
|
}
|
|
1316
1316
|
t.add(n);
|
|
1317
1317
|
}
|
|
1318
|
-
return e.actions.length > 0 && t.size === 0 &&
|
|
1318
|
+
return e.actions.length > 0 && t.size === 0 && sn("config.ai: no usable actions — offering no AI controls."), on.filter((e) => t.has(e));
|
|
1319
1319
|
}
|
|
1320
1320
|
//#endregion
|
|
1321
1321
|
//#region src/components/AiActionPicker.vue?vue&type=script&setup=true&lang.ts
|
|
1322
|
-
var
|
|
1322
|
+
var ln = [
|
|
1323
1323
|
"disabled",
|
|
1324
1324
|
"aria-busy",
|
|
1325
1325
|
"title",
|
|
1326
1326
|
"aria-label",
|
|
1327
1327
|
"popovertarget",
|
|
1328
1328
|
"aria-expanded"
|
|
1329
|
-
],
|
|
1329
|
+
], un = ["id", "aria-label"], dn = { class: "ai-list" }, fn = ["onClick"], pn = { class: "ai-option-label" }, mn = { class: "ai-option-hint" }, hn = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1330
1330
|
__name: "AiActionPicker",
|
|
1331
1331
|
props: {
|
|
1332
1332
|
actions: { type: Array },
|
|
@@ -1336,155 +1336,155 @@ var on = [
|
|
|
1336
1336
|
}
|
|
1337
1337
|
},
|
|
1338
1338
|
emits: ["select"],
|
|
1339
|
-
setup(e, { emit:
|
|
1340
|
-
let
|
|
1341
|
-
function
|
|
1339
|
+
setup(e, { emit: n }) {
|
|
1340
|
+
let o = n, { t: s } = Xe(), c = te(), l = b("trigger"), d = b("popover"), p = a(() => d.value?.matches(":popover-open") ?? !1);
|
|
1341
|
+
function m(e) {
|
|
1342
1342
|
if (e.newState !== "open") return;
|
|
1343
|
-
let t =
|
|
1343
|
+
let t = d.value, n = l.value?.getBoundingClientRect();
|
|
1344
1344
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1347
|
-
let t = e.relatedTarget, n =
|
|
1346
|
+
function h(e) {
|
|
1347
|
+
let t = e.relatedTarget, n = d.value;
|
|
1348
1348
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1351
|
-
|
|
1350
|
+
function g(e) {
|
|
1351
|
+
o("select", e), d.value?.hidePopover();
|
|
1352
1352
|
}
|
|
1353
|
-
return (
|
|
1353
|
+
return (n, a) => (y(), t(r, null, [e.actions.length ? (y(), t("button", {
|
|
1354
1354
|
key: 0,
|
|
1355
1355
|
ref_key: "trigger",
|
|
1356
|
-
ref:
|
|
1356
|
+
ref: l,
|
|
1357
1357
|
type: "button",
|
|
1358
|
-
class:
|
|
1358
|
+
class: D(["ai-trigger", { active: p.value }]),
|
|
1359
1359
|
disabled: e.pending,
|
|
1360
1360
|
"aria-busy": e.pending,
|
|
1361
|
-
title:
|
|
1362
|
-
"aria-label":
|
|
1363
|
-
popovertarget:
|
|
1361
|
+
title: O(s)("blocks.text.ai.label"),
|
|
1362
|
+
"aria-label": O(s)("blocks.text.ai.label"),
|
|
1363
|
+
popovertarget: O(c),
|
|
1364
1364
|
"aria-haspopup": "dialog",
|
|
1365
|
-
"aria-expanded":
|
|
1366
|
-
onMousedown:
|
|
1367
|
-
}, [
|
|
1365
|
+
"aria-expanded": p.value,
|
|
1366
|
+
onMousedown: a[0] ||= _(() => {}, ["prevent"])
|
|
1367
|
+
}, [f(M, {
|
|
1368
1368
|
name: "sparkles",
|
|
1369
1369
|
size: 16
|
|
1370
|
-
})], 42,
|
|
1370
|
+
})], 42, ln)) : E("", !0), e.actions.length ? (y(), t("div", {
|
|
1371
1371
|
key: 1,
|
|
1372
|
-
id:
|
|
1372
|
+
id: O(c),
|
|
1373
1373
|
ref_key: "popover",
|
|
1374
|
-
ref:
|
|
1374
|
+
ref: d,
|
|
1375
1375
|
class: "ai-popover",
|
|
1376
1376
|
popover: "",
|
|
1377
1377
|
role: "dialog",
|
|
1378
|
-
"aria-label":
|
|
1379
|
-
onBeforetoggle:
|
|
1380
|
-
onFocusout:
|
|
1381
|
-
}, [i("ul",
|
|
1378
|
+
"aria-label": O(s)("blocks.text.ai.label"),
|
|
1379
|
+
onBeforetoggle: m,
|
|
1380
|
+
onFocusout: h
|
|
1381
|
+
}, [i("ul", dn, [(y(!0), t(r, null, u(e.actions, (e) => (y(), t("li", { key: e }, [i("button", {
|
|
1382
1382
|
type: "button",
|
|
1383
1383
|
class: "ai-option",
|
|
1384
|
-
onClick: (t) =>
|
|
1385
|
-
onMousedown:
|
|
1386
|
-
}, [i("span",
|
|
1384
|
+
onClick: (t) => g(e),
|
|
1385
|
+
onMousedown: a[1] ||= _(() => {}, ["prevent"])
|
|
1386
|
+
}, [i("span", pn, x(O(s)(`blocks.text.ai.actions.${e}.label`)), 1), i("span", mn, x(O(s)(`blocks.text.ai.actions.${e}.hint`)), 1)], 40, fn)]))), 128))])], 40, un)) : E("", !0)], 64));
|
|
1387
1387
|
}
|
|
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"]]),
|
|
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"]]), gn = [
|
|
1389
1389
|
"title",
|
|
1390
1390
|
"aria-label",
|
|
1391
1391
|
"popovertarget",
|
|
1392
1392
|
"aria-expanded"
|
|
1393
|
-
],
|
|
1393
|
+
], _n = ["id", "aria-label"], vn = {
|
|
1394
1394
|
key: 0,
|
|
1395
1395
|
class: "merge-tag-list"
|
|
1396
|
-
},
|
|
1396
|
+
}, yn = ["onClick"], bn = { class: "merge-tag-option-label" }, xn = { class: "merge-tag-option-id" }, Sn = {
|
|
1397
1397
|
key: 1,
|
|
1398
1398
|
class: "merge-tag-empty"
|
|
1399
|
-
},
|
|
1399
|
+
}, Cn = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1400
1400
|
__name: "MergeTagPicker",
|
|
1401
1401
|
emits: ["select"],
|
|
1402
|
-
setup(e, { emit:
|
|
1403
|
-
let
|
|
1402
|
+
setup(e, { emit: o }) {
|
|
1403
|
+
let s = o, { t: c, locale: l } = Xe(), p = d($e, a(() => ({}))), m = a(() => Ue(p.value).map((e) => ({
|
|
1404
1404
|
id: e,
|
|
1405
|
-
label:
|
|
1406
|
-
}))),
|
|
1407
|
-
let e =
|
|
1408
|
-
return e ?
|
|
1409
|
-
}),
|
|
1410
|
-
function
|
|
1405
|
+
label: Ge(p.value, e, l.value)
|
|
1406
|
+
}))), h = A(""), g = a(() => {
|
|
1407
|
+
let e = h.value.trim().toLowerCase();
|
|
1408
|
+
return e ? m.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : m.value;
|
|
1409
|
+
}), v = te(), ee = a(() => S.value?.matches(":popover-open") ?? !1), ne = b("trigger"), S = b("popover"), C = b("filterInput");
|
|
1410
|
+
function w(e) {
|
|
1411
1411
|
if (e.newState !== "open") return;
|
|
1412
|
-
|
|
1413
|
-
let t =
|
|
1412
|
+
h.value = "";
|
|
1413
|
+
let t = S.value, n = ne.value?.getBoundingClientRect();
|
|
1414
1414
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1417
|
-
e.newState === "open" &&
|
|
1416
|
+
function re(e) {
|
|
1417
|
+
e.newState === "open" && n(() => C.value?.focus());
|
|
1418
1418
|
}
|
|
1419
|
-
function
|
|
1420
|
-
let t = e.relatedTarget, n =
|
|
1419
|
+
function T(e) {
|
|
1420
|
+
let t = e.relatedTarget, n = S.value;
|
|
1421
1421
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1424
|
-
|
|
1423
|
+
function ie(e) {
|
|
1424
|
+
s("select", e), S.value?.hidePopover();
|
|
1425
1425
|
}
|
|
1426
|
-
return (e,
|
|
1426
|
+
return (e, n) => (y(), t(r, null, [m.value.length ? (y(), t("button", {
|
|
1427
1427
|
key: 0,
|
|
1428
1428
|
ref_key: "trigger",
|
|
1429
|
-
ref:
|
|
1429
|
+
ref: ne,
|
|
1430
1430
|
type: "button",
|
|
1431
|
-
class:
|
|
1432
|
-
title:
|
|
1433
|
-
"aria-label":
|
|
1434
|
-
popovertarget:
|
|
1431
|
+
class: D(["merge-tag-trigger", { active: ee.value }]),
|
|
1432
|
+
title: O(c)("blocks.text.mergeTag"),
|
|
1433
|
+
"aria-label": O(c)("blocks.text.mergeTag"),
|
|
1434
|
+
popovertarget: O(v),
|
|
1435
1435
|
"aria-haspopup": "dialog",
|
|
1436
1436
|
"aria-expanded": ee.value,
|
|
1437
|
-
onMousedown:
|
|
1438
|
-
}, [
|
|
1437
|
+
onMousedown: n[0] ||= _(() => {}, ["prevent"])
|
|
1438
|
+
}, [f(M, {
|
|
1439
1439
|
name: "braces",
|
|
1440
1440
|
size: 16
|
|
1441
|
-
})], 42,
|
|
1441
|
+
})], 42, gn)) : E("", !0), m.value.length ? (y(), t("div", {
|
|
1442
1442
|
key: 1,
|
|
1443
|
-
id:
|
|
1443
|
+
id: O(v),
|
|
1444
1444
|
ref_key: "popover",
|
|
1445
|
-
ref:
|
|
1445
|
+
ref: S,
|
|
1446
1446
|
class: "merge-tag-popover",
|
|
1447
1447
|
popover: "",
|
|
1448
1448
|
role: "dialog",
|
|
1449
|
-
"aria-label":
|
|
1450
|
-
onBeforetoggle:
|
|
1451
|
-
onToggle:
|
|
1452
|
-
onFocusout:
|
|
1453
|
-
}, [
|
|
1449
|
+
"aria-label": O(c)("blocks.text.mergeTag"),
|
|
1450
|
+
onBeforetoggle: w,
|
|
1451
|
+
onToggle: re,
|
|
1452
|
+
onFocusout: T
|
|
1453
|
+
}, [f(Pe, {
|
|
1454
1454
|
ref_key: "filterInput",
|
|
1455
|
-
ref:
|
|
1456
|
-
modelValue:
|
|
1457
|
-
"onUpdate:modelValue":
|
|
1455
|
+
ref: C,
|
|
1456
|
+
modelValue: h.value,
|
|
1457
|
+
"onUpdate:modelValue": n[1] ||= (e) => h.value = e,
|
|
1458
1458
|
autocomplete: "off",
|
|
1459
|
-
placeholder:
|
|
1460
|
-
"aria-label":
|
|
1459
|
+
placeholder: O(c)("blocks.text.mergeTagSearch"),
|
|
1460
|
+
"aria-label": O(c)("blocks.text.mergeTagSearch"),
|
|
1461
1461
|
spellcheck: "false"
|
|
1462
1462
|
}, null, 8, [
|
|
1463
1463
|
"modelValue",
|
|
1464
1464
|
"placeholder",
|
|
1465
1465
|
"aria-label"
|
|
1466
|
-
]),
|
|
1466
|
+
]), g.value.length ? (y(), t("ul", vn, [(y(!0), t(r, null, u(g.value, (e) => (y(), t("li", { key: e.id }, [i("button", {
|
|
1467
1467
|
type: "button",
|
|
1468
1468
|
class: "merge-tag-option",
|
|
1469
|
-
onClick: (t) =>
|
|
1470
|
-
onMousedown:
|
|
1471
|
-
}, [i("span",
|
|
1469
|
+
onClick: (t) => ie(e.id),
|
|
1470
|
+
onMousedown: n[2] ||= _(() => {}, ["prevent"])
|
|
1471
|
+
}, [i("span", bn, x(e.label), 1), i("span", xn, x(e.id), 1)], 40, yn)]))), 128))])) : (y(), t("p", Sn, x(O(c)("blocks.text.mergeTagEmpty")), 1))], 40, _n)) : E("", !0)], 64));
|
|
1472
1472
|
}
|
|
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"]]),
|
|
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"]]), wn = /* @__PURE__ */ m({
|
|
1474
1474
|
__name: "MergeTagView",
|
|
1475
|
-
props:
|
|
1476
|
-
setup(
|
|
1477
|
-
let
|
|
1478
|
-
return (
|
|
1475
|
+
props: nn,
|
|
1476
|
+
setup(e) {
|
|
1477
|
+
let t = e, { t: n, locale: r } = Xe(), i = d($e, a(() => ({}))), o = a(() => String(t.node.attrs.id ?? "")), s = a(() => i.value[o.value] !== void 0), c = a(() => Ge(i.value, o.value, r.value)), l = a(() => n("blocks.text.mergeTagChip", { name: c.value }));
|
|
1478
|
+
return (e, t) => (y(), p(O($t), {
|
|
1479
1479
|
as: "span",
|
|
1480
|
-
class:
|
|
1481
|
-
"data-merge-tag":
|
|
1480
|
+
class: D(["merge-tag", { "is-unknown": !s.value }]),
|
|
1481
|
+
"data-merge-tag": o.value,
|
|
1482
1482
|
contenteditable: "false",
|
|
1483
1483
|
role: "img",
|
|
1484
|
-
"aria-label":
|
|
1485
|
-
title:
|
|
1484
|
+
"aria-label": l.value,
|
|
1485
|
+
title: l.value
|
|
1486
1486
|
}, {
|
|
1487
|
-
default:
|
|
1487
|
+
default: C(() => [T(x(c.value), 1)]),
|
|
1488
1488
|
_: 1
|
|
1489
1489
|
}, 8, [
|
|
1490
1490
|
"class",
|
|
@@ -1496,53 +1496,53 @@ var on = [
|
|
|
1496
1496
|
});
|
|
1497
1497
|
//#endregion
|
|
1498
1498
|
//#region src/fontSizes.ts
|
|
1499
|
-
function
|
|
1500
|
-
return
|
|
1499
|
+
function Tn(e) {
|
|
1500
|
+
return Ce(e);
|
|
1501
1501
|
}
|
|
1502
|
-
var
|
|
1503
|
-
function
|
|
1502
|
+
var En = new Set(Be.map(Tn));
|
|
1503
|
+
function Dn(e) {
|
|
1504
1504
|
let t = e.trim();
|
|
1505
|
-
return
|
|
1505
|
+
return En.has(t) ? t : null;
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return
|
|
1507
|
+
function On(e) {
|
|
1508
|
+
return En.has(e);
|
|
1509
1509
|
}
|
|
1510
1510
|
//#endregion
|
|
1511
1511
|
//#region src/panels/contentPanel/components/blocks/aiEdit.ts
|
|
1512
|
-
var
|
|
1513
|
-
function
|
|
1514
|
-
return e.textBetween(t, n, "",
|
|
1512
|
+
var kn = "hardBreak", An = "link", jn = /\{\{([^{}]*)\}\}/g, Mn = /\r\n?/g, Nn = /\s*\n\s*/g;
|
|
1513
|
+
function Pn(e, t, n) {
|
|
1514
|
+
return e.textBetween(t, n, "", Fn);
|
|
1515
1515
|
}
|
|
1516
|
-
function
|
|
1517
|
-
return e.type.name === "mergeTag" ? `{{${e.attrs.id}}}` : e.type.name ===
|
|
1516
|
+
function Fn(e) {
|
|
1517
|
+
return e.type.name === "mergeTag" ? `{{${e.attrs.id}}}` : e.type.name === kn ? "\n" : "";
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function In(e, t) {
|
|
1520
1520
|
let { from: n, to: r } = t.empty ? {
|
|
1521
1521
|
from: 0,
|
|
1522
1522
|
to: e.content.size
|
|
1523
1523
|
} : t, i = [];
|
|
1524
1524
|
return e.nodesBetween(n, r, (t, a) => {
|
|
1525
1525
|
if (!t.isTextblock) return !0;
|
|
1526
|
-
let o =
|
|
1526
|
+
let o = Ln(e, Math.max(n, a + 1), Math.min(r, a + 1 + t.content.size));
|
|
1527
1527
|
return o && i.push(o), !1;
|
|
1528
1528
|
}), i;
|
|
1529
1529
|
}
|
|
1530
|
-
function
|
|
1531
|
-
let r =
|
|
1530
|
+
function Ln(e, t, n) {
|
|
1531
|
+
let r = Pn(e, t, n), i = r.trim();
|
|
1532
1532
|
if (i === "") return;
|
|
1533
1533
|
let a = t + r.length - r.trimStart().length, o = n - (r.length - r.trimEnd().length);
|
|
1534
1534
|
return {
|
|
1535
1535
|
from: a,
|
|
1536
1536
|
to: o,
|
|
1537
1537
|
text: i,
|
|
1538
|
-
...
|
|
1538
|
+
...Rn(e, a, o)
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
|
-
function
|
|
1541
|
+
function Rn(e, t, n) {
|
|
1542
1542
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = [];
|
|
1543
1543
|
e.nodesBetween(t, n, (e, o) => {
|
|
1544
1544
|
if (e.isText) {
|
|
1545
|
-
let i = e.marks.filter((e) => e.type.name !==
|
|
1545
|
+
let i = e.marks.filter((e) => e.type.name !== An), a = JSON.stringify(i.map((e) => e.toJSON())), s = Math.min(n, o + e.nodeSize) - Math.max(t, o);
|
|
1546
1546
|
r.set(a, {
|
|
1547
1547
|
marks: i,
|
|
1548
1548
|
chars: (r.get(a)?.chars ?? 0) + s
|
|
@@ -1551,7 +1551,7 @@ function Fn(e, t, n) {
|
|
|
1551
1551
|
let t = String(e.attrs.id);
|
|
1552
1552
|
i.set(t, i.get(t) ?? e.marks);
|
|
1553
1553
|
} else return !0;
|
|
1554
|
-
return a.push(e.marks.find((e) => e.type.name ===
|
|
1554
|
+
return a.push(e.marks.find((e) => e.type.name === An)), !1;
|
|
1555
1555
|
});
|
|
1556
1556
|
let o = [], s = 0;
|
|
1557
1557
|
for (let { marks: e, chars: t } of r.values()) t > s && (o = e, s = t);
|
|
@@ -1561,45 +1561,45 @@ function Fn(e, t, n) {
|
|
|
1561
1561
|
tagMarks: i
|
|
1562
1562
|
};
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1565
|
-
let r = n.replace(
|
|
1564
|
+
function zn(e, t, n) {
|
|
1565
|
+
let r = n.replace(Mn, "\n").trim();
|
|
1566
1566
|
if (r === "" || r === t.text) return;
|
|
1567
|
-
let i = e.nodes[
|
|
1568
|
-
for (let [n, r] of a.entries()) i && n > 0 && o.push(i.create()), o.push(...
|
|
1569
|
-
return
|
|
1567
|
+
let i = e.nodes[kn], a = i ? r.split("\n") : [r.replace(Nn, " ")], o = [];
|
|
1568
|
+
for (let [n, r] of a.entries()) i && n > 0 && o.push(i.create()), o.push(...Bn(e, t, r));
|
|
1569
|
+
return I.from(o);
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1572
|
-
let r = e.nodes[
|
|
1573
|
-
for (let o of n.matchAll(
|
|
1571
|
+
function Bn(e, t, n) {
|
|
1572
|
+
let r = e.nodes[Ye], i = [], a = 0;
|
|
1573
|
+
for (let o of n.matchAll(jn)) {
|
|
1574
1574
|
let s = o[1] ?? "";
|
|
1575
|
-
r &&
|
|
1575
|
+
r && L.test(s) && (o.index > a && i.push(e.text(n.slice(a, o.index), t.marks)), i.push(r.create({ id: s }, null, t.tagMarks.get(s) ?? t.marks)), a = o.index + o[0].length);
|
|
1576
1576
|
}
|
|
1577
1577
|
return a < n.length && i.push(e.text(n.slice(a), t.marks)), i;
|
|
1578
1578
|
}
|
|
1579
|
-
function
|
|
1579
|
+
function Vn(e, t, n, r) {
|
|
1580
1580
|
let { tr: i } = e;
|
|
1581
1581
|
for (let [a, o] of [...t.entries()].reverse()) {
|
|
1582
|
-
let t = n[a], s = r.map(o.from, 1), c = r.map(o.to, -1), l = typeof t == "string" &&
|
|
1582
|
+
let t = n[a], s = r.map(o.from, 1), c = r.map(o.to, -1), l = typeof t == "string" && Hn(e.doc, s, c, o.text) ? zn(e.schema, o, t) : void 0;
|
|
1583
1583
|
l && i.replaceWith(s, c, l);
|
|
1584
1584
|
}
|
|
1585
1585
|
return i.docChanged ? i : void 0;
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1587
|
+
function Hn(e, t, n, r) {
|
|
1588
1588
|
if (t >= n || n > e.content.size) return !1;
|
|
1589
1589
|
let i = e.resolve(t);
|
|
1590
|
-
return i.parent.isTextblock && i.sameParent(e.resolve(n)) &&
|
|
1590
|
+
return i.parent.isTextblock && i.sameParent(e.resolve(n)) && Pn(e, t, n) === r;
|
|
1591
1591
|
}
|
|
1592
1592
|
//#endregion
|
|
1593
1593
|
//#region src/panels/contentPanel/components/blocks/brandTypingStyle.ts
|
|
1594
|
-
var
|
|
1594
|
+
var Un = R.create({
|
|
1595
1595
|
name: "brandTypingStyle",
|
|
1596
1596
|
addOptions() {
|
|
1597
1597
|
return { marks: () => [] };
|
|
1598
1598
|
},
|
|
1599
1599
|
addProseMirrorPlugins() {
|
|
1600
1600
|
let { marks: e } = this.options;
|
|
1601
|
-
return [new
|
|
1602
|
-
key: new
|
|
1601
|
+
return [new N({
|
|
1602
|
+
key: new P("brandTypingStyle"),
|
|
1603
1603
|
appendTransaction(t, n, r) {
|
|
1604
1604
|
let { selection: i, storedMarks: a, schema: o } = r;
|
|
1605
1605
|
if (a !== null || !i.empty) return null;
|
|
@@ -1610,95 +1610,125 @@ var Bn = B.create({
|
|
|
1610
1610
|
}
|
|
1611
1611
|
})];
|
|
1612
1612
|
}
|
|
1613
|
-
})
|
|
1614
|
-
|
|
1615
|
-
|
|
1613
|
+
});
|
|
1614
|
+
//#endregion
|
|
1615
|
+
//#region src/panels/contentPanel/components/blocks/pasteFormatting.ts
|
|
1616
|
+
function Wn(e) {
|
|
1617
|
+
let { paragraph: t } = e.schema.nodes;
|
|
1618
|
+
if (t) return {
|
|
1619
|
+
type: t,
|
|
1620
|
+
attrs: t.create().attrs
|
|
1621
|
+
};
|
|
1622
|
+
let { parent: n } = e.selection.$from;
|
|
1623
|
+
return {
|
|
1624
|
+
type: n.type,
|
|
1625
|
+
attrs: n.attrs
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1628
|
+
function Gn(e, t) {
|
|
1629
|
+
let n = Wn(e), r = !1;
|
|
1630
|
+
return t.content.descendants((e) => r ? !1 : (e.isText ? r = e.marks.length > 0 : e.isTextblock ? r = !e.hasMarkup(n.type, n.attrs) : e.isInline && (r = e.type.name !== "hardBreak"), !r)), r;
|
|
1631
|
+
}
|
|
1632
|
+
function Kn(e, t) {
|
|
1633
|
+
let n = t.openStart === 0 && t.openEnd === 0 && t.content.childCount === 1 ? t.content.firstChild : null;
|
|
1634
|
+
return (n ? e.tr.replaceSelectionWith(n, !1) : e.tr.replaceSelection(t)).scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste");
|
|
1635
|
+
}
|
|
1636
|
+
var qn = /(?:\r\n?|\n)+/;
|
|
1637
|
+
function Jn(e, t) {
|
|
1638
|
+
let { schema: n, selection: r, storedMarks: i } = e, a = i ?? r.$from.marks(), o = Wn(e), s = t.split(qn).map((e) => o.type.create(o.attrs, e ? n.text(e, a) : null));
|
|
1639
|
+
return new H(I.from(s), 1, 1);
|
|
1640
|
+
}
|
|
1641
|
+
//#endregion
|
|
1642
|
+
//#region src/panels/contentPanel/components/blocks/sanitizePastedFonts.ts
|
|
1643
|
+
var Yn = "textStyle";
|
|
1644
|
+
function Xn(e) {
|
|
1645
|
+
let t = ke(e);
|
|
1616
1646
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1617
1647
|
}
|
|
1618
|
-
function
|
|
1619
|
-
if (e.type.name !==
|
|
1648
|
+
function Zn(e, t) {
|
|
1649
|
+
if (e.type.name !== Yn) return e;
|
|
1620
1650
|
let n = { ...e.attrs };
|
|
1621
|
-
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily =
|
|
1651
|
+
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily = Xn(n.fontFamily)), typeof n.fontSize == "string" && (n.fontSize = Dn(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;
|
|
1622
1652
|
}
|
|
1623
|
-
function
|
|
1653
|
+
function Qn(e, t) {
|
|
1624
1654
|
return e.flatMap((e) => {
|
|
1625
|
-
let n =
|
|
1655
|
+
let n = Zn(e, t);
|
|
1626
1656
|
return n ? [n] : [];
|
|
1627
1657
|
});
|
|
1628
1658
|
}
|
|
1629
|
-
function
|
|
1630
|
-
return e.isText ? e.mark(
|
|
1659
|
+
function $n(e, t) {
|
|
1660
|
+
return e.isText ? e.mark(Qn(e.marks, t)) : e.copy(er(e.content, t)).mark(Qn(e.marks, t));
|
|
1631
1661
|
}
|
|
1632
|
-
function
|
|
1662
|
+
function er(e, t) {
|
|
1633
1663
|
let n = [];
|
|
1634
|
-
for (let r = 0; r < e.childCount; r++) n.push(
|
|
1635
|
-
return
|
|
1664
|
+
for (let r = 0; r < e.childCount; r++) n.push($n(e.child(r), t));
|
|
1665
|
+
return I.fromArray(n);
|
|
1636
1666
|
}
|
|
1637
|
-
function
|
|
1638
|
-
return new
|
|
1667
|
+
function tr(e, t) {
|
|
1668
|
+
return new H(er(e.content, t), e.openStart, e.openEnd);
|
|
1639
1669
|
}
|
|
1640
1670
|
//#endregion
|
|
1641
1671
|
//#region src/panels/contentPanel/components/blocks/selectAllText.ts
|
|
1642
|
-
var
|
|
1672
|
+
var nr = R.create({
|
|
1643
1673
|
name: "selectAllText",
|
|
1644
1674
|
priority: 1e3,
|
|
1645
1675
|
addKeyboardShortcuts() {
|
|
1646
1676
|
return { "Mod-a": ({ editor: e }) => {
|
|
1647
1677
|
let { doc: t } = e.state;
|
|
1648
1678
|
return e.commands.setTextSelection({
|
|
1649
|
-
from:
|
|
1650
|
-
to:
|
|
1679
|
+
from: F.atStart(t).from,
|
|
1680
|
+
to: F.atEnd(t).to
|
|
1651
1681
|
});
|
|
1652
1682
|
} };
|
|
1653
1683
|
}
|
|
1654
|
-
}),
|
|
1684
|
+
}), rr = R.create({
|
|
1655
1685
|
name: "keepEmptiedBlock",
|
|
1656
1686
|
addProseMirrorPlugins() {
|
|
1657
|
-
return [new
|
|
1658
|
-
key: new
|
|
1687
|
+
return [new N({
|
|
1688
|
+
key: new P("keepEmptiedBlock"),
|
|
1659
1689
|
filterTransaction(e) {
|
|
1660
1690
|
return e.docChanged && e.setMeta("preventClearDocument", !0), !0;
|
|
1661
1691
|
}
|
|
1662
1692
|
})];
|
|
1663
1693
|
}
|
|
1664
|
-
}),
|
|
1694
|
+
}), ir = { class: "picker" }, ar = ["aria-label", "value"], or = {
|
|
1665
1695
|
key: 0,
|
|
1666
1696
|
value: "paragraph"
|
|
1667
|
-
},
|
|
1697
|
+
}, sr = ["value"], cr = { class: "picker" }, lr = ["aria-label", "value"], ur = {
|
|
1668
1698
|
value: "mixed",
|
|
1669
1699
|
disabled: "",
|
|
1670
1700
|
hidden: ""
|
|
1671
|
-
},
|
|
1701
|
+
}, dr = ["value"], fr = ["value"], pr = { class: "picker" }, mr = ["aria-label", "value"], hr = {
|
|
1672
1702
|
value: "mixed",
|
|
1673
1703
|
disabled: "",
|
|
1674
1704
|
hidden: ""
|
|
1675
|
-
},
|
|
1705
|
+
}, gr = { value: "" }, _r = ["value"], vr = ["title", "aria-label"], yr = ["title", "aria-label"], br = ["title", "aria-label"], xr = [
|
|
1676
1706
|
"title",
|
|
1677
1707
|
"popovertarget",
|
|
1678
1708
|
"aria-expanded"
|
|
1679
|
-
],
|
|
1709
|
+
], Sr = ["id", "aria-label"], Cr = { class: "link-field" }, wr = {
|
|
1680
1710
|
key: 0,
|
|
1681
1711
|
class: "link-anchor"
|
|
1682
|
-
},
|
|
1712
|
+
}, Tr = {
|
|
1683
1713
|
key: 0,
|
|
1684
1714
|
value: ""
|
|
1685
|
-
},
|
|
1715
|
+
}, Er = {
|
|
1686
1716
|
key: 1,
|
|
1687
1717
|
value: "",
|
|
1688
1718
|
disabled: "",
|
|
1689
1719
|
hidden: ""
|
|
1690
|
-
},
|
|
1720
|
+
}, Dr = ["value"], Or = ["title", "aria-label"], kr = ["title", "onClick"], Ar = {
|
|
1691
1721
|
"aria-hidden": "true",
|
|
1692
1722
|
height: "16",
|
|
1693
1723
|
viewBox: "0 0 16 16",
|
|
1694
1724
|
width: "16"
|
|
1695
|
-
},
|
|
1725
|
+
}, jr = [
|
|
1696
1726
|
"width",
|
|
1697
1727
|
"x",
|
|
1698
1728
|
"y"
|
|
1699
|
-
],
|
|
1729
|
+
], Mr = ["aria-labelledby", "onKeydown"], Nr = ["id"], Pr = 8, Fr = 220, Ir = /*#__PURE__*/ B(/* @__PURE__ */ m({
|
|
1700
1730
|
__name: "TextEditor",
|
|
1701
|
-
props: /*@__PURE__*/
|
|
1731
|
+
props: /*@__PURE__*/ g({
|
|
1702
1732
|
editable: {
|
|
1703
1733
|
type: Boolean,
|
|
1704
1734
|
default: !1
|
|
@@ -1721,51 +1751,52 @@ var Jn = B.create({
|
|
|
1721
1751
|
fitSizeModifiers: {}
|
|
1722
1752
|
}),
|
|
1723
1753
|
emits: ["update:text", "update:fitSize"],
|
|
1724
|
-
setup(
|
|
1725
|
-
let
|
|
1754
|
+
setup(e) {
|
|
1755
|
+
let o = ee(e, "text"), s = ee(e, "fitSize"), l = e, { t: p, locale: m } = Xe(), g = [
|
|
1726
1756
|
"left",
|
|
1727
1757
|
"center",
|
|
1728
1758
|
"right",
|
|
1729
1759
|
"justify"
|
|
1730
|
-
],
|
|
1731
|
-
...
|
|
1760
|
+
], ne = a(() => p(l.headerOnly ? "blocks.header.label" : "blocks.text.label")), S = en({
|
|
1761
|
+
...Le,
|
|
1732
1762
|
editorProps: {
|
|
1733
1763
|
attributes: {
|
|
1734
|
-
"aria-label":
|
|
1764
|
+
"aria-label": ne.value,
|
|
1735
1765
|
"aria-multiline": "true",
|
|
1736
1766
|
role: "textbox"
|
|
1737
1767
|
},
|
|
1738
|
-
transformPasted: (e) =>
|
|
1768
|
+
transformPasted: (e) => tr(e, R.value),
|
|
1769
|
+
handlePaste: (e, t, n) => Y(t, n)
|
|
1739
1770
|
},
|
|
1740
|
-
content:
|
|
1771
|
+
content: de(o.value),
|
|
1741
1772
|
editable: l.editable,
|
|
1742
1773
|
extensions: [
|
|
1743
|
-
...(l.headerOnly ?
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1774
|
+
...(l.headerOnly ? He : Fe).map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => an(wn) }) : e),
|
|
1775
|
+
Yt,
|
|
1776
|
+
nr,
|
|
1777
|
+
rr,
|
|
1778
|
+
Un.configure({ marks: Ae }),
|
|
1779
|
+
Kt.configure({ placeholder: () => p(l.headerOnly ? "blocks.header.placeholder" : "blocks.text.placeholder") })
|
|
1749
1780
|
],
|
|
1750
1781
|
onUpdate({ editor: e }) {
|
|
1751
|
-
|
|
1782
|
+
o.value = et(e.getJSON()), N();
|
|
1752
1783
|
},
|
|
1753
1784
|
onSelectionUpdate() {
|
|
1754
|
-
|
|
1785
|
+
N();
|
|
1755
1786
|
}
|
|
1756
1787
|
});
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}),
|
|
1760
|
-
let t =
|
|
1761
|
-
!t ||
|
|
1762
|
-
}),
|
|
1763
|
-
let
|
|
1764
|
-
function
|
|
1765
|
-
let e =
|
|
1788
|
+
h(ne, (e) => {
|
|
1789
|
+
S.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1790
|
+
}), h(o, (e) => {
|
|
1791
|
+
let t = S.value;
|
|
1792
|
+
!t || De(e, et(t.getJSON())) || t.commands.setContent(de(e), { emitUpdate: !1 });
|
|
1793
|
+
}), h(() => l.editable, (e) => S.value?.setEditable(e));
|
|
1794
|
+
let w = b("root"), T = b("toolbar"), ae = b("content");
|
|
1795
|
+
function se() {
|
|
1796
|
+
let e = ae.value?.$el;
|
|
1766
1797
|
if (!(l.editable && e)) return;
|
|
1767
1798
|
if (l.width !== "fit") {
|
|
1768
|
-
|
|
1799
|
+
s.value !== void 0 && (s.value = void 0);
|
|
1769
1800
|
return;
|
|
1770
1801
|
}
|
|
1771
1802
|
let t = e.getBoundingClientRect(), n = {
|
|
@@ -1773,139 +1804,159 @@ var Jn = B.create({
|
|
|
1773
1804
|
height: Math.ceil(t.height)
|
|
1774
1805
|
};
|
|
1775
1806
|
if (n.width < 1 || n.height < 1) return;
|
|
1776
|
-
let r =
|
|
1777
|
-
(r?.width !== n.width || r.height !== n.height) && (
|
|
1807
|
+
let r = s.value;
|
|
1808
|
+
(r?.width !== n.width || r.height !== n.height) && (s.value = n);
|
|
1778
1809
|
}
|
|
1779
|
-
let
|
|
1780
|
-
function
|
|
1781
|
-
let e =
|
|
1782
|
-
!(
|
|
1810
|
+
let k, ue;
|
|
1811
|
+
function j() {
|
|
1812
|
+
let e = ae.value?.$el;
|
|
1813
|
+
!(k && e) || e === ue || (ue && k.unobserve(ue), k.observe(e), ue = e);
|
|
1783
1814
|
}
|
|
1784
|
-
function
|
|
1785
|
-
|
|
1786
|
-
|
|
1815
|
+
function fe() {
|
|
1816
|
+
n(() => {
|
|
1817
|
+
j(), se();
|
|
1787
1818
|
});
|
|
1788
1819
|
}
|
|
1789
|
-
|
|
1790
|
-
!l.editable || typeof ResizeObserver > "u" || (
|
|
1791
|
-
}),
|
|
1820
|
+
c(() => {
|
|
1821
|
+
!l.editable || typeof ResizeObserver > "u" || (k = new ResizeObserver(se), fe());
|
|
1822
|
+
}), v(() => k?.disconnect()), h(() => [
|
|
1792
1823
|
l.width,
|
|
1793
1824
|
l.paragraphSpacing,
|
|
1794
1825
|
l.padding,
|
|
1795
|
-
|
|
1796
|
-
],
|
|
1797
|
-
function
|
|
1826
|
+
o.value
|
|
1827
|
+
], fe);
|
|
1828
|
+
function me() {
|
|
1798
1829
|
let e = T.value;
|
|
1799
|
-
!e || e.matches(":popover-open") || (e.showPopover(),
|
|
1830
|
+
!e || e.matches(":popover-open") || (e.showPopover(), N());
|
|
1800
1831
|
}
|
|
1801
|
-
function
|
|
1832
|
+
function _e(e) {
|
|
1802
1833
|
let t = e.relatedTarget;
|
|
1803
|
-
t instanceof Node &&
|
|
1834
|
+
t instanceof Node && w.value?.contains(t) || T.value?.matches(":popover-open") && T.value.hidePopover();
|
|
1835
|
+
}
|
|
1836
|
+
let ye = d(ie, void 0);
|
|
1837
|
+
function xe() {
|
|
1838
|
+
let e = ye?.value?.getBoundingClientRect();
|
|
1839
|
+
return {
|
|
1840
|
+
top: Math.max(e?.top ?? 0, 0),
|
|
1841
|
+
bottom: Math.min(e?.bottom ?? window.innerHeight, window.innerHeight)
|
|
1842
|
+
};
|
|
1804
1843
|
}
|
|
1805
|
-
function
|
|
1806
|
-
let e =
|
|
1844
|
+
function N() {
|
|
1845
|
+
let e = S.value?.view, t = T.value, n = w.value;
|
|
1807
1846
|
if (!(e && t && n && t.matches(":popover-open"))) return;
|
|
1808
|
-
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(
|
|
1809
|
-
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o -
|
|
1847
|
+
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max(Pr, window.innerWidth - Fr - Pr), o = Math.min(Math.max(i.left, Pr), a);
|
|
1848
|
+
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - Pr}px`, t.style.top = `${Ve(i.top, t.offsetHeight, xe())}px`;
|
|
1849
|
+
}
|
|
1850
|
+
function Ce(e) {
|
|
1851
|
+
let t = {
|
|
1852
|
+
capture: !0,
|
|
1853
|
+
passive: !0
|
|
1854
|
+
}, n = w.value?.getRootNode();
|
|
1855
|
+
for (let r of [window, n instanceof ShadowRoot ? n : null]) e ? r?.addEventListener("scroll", N, t) : r?.removeEventListener("scroll", N, t);
|
|
1856
|
+
e ? window.addEventListener("resize", N) : window.removeEventListener("resize", N);
|
|
1810
1857
|
}
|
|
1811
|
-
function
|
|
1812
|
-
|
|
1858
|
+
function P(e) {
|
|
1859
|
+
Ce(e.newState === "open");
|
|
1860
|
+
}
|
|
1861
|
+
v(() => Ce(!1));
|
|
1862
|
+
function Te() {
|
|
1863
|
+
let e = S.value;
|
|
1813
1864
|
if (!e) return l.headerOnly ? "h1" : "paragraph";
|
|
1814
1865
|
let t = We.find((t) => e.isActive("heading", { level: t }));
|
|
1815
1866
|
return t ? `h${t}` : "paragraph";
|
|
1816
1867
|
}
|
|
1817
|
-
function
|
|
1868
|
+
function F(e) {
|
|
1818
1869
|
let { target: t } = e;
|
|
1819
1870
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1820
|
-
let n =
|
|
1871
|
+
let n = S.value?.chain().focus();
|
|
1821
1872
|
if (!n) return;
|
|
1822
1873
|
let r = We.find((e) => `h${e}` === t.value);
|
|
1823
1874
|
r ? n.setHeading({ level: r }).run() : l.headerOnly || n.setParagraph().run();
|
|
1824
1875
|
}
|
|
1825
|
-
let
|
|
1826
|
-
function
|
|
1827
|
-
let e =
|
|
1828
|
-
return
|
|
1876
|
+
let I = d(oe, a(() => Ze)), Oe = d(je, void 0);
|
|
1877
|
+
function Ae() {
|
|
1878
|
+
let e = Oe?.value;
|
|
1879
|
+
return ve(l.headerOnly ? e?.header : e?.text, I.value);
|
|
1829
1880
|
}
|
|
1830
|
-
let
|
|
1831
|
-
function
|
|
1881
|
+
let L = Me(), R = a(() => new Set(L.value.map((e) => e.stack)));
|
|
1882
|
+
function z(e) {
|
|
1832
1883
|
return `custom:${e}`;
|
|
1833
1884
|
}
|
|
1834
|
-
function
|
|
1835
|
-
if (typeof e != "string") return
|
|
1836
|
-
let t =
|
|
1837
|
-
return t ?
|
|
1885
|
+
function B(e) {
|
|
1886
|
+
if (typeof e != "string") return I.value;
|
|
1887
|
+
let t = L.value.find((t) => t.stack === e);
|
|
1888
|
+
return t ? z(t.name) : ke(e)?.key ?? I.value;
|
|
1838
1889
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let e =
|
|
1841
|
-
if (!e) return
|
|
1890
|
+
function Re() {
|
|
1891
|
+
let e = S.value;
|
|
1892
|
+
if (!e) return I.value;
|
|
1842
1893
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1843
|
-
if (r) return
|
|
1894
|
+
if (r) return B(e.getAttributes("textStyle").fontFamily);
|
|
1844
1895
|
let i = /* @__PURE__ */ new Set();
|
|
1845
1896
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1846
1897
|
if (!e.isText) return;
|
|
1847
1898
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1848
|
-
i.add(
|
|
1899
|
+
i.add(B(t?.attrs.fontFamily));
|
|
1849
1900
|
});
|
|
1850
1901
|
let a = Array.from(i);
|
|
1851
|
-
return a.length > 1 ? "mixed" : a[0] ??
|
|
1902
|
+
return a.length > 1 ? "mixed" : a[0] ?? I.value;
|
|
1852
1903
|
}
|
|
1853
|
-
function
|
|
1904
|
+
function V(e) {
|
|
1854
1905
|
let { target: t } = e;
|
|
1855
1906
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1856
|
-
let n = t.value, r =
|
|
1907
|
+
let n = t.value, r = S.value?.chain().focus();
|
|
1857
1908
|
if (!r) return;
|
|
1858
|
-
let i =
|
|
1909
|
+
let i = L.value.find((e) => z(e.name) === n);
|
|
1859
1910
|
if (i) {
|
|
1860
1911
|
r.setFontFamily(i.stack).run();
|
|
1861
1912
|
return;
|
|
1862
1913
|
}
|
|
1863
|
-
|
|
1914
|
+
pe(n) && (n === I.value ? r.unsetFontFamily().run() : r.setFontFamily(ge(n)).run());
|
|
1864
1915
|
}
|
|
1865
|
-
function
|
|
1866
|
-
return typeof e == "string" &&
|
|
1916
|
+
function Ue(e) {
|
|
1917
|
+
return typeof e == "string" && On(e) ? e : "";
|
|
1867
1918
|
}
|
|
1868
|
-
function
|
|
1869
|
-
let e =
|
|
1919
|
+
function Ge() {
|
|
1920
|
+
let e = S.value;
|
|
1870
1921
|
if (!e) return "";
|
|
1871
1922
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1872
|
-
if (r) return
|
|
1923
|
+
if (r) return Ue(e.getAttributes("textStyle").fontSize);
|
|
1873
1924
|
let i = /* @__PURE__ */ new Set();
|
|
1874
1925
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1875
1926
|
if (!e.isText) return;
|
|
1876
1927
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1877
|
-
i.add(
|
|
1928
|
+
i.add(Ue(t?.attrs.fontSize));
|
|
1878
1929
|
});
|
|
1879
1930
|
let a = Array.from(i);
|
|
1880
1931
|
return a.length > 1 ? "mixed" : a[0] ?? "";
|
|
1881
1932
|
}
|
|
1882
|
-
function
|
|
1933
|
+
function Qe(e) {
|
|
1883
1934
|
let { target: t } = e;
|
|
1884
1935
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1885
|
-
let n =
|
|
1886
|
-
n && (t.value === "" ? n.unsetFontSize().run() :
|
|
1936
|
+
let n = S.value?.chain().focus();
|
|
1937
|
+
n && (t.value === "" ? n.unsetFontSize().run() : On(t.value) && n.setFontSize(t.value).run());
|
|
1887
1938
|
}
|
|
1888
|
-
let
|
|
1889
|
-
let e =
|
|
1890
|
-
return
|
|
1891
|
-
}),
|
|
1939
|
+
let $e = Ke(() => {
|
|
1940
|
+
let e = Re();
|
|
1941
|
+
return pe(e) ? e : void 0;
|
|
1942
|
+
}), tt = a({
|
|
1892
1943
|
get: () => {
|
|
1893
|
-
let e =
|
|
1944
|
+
let e = S.value?.getAttributes("textStyle").color, t = typeof e == "string" ? Se(e) : void 0;
|
|
1894
1945
|
return t ? {
|
|
1895
1946
|
type: "color",
|
|
1896
1947
|
...t
|
|
1897
|
-
} :
|
|
1948
|
+
} : we;
|
|
1898
1949
|
},
|
|
1899
1950
|
set: (e) => {
|
|
1900
|
-
e.type !== "transparent" &&
|
|
1951
|
+
e.type !== "transparent" && S.value?.chain().setColor(Ee(e)).run();
|
|
1901
1952
|
}
|
|
1902
|
-
}),
|
|
1953
|
+
}), rt = {
|
|
1903
1954
|
left: "blocks.text.alignLeft",
|
|
1904
1955
|
center: "blocks.text.alignCenter",
|
|
1905
1956
|
right: "blocks.text.alignRight",
|
|
1906
1957
|
justify: "blocks.text.alignJustify"
|
|
1907
1958
|
};
|
|
1908
|
-
function
|
|
1959
|
+
function H(e) {
|
|
1909
1960
|
return (e === "justify" ? [
|
|
1910
1961
|
14,
|
|
1911
1962
|
14,
|
|
@@ -1925,53 +1976,85 @@ var Jn = B.create({
|
|
|
1925
1976
|
};
|
|
1926
1977
|
});
|
|
1927
1978
|
}
|
|
1928
|
-
let
|
|
1929
|
-
function
|
|
1979
|
+
let it = te(), U = b("linkPopover"), ot = b("linkInput"), W = b("linkTrigger"), G = A(""), st = A(!1), ct = A(!1);
|
|
1980
|
+
function lt(e) {
|
|
1930
1981
|
if (e.newState !== "open") return;
|
|
1931
|
-
let t =
|
|
1932
|
-
G.value = typeof t == "string" ? t : "",
|
|
1933
|
-
let n = U.value, r =
|
|
1982
|
+
let t = S.value?.getAttributes("link")?.href;
|
|
1983
|
+
G.value = typeof t == "string" ? t : "", ct.value = G.value !== "";
|
|
1984
|
+
let n = U.value, r = W.value?.getBoundingClientRect();
|
|
1934
1985
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1935
1986
|
}
|
|
1936
|
-
function
|
|
1937
|
-
if (
|
|
1987
|
+
function ut(e) {
|
|
1988
|
+
if (st.value = e.newState === "open", e.newState !== "open") return;
|
|
1938
1989
|
let t = U.value;
|
|
1939
1990
|
if (t) {
|
|
1940
1991
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1941
1992
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1942
1993
|
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1994
|
+
n(() => {
|
|
1995
|
+
ot.value?.focus(), ot.value?.select();
|
|
1945
1996
|
});
|
|
1946
1997
|
}
|
|
1947
|
-
function
|
|
1998
|
+
function dt(e) {
|
|
1948
1999
|
let t = e.relatedTarget, n = U.value;
|
|
1949
2000
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
1950
2001
|
}
|
|
1951
|
-
function
|
|
1952
|
-
let e =
|
|
2002
|
+
function K() {
|
|
2003
|
+
let e = S.value?.chain().focus();
|
|
1953
2004
|
if (!e) return;
|
|
1954
|
-
let t =
|
|
2005
|
+
let t = qe(G.value);
|
|
1955
2006
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
1956
2007
|
href: t,
|
|
1957
2008
|
target: t.startsWith("#") ? null : "_blank"
|
|
1958
2009
|
}).run(), U.value?.hidePopover();
|
|
1959
2010
|
}
|
|
1960
|
-
let
|
|
1961
|
-
function
|
|
2011
|
+
let ft = d(ce, a(() => [])), pt = a(() => G.value.startsWith("#") && ft.value.includes(G.value.slice(1)) ? G.value.slice(1) : "");
|
|
2012
|
+
function mt(e) {
|
|
1962
2013
|
e === "" ? G.value.startsWith("#") && (G.value = "") : G.value = `#${e}`;
|
|
1963
2014
|
}
|
|
1964
|
-
function
|
|
1965
|
-
|
|
2015
|
+
function ht() {
|
|
2016
|
+
S.value?.chain().focus().unsetLink().run(), U.value?.hidePopover();
|
|
2017
|
+
}
|
|
2018
|
+
let q = b("pastePrompt"), gt = b("pasteKeep"), _t = te(), J;
|
|
2019
|
+
function Y(e, t) {
|
|
2020
|
+
let n = S.value, r = q.value, i = e.clipboardData?.getData("text/plain") ?? "";
|
|
2021
|
+
return n && r && i && Gn(n.state, t) ? (J = {
|
|
2022
|
+
slice: t,
|
|
2023
|
+
text: i
|
|
2024
|
+
}, r.showPopover(), vt(n.view, r), gt.value?.focus(), !0) : !1;
|
|
2025
|
+
}
|
|
2026
|
+
function vt(e, t) {
|
|
2027
|
+
let n = e.coordsAtPos(e.state.selection.from), r = Ie(n, window.innerHeight), i = window.innerWidth - t.offsetWidth - 8;
|
|
2028
|
+
t.style.left = `${Math.max(8, Math.min(n.left, i))}px`, t.style.top = r.side === "below" ? `${r.offset + 4}px` : "auto", t.style.bottom = r.side === "above" ? `${r.offset + 4}px` : "auto";
|
|
1966
2029
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
2030
|
+
function X(e) {
|
|
2031
|
+
let t = J;
|
|
2032
|
+
J = void 0;
|
|
2033
|
+
let n = S.value;
|
|
2034
|
+
if (t && n && !n.isDestroyed) {
|
|
2035
|
+
let { view: r } = n;
|
|
2036
|
+
r.focus(), r.dispatch(Kn(r.state, e ? t.slice : Jn(r.state, t.text)));
|
|
2037
|
+
}
|
|
2038
|
+
yt();
|
|
2039
|
+
}
|
|
2040
|
+
function Z() {
|
|
2041
|
+
J = void 0, S.value?.view.focus(), yt();
|
|
2042
|
+
}
|
|
2043
|
+
function yt() {
|
|
2044
|
+
q.value?.matches(":popover-open") && q.value.hidePopover();
|
|
2045
|
+
}
|
|
2046
|
+
function bt(e) {
|
|
2047
|
+
let t = e.relatedTarget;
|
|
2048
|
+
t instanceof Node && q.value?.contains(t) || (J = void 0, yt());
|
|
2049
|
+
}
|
|
2050
|
+
let xt = d(nt), St = he(), Ct = a(() => cn(xt?.value?.ai)), wt = A(!1);
|
|
2051
|
+
async function Tt(e) {
|
|
2052
|
+
let t = S.value, n = xt?.value?.ai;
|
|
2053
|
+
if (!(t && n) || wt.value) return;
|
|
2054
|
+
let r = In(t.state.doc, t.state.selection);
|
|
1972
2055
|
if (r.length === 0) return;
|
|
1973
|
-
|
|
1974
|
-
let i = new
|
|
2056
|
+
wt.value = !0;
|
|
2057
|
+
let i = new be(), a = ({ transaction: e, appendedTransactions: t }) => {
|
|
1975
2058
|
for (let n of [e, ...t]) i.appendMapping(n.mapping);
|
|
1976
2059
|
};
|
|
1977
2060
|
t.on("transaction", a);
|
|
@@ -1979,246 +2062,279 @@ var Jn = B.create({
|
|
|
1979
2062
|
let a = await Promise.all(r.map(({ text: t }) => n.run({
|
|
1980
2063
|
action: e,
|
|
1981
2064
|
text: t,
|
|
1982
|
-
locale:
|
|
2065
|
+
locale: m.value
|
|
1983
2066
|
})));
|
|
1984
2067
|
if (!t.isDestroyed) {
|
|
1985
|
-
let e =
|
|
2068
|
+
let e = Vn(t.state, r, a, i);
|
|
1986
2069
|
e && t.view.dispatch(e);
|
|
1987
2070
|
}
|
|
1988
2071
|
} catch (e) {
|
|
1989
|
-
console.error("[bygga-editor] the AI action failed —", e),
|
|
2072
|
+
console.error("[bygga-editor] the AI action failed —", e), St?.show(p("blocks.text.ai.failed"));
|
|
1990
2073
|
} finally {
|
|
1991
|
-
t.off("transaction", a),
|
|
2074
|
+
t.off("transaction", a), wt.value = !1;
|
|
1992
2075
|
}
|
|
1993
2076
|
}
|
|
1994
|
-
function
|
|
1995
|
-
|
|
1996
|
-
type:
|
|
2077
|
+
function Et(e) {
|
|
2078
|
+
S.value?.chain().focus().insertContent({
|
|
2079
|
+
type: Ye,
|
|
1997
2080
|
attrs: { id: e }
|
|
1998
2081
|
}).run();
|
|
1999
2082
|
}
|
|
2000
|
-
return (
|
|
2083
|
+
return (e, n) => (y(), t("div", {
|
|
2001
2084
|
ref_key: "root",
|
|
2002
|
-
ref:
|
|
2085
|
+
ref: w,
|
|
2003
2086
|
style: {
|
|
2004
2087
|
position: "relative",
|
|
2005
2088
|
width: "100%"
|
|
2006
2089
|
},
|
|
2007
|
-
onFocusin:
|
|
2008
|
-
onFocusout:
|
|
2009
|
-
}, [E(C($e), {
|
|
2010
|
-
width: l.width,
|
|
2011
|
-
align: l.align
|
|
2012
|
-
}, {
|
|
2013
|
-
default: e(() => [E(C(Yt), {
|
|
2014
|
-
ref_key: "content",
|
|
2015
|
-
ref: ie,
|
|
2016
|
-
class: k({
|
|
2017
|
-
"text-input": l.editable,
|
|
2018
|
-
"text-spaced": l.paragraphSpacing !== void 0
|
|
2019
|
-
}),
|
|
2020
|
-
editor: C(v),
|
|
2021
|
-
style: re([C(xe)(l), l.paragraphSpacing === void 0 ? void 0 : { "--bygga-paragraph-spacing": `${l.paragraphSpacing}px` }])
|
|
2022
|
-
}, null, 8, [
|
|
2023
|
-
"class",
|
|
2024
|
-
"editor",
|
|
2025
|
-
"style"
|
|
2026
|
-
])]),
|
|
2027
|
-
_: 1
|
|
2028
|
-
}, 8, ["width", "align"]), l.editable ? (_(), D("div", {
|
|
2029
|
-
key: 0,
|
|
2030
|
-
ref_key: "toolbar",
|
|
2031
|
-
ref: T,
|
|
2032
|
-
popover: "manual",
|
|
2033
|
-
class: "toolbar"
|
|
2090
|
+
onFocusin: me,
|
|
2091
|
+
onFocusout: _e
|
|
2034
2092
|
}, [
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
})]),
|
|
2049
|
-
n[20] ||= i("span", { class: "divider" }, null, -1),
|
|
2050
|
-
i("span", er, [i("select", {
|
|
2051
|
-
"aria-label": C(u)("blocks.text.font"),
|
|
2052
|
-
class: "font",
|
|
2053
|
-
value: Oe(),
|
|
2054
|
-
onChange: je,
|
|
2055
|
-
onMousedown: n[1] ||= j(() => {}, ["stop"])
|
|
2056
|
-
}, [
|
|
2057
|
-
i("option", nr, w(C(u)("blocks.text.fontMixed")), 1),
|
|
2058
|
-
(_(!0), D(h, null, o(C(Ie), (e) => (_(), D("option", {
|
|
2059
|
-
key: e.key,
|
|
2060
|
-
value: e.key
|
|
2061
|
-
}, w(e.name), 9, rr))), 128)),
|
|
2062
|
-
(_(!0), D(h, null, o(C(z), (e) => (_(), D("option", {
|
|
2063
|
-
key: B(e.name),
|
|
2064
|
-
value: B(e.name)
|
|
2065
|
-
}, w(e.name), 9, ir))), 128))
|
|
2066
|
-
], 40, tr), E(R, {
|
|
2067
|
-
class: "picker-chevron",
|
|
2068
|
-
name: "chevron-down",
|
|
2069
|
-
size: 12
|
|
2070
|
-
})]),
|
|
2071
|
-
i("span", ar, [i("select", {
|
|
2072
|
-
"aria-label": C(u)("blocks.text.fontSize"),
|
|
2073
|
-
class: "size",
|
|
2074
|
-
value: Ne(),
|
|
2075
|
-
onChange: H,
|
|
2076
|
-
onMousedown: n[2] ||= j(() => {}, ["stop"])
|
|
2077
|
-
}, [
|
|
2078
|
-
i("option", sr, w(C(u)("blocks.text.fontMixed")), 1),
|
|
2079
|
-
i("option", cr, w(C(u)("blocks.text.fontSizeDefault")), 1),
|
|
2080
|
-
(_(!0), D(h, null, o(C(Re), (e) => (_(), D("option", {
|
|
2081
|
-
key: e,
|
|
2082
|
-
value: C(Sn)(e)
|
|
2083
|
-
}, w(e), 9, lr))), 128))
|
|
2084
|
-
], 40, or), E(R, {
|
|
2085
|
-
class: "picker-chevron",
|
|
2086
|
-
name: "chevron-down",
|
|
2087
|
-
size: 12
|
|
2088
|
-
})]),
|
|
2089
|
-
E(Ue, {
|
|
2090
|
-
modelValue: Le.value,
|
|
2091
|
-
"onUpdate:modelValue": n[3] ||= (e) => Le.value = e,
|
|
2092
|
-
"allow-transparent": !1,
|
|
2093
|
-
label: C(u)("blocks.text.textColor"),
|
|
2094
|
-
compact: "",
|
|
2095
|
-
onMousedown: n[4] ||= j(() => {}, ["stop"])
|
|
2096
|
-
}, null, 8, ["modelValue", "label"]),
|
|
2097
|
-
n[21] ||= i("span", { class: "divider" }, null, -1),
|
|
2098
|
-
i("button", {
|
|
2099
|
-
class: k({ active: C(v)?.isActive("bold") }),
|
|
2100
|
-
type: "button",
|
|
2101
|
-
title: C(u)("blocks.text.bold"),
|
|
2102
|
-
"aria-label": C(u)("blocks.text.bold"),
|
|
2103
|
-
onClick: n[5] ||= (e) => C(v)?.chain().focus().toggleBold().run(),
|
|
2104
|
-
onMousedown: n[6] ||= j(() => {}, ["prevent"])
|
|
2105
|
-
}, [...n[17] ||= [i("b", null, "B", -1)]], 42, ur),
|
|
2106
|
-
i("button", {
|
|
2107
|
-
class: k({ active: C(v)?.isActive("italic") }),
|
|
2108
|
-
type: "button",
|
|
2109
|
-
title: C(u)("blocks.text.italic"),
|
|
2110
|
-
"aria-label": C(u)("blocks.text.italic"),
|
|
2111
|
-
onClick: n[7] ||= (e) => C(v)?.chain().focus().toggleItalic().run(),
|
|
2112
|
-
onMousedown: n[8] ||= j(() => {}, ["prevent"])
|
|
2113
|
-
}, [...n[18] ||= [i("i", null, "I", -1)]], 42, dr),
|
|
2114
|
-
i("button", {
|
|
2115
|
-
class: k({ active: C(v)?.isActive("underline") }),
|
|
2116
|
-
type: "button",
|
|
2117
|
-
title: C(u)("blocks.text.underline"),
|
|
2118
|
-
"aria-label": C(u)("blocks.text.underline"),
|
|
2119
|
-
onClick: n[9] ||= (e) => C(v)?.chain().focus().toggleUnderline().run(),
|
|
2120
|
-
onMousedown: n[10] ||= j(() => {}, ["prevent"])
|
|
2121
|
-
}, [...n[19] ||= [i("u", null, "U", -1)]], 42, fr),
|
|
2122
|
-
i("button", {
|
|
2123
|
-
ref_key: "linkTrigger",
|
|
2124
|
-
ref: Qe,
|
|
2125
|
-
class: k({ active: C(v)?.isActive("link") }),
|
|
2126
|
-
type: "button",
|
|
2127
|
-
title: C(u)("blocks.text.link"),
|
|
2128
|
-
popovertarget: C(Ye),
|
|
2129
|
-
"aria-haspopup": "dialog",
|
|
2130
|
-
"aria-expanded": et.value,
|
|
2131
|
-
onMousedown: n[11] ||= j(() => {}, ["prevent"])
|
|
2132
|
-
}, [E(R, {
|
|
2133
|
-
name: "link",
|
|
2134
|
-
size: 16
|
|
2135
|
-
})], 42, pr),
|
|
2136
|
-
l.editable ? (_(), D("div", {
|
|
2137
|
-
key: 0,
|
|
2138
|
-
id: C(Ye),
|
|
2139
|
-
ref_key: "linkPopover",
|
|
2140
|
-
ref: U,
|
|
2141
|
-
class: "link-popover",
|
|
2142
|
-
popover: "",
|
|
2143
|
-
role: "dialog",
|
|
2144
|
-
"aria-label": C(u)("blocks.text.link"),
|
|
2145
|
-
onBeforetoggle: K,
|
|
2146
|
-
onToggle: nt,
|
|
2147
|
-
onFocusout: rt
|
|
2148
|
-
}, [
|
|
2149
|
-
i("span", hr, [E(Te, {
|
|
2150
|
-
ref_key: "linkInput",
|
|
2151
|
-
ref: W,
|
|
2152
|
-
modelValue: G.value,
|
|
2153
|
-
"onUpdate:modelValue": n[12] ||= (e) => G.value = e,
|
|
2154
|
-
inputmode: "url",
|
|
2155
|
-
spellcheck: "false",
|
|
2156
|
-
autocomplete: "off",
|
|
2157
|
-
placeholder: C(u)("blocks.text.linkPlaceholder"),
|
|
2158
|
-
"aria-label": C(u)("blocks.text.linkPrompt"),
|
|
2159
|
-
onKeydown: ne(j(it, ["prevent"]), ["enter"])
|
|
2093
|
+
f(O(at), {
|
|
2094
|
+
width: l.width,
|
|
2095
|
+
align: l.align
|
|
2096
|
+
}, {
|
|
2097
|
+
default: C(() => [f(O(Qt), {
|
|
2098
|
+
ref_key: "content",
|
|
2099
|
+
ref: ae,
|
|
2100
|
+
class: D({
|
|
2101
|
+
"text-input": l.editable,
|
|
2102
|
+
"text-spaced": l.paragraphSpacing !== void 0
|
|
2103
|
+
}),
|
|
2104
|
+
editor: O(S),
|
|
2105
|
+
style: re([O(Ne)(l), l.paragraphSpacing === void 0 ? void 0 : { "--bygga-paragraph-spacing": `${l.paragraphSpacing}px` }])
|
|
2160
2106
|
}, null, 8, [
|
|
2161
|
-
"
|
|
2162
|
-
"
|
|
2163
|
-
"
|
|
2164
|
-
"onKeydown"
|
|
2107
|
+
"class",
|
|
2108
|
+
"editor",
|
|
2109
|
+
"style"
|
|
2165
2110
|
])]),
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2111
|
+
_: 1
|
|
2112
|
+
}, 8, ["width", "align"]),
|
|
2113
|
+
l.editable ? (y(), t("div", {
|
|
2114
|
+
key: 0,
|
|
2115
|
+
ref_key: "toolbar",
|
|
2116
|
+
ref: T,
|
|
2117
|
+
popover: "manual",
|
|
2118
|
+
class: "toolbar",
|
|
2119
|
+
onToggle: P
|
|
2120
|
+
}, [
|
|
2121
|
+
i("span", ir, [i("select", {
|
|
2122
|
+
"aria-label": O(p)("blocks.text.styleLabel"),
|
|
2123
|
+
class: "style",
|
|
2124
|
+
value: Te(),
|
|
2125
|
+
onChange: F,
|
|
2126
|
+
onMousedown: n[0] ||= _(() => {}, ["stop"])
|
|
2127
|
+
}, [l.headerOnly ? E("", !0) : (y(), t("option", or, x(O(p)("blocks.text.styleNormal")), 1)), (y(!0), t(r, null, u(O(We), (e) => (y(), t("option", {
|
|
2128
|
+
key: e,
|
|
2129
|
+
value: `h${e}`
|
|
2130
|
+
}, x(O(p)("blocks.text.styleHeading", { level: e })), 9, sr))), 128))], 40, ar), f(M, {
|
|
2131
|
+
class: "picker-chevron",
|
|
2132
|
+
name: "chevron-down",
|
|
2133
|
+
size: 12
|
|
2134
|
+
})]),
|
|
2135
|
+
n[24] ||= i("span", { class: "divider" }, null, -1),
|
|
2136
|
+
i("span", cr, [i("select", {
|
|
2137
|
+
"aria-label": O(p)("blocks.text.font"),
|
|
2138
|
+
class: "font",
|
|
2139
|
+
value: Re(),
|
|
2140
|
+
onChange: V,
|
|
2141
|
+
onMousedown: n[1] ||= _(() => {}, ["stop"])
|
|
2142
|
+
}, [
|
|
2143
|
+
i("option", ur, x(O(p)("blocks.text.fontMixed")), 1),
|
|
2144
|
+
(y(!0), t(r, null, u(O($e), (e) => (y(), t("option", {
|
|
2145
|
+
key: e.key,
|
|
2146
|
+
value: e.key
|
|
2147
|
+
}, x(e.name), 9, dr))), 128)),
|
|
2148
|
+
(y(!0), t(r, null, u(O(L), (e) => (y(), t("option", {
|
|
2149
|
+
key: z(e.name),
|
|
2150
|
+
value: z(e.name)
|
|
2151
|
+
}, x(e.name), 9, fr))), 128))
|
|
2152
|
+
], 40, lr), f(M, {
|
|
2153
|
+
class: "picker-chevron",
|
|
2154
|
+
name: "chevron-down",
|
|
2155
|
+
size: 12
|
|
2156
|
+
})]),
|
|
2157
|
+
i("span", pr, [i("select", {
|
|
2158
|
+
"aria-label": O(p)("blocks.text.fontSize"),
|
|
2159
|
+
class: "size",
|
|
2160
|
+
value: Ge(),
|
|
2161
|
+
onChange: Qe,
|
|
2162
|
+
onMousedown: n[2] ||= _(() => {}, ["stop"])
|
|
2163
|
+
}, [
|
|
2164
|
+
i("option", hr, x(O(p)("blocks.text.fontMixed")), 1),
|
|
2165
|
+
i("option", gr, x(O(p)("blocks.text.fontSizeDefault")), 1),
|
|
2166
|
+
(y(!0), t(r, null, u(O(Be), (e) => (y(), t("option", {
|
|
2173
2167
|
key: e,
|
|
2174
|
-
value: e
|
|
2175
|
-
},
|
|
2176
|
-
|
|
2177
|
-
|
|
2168
|
+
value: O(Tn)(e)
|
|
2169
|
+
}, x(e), 9, _r))), 128))
|
|
2170
|
+
], 40, mr), f(M, {
|
|
2171
|
+
class: "picker-chevron",
|
|
2172
|
+
name: "chevron-down",
|
|
2173
|
+
size: 12
|
|
2174
|
+
})]),
|
|
2175
|
+
f(Je, {
|
|
2176
|
+
modelValue: tt.value,
|
|
2177
|
+
"onUpdate:modelValue": n[3] ||= (e) => tt.value = e,
|
|
2178
|
+
"allow-transparent": !1,
|
|
2179
|
+
label: O(p)("blocks.text.textColor"),
|
|
2180
|
+
compact: "",
|
|
2181
|
+
"keep-focus": "",
|
|
2182
|
+
onMousedown: n[4] ||= _(() => {}, ["stop"])
|
|
2183
|
+
}, null, 8, ["modelValue", "label"]),
|
|
2184
|
+
n[25] ||= i("span", { class: "divider" }, null, -1),
|
|
2185
|
+
i("button", {
|
|
2186
|
+
class: D({ active: O(S)?.isActive("bold") }),
|
|
2187
|
+
type: "button",
|
|
2188
|
+
title: O(p)("blocks.text.bold"),
|
|
2189
|
+
"aria-label": O(p)("blocks.text.bold"),
|
|
2190
|
+
onClick: n[5] ||= (e) => O(S)?.chain().focus().toggleBold().run(),
|
|
2191
|
+
onMousedown: n[6] ||= _(() => {}, ["prevent"])
|
|
2192
|
+
}, [...n[21] ||= [i("b", null, "B", -1)]], 42, vr),
|
|
2193
|
+
i("button", {
|
|
2194
|
+
class: D({ active: O(S)?.isActive("italic") }),
|
|
2195
|
+
type: "button",
|
|
2196
|
+
title: O(p)("blocks.text.italic"),
|
|
2197
|
+
"aria-label": O(p)("blocks.text.italic"),
|
|
2198
|
+
onClick: n[7] ||= (e) => O(S)?.chain().focus().toggleItalic().run(),
|
|
2199
|
+
onMousedown: n[8] ||= _(() => {}, ["prevent"])
|
|
2200
|
+
}, [...n[22] ||= [i("i", null, "I", -1)]], 42, yr),
|
|
2178
2201
|
i("button", {
|
|
2179
|
-
class: "
|
|
2202
|
+
class: D({ active: O(S)?.isActive("underline") }),
|
|
2180
2203
|
type: "button",
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2204
|
+
title: O(p)("blocks.text.underline"),
|
|
2205
|
+
"aria-label": O(p)("blocks.text.underline"),
|
|
2206
|
+
onClick: n[9] ||= (e) => O(S)?.chain().focus().toggleUnderline().run(),
|
|
2207
|
+
onMousedown: n[10] ||= _(() => {}, ["prevent"])
|
|
2208
|
+
}, [...n[23] ||= [i("u", null, "U", -1)]], 42, br),
|
|
2209
|
+
i("button", {
|
|
2210
|
+
ref_key: "linkTrigger",
|
|
2211
|
+
ref: W,
|
|
2212
|
+
class: D({ active: O(S)?.isActive("link") }),
|
|
2187
2213
|
type: "button",
|
|
2188
|
-
title:
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2214
|
+
title: O(p)("blocks.text.link"),
|
|
2215
|
+
popovertarget: O(it),
|
|
2216
|
+
"aria-haspopup": "dialog",
|
|
2217
|
+
"aria-expanded": st.value,
|
|
2218
|
+
onMousedown: n[11] ||= _(() => {}, ["prevent"])
|
|
2219
|
+
}, [f(M, {
|
|
2220
|
+
name: "link",
|
|
2194
2221
|
size: 16
|
|
2195
|
-
})],
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2222
|
+
})], 42, xr),
|
|
2223
|
+
l.editable ? (y(), t("div", {
|
|
2224
|
+
key: 0,
|
|
2225
|
+
id: O(it),
|
|
2226
|
+
ref_key: "linkPopover",
|
|
2227
|
+
ref: U,
|
|
2228
|
+
class: "link-popover",
|
|
2229
|
+
popover: "",
|
|
2230
|
+
role: "dialog",
|
|
2231
|
+
"aria-label": O(p)("blocks.text.link"),
|
|
2232
|
+
onBeforetoggle: lt,
|
|
2233
|
+
onToggle: ut,
|
|
2234
|
+
onFocusout: dt
|
|
2235
|
+
}, [
|
|
2236
|
+
i("span", Cr, [f(Pe, {
|
|
2237
|
+
ref_key: "linkInput",
|
|
2238
|
+
ref: ot,
|
|
2239
|
+
modelValue: G.value,
|
|
2240
|
+
"onUpdate:modelValue": n[12] ||= (e) => G.value = e,
|
|
2241
|
+
inputmode: "url",
|
|
2242
|
+
spellcheck: "false",
|
|
2243
|
+
autocomplete: "off",
|
|
2244
|
+
placeholder: O(p)("blocks.text.linkPlaceholder"),
|
|
2245
|
+
"aria-label": O(p)("blocks.text.linkPrompt"),
|
|
2246
|
+
onKeydown: le(_(K, ["prevent"]), ["enter"])
|
|
2247
|
+
}, null, 8, [
|
|
2248
|
+
"modelValue",
|
|
2249
|
+
"placeholder",
|
|
2250
|
+
"aria-label",
|
|
2251
|
+
"onKeydown"
|
|
2252
|
+
])]),
|
|
2253
|
+
O(ft).length ? (y(), t("span", wr, [f(ze, {
|
|
2254
|
+
"aria-label": O(p)("blocks.common.anchorLink.label"),
|
|
2255
|
+
"model-value": pt.value,
|
|
2256
|
+
"onUpdate:modelValue": mt,
|
|
2257
|
+
onMousedown: n[13] ||= _(() => {}, ["stop"])
|
|
2258
|
+
}, {
|
|
2259
|
+
default: C(() => [pt.value ? (y(), t("option", Tr, x(O(p)("blocks.common.anchorLink.none")), 1)) : (y(), t("option", Er, x(O(p)("blocks.common.anchorLink.placeholder")), 1)), (y(!0), t(r, null, u(O(ft), (e) => (y(), t("option", {
|
|
2260
|
+
key: e,
|
|
2261
|
+
value: e
|
|
2262
|
+
}, " #" + x(e), 9, Dr))), 128))]),
|
|
2263
|
+
_: 1
|
|
2264
|
+
}, 8, ["aria-label", "model-value"])])) : E("", !0),
|
|
2265
|
+
i("button", {
|
|
2266
|
+
class: "link-apply",
|
|
2267
|
+
type: "button",
|
|
2268
|
+
onClick: K,
|
|
2269
|
+
onMousedown: n[14] ||= _(() => {}, ["prevent"])
|
|
2270
|
+
}, x(O(p)("blocks.text.linkApply")), 33),
|
|
2271
|
+
ct.value ? (y(), t("button", {
|
|
2272
|
+
key: 1,
|
|
2273
|
+
class: "link-remove",
|
|
2274
|
+
type: "button",
|
|
2275
|
+
title: O(p)("blocks.text.linkRemove"),
|
|
2276
|
+
"aria-label": O(p)("blocks.text.linkRemove"),
|
|
2277
|
+
onClick: ht,
|
|
2278
|
+
onMousedown: n[15] ||= _(() => {}, ["prevent"])
|
|
2279
|
+
}, [f(M, {
|
|
2280
|
+
name: "trash",
|
|
2281
|
+
size: 16
|
|
2282
|
+
})], 40, Or)) : E("", !0)
|
|
2283
|
+
], 40, Sr)) : E("", !0),
|
|
2284
|
+
f(Cn, { onSelect: Et }),
|
|
2285
|
+
f(hn, {
|
|
2286
|
+
actions: Ct.value,
|
|
2287
|
+
pending: wt.value,
|
|
2288
|
+
onSelect: Tt
|
|
2289
|
+
}, null, 8, ["actions", "pending"]),
|
|
2290
|
+
n[26] ||= i("span", { class: "divider" }, null, -1),
|
|
2291
|
+
(y(), t(r, null, u(g, (e) => i("button", {
|
|
2292
|
+
key: e,
|
|
2293
|
+
class: D({ active: O(S)?.isActive({ textAlign: e }) }),
|
|
2294
|
+
title: O(p)(rt[e]),
|
|
2295
|
+
type: "button",
|
|
2296
|
+
onClick: (t) => O(S)?.chain().focus().setTextAlign(e).run(),
|
|
2297
|
+
onMousedown: n[16] ||= _(() => {}, ["prevent"])
|
|
2298
|
+
}, [(y(), t("svg", Ar, [(y(!0), t(r, null, u(H(e), (e, n) => (y(), t("rect", {
|
|
2299
|
+
key: n,
|
|
2300
|
+
fill: "currentColor",
|
|
2301
|
+
height: "1.5",
|
|
2302
|
+
rx: "0.5",
|
|
2303
|
+
width: e.w,
|
|
2304
|
+
x: e.x,
|
|
2305
|
+
y: e.y
|
|
2306
|
+
}, null, 8, jr))), 128))]))], 42, kr)), 64))
|
|
2307
|
+
], 544)) : E("", !0),
|
|
2308
|
+
l.editable ? (y(), t("div", {
|
|
2309
|
+
key: 1,
|
|
2310
|
+
ref_key: "pastePrompt",
|
|
2311
|
+
ref: q,
|
|
2312
|
+
popover: "manual",
|
|
2313
|
+
class: "paste-prompt",
|
|
2314
|
+
role: "dialog",
|
|
2315
|
+
tabindex: "-1",
|
|
2316
|
+
"aria-labelledby": O(_t),
|
|
2317
|
+
onKeydown: le(_(Z, ["stop", "prevent"]), ["esc"]),
|
|
2318
|
+
onFocusout: bt
|
|
2319
|
+
}, [
|
|
2320
|
+
i("span", { id: O(_t) }, x(O(p)("blocks.text.pastePrompt.question")), 9, Nr),
|
|
2321
|
+
i("button", {
|
|
2322
|
+
ref_key: "pasteKeep",
|
|
2323
|
+
ref: gt,
|
|
2324
|
+
class: "paste-keep",
|
|
2325
|
+
type: "button",
|
|
2326
|
+
onClick: n[17] ||= (e) => X(!0),
|
|
2327
|
+
onMousedown: n[18] ||= _(() => {}, ["prevent"])
|
|
2328
|
+
}, x(O(p)("blocks.text.pastePrompt.keep")), 545),
|
|
2329
|
+
i("button", {
|
|
2330
|
+
class: "paste-plain",
|
|
2331
|
+
type: "button",
|
|
2332
|
+
onClick: n[19] ||= (e) => X(!1),
|
|
2333
|
+
onMousedown: n[20] ||= _(() => {}, ["prevent"])
|
|
2334
|
+
}, x(O(p)("blocks.text.pastePrompt.plain")), 33)
|
|
2335
|
+
], 40, Mr)) : E("", !0)
|
|
2336
|
+
], 544));
|
|
2337
|
+
}
|
|
2338
|
+
}), [["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-7fc8d0cb]{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-7fc8d0cb]:popover-open{display:flex}.toolbar>button[data-v-7fc8d0cb]{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-7fc8d0cb]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.toolbar>button.active[data-v-7fc8d0cb]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.toolbar .picker[data-v-7fc8d0cb]{align-items:center;display:inline-flex;position:relative}.toolbar .style[data-v-7fc8d0cb],.toolbar .font[data-v-7fc8d0cb],.toolbar .size[data-v-7fc8d0cb]{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-7fc8d0cb]:hover,.toolbar .font[data-v-7fc8d0cb]:hover,.toolbar .size[data-v-7fc8d0cb]:hover{background:color-mix(in srgb, var(--bygga-color-text) 7%, transparent)}.toolbar .picker-chevron[data-v-7fc8d0cb]{color:var(--bygga-color-text);pointer-events:none;position:absolute;right:5px}.toolbar .divider[data-v-7fc8d0cb]{background:var(--bygga-color-divider);width:1px;height:24px;margin:0 4px}.link-popover[data-v-7fc8d0cb]{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-7fc8d0cb]:popover-open{display:flex}.link-field[data-v-7fc8d0cb]{width:18em}.link-anchor[data-v-7fc8d0cb]{width:10em}.link-apply[data-v-7fc8d0cb]{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-7fc8d0cb]{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-7fc8d0cb]:hover{background:var(--bygga-color-track);color:var(--bygga-color-accent)}.paste-prompt[data-v-7fc8d0cb]{background:var(--bygga-color-surface);border:1px solid var(--bygga-color-border);border-radius:var(--bygga-radius-sm);box-shadow:var(--bygga-shadow-card);color:var(--bygga-color-text);font-family:var(--bygga-font-family);white-space:nowrap;direction:ltr;align-items:center;gap:8px;margin:0;padding:6px 6px 6px 10px;font-size:13px;font-weight:400;position:fixed;inset:auto}.paste-prompt[data-v-7fc8d0cb]:popover-open{display:flex}.paste-keep[data-v-7fc8d0cb],.paste-plain[data-v-7fc8d0cb]{border-radius:var(--bygga-radius-sm);cursor:pointer;font:inherit;padding:.4em .8em}.paste-keep[data-v-7fc8d0cb]{background:var(--bygga-color-accent);border:1px solid var(--bygga-color-accent);color:var(--bygga-color-surface)}.paste-plain[data-v-7fc8d0cb]{border:1px solid var(--bygga-color-border);color:var(--bygga-color-text);background:0 0}"]], ["__scopeId", "data-v-7fc8d0cb"]]);
|
|
2223
2339
|
//#endregion
|
|
2224
|
-
export {
|
|
2340
|
+
export { Ir as default };
|