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