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