@bygga.dev/editor 1.3.0 → 1.4.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/{TextEditor-JwRYUlJJ.js → TextEditor-BfX5P-be.js} +482 -482
- package/bygga-editor.js +1317 -1260
- package/element.d.ts +10 -2
- package/package.json +1 -1
- package/{urls-B4ECLEvt.js → urls-T0CnP_ys.js} +2798 -2728
|
@@ -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
|
|
2
|
-
import { $ as
|
|
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 _, Z as v, _ as y, at as b, ct as x, f as S, ft as C, i as te, j as w, k as T, lt as E, ot as ne, q as re, rt as ie, t as ae, tt as D, v as O, w as k, x as A, y as j, z as M } from "./providerKeys-BrTFiegH.js";
|
|
2
|
+
import { $ as oe, $t as se, J as ce, Q as le, Qt as ue, St as N, T as de, Zt as fe, _t as P, at as pe, b as me, bt as he, c as ge, cn as _e, ct as ve, d as ye, dt as be, en as xe, et as Se, ft as F, gt as I, ht as L, in as Ce, it as we, l as Te, lt as Ee, mt as De, n as Oe, nn as ke, nt as R, ot as z, pt as B, q as Ae, r as V, rn as je, rt as H, s as Me, st as Ne, t as Pe, tn as Fe, tt as Ie, u as Le, un as Re, ut as ze, v as Be, vt as Ve, x as U, xt as W, yt as He } from "./urls-T0CnP_ys.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 Ue(e = {}) {
|
|
5
|
+
return new L({ view(t) {
|
|
6
|
+
return new We(t, e);
|
|
7
7
|
} });
|
|
8
8
|
}
|
|
9
|
-
var
|
|
9
|
+
var We = 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 = he(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
|
+
}, G = class e extends P {
|
|
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) : P.near(r);
|
|
107
107
|
}
|
|
108
108
|
content() {
|
|
109
|
-
return
|
|
109
|
+
return N.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 Ge(this.anchor);
|
|
126
126
|
}
|
|
127
127
|
static valid(e) {
|
|
128
128
|
let t = e.parent;
|
|
129
|
-
if (t.inlineContent || !
|
|
129
|
+
if (t.inlineContent || !qe(e) || !Je(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 && !De.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
|
+
G.prototype.visible = !1, G.findFrom = G.findGapCursorFrom, P.jsonID("gapcursor", G);
|
|
167
|
+
var Ge = 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 G.valid(t) ? new G(t) : P.near(t);
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
function
|
|
179
|
+
function Ke(e) {
|
|
180
180
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function qe(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 || Ke(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 Je(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,90 +201,90 @@ 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 || Ke(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 Ye() {
|
|
211
|
+
return new L({ props: {
|
|
212
|
+
decorations: $e,
|
|
213
213
|
createSelectionBetween(e, t, n) {
|
|
214
|
-
return t.pos == n.pos &&
|
|
214
|
+
return t.pos == n.pos && G.valid(n) ? new G(n) : null;
|
|
215
215
|
},
|
|
216
|
-
handleClick:
|
|
217
|
-
handleKeyDown:
|
|
218
|
-
handleDOMEvents: { beforeinput:
|
|
216
|
+
handleClick: Ze,
|
|
217
|
+
handleKeyDown: Xe,
|
|
218
|
+
handleDOMEvents: { beforeinput: Qe }
|
|
219
219
|
} });
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
ArrowLeft:
|
|
223
|
-
ArrowRight:
|
|
224
|
-
ArrowUp:
|
|
225
|
-
ArrowDown:
|
|
221
|
+
var Xe = be({
|
|
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 Ve) {
|
|
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 = G.findGapCursorFrom(o, t, s);
|
|
236
|
+
return c ? (r && r(e.tr.setSelection(new G(c))), !0) : !1;
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Ze(e, t, n) {
|
|
240
240
|
if (!e || !e.editable) return !1;
|
|
241
241
|
let r = e.state.doc.resolve(t);
|
|
242
|
-
if (!
|
|
242
|
+
if (!G.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 && De.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new G(r))), !0);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
249
|
+
function Qe(e, t) {
|
|
250
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof G)) 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 = W.empty;
|
|
254
|
+
for (let e = r.length - 1; e >= 0; e--) i = W.from(r[e].createAndFill(null, i));
|
|
255
|
+
let a = e.state.tr.replace(n.pos, n.pos, new N(i, 0, 0));
|
|
256
|
+
return a.setSelection(Ve.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
if (!(e.selection instanceof
|
|
258
|
+
function $e(e) {
|
|
259
|
+
if (!(e.selection instanceof G)) return null;
|
|
260
260
|
let t = document.createElement("div");
|
|
261
|
-
return t.className = "ProseMirror-gapcursor",
|
|
261
|
+
return t.className = "ProseMirror-gapcursor", B.create(e.doc, [F.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
|
|
266
|
-
|
|
267
|
-
return e.length ? (e =
|
|
268
|
-
},
|
|
269
|
-
return e.length ?
|
|
270
|
-
},
|
|
271
|
-
return new
|
|
272
|
-
},
|
|
273
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
274
|
-
},
|
|
265
|
+
var et = 200, q = function() {};
|
|
266
|
+
q.prototype.append = function(e) {
|
|
267
|
+
return e.length ? (e = q.from(e), !this.length && e || e.length < et && this.leafAppend(e) || this.length < et && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
268
|
+
}, q.prototype.prepend = function(e) {
|
|
269
|
+
return e.length ? q.from(e).append(this) : this;
|
|
270
|
+
}, q.prototype.appendInner = function(e) {
|
|
271
|
+
return new nt(this, e);
|
|
272
|
+
}, q.prototype.slice = function(e, t) {
|
|
273
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? q.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
274
|
+
}, q.prototype.get = function(e) {
|
|
275
275
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
276
|
-
},
|
|
276
|
+
}, q.prototype.forEach = function(e, t, n) {
|
|
277
277
|
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);
|
|
278
|
-
},
|
|
278
|
+
}, q.prototype.map = function(e, t, n) {
|
|
279
279
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
280
280
|
var r = [];
|
|
281
281
|
return this.forEach(function(t, n) {
|
|
282
282
|
return r.push(e(t, n));
|
|
283
283
|
}, t, n), r;
|
|
284
|
-
},
|
|
285
|
-
return e instanceof
|
|
284
|
+
}, q.from = function(e) {
|
|
285
|
+
return e instanceof q ? e : e && e.length ? new tt(e) : q.empty;
|
|
286
286
|
};
|
|
287
|
-
var
|
|
287
|
+
var tt = /* @__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 <= et) 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 <= et) 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
|
-
}(
|
|
316
|
-
|
|
317
|
-
var
|
|
315
|
+
}(q);
|
|
316
|
+
q.empty = new tt([]);
|
|
317
|
+
var nt = /* @__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
|
-
}(
|
|
344
|
+
}(q), rt = 500, J = class e {
|
|
345
345
|
constructor(e, t) {
|
|
346
346
|
this.items = e, this.eventCount = t;
|
|
347
347
|
}
|
|
@@ -361,9 +361,9 @@ var et = /* @__PURE__ */ function(e) {
|
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
363
|
if (i) {
|
|
364
|
-
u.push(new
|
|
364
|
+
u.push(new Y(t.map));
|
|
365
365
|
let e = t.step.map(i.slice(a)), n;
|
|
366
|
-
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new
|
|
366
|
+
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new Y(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
|
|
367
367
|
} else o.maybeStep(t.step);
|
|
368
368
|
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;
|
|
369
369
|
}, this.items.length, 0), {
|
|
@@ -375,21 +375,21 @@ var et = /* @__PURE__ */ function(e) {
|
|
|
375
375
|
addTransform(t, n, r, i) {
|
|
376
376
|
let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
|
|
377
377
|
for (let e = 0; e < t.steps.length; e++) {
|
|
378
|
-
let r = t.steps[e].invert(t.docs[e]), l = new
|
|
378
|
+
let r = t.steps[e].invert(t.docs[e]), l = new Y(t.mapping.maps[e], r, n), u;
|
|
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 > at && (s = it(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 He();
|
|
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);
|
|
389
389
|
}, e, t), n;
|
|
390
390
|
}
|
|
391
391
|
addMaps(t) {
|
|
392
|
-
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new
|
|
392
|
+
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new Y(e))), this.eventCount);
|
|
393
393
|
}
|
|
394
394
|
rebased(t, n) {
|
|
395
395
|
if (!this.eventCount) return this;
|
|
@@ -405,13 +405,13 @@ var et = /* @__PURE__ */ function(e) {
|
|
|
405
405
|
let i = a.maps[n];
|
|
406
406
|
if (e.step) {
|
|
407
407
|
let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
|
|
408
|
-
l && s++, r.push(new
|
|
409
|
-
} else r.push(new
|
|
408
|
+
l && s++, r.push(new Y(i, o, l));
|
|
409
|
+
} else r.push(new Y(i));
|
|
410
410
|
}, i);
|
|
411
411
|
let l = [];
|
|
412
|
-
for (let e = n; e < o; e++) l.push(new
|
|
412
|
+
for (let e = n; e < o; e++) l.push(new Y(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() > rt && (u = u.compress(this.items.length - r.length)), u;
|
|
415
415
|
}
|
|
416
416
|
emptyItemCount() {
|
|
417
417
|
let e = 0;
|
|
@@ -428,21 +428,21 @@ var et = /* @__PURE__ */ function(e) {
|
|
|
428
428
|
if (r--, o && n.appendMap(o, r), t) {
|
|
429
429
|
let s = e.selection && e.selection.map(n.slice(r));
|
|
430
430
|
s && a++;
|
|
431
|
-
let c = new
|
|
431
|
+
let c = new Y(o.invert(), t, s), l, u = i.length - 1;
|
|
432
432
|
(l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
|
|
433
433
|
}
|
|
434
434
|
} else e.map && r--;
|
|
435
|
-
}, this.items.length, 0), new e(
|
|
435
|
+
}, this.items.length, 0), new e(q.from(i.reverse()), a);
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
|
-
|
|
439
|
-
function
|
|
438
|
+
J.empty = new J(q.empty, 0);
|
|
439
|
+
function it(e, t) {
|
|
440
440
|
let n;
|
|
441
441
|
return e.forEach((e, r) => {
|
|
442
442
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
443
443
|
}), e.slice(n);
|
|
444
444
|
}
|
|
445
|
-
var
|
|
445
|
+
var Y = class e {
|
|
446
446
|
constructor(e, t, n, r) {
|
|
447
447
|
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
|
|
448
448
|
}
|
|
@@ -452,25 +452,25 @@ var X = class e {
|
|
|
452
452
|
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, X = class {
|
|
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
|
|
461
|
-
let i = n.getMeta(
|
|
459
|
+
}, at = 20;
|
|
460
|
+
function ot(e, t, n, r) {
|
|
461
|
+
let i = n.getMeta(Z), a;
|
|
462
462
|
if (i) return i.historyState;
|
|
463
|
-
n.getMeta(
|
|
463
|
+
n.getMeta(mt) && (e = new X(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(
|
|
466
|
+
if (o && o.getMeta(Z)) return o.getMeta(Z).redo ? new X(e.done.addTransform(n, void 0, r, pt(t)), e.undone, ct(n.mapping.maps), e.prevTime, e.prevComposition) : new X(e.done, e.undone.addTransform(n, void 0, r, pt(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
|
|
470
|
-
} else if (a = n.getMeta("rebased")) return new
|
|
471
|
-
else return new
|
|
468
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !st(n, e.prevRanges)), s = o ? lt(e.prevRanges, n.mapping) : ct(n.mapping.maps);
|
|
469
|
+
return new X(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, pt(t)), J.empty, s, n.time, i ?? e.prevComposition);
|
|
470
|
+
} else if (a = n.getMeta("rebased")) return new X(e.done.rebased(n, a), e.undone.rebased(n, a), lt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
471
|
+
else return new X(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), lt(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function st(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 ct(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 lt(e, t) {
|
|
487
487
|
if (!e) return null;
|
|
488
488
|
let n = [];
|
|
489
489
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -492,62 +492,62 @@ function st(e, t) {
|
|
|
492
492
|
}
|
|
493
493
|
return n;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
let r =
|
|
495
|
+
function ut(e, t, n) {
|
|
496
|
+
let r = pt(t), i = Z.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
497
497
|
if (!a) return null;
|
|
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
|
|
499
|
-
return a.transform.setSelection(o).setMeta(
|
|
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 X(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
499
|
+
return a.transform.setSelection(o).setMeta(Z, {
|
|
500
500
|
redo: n,
|
|
501
501
|
historyState: c
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
|
-
var
|
|
505
|
-
function
|
|
504
|
+
var dt = !1, ft = null;
|
|
505
|
+
function pt(e) {
|
|
506
506
|
let t = e.plugins;
|
|
507
|
-
if (
|
|
508
|
-
|
|
507
|
+
if (ft != t) {
|
|
508
|
+
dt = !1, ft = t;
|
|
509
509
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
510
|
-
|
|
510
|
+
dt = !0;
|
|
511
511
|
break;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
return
|
|
514
|
+
return dt;
|
|
515
515
|
}
|
|
516
|
-
var
|
|
517
|
-
function
|
|
516
|
+
var Z = new I("history"), mt = new I("closeHistory");
|
|
517
|
+
function ht(e = {}) {
|
|
518
518
|
return e = {
|
|
519
519
|
depth: e.depth || 100,
|
|
520
520
|
newGroupDelay: e.newGroupDelay || 500
|
|
521
|
-
}, new
|
|
522
|
-
key:
|
|
521
|
+
}, new L({
|
|
522
|
+
key: Z,
|
|
523
523
|
state: {
|
|
524
524
|
init() {
|
|
525
|
-
return new
|
|
525
|
+
return new X(J.empty, J.empty, null, 0, -1);
|
|
526
526
|
},
|
|
527
527
|
apply(t, n, r) {
|
|
528
|
-
return
|
|
528
|
+
return ot(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" ? _t : n == "historyRedo" ? vt : 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 gt(e, t) {
|
|
539
539
|
return (n, r) => {
|
|
540
|
-
let i =
|
|
540
|
+
let i = Z.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 = ut(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 _t = gt(!1, !0), vt = gt(!0, !0);
|
|
550
|
+
H.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 L({
|
|
583
|
+
key: new I("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
|
+
}), H.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 [Ue(this.options)];
|
|
622
622
|
}
|
|
623
|
-
}),
|
|
623
|
+
}), H.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 L({
|
|
633
|
+
key: new I("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 B.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(F.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
649
|
+
}), B.create(e, a);
|
|
650
650
|
} }
|
|
651
651
|
})];
|
|
652
652
|
}
|
|
653
|
-
}),
|
|
653
|
+
}), H.create({
|
|
654
654
|
name: "gapCursor",
|
|
655
655
|
addProseMirrorPlugins() {
|
|
656
|
-
return [
|
|
656
|
+
return [Ye()];
|
|
657
657
|
},
|
|
658
658
|
extendNodeSchema(e) {
|
|
659
|
-
return { allowGapCursor:
|
|
659
|
+
return { allowGapCursor: pe(Ne(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 yt = "placeholder", Q = new I("tiptap__placeholder"), bt = 200;
|
|
667
|
+
function xt(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), F.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 St(e, t) {
|
|
680
680
|
return typeof e == "function" ? e(t) : e;
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function Ct({ 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 && ve(c)) {
|
|
688
688
|
let r = a >= l && a <= l + c.nodeSize;
|
|
689
|
-
o.push(
|
|
689
|
+
o.push(xt({
|
|
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: St(t.emptyNodeClass, {
|
|
698
698
|
editor: e,
|
|
699
699
|
node: c,
|
|
700
700
|
pos: l,
|
|
@@ -706,10 +706,10 @@ function xt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
706
706
|
}));
|
|
707
707
|
}
|
|
708
708
|
} else {
|
|
709
|
-
let i =
|
|
709
|
+
let i = Q.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 && ve(r);
|
|
712
|
+
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(xt({
|
|
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: St(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 B.create(r, o);
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function wt(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 Tt(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 Et(e) {
|
|
742
742
|
let t = e;
|
|
743
743
|
for (; t;) {
|
|
744
|
-
if (
|
|
744
|
+
if (Tt(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 Dt(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 Ot({ 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 ? Dt(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) - bt, a = Math.min(n.bottom, r.bottom) + bt;
|
|
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 kt = {
|
|
789
789
|
init() {
|
|
790
790
|
return {
|
|
791
791
|
topPos: null,
|
|
@@ -793,7 +793,7 @@ var Dt = {
|
|
|
793
793
|
};
|
|
794
794
|
},
|
|
795
795
|
apply(e, t) {
|
|
796
|
-
let n = e.getMeta(
|
|
796
|
+
let n = e.getMeta(Q);
|
|
797
797
|
return n?.positions ? {
|
|
798
798
|
topPos: n.positions.top,
|
|
799
799
|
bottomPos: n.positions.bottom
|
|
@@ -803,16 +803,16 @@ var Dt = {
|
|
|
803
803
|
} : t;
|
|
804
804
|
}
|
|
805
805
|
};
|
|
806
|
-
function
|
|
807
|
-
let t =
|
|
808
|
-
let n =
|
|
806
|
+
function At(e) {
|
|
807
|
+
let t = Et(e.dom), n = () => {
|
|
808
|
+
let n = Ot({
|
|
809
809
|
view: e,
|
|
810
810
|
scrollContainer: t
|
|
811
811
|
});
|
|
812
812
|
if (n === null) return;
|
|
813
|
-
let r =
|
|
813
|
+
let r = Q.getState(e.state);
|
|
814
814
|
if (r?.topPos === n.top && r?.bottomPos === n.bottom) return;
|
|
815
|
-
let i = e.state.tr.setMeta(
|
|
815
|
+
let i = e.state.tr.setMeta(Q, { positions: n });
|
|
816
816
|
e.dispatch(i);
|
|
817
817
|
}, r = null, i = 0, a = () => {
|
|
818
818
|
r === null && (r = requestAnimationFrame(() => {
|
|
@@ -834,13 +834,13 @@ function Ot(e) {
|
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
let n = t.dataAttribute ? `data-${
|
|
839
|
-
return new
|
|
840
|
-
key:
|
|
841
|
-
state:
|
|
842
|
-
view:
|
|
843
|
-
props: { decorations: ({ doc: r, selection: i }) =>
|
|
837
|
+
function jt({ editor: e, options: t }) {
|
|
838
|
+
let n = t.dataAttribute ? `data-${wt(t.dataAttribute)}` : `data-${yt}`;
|
|
839
|
+
return new L({
|
|
840
|
+
key: Q,
|
|
841
|
+
state: kt,
|
|
842
|
+
view: At,
|
|
843
|
+
props: { decorations: ({ doc: r, selection: i }) => Ct({
|
|
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 Mt = H.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: yt,
|
|
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 [jt({
|
|
867
867
|
editor: this.editor,
|
|
868
868
|
options: this.options
|
|
869
869
|
})];
|
|
870
870
|
}
|
|
871
|
-
}),
|
|
872
|
-
|
|
871
|
+
}), Nt = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
872
|
+
H.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" && z(Nt, e.options.injectNonce, "selection"), [new L({
|
|
880
|
+
key: new I("selection"),
|
|
881
881
|
props: { decorations(n) {
|
|
882
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
882
|
+
return n.selection.empty || e.isFocused || !e.isEditable || Ee(n.selection) || e.view.dragging ? null : B.create(n.doc, [F.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
883
883
|
} }
|
|
884
884
|
})];
|
|
885
885
|
}
|
|
886
886
|
});
|
|
887
|
-
function
|
|
887
|
+
function Pt({ types: e, node: t }) {
|
|
888
888
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
889
889
|
}
|
|
890
|
-
|
|
890
|
+
H.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 I(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 L({
|
|
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 !Pt({
|
|
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 !Pt({
|
|
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 Ft = H.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 }) => _t(e, t),
|
|
937
|
+
redo: () => ({ state: e, dispatch: t }) => vt(e, t)
|
|
938
938
|
};
|
|
939
939
|
},
|
|
940
940
|
addProseMirrorPlugins() {
|
|
941
|
-
return [
|
|
941
|
+
return [ht(this.options)];
|
|
942
942
|
},
|
|
943
943
|
addKeyboardShortcuts() {
|
|
944
944
|
return {
|
|
@@ -952,8 +952,8 @@ 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
|
|
956
|
-
return
|
|
955
|
+
function It(e) {
|
|
956
|
+
return v((t, n) => ({
|
|
957
957
|
get() {
|
|
958
958
|
return t(), e;
|
|
959
959
|
},
|
|
@@ -966,11 +966,11 @@ function Pt(e) {
|
|
|
966
966
|
}
|
|
967
967
|
}));
|
|
968
968
|
}
|
|
969
|
-
var
|
|
969
|
+
var Lt = class extends R {
|
|
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 = It(this.view.state), this.reactiveExtensionStorage = It(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
972
972
|
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
973
|
-
}),
|
|
973
|
+
}), D(this);
|
|
974
974
|
}
|
|
975
975
|
get state() {
|
|
976
976
|
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
@@ -986,19 +986,19 @@ 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
|
+
}, Rt = T({
|
|
990
990
|
name: "EditorContent",
|
|
991
991
|
props: { editor: {
|
|
992
992
|
default: null,
|
|
993
993
|
type: Object
|
|
994
994
|
} },
|
|
995
995
|
setup(t) {
|
|
996
|
-
let n =
|
|
996
|
+
let n = b(), r = e();
|
|
997
997
|
return c(() => {
|
|
998
998
|
let e = t.editor;
|
|
999
999
|
e && e.options.element && n.value && a(() => {
|
|
1000
1000
|
if (!n.value || !e.view.dom?.parentNode) return;
|
|
1001
|
-
let t =
|
|
1001
|
+
let t = x(n.value);
|
|
1002
1002
|
n.value.append(...e.view.dom.parentNode.childNodes), e.contentComponent = r.ctx._, r && (e.appContext = {
|
|
1003
1003
|
...r.appContext,
|
|
1004
1004
|
provides: r.provides
|
|
@@ -1010,12 +1010,12 @@ var Ft = class extends Pe {
|
|
|
1010
1010
|
}), { rootEl: n };
|
|
1011
1011
|
},
|
|
1012
1012
|
render() {
|
|
1013
|
-
return
|
|
1013
|
+
return w("div", { ref: (e) => {
|
|
1014
1014
|
this.rootEl = e;
|
|
1015
1015
|
} });
|
|
1016
1016
|
}
|
|
1017
1017
|
});
|
|
1018
|
-
|
|
1018
|
+
T({
|
|
1019
1019
|
name: "NodeViewContent",
|
|
1020
1020
|
props: { as: {
|
|
1021
1021
|
type: String,
|
|
@@ -1031,13 +1031,13 @@ w({
|
|
|
1031
1031
|
e && e(null);
|
|
1032
1032
|
},
|
|
1033
1033
|
render() {
|
|
1034
|
-
return
|
|
1034
|
+
return w(this.as, {
|
|
1035
1035
|
style: { whiteSpace: "pre-wrap" },
|
|
1036
1036
|
"data-node-view-content": ""
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
1039
|
});
|
|
1040
|
-
var
|
|
1040
|
+
var zt = T({
|
|
1041
1041
|
name: "NodeViewWrapper",
|
|
1042
1042
|
props: { as: {
|
|
1043
1043
|
type: String,
|
|
@@ -1046,24 +1046,24 @@ var Lt = w({
|
|
|
1046
1046
|
inject: ["onDragStart", "decorationClasses"],
|
|
1047
1047
|
render() {
|
|
1048
1048
|
var e;
|
|
1049
|
-
return
|
|
1049
|
+
return w(this.as, {
|
|
1050
1050
|
class: this.decorationClasses,
|
|
1051
1051
|
style: { whiteSpace: "normal" },
|
|
1052
1052
|
"data-node-view-wrapper": "",
|
|
1053
1053
|
onDragstart: this.onDragStart
|
|
1054
1054
|
}, (e = this.$slots).default?.call(e));
|
|
1055
1055
|
}
|
|
1056
|
-
}),
|
|
1057
|
-
let t =
|
|
1056
|
+
}), Bt = (e = {}) => {
|
|
1057
|
+
let t = ne();
|
|
1058
1058
|
return u(() => {
|
|
1059
|
-
t.value = new
|
|
1059
|
+
t.value = new Lt(e);
|
|
1060
1060
|
}), s(() => {
|
|
1061
1061
|
var e;
|
|
1062
1062
|
(e = t.value) == null || e.destroy();
|
|
1063
1063
|
}), t;
|
|
1064
|
-
},
|
|
1064
|
+
}, Vt = 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 = D(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;
|
|
@@ -1073,11 +1073,11 @@ var Lt = w({
|
|
|
1073
1073
|
}
|
|
1074
1074
|
renderComponent() {
|
|
1075
1075
|
if (this.destroyed) return this.renderedComponent;
|
|
1076
|
-
let e =
|
|
1077
|
-
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el &&
|
|
1076
|
+
let e = w(this.component, this.props);
|
|
1077
|
+
return this.editor.appContext && (e.appContext = this.editor.appContext), typeof document < "u" && this.el && S(e, this.el), {
|
|
1078
1078
|
vNode: e,
|
|
1079
1079
|
destroy: () => {
|
|
1080
|
-
this.el &&
|
|
1080
|
+
this.el && S(null, this.el), this.el = null, e = null;
|
|
1081
1081
|
},
|
|
1082
1082
|
el: this.el ? this.el.firstElementChild : null
|
|
1083
1083
|
};
|
|
@@ -1091,20 +1091,20 @@ var Lt = w({
|
|
|
1091
1091
|
this.destroyed || (this.destroyed = !0, this.renderedComponent.destroy());
|
|
1092
1092
|
}
|
|
1093
1093
|
};
|
|
1094
|
-
|
|
1094
|
+
T({
|
|
1095
1095
|
name: "MarkViewContent",
|
|
1096
1096
|
props: { as: {
|
|
1097
1097
|
type: String,
|
|
1098
1098
|
default: "span"
|
|
1099
1099
|
} },
|
|
1100
1100
|
render() {
|
|
1101
|
-
return
|
|
1101
|
+
return w(this.as, {
|
|
1102
1102
|
style: { whiteSpace: "inherit" },
|
|
1103
1103
|
"data-mark-view-content": ""
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
1106
1106
|
});
|
|
1107
|
-
var
|
|
1107
|
+
var Ht = {
|
|
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
|
+
}, Ut = class extends we {
|
|
1153
1153
|
constructor(e, t, n) {
|
|
1154
1154
|
super(e, t, n), this.cachedExtensionWithSyncedStorage = null, this.handlePositionUpdate = () => {
|
|
1155
1155
|
let e = this.getPos();
|
|
@@ -1179,8 +1179,8 @@ var Bt = {
|
|
|
1179
1179
|
updateAttributes: (e = {}) => this.updateAttributes(e),
|
|
1180
1180
|
deleteNode: () => this.deleteNode()
|
|
1181
1181
|
}, n = e, r = this.onDragStart.bind(this);
|
|
1182
|
-
this.decorationClasses =
|
|
1183
|
-
let i =
|
|
1182
|
+
this.decorationClasses = b(this.getDecorationClasses());
|
|
1183
|
+
let i = T({
|
|
1184
1184
|
extends: { ...this.component },
|
|
1185
1185
|
props: Object.keys(e),
|
|
1186
1186
|
template: this.component.template,
|
|
@@ -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 Vt(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 (ze({
|
|
1213
1213
|
selection: this.editor.state.selection,
|
|
1214
1214
|
pos: e,
|
|
1215
1215
|
nodeSize: this.node.nodeSize,
|
|
@@ -1267,111 +1267,111 @@ 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 Wt(e, t) {
|
|
1271
|
+
return (n) => n.editor.contentComponent ? new Ut(typeof e == "function" && "__vccOpts" in e ? e.__vccOpts : e, n, t) : {};
|
|
1272
1272
|
}
|
|
1273
1273
|
//#endregion
|
|
1274
1274
|
//#region src/components/MergeTagPicker.vue?vue&type=script&setup=true&lang.ts
|
|
1275
|
-
var
|
|
1275
|
+
var Gt = [
|
|
1276
1276
|
"title",
|
|
1277
1277
|
"aria-label",
|
|
1278
1278
|
"popovertarget",
|
|
1279
1279
|
"aria-expanded"
|
|
1280
|
-
],
|
|
1280
|
+
], Kt = ["id", "aria-label"], qt = {
|
|
1281
1281
|
key: 0,
|
|
1282
1282
|
class: "merge-tag-list"
|
|
1283
|
-
},
|
|
1283
|
+
}, Jt = ["onClick"], Yt = { class: "merge-tag-option-label" }, Xt = { class: "merge-tag-option-id" }, Zt = {
|
|
1284
1284
|
key: 1,
|
|
1285
1285
|
class: "merge-tag-empty"
|
|
1286
|
-
},
|
|
1286
|
+
}, Qt = /*#__PURE__*/ de(/* @__PURE__ */ T({
|
|
1287
1287
|
__name: "MergeTagPicker",
|
|
1288
1288
|
emits: ["select"],
|
|
1289
1289
|
setup(e, { emit: t }) {
|
|
1290
|
-
let n = t, { t: i, locale: o } =
|
|
1290
|
+
let n = t, { t: i, locale: o } = me(), s = d(Be, A(() => ({}))), c = A(() => Oe(s.value).map((e) => ({
|
|
1291
1291
|
id: e,
|
|
1292
|
-
label:
|
|
1293
|
-
}))), u =
|
|
1292
|
+
label: V(s.value, e, o.value)
|
|
1293
|
+
}))), u = b(""), f = A(() => {
|
|
1294
1294
|
let e = u.value.trim().toLowerCase();
|
|
1295
1295
|
return e ? c.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : c.value;
|
|
1296
|
-
}), p = ee(),
|
|
1297
|
-
function
|
|
1296
|
+
}), p = ee(), _ = A(() => y.value?.matches(":popover-open") ?? !1), v = l("trigger"), y = l("popover"), S = l("filterInput");
|
|
1297
|
+
function te(e) {
|
|
1298
1298
|
if (e.newState !== "open") return;
|
|
1299
1299
|
u.value = "";
|
|
1300
|
-
let t =
|
|
1300
|
+
let t = y.value, n = v.value?.getBoundingClientRect();
|
|
1301
1301
|
t && n && (t.style.left = `${n.left}px`, t.style.top = `${n.bottom + 4}px`);
|
|
1302
1302
|
}
|
|
1303
|
-
function C(e) {
|
|
1304
|
-
e.newState === "open" && a(() => x.value?.focus());
|
|
1305
|
-
}
|
|
1306
1303
|
function w(e) {
|
|
1307
|
-
|
|
1304
|
+
e.newState === "open" && a(() => S.value?.focus());
|
|
1305
|
+
}
|
|
1306
|
+
function T(e) {
|
|
1307
|
+
let t = e.relatedTarget, n = y.value;
|
|
1308
1308
|
t instanceof Node && n?.contains(t) || n?.matches(":popover-open") && n.hidePopover();
|
|
1309
1309
|
}
|
|
1310
|
-
function
|
|
1311
|
-
n("select", e),
|
|
1310
|
+
function ne(e) {
|
|
1311
|
+
n("select", e), y.value?.hidePopover();
|
|
1312
1312
|
}
|
|
1313
|
-
return (e, t) => (
|
|
1313
|
+
return (e, t) => (M(), h(j, null, [c.value.length ? (M(), h("button", {
|
|
1314
1314
|
key: 0,
|
|
1315
1315
|
ref_key: "trigger",
|
|
1316
|
-
ref:
|
|
1316
|
+
ref: v,
|
|
1317
1317
|
type: "button",
|
|
1318
|
-
class:
|
|
1319
|
-
title:
|
|
1320
|
-
"aria-label":
|
|
1321
|
-
popovertarget:
|
|
1318
|
+
class: E(["merge-tag-trigger", { active: _.value }]),
|
|
1319
|
+
title: x(i)("blocks.text.mergeTag"),
|
|
1320
|
+
"aria-label": x(i)("blocks.text.mergeTag"),
|
|
1321
|
+
popovertarget: x(p),
|
|
1322
1322
|
"aria-haspopup": "dialog",
|
|
1323
|
-
"aria-expanded":
|
|
1324
|
-
onMousedown: t[0] ||=
|
|
1325
|
-
}, [r(
|
|
1323
|
+
"aria-expanded": _.value,
|
|
1324
|
+
onMousedown: t[0] ||= O(() => {}, ["prevent"])
|
|
1325
|
+
}, [r(U, {
|
|
1326
1326
|
name: "braces",
|
|
1327
1327
|
size: 16
|
|
1328
|
-
})], 42,
|
|
1328
|
+
})], 42, Gt)) : k("", !0), c.value.length ? (M(), h("div", {
|
|
1329
1329
|
key: 1,
|
|
1330
|
-
id:
|
|
1330
|
+
id: x(p),
|
|
1331
1331
|
ref_key: "popover",
|
|
1332
|
-
ref:
|
|
1332
|
+
ref: y,
|
|
1333
1333
|
class: "merge-tag-popover",
|
|
1334
1334
|
popover: "",
|
|
1335
1335
|
role: "dialog",
|
|
1336
|
-
"aria-label":
|
|
1337
|
-
onBeforetoggle:
|
|
1338
|
-
onToggle:
|
|
1339
|
-
onFocusout:
|
|
1340
|
-
}, [r(
|
|
1336
|
+
"aria-label": x(i)("blocks.text.mergeTag"),
|
|
1337
|
+
onBeforetoggle: te,
|
|
1338
|
+
onToggle: w,
|
|
1339
|
+
onFocusout: T
|
|
1340
|
+
}, [r(ye, {
|
|
1341
1341
|
ref_key: "filterInput",
|
|
1342
|
-
ref:
|
|
1342
|
+
ref: S,
|
|
1343
1343
|
modelValue: u.value,
|
|
1344
1344
|
"onUpdate:modelValue": t[1] ||= (e) => u.value = e,
|
|
1345
1345
|
autocomplete: "off",
|
|
1346
|
-
placeholder:
|
|
1347
|
-
"aria-label":
|
|
1346
|
+
placeholder: x(i)("blocks.text.mergeTagSearch"),
|
|
1347
|
+
"aria-label": x(i)("blocks.text.mergeTagSearch"),
|
|
1348
1348
|
spellcheck: "false"
|
|
1349
1349
|
}, null, 8, [
|
|
1350
1350
|
"modelValue",
|
|
1351
1351
|
"placeholder",
|
|
1352
1352
|
"aria-label"
|
|
1353
|
-
]), f.value.length ? (
|
|
1353
|
+
]), f.value.length ? (M(), h("ul", qt, [(M(!0), h(j, null, g(f.value, (e) => (M(), h("li", { key: e.id }, [m("button", {
|
|
1354
1354
|
type: "button",
|
|
1355
1355
|
class: "merge-tag-option",
|
|
1356
|
-
onClick: (t) =>
|
|
1357
|
-
onMousedown: t[2] ||=
|
|
1358
|
-
}, [m("span",
|
|
1356
|
+
onClick: (t) => ne(e.id),
|
|
1357
|
+
onMousedown: t[2] ||= O(() => {}, ["prevent"])
|
|
1358
|
+
}, [m("span", Yt, C(e.label), 1), m("span", Xt, C(e.id), 1)], 40, Jt)]))), 128))])) : (M(), h("p", Zt, C(x(i)("blocks.text.mergeTagEmpty")), 1))], 40, Kt)) : k("", !0)], 64));
|
|
1359
1359
|
}
|
|
1360
|
-
}), [["styles", [".merge-tag-trigger[data-v-
|
|
1360
|
+
}), [["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"]]), $t = /* @__PURE__ */ T({
|
|
1361
1361
|
__name: "MergeTagView",
|
|
1362
|
-
props:
|
|
1362
|
+
props: Ht,
|
|
1363
1363
|
setup(e) {
|
|
1364
|
-
let t = e, { t: r, locale: a } =
|
|
1365
|
-
return (e, t) => (
|
|
1364
|
+
let t = e, { t: r, locale: a } = me(), o = d(Be, A(() => ({}))), s = A(() => String(t.node.attrs.id ?? "")), c = A(() => o.value[s.value] !== void 0), l = A(() => V(o.value, s.value, a.value)), u = A(() => r("blocks.text.mergeTagChip", { name: l.value }));
|
|
1365
|
+
return (e, t) => (M(), n(x(zt), {
|
|
1366
1366
|
as: "span",
|
|
1367
|
-
class:
|
|
1367
|
+
class: E(["merge-tag", { "is-unknown": !c.value }]),
|
|
1368
1368
|
"data-merge-tag": s.value,
|
|
1369
1369
|
contenteditable: "false",
|
|
1370
1370
|
role: "img",
|
|
1371
1371
|
"aria-label": u.value,
|
|
1372
1372
|
title: u.value
|
|
1373
1373
|
}, {
|
|
1374
|
-
default:
|
|
1374
|
+
default: _(() => [i(C(l.value), 1)]),
|
|
1375
1375
|
_: 1
|
|
1376
1376
|
}, 8, [
|
|
1377
1377
|
"class",
|
|
@@ -1383,81 +1383,81 @@ var Ut = [
|
|
|
1383
1383
|
});
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
//#region src/fontSizes.ts
|
|
1386
|
-
function
|
|
1386
|
+
function en(e) {
|
|
1387
1387
|
return `${e}px`;
|
|
1388
1388
|
}
|
|
1389
|
-
var
|
|
1390
|
-
function
|
|
1389
|
+
var tn = new Set(ce.map(en));
|
|
1390
|
+
function nn(e) {
|
|
1391
1391
|
let t = e.trim();
|
|
1392
|
-
return
|
|
1392
|
+
return tn.has(t) ? t : null;
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1395
|
-
return
|
|
1394
|
+
function rn(e) {
|
|
1395
|
+
return tn.has(e);
|
|
1396
1396
|
}
|
|
1397
1397
|
//#endregion
|
|
1398
1398
|
//#region src/panels/contentPanel/components/blocks/sanitizePastedFonts.ts
|
|
1399
|
-
var
|
|
1400
|
-
function
|
|
1401
|
-
let t =
|
|
1399
|
+
var an = "textStyle";
|
|
1400
|
+
function on(e) {
|
|
1401
|
+
let t = Fe(e);
|
|
1402
1402
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1405
|
-
if (e.type.name !==
|
|
1404
|
+
function sn(e, t) {
|
|
1405
|
+
if (e.type.name !== an) return e;
|
|
1406
1406
|
let n = { ...e.attrs };
|
|
1407
|
-
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily =
|
|
1407
|
+
return typeof n.fontFamily == "string" && !t?.has(n.fontFamily) && (n.fontFamily = on(n.fontFamily)), typeof n.fontSize == "string" && (n.fontSize = nn(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
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function cn(e, t) {
|
|
1410
1410
|
return e.flatMap((e) => {
|
|
1411
|
-
let n =
|
|
1411
|
+
let n = sn(e, t);
|
|
1412
1412
|
return n ? [n] : [];
|
|
1413
1413
|
});
|
|
1414
1414
|
}
|
|
1415
|
-
function
|
|
1416
|
-
return e.isText ? e.mark(
|
|
1415
|
+
function ln(e, t) {
|
|
1416
|
+
return e.isText ? e.mark(cn(e.marks, t)) : e.copy(un(e.content, t)).mark(cn(e.marks, t));
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1418
|
+
function un(e, t) {
|
|
1419
1419
|
let n = [];
|
|
1420
|
-
for (let r = 0; r < e.childCount; r++) n.push(
|
|
1421
|
-
return
|
|
1420
|
+
for (let r = 0; r < e.childCount; r++) n.push(ln(e.child(r), t));
|
|
1421
|
+
return W.fromArray(n);
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1424
|
-
return new
|
|
1423
|
+
function dn(e, t) {
|
|
1424
|
+
return new N(un(e.content, t), e.openStart, e.openEnd);
|
|
1425
1425
|
}
|
|
1426
1426
|
//#endregion
|
|
1427
1427
|
//#region src/panels/contentPanel/components/blocks/TextEditor.vue?vue&type=script&setup=true&lang.ts
|
|
1428
|
-
var
|
|
1428
|
+
var fn = { class: "picker" }, pn = ["aria-label", "value"], mn = { value: "paragraph" }, hn = ["value"], gn = { class: "picker" }, _n = ["aria-label", "value"], vn = {
|
|
1429
1429
|
value: "mixed",
|
|
1430
1430
|
disabled: "",
|
|
1431
1431
|
hidden: ""
|
|
1432
|
-
},
|
|
1432
|
+
}, yn = ["value"], bn = ["value"], xn = { class: "picker" }, Sn = ["aria-label", "value"], Cn = {
|
|
1433
1433
|
value: "mixed",
|
|
1434
1434
|
disabled: "",
|
|
1435
1435
|
hidden: ""
|
|
1436
|
-
},
|
|
1436
|
+
}, wn = { value: "" }, Tn = ["value"], En = ["title", "aria-label"], Dn = ["title", "aria-label"], On = ["title", "aria-label"], kn = [
|
|
1437
1437
|
"title",
|
|
1438
1438
|
"popovertarget",
|
|
1439
1439
|
"aria-expanded"
|
|
1440
|
-
],
|
|
1440
|
+
], An = ["id", "aria-label"], jn = { class: "link-field" }, Mn = {
|
|
1441
1441
|
key: 0,
|
|
1442
1442
|
class: "link-anchor"
|
|
1443
|
-
},
|
|
1443
|
+
}, Nn = {
|
|
1444
1444
|
key: 0,
|
|
1445
1445
|
value: ""
|
|
1446
|
-
},
|
|
1446
|
+
}, Pn = {
|
|
1447
1447
|
key: 1,
|
|
1448
1448
|
value: "",
|
|
1449
1449
|
disabled: "",
|
|
1450
1450
|
hidden: ""
|
|
1451
|
-
},
|
|
1451
|
+
}, Fn = ["value"], In = ["title", "aria-label"], Ln = ["title", "onClick"], Rn = {
|
|
1452
1452
|
"aria-hidden": "true",
|
|
1453
1453
|
height: "16",
|
|
1454
1454
|
viewBox: "0 0 16 16",
|
|
1455
1455
|
width: "16"
|
|
1456
|
-
},
|
|
1456
|
+
}, zn = [
|
|
1457
1457
|
"width",
|
|
1458
1458
|
"x",
|
|
1459
1459
|
"y"
|
|
1460
|
-
],
|
|
1460
|
+
], $ = 8, Bn = 220, Vn = /*#__PURE__*/ de(/* @__PURE__ */ T({
|
|
1461
1461
|
__name: "TextEditor",
|
|
1462
1462
|
props: /*@__PURE__*/ f({
|
|
1463
1463
|
editable: {
|
|
@@ -1476,149 +1476,149 @@ var un = { class: "picker" }, dn = ["aria-label", "value"], fn = { value: "parag
|
|
|
1476
1476
|
}),
|
|
1477
1477
|
emits: ["update:text"],
|
|
1478
1478
|
setup(e) {
|
|
1479
|
-
let t = o(e, "text"), n = e, { t: i } =
|
|
1479
|
+
let t = o(e, "text"), n = e, { t: i } = me(), s = [
|
|
1480
1480
|
"left",
|
|
1481
1481
|
"center",
|
|
1482
1482
|
"right",
|
|
1483
1483
|
"justify"
|
|
1484
|
-
], c =
|
|
1485
|
-
...
|
|
1484
|
+
], c = A(() => i("blocks.text.label")), u = Bt({
|
|
1485
|
+
...oe,
|
|
1486
1486
|
editorProps: {
|
|
1487
1487
|
attributes: {
|
|
1488
1488
|
"aria-label": c.value,
|
|
1489
1489
|
"aria-multiline": "true",
|
|
1490
1490
|
role: "textbox"
|
|
1491
1491
|
},
|
|
1492
|
-
transformPasted: (e) =>
|
|
1492
|
+
transformPasted: (e) => dn(e, de.value)
|
|
1493
1493
|
},
|
|
1494
|
-
content:
|
|
1494
|
+
content: se(t.value),
|
|
1495
1495
|
editable: n.editable,
|
|
1496
1496
|
extensions: [
|
|
1497
|
-
...
|
|
1498
|
-
|
|
1499
|
-
|
|
1497
|
+
...Se.map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => Wt($t) }) : e),
|
|
1498
|
+
Ft,
|
|
1499
|
+
Mt.configure({ placeholder: () => i("blocks.text.placeholder") })
|
|
1500
1500
|
],
|
|
1501
1501
|
onUpdate({ editor: e }) {
|
|
1502
|
-
t.value =
|
|
1502
|
+
t.value = fe(e.getJSON()), T();
|
|
1503
1503
|
},
|
|
1504
1504
|
onSelectionUpdate() {
|
|
1505
|
-
|
|
1505
|
+
T();
|
|
1506
1506
|
}
|
|
1507
1507
|
});
|
|
1508
|
-
|
|
1508
|
+
re(c, (e) => {
|
|
1509
1509
|
u.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1510
|
-
}),
|
|
1510
|
+
}), re(t, (e) => {
|
|
1511
1511
|
let t = u.value;
|
|
1512
|
-
!t ||
|
|
1513
|
-
}),
|
|
1514
|
-
let f = l("root"),
|
|
1515
|
-
function
|
|
1516
|
-
let e =
|
|
1517
|
-
!e || e.matches(":popover-open") || (e.showPopover(),
|
|
1512
|
+
!t || ue(e, fe(t.getJSON())) || t.commands.setContent(se(e), { emitUpdate: !1 });
|
|
1513
|
+
}), re(() => n.editable, (e) => u.value?.setEditable(e));
|
|
1514
|
+
let f = l("root"), v = l("toolbar");
|
|
1515
|
+
function S() {
|
|
1516
|
+
let e = v.value;
|
|
1517
|
+
!e || e.matches(":popover-open") || (e.showPopover(), T());
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function w(e) {
|
|
1520
1520
|
let t = e.relatedTarget;
|
|
1521
|
-
t instanceof Node && f.value?.contains(t) ||
|
|
1521
|
+
t instanceof Node && f.value?.contains(t) || v.value?.matches(":popover-open") && v.value.hidePopover();
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1524
|
-
let e = u.value?.view, t =
|
|
1523
|
+
function T() {
|
|
1524
|
+
let e = u.value?.view, t = v.value, n = f.value;
|
|
1525
1525
|
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 -
|
|
1526
|
+
let r = n.closest(".block-container"), i = (r?.querySelector(":scope > .block-label") ?? r ?? n).getBoundingClientRect(), a = Math.max($, window.innerWidth - Bn - $), o = Math.min(Math.max(i.left, $), a);
|
|
1527
|
+
t.style.left = `${o}px`, t.style.maxWidth = `${window.innerWidth - o - $}px`, t.style.top = `${i.top}px`;
|
|
1528
1528
|
}
|
|
1529
|
-
function
|
|
1529
|
+
function ne() {
|
|
1530
1530
|
let e = u.value;
|
|
1531
1531
|
if (!e) return "paragraph";
|
|
1532
|
-
let t =
|
|
1532
|
+
let t = le.find((t) => e.isActive("heading", { level: t }));
|
|
1533
1533
|
return t ? `h${t}` : "paragraph";
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1535
|
+
function ie(e) {
|
|
1536
1536
|
let { target: t } = e;
|
|
1537
1537
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1538
1538
|
let n = u.value?.chain().focus();
|
|
1539
1539
|
if (!n) return;
|
|
1540
|
-
let r =
|
|
1540
|
+
let r = le.find((e) => `h${e}` === t.value);
|
|
1541
1541
|
r ? n.setHeading({ level: r }).run() : n.setParagraph().run();
|
|
1542
1542
|
}
|
|
1543
|
-
let
|
|
1544
|
-
function
|
|
1543
|
+
let D = d(te, A(() => xe)), N = ge(), de = A(() => new Set(N.value.map((e) => e.stack)));
|
|
1544
|
+
function P(e) {
|
|
1545
1545
|
return `custom:${e}`;
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1548
|
-
if (typeof e != "string") return
|
|
1549
|
-
let t =
|
|
1550
|
-
return t ?
|
|
1547
|
+
function pe(e) {
|
|
1548
|
+
if (typeof e != "string") return D.value;
|
|
1549
|
+
let t = N.value.find((t) => t.stack === e);
|
|
1550
|
+
return t ? P(t.name) : Fe(e)?.key ?? D.value;
|
|
1551
1551
|
}
|
|
1552
|
-
function
|
|
1552
|
+
function he() {
|
|
1553
1553
|
let e = u.value;
|
|
1554
|
-
if (!e) return
|
|
1554
|
+
if (!e) return D.value;
|
|
1555
1555
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1556
|
-
if (r) return
|
|
1556
|
+
if (r) return pe(e.getAttributes("textStyle").fontFamily);
|
|
1557
1557
|
let i = /* @__PURE__ */ new Set();
|
|
1558
1558
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1559
1559
|
if (!e.isText) return;
|
|
1560
1560
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1561
|
-
i.add(
|
|
1561
|
+
i.add(pe(t?.attrs.fontFamily));
|
|
1562
1562
|
});
|
|
1563
1563
|
let a = Array.from(i);
|
|
1564
|
-
return a.length > 1 ? "mixed" : a[0] ??
|
|
1564
|
+
return a.length > 1 ? "mixed" : a[0] ?? D.value;
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1566
|
+
function ve(e) {
|
|
1567
1567
|
let { target: t } = e;
|
|
1568
1568
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1569
1569
|
let n = t.value, r = u.value?.chain().focus();
|
|
1570
1570
|
if (!r) return;
|
|
1571
|
-
let i =
|
|
1571
|
+
let i = N.value.find((e) => P(e.name) === n);
|
|
1572
1572
|
if (i) {
|
|
1573
1573
|
r.setFontFamily(i.stack).run();
|
|
1574
1574
|
return;
|
|
1575
1575
|
}
|
|
1576
|
-
|
|
1576
|
+
je(n) && (n === D.value ? r.unsetFontFamily().run() : r.setFontFamily(ke(n)).run());
|
|
1577
1577
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return typeof e == "string" &&
|
|
1578
|
+
function be(e) {
|
|
1579
|
+
return typeof e == "string" && rn(e) ? e : "";
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1581
|
+
function F() {
|
|
1582
1582
|
let e = u.value;
|
|
1583
1583
|
if (!e) return "";
|
|
1584
1584
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1585
|
-
if (r) return
|
|
1585
|
+
if (r) return be(e.getAttributes("textStyle").fontSize);
|
|
1586
1586
|
let i = /* @__PURE__ */ new Set();
|
|
1587
1587
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1588
1588
|
if (!e.isText) return;
|
|
1589
1589
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1590
|
-
i.add(
|
|
1590
|
+
i.add(be(t?.attrs.fontSize));
|
|
1591
1591
|
});
|
|
1592
1592
|
let a = Array.from(i);
|
|
1593
1593
|
return a.length > 1 ? "mixed" : a[0] ?? "";
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function I(e) {
|
|
1596
1596
|
let { target: t } = e;
|
|
1597
1597
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1598
1598
|
let n = u.value?.chain().focus();
|
|
1599
|
-
n && (t.value === "" ? n.unsetFontSize().run() :
|
|
1599
|
+
n && (t.value === "" ? n.unsetFontSize().run() : rn(t.value) && n.setFontSize(t.value).run());
|
|
1600
1600
|
}
|
|
1601
|
-
let
|
|
1602
|
-
let e =
|
|
1603
|
-
return
|
|
1604
|
-
}), we =
|
|
1601
|
+
let L = Me(() => {
|
|
1602
|
+
let e = he();
|
|
1603
|
+
return je(e) ? e : void 0;
|
|
1604
|
+
}), we = A({
|
|
1605
1605
|
get: () => {
|
|
1606
|
-
let e = u.value?.getAttributes("textStyle").color, t = typeof e == "string" ?
|
|
1606
|
+
let e = u.value?.getAttributes("textStyle").color, t = typeof e == "string" ? _e(e) : void 0;
|
|
1607
1607
|
return t ? {
|
|
1608
1608
|
type: "color",
|
|
1609
1609
|
...t
|
|
1610
|
-
} :
|
|
1610
|
+
} : Ce;
|
|
1611
1611
|
},
|
|
1612
1612
|
set: (e) => {
|
|
1613
|
-
e.type !== "transparent" && u.value?.chain().setColor(
|
|
1613
|
+
e.type !== "transparent" && u.value?.chain().setColor(Re(e)).run();
|
|
1614
1614
|
}
|
|
1615
|
-
}),
|
|
1615
|
+
}), Ee = {
|
|
1616
1616
|
left: "blocks.text.alignLeft",
|
|
1617
1617
|
center: "blocks.text.alignCenter",
|
|
1618
1618
|
right: "blocks.text.alignRight",
|
|
1619
1619
|
justify: "blocks.text.alignJustify"
|
|
1620
1620
|
};
|
|
1621
|
-
function
|
|
1621
|
+
function De(e) {
|
|
1622
1622
|
return (e === "justify" ? [
|
|
1623
1623
|
14,
|
|
1624
1624
|
14,
|
|
@@ -1638,242 +1638,242 @@ var un = { class: "picker" }, dn = ["aria-label", "value"], fn = { value: "parag
|
|
|
1638
1638
|
};
|
|
1639
1639
|
});
|
|
1640
1640
|
}
|
|
1641
|
-
let
|
|
1642
|
-
function
|
|
1641
|
+
let Oe = ee(), R = l("linkPopover"), z = l("linkInput"), B = l("linkTrigger"), V = b(""), H = b(!1), Ne = b(!1);
|
|
1642
|
+
function ze(e) {
|
|
1643
1643
|
if (e.newState !== "open") return;
|
|
1644
1644
|
let t = u.value?.getAttributes("link")?.href;
|
|
1645
|
-
|
|
1646
|
-
let n =
|
|
1645
|
+
V.value = typeof t == "string" ? t : "", Ne.value = V.value !== "";
|
|
1646
|
+
let n = R.value, r = B.value?.getBoundingClientRect();
|
|
1647
1647
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1648
1648
|
}
|
|
1649
|
-
function
|
|
1650
|
-
if (
|
|
1651
|
-
let t =
|
|
1649
|
+
function Be(e) {
|
|
1650
|
+
if (H.value = e.newState === "open", e.newState !== "open") return;
|
|
1651
|
+
let t = R.value;
|
|
1652
1652
|
if (t) {
|
|
1653
1653
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1654
1654
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1655
1655
|
}
|
|
1656
1656
|
a(() => {
|
|
1657
|
-
|
|
1657
|
+
z.value?.focus(), z.value?.select();
|
|
1658
1658
|
});
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1661
|
-
let t = e.relatedTarget, n =
|
|
1660
|
+
function Ve(e) {
|
|
1661
|
+
let t = e.relatedTarget, n = R.value;
|
|
1662
1662
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
1663
1663
|
}
|
|
1664
|
-
function
|
|
1664
|
+
function W() {
|
|
1665
1665
|
let e = u.value?.chain().focus();
|
|
1666
1666
|
if (!e) return;
|
|
1667
|
-
let t =
|
|
1667
|
+
let t = Pe(V.value);
|
|
1668
1668
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
1669
1669
|
href: t,
|
|
1670
1670
|
target: t.startsWith("#") ? null : "_blank"
|
|
1671
|
-
}).run(),
|
|
1671
|
+
}).run(), R.value?.hidePopover();
|
|
1672
1672
|
}
|
|
1673
|
-
let
|
|
1674
|
-
function
|
|
1675
|
-
e === "" ?
|
|
1673
|
+
let He = d(ae, A(() => [])), Ue = A(() => V.value.startsWith("#") && He.value.includes(V.value.slice(1)) ? V.value.slice(1) : "");
|
|
1674
|
+
function We(e) {
|
|
1675
|
+
e === "" ? V.value.startsWith("#") && (V.value = "") : V.value = `#${e}`;
|
|
1676
1676
|
}
|
|
1677
|
-
function
|
|
1678
|
-
u.value?.chain().focus().unsetLink().run(),
|
|
1677
|
+
function G() {
|
|
1678
|
+
u.value?.chain().focus().unsetLink().run(), R.value?.hidePopover();
|
|
1679
1679
|
}
|
|
1680
|
-
function
|
|
1680
|
+
function Ge(e) {
|
|
1681
1681
|
u.value?.chain().focus().insertContent({
|
|
1682
|
-
type:
|
|
1682
|
+
type: Ie,
|
|
1683
1683
|
attrs: { id: e }
|
|
1684
1684
|
}).run();
|
|
1685
1685
|
}
|
|
1686
|
-
return (e, t) => (
|
|
1686
|
+
return (e, t) => (M(), h("div", {
|
|
1687
1687
|
ref_key: "root",
|
|
1688
1688
|
ref: f,
|
|
1689
1689
|
style: {
|
|
1690
1690
|
position: "relative",
|
|
1691
1691
|
width: "100%"
|
|
1692
1692
|
},
|
|
1693
|
-
onFocusin:
|
|
1694
|
-
onFocusout:
|
|
1695
|
-
}, [r(
|
|
1696
|
-
editor:
|
|
1697
|
-
style:
|
|
1698
|
-
}), null, 16, ["editor", "style"]), n.editable ? (
|
|
1693
|
+
onFocusin: S,
|
|
1694
|
+
onFocusout: w
|
|
1695
|
+
}, [r(x(Rt), p(n.editable ? { class: "text-input" } : {}, {
|
|
1696
|
+
editor: x(u),
|
|
1697
|
+
style: x(Ae)(n)
|
|
1698
|
+
}), null, 16, ["editor", "style"]), n.editable ? (M(), h("div", {
|
|
1699
1699
|
key: 0,
|
|
1700
1700
|
ref_key: "toolbar",
|
|
1701
|
-
ref:
|
|
1701
|
+
ref: v,
|
|
1702
1702
|
popover: "manual",
|
|
1703
1703
|
class: "toolbar"
|
|
1704
1704
|
}, [
|
|
1705
|
-
m("span",
|
|
1706
|
-
"aria-label":
|
|
1705
|
+
m("span", fn, [m("select", {
|
|
1706
|
+
"aria-label": x(i)("blocks.text.styleLabel"),
|
|
1707
1707
|
class: "style",
|
|
1708
|
-
value:
|
|
1709
|
-
onChange:
|
|
1710
|
-
onMousedown: t[0] ||=
|
|
1711
|
-
}, [m("option",
|
|
1708
|
+
value: ne(),
|
|
1709
|
+
onChange: ie,
|
|
1710
|
+
onMousedown: t[0] ||= O(() => {}, ["stop"])
|
|
1711
|
+
}, [m("option", mn, C(x(i)("blocks.text.styleNormal")), 1), (M(!0), h(j, null, g(x(le), (e) => (M(), h("option", {
|
|
1712
1712
|
key: e,
|
|
1713
1713
|
value: `h${e}`
|
|
1714
|
-
},
|
|
1714
|
+
}, C(x(i)("blocks.text.styleHeading", { level: e })), 9, hn))), 128))], 40, pn), r(U, {
|
|
1715
1715
|
class: "picker-chevron",
|
|
1716
1716
|
name: "chevron-down",
|
|
1717
1717
|
size: 12
|
|
1718
1718
|
})]),
|
|
1719
1719
|
t[20] ||= m("span", { class: "divider" }, null, -1),
|
|
1720
|
-
m("span",
|
|
1721
|
-
"aria-label":
|
|
1720
|
+
m("span", gn, [m("select", {
|
|
1721
|
+
"aria-label": x(i)("blocks.text.font"),
|
|
1722
1722
|
class: "font",
|
|
1723
|
-
value:
|
|
1724
|
-
onChange:
|
|
1725
|
-
onMousedown: t[1] ||=
|
|
1723
|
+
value: he(),
|
|
1724
|
+
onChange: ve,
|
|
1725
|
+
onMousedown: t[1] ||= O(() => {}, ["stop"])
|
|
1726
1726
|
}, [
|
|
1727
|
-
m("option",
|
|
1728
|
-
(
|
|
1727
|
+
m("option", vn, C(x(i)("blocks.text.fontMixed")), 1),
|
|
1728
|
+
(M(!0), h(j, null, g(x(L), (e) => (M(), h("option", {
|
|
1729
1729
|
key: e.key,
|
|
1730
1730
|
value: e.key
|
|
1731
|
-
},
|
|
1732
|
-
(
|
|
1733
|
-
key:
|
|
1734
|
-
value:
|
|
1735
|
-
},
|
|
1736
|
-
], 40,
|
|
1731
|
+
}, C(e.name), 9, yn))), 128)),
|
|
1732
|
+
(M(!0), h(j, null, g(x(N), (e) => (M(), h("option", {
|
|
1733
|
+
key: P(e.name),
|
|
1734
|
+
value: P(e.name)
|
|
1735
|
+
}, C(e.name), 9, bn))), 128))
|
|
1736
|
+
], 40, _n), r(U, {
|
|
1737
1737
|
class: "picker-chevron",
|
|
1738
1738
|
name: "chevron-down",
|
|
1739
1739
|
size: 12
|
|
1740
1740
|
})]),
|
|
1741
|
-
m("span",
|
|
1742
|
-
"aria-label":
|
|
1741
|
+
m("span", xn, [m("select", {
|
|
1742
|
+
"aria-label": x(i)("blocks.text.fontSize"),
|
|
1743
1743
|
class: "size",
|
|
1744
|
-
value:
|
|
1745
|
-
onChange:
|
|
1746
|
-
onMousedown: t[2] ||=
|
|
1744
|
+
value: F(),
|
|
1745
|
+
onChange: I,
|
|
1746
|
+
onMousedown: t[2] ||= O(() => {}, ["stop"])
|
|
1747
1747
|
}, [
|
|
1748
|
-
m("option",
|
|
1749
|
-
m("option",
|
|
1750
|
-
(
|
|
1748
|
+
m("option", Cn, C(x(i)("blocks.text.fontMixed")), 1),
|
|
1749
|
+
m("option", wn, C(x(i)("blocks.text.fontSizeDefault")), 1),
|
|
1750
|
+
(M(!0), h(j, null, g(x(ce), (e) => (M(), h("option", {
|
|
1751
1751
|
key: e,
|
|
1752
|
-
value:
|
|
1753
|
-
},
|
|
1754
|
-
], 40,
|
|
1752
|
+
value: x(en)(e)
|
|
1753
|
+
}, C(e), 9, Tn))), 128))
|
|
1754
|
+
], 40, Sn), r(U, {
|
|
1755
1755
|
class: "picker-chevron",
|
|
1756
1756
|
name: "chevron-down",
|
|
1757
1757
|
size: 12
|
|
1758
1758
|
})]),
|
|
1759
|
-
r(
|
|
1759
|
+
r(Le, {
|
|
1760
1760
|
modelValue: we.value,
|
|
1761
1761
|
"onUpdate:modelValue": t[3] ||= (e) => we.value = e,
|
|
1762
1762
|
"allow-transparent": !1,
|
|
1763
|
-
label:
|
|
1763
|
+
label: x(i)("blocks.text.textColor"),
|
|
1764
1764
|
compact: "",
|
|
1765
|
-
onMousedown: t[4] ||=
|
|
1765
|
+
onMousedown: t[4] ||= O(() => {}, ["stop"])
|
|
1766
1766
|
}, null, 8, ["modelValue", "label"]),
|
|
1767
1767
|
t[21] ||= m("span", { class: "divider" }, null, -1),
|
|
1768
1768
|
m("button", {
|
|
1769
|
-
class:
|
|
1769
|
+
class: E({ active: x(u)?.isActive("bold") }),
|
|
1770
1770
|
type: "button",
|
|
1771
|
-
title:
|
|
1772
|
-
"aria-label":
|
|
1773
|
-
onClick: t[5] ||= (e) =>
|
|
1774
|
-
onMousedown: t[6] ||=
|
|
1775
|
-
}, [...t[17] ||= [m("b", null, "B", -1)]], 42,
|
|
1771
|
+
title: x(i)("blocks.text.bold"),
|
|
1772
|
+
"aria-label": x(i)("blocks.text.bold"),
|
|
1773
|
+
onClick: t[5] ||= (e) => x(u)?.chain().focus().toggleBold().run(),
|
|
1774
|
+
onMousedown: t[6] ||= O(() => {}, ["prevent"])
|
|
1775
|
+
}, [...t[17] ||= [m("b", null, "B", -1)]], 42, En),
|
|
1776
1776
|
m("button", {
|
|
1777
|
-
class:
|
|
1777
|
+
class: E({ active: x(u)?.isActive("italic") }),
|
|
1778
1778
|
type: "button",
|
|
1779
|
-
title:
|
|
1780
|
-
"aria-label":
|
|
1781
|
-
onClick: t[7] ||= (e) =>
|
|
1782
|
-
onMousedown: t[8] ||=
|
|
1783
|
-
}, [...t[18] ||= [m("i", null, "I", -1)]], 42,
|
|
1779
|
+
title: x(i)("blocks.text.italic"),
|
|
1780
|
+
"aria-label": x(i)("blocks.text.italic"),
|
|
1781
|
+
onClick: t[7] ||= (e) => x(u)?.chain().focus().toggleItalic().run(),
|
|
1782
|
+
onMousedown: t[8] ||= O(() => {}, ["prevent"])
|
|
1783
|
+
}, [...t[18] ||= [m("i", null, "I", -1)]], 42, Dn),
|
|
1784
1784
|
m("button", {
|
|
1785
|
-
class:
|
|
1785
|
+
class: E({ active: x(u)?.isActive("underline") }),
|
|
1786
1786
|
type: "button",
|
|
1787
|
-
title:
|
|
1788
|
-
"aria-label":
|
|
1789
|
-
onClick: t[9] ||= (e) =>
|
|
1790
|
-
onMousedown: t[10] ||=
|
|
1791
|
-
}, [...t[19] ||= [m("u", null, "U", -1)]], 42,
|
|
1787
|
+
title: x(i)("blocks.text.underline"),
|
|
1788
|
+
"aria-label": x(i)("blocks.text.underline"),
|
|
1789
|
+
onClick: t[9] ||= (e) => x(u)?.chain().focus().toggleUnderline().run(),
|
|
1790
|
+
onMousedown: t[10] ||= O(() => {}, ["prevent"])
|
|
1791
|
+
}, [...t[19] ||= [m("u", null, "U", -1)]], 42, On),
|
|
1792
1792
|
m("button", {
|
|
1793
1793
|
ref_key: "linkTrigger",
|
|
1794
|
-
ref:
|
|
1795
|
-
class:
|
|
1794
|
+
ref: B,
|
|
1795
|
+
class: E({ active: x(u)?.isActive("link") }),
|
|
1796
1796
|
type: "button",
|
|
1797
|
-
title:
|
|
1798
|
-
popovertarget:
|
|
1797
|
+
title: x(i)("blocks.text.link"),
|
|
1798
|
+
popovertarget: x(Oe),
|
|
1799
1799
|
"aria-haspopup": "dialog",
|
|
1800
|
-
"aria-expanded":
|
|
1801
|
-
onMousedown: t[11] ||=
|
|
1802
|
-
}, [r(
|
|
1800
|
+
"aria-expanded": H.value,
|
|
1801
|
+
onMousedown: t[11] ||= O(() => {}, ["prevent"])
|
|
1802
|
+
}, [r(U, {
|
|
1803
1803
|
name: "link",
|
|
1804
1804
|
size: 16
|
|
1805
|
-
})], 42,
|
|
1806
|
-
n.editable ? (
|
|
1805
|
+
})], 42, kn),
|
|
1806
|
+
n.editable ? (M(), h("div", {
|
|
1807
1807
|
key: 0,
|
|
1808
|
-
id:
|
|
1808
|
+
id: x(Oe),
|
|
1809
1809
|
ref_key: "linkPopover",
|
|
1810
|
-
ref:
|
|
1810
|
+
ref: R,
|
|
1811
1811
|
class: "link-popover",
|
|
1812
1812
|
popover: "",
|
|
1813
1813
|
role: "dialog",
|
|
1814
|
-
"aria-label":
|
|
1815
|
-
onBeforetoggle:
|
|
1816
|
-
onToggle:
|
|
1817
|
-
onFocusout:
|
|
1814
|
+
"aria-label": x(i)("blocks.text.link"),
|
|
1815
|
+
onBeforetoggle: ze,
|
|
1816
|
+
onToggle: Be,
|
|
1817
|
+
onFocusout: Ve
|
|
1818
1818
|
}, [
|
|
1819
|
-
m("span",
|
|
1819
|
+
m("span", jn, [r(ye, {
|
|
1820
1820
|
ref_key: "linkInput",
|
|
1821
|
-
ref:
|
|
1822
|
-
modelValue:
|
|
1823
|
-
"onUpdate:modelValue": t[12] ||= (e) =>
|
|
1821
|
+
ref: z,
|
|
1822
|
+
modelValue: V.value,
|
|
1823
|
+
"onUpdate:modelValue": t[12] ||= (e) => V.value = e,
|
|
1824
1824
|
inputmode: "url",
|
|
1825
1825
|
spellcheck: "false",
|
|
1826
1826
|
autocomplete: "off",
|
|
1827
|
-
placeholder:
|
|
1828
|
-
"aria-label":
|
|
1829
|
-
onKeydown:
|
|
1827
|
+
placeholder: x(i)("blocks.text.linkPlaceholder"),
|
|
1828
|
+
"aria-label": x(i)("blocks.text.linkPrompt"),
|
|
1829
|
+
onKeydown: y(O(W, ["prevent"]), ["enter"])
|
|
1830
1830
|
}, null, 8, [
|
|
1831
1831
|
"modelValue",
|
|
1832
1832
|
"placeholder",
|
|
1833
1833
|
"aria-label",
|
|
1834
1834
|
"onKeydown"
|
|
1835
1835
|
])]),
|
|
1836
|
-
|
|
1837
|
-
"aria-label":
|
|
1838
|
-
"model-value":
|
|
1839
|
-
"onUpdate:modelValue":
|
|
1840
|
-
onMousedown: t[13] ||=
|
|
1836
|
+
x(He).length ? (M(), h("span", Mn, [r(Te, {
|
|
1837
|
+
"aria-label": x(i)("blocks.common.anchorLink.label"),
|
|
1838
|
+
"model-value": Ue.value,
|
|
1839
|
+
"onUpdate:modelValue": We,
|
|
1840
|
+
onMousedown: t[13] ||= O(() => {}, ["stop"])
|
|
1841
1841
|
}, {
|
|
1842
|
-
default:
|
|
1842
|
+
default: _(() => [Ue.value ? (M(), h("option", Nn, C(x(i)("blocks.common.anchorLink.none")), 1)) : (M(), h("option", Pn, C(x(i)("blocks.common.anchorLink.placeholder")), 1)), (M(!0), h(j, null, g(x(He), (e) => (M(), h("option", {
|
|
1843
1843
|
key: e,
|
|
1844
1844
|
value: e
|
|
1845
|
-
}, " #" +
|
|
1845
|
+
}, " #" + C(e), 9, Fn))), 128))]),
|
|
1846
1846
|
_: 1
|
|
1847
|
-
}, 8, ["aria-label", "model-value"])])) :
|
|
1847
|
+
}, 8, ["aria-label", "model-value"])])) : k("", !0),
|
|
1848
1848
|
m("button", {
|
|
1849
1849
|
class: "link-apply",
|
|
1850
1850
|
type: "button",
|
|
1851
|
-
onClick:
|
|
1852
|
-
onMousedown: t[14] ||=
|
|
1853
|
-
},
|
|
1854
|
-
|
|
1851
|
+
onClick: W,
|
|
1852
|
+
onMousedown: t[14] ||= O(() => {}, ["prevent"])
|
|
1853
|
+
}, C(x(i)("blocks.text.linkApply")), 33),
|
|
1854
|
+
Ne.value ? (M(), h("button", {
|
|
1855
1855
|
key: 1,
|
|
1856
1856
|
class: "link-remove",
|
|
1857
1857
|
type: "button",
|
|
1858
|
-
title:
|
|
1859
|
-
"aria-label":
|
|
1860
|
-
onClick:
|
|
1861
|
-
onMousedown: t[15] ||=
|
|
1862
|
-
}, [r(
|
|
1858
|
+
title: x(i)("blocks.text.linkRemove"),
|
|
1859
|
+
"aria-label": x(i)("blocks.text.linkRemove"),
|
|
1860
|
+
onClick: G,
|
|
1861
|
+
onMousedown: t[15] ||= O(() => {}, ["prevent"])
|
|
1862
|
+
}, [r(U, {
|
|
1863
1863
|
name: "trash",
|
|
1864
1864
|
size: 16
|
|
1865
|
-
})], 40,
|
|
1866
|
-
], 40,
|
|
1867
|
-
r(
|
|
1865
|
+
})], 40, In)) : k("", !0)
|
|
1866
|
+
], 40, An)) : k("", !0),
|
|
1867
|
+
r(Qt, { onSelect: Ge }),
|
|
1868
1868
|
t[22] ||= m("span", { class: "divider" }, null, -1),
|
|
1869
|
-
(
|
|
1869
|
+
(M(), h(j, null, g(s, (e) => m("button", {
|
|
1870
1870
|
key: e,
|
|
1871
|
-
class:
|
|
1872
|
-
title:
|
|
1871
|
+
class: E({ active: x(u)?.isActive({ textAlign: e }) }),
|
|
1872
|
+
title: x(i)(Ee[e]),
|
|
1873
1873
|
type: "button",
|
|
1874
|
-
onClick: (t) =>
|
|
1875
|
-
onMousedown: t[16] ||=
|
|
1876
|
-
}, [(
|
|
1874
|
+
onClick: (t) => x(u)?.chain().focus().setTextAlign(e).run(),
|
|
1875
|
+
onMousedown: t[16] ||= O(() => {}, ["prevent"])
|
|
1876
|
+
}, [(M(), h("svg", Rn, [(M(!0), h(j, null, g(De(e), (e, t) => (M(), h("rect", {
|
|
1877
1877
|
key: t,
|
|
1878
1878
|
fill: "currentColor",
|
|
1879
1879
|
height: "1.5",
|
|
@@ -1881,9 +1881,9 @@ var un = { class: "picker" }, dn = ["aria-label", "value"], fn = { value: "parag
|
|
|
1881
1881
|
width: e.w,
|
|
1882
1882
|
x: e.x,
|
|
1883
1883
|
y: e.y
|
|
1884
|
-
}, null, 8,
|
|
1885
|
-
], 512)) :
|
|
1884
|
+
}, null, 8, zn))), 128))]))], 42, Ln)), 64))
|
|
1885
|
+
], 512)) : k("", !0)], 544));
|
|
1886
1886
|
}
|
|
1887
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-3445ad1e]{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-3445ad1e]:popover-open{display:flex}.toolbar>button[data-v-3445ad1e]{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-3445ad1e]:hover{background:color-mix(in srgb, var(--bygga-color-text) 30%, transparent)}.toolbar>button.active[data-v-3445ad1e]{background:var(--bygga-color-selected,var(--bygga-color-text));color:var(--bygga-color-selected-text,#fff);forced-color-adjust:none}.toolbar .picker[data-v-3445ad1e]{align-items:center;display:inline-flex;position:relative}.toolbar .style[data-v-3445ad1e],.toolbar .font[data-v-3445ad1e],.toolbar .size[data-v-3445ad1e]{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-3445ad1e]:hover,.toolbar .font[data-v-3445ad1e]:hover,.toolbar .size[data-v-3445ad1e]:hover{background:color-mix(in srgb, var(--bygga-color-text) 7%, transparent)}.toolbar .picker-chevron[data-v-3445ad1e]{color:var(--bygga-color-text);pointer-events:none;position:absolute;right:5px}.toolbar .divider[data-v-3445ad1e]{background:var(--bygga-color-divider);width:1px;height:24px;margin:0 4px}.link-popover[data-v-3445ad1e]{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-3445ad1e]:popover-open{display:flex}.link-field[data-v-3445ad1e]{width:18em}.link-anchor[data-v-3445ad1e]{width:10em}.link-apply[data-v-3445ad1e]{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-3445ad1e]{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-3445ad1e]:hover{background:var(--bygga-color-track);color:var(--bygga-color-accent)}"]], ["__scopeId", "data-v-3445ad1e"]]);
|
|
1888
1888
|
//#endregion
|
|
1889
|
-
export {
|
|
1889
|
+
export { Vn as default };
|