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