@bygga.dev/editor 1.0.0 → 1.1.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-DGmHp-AF.js → TextEditor-CJ2hChsq.js} +219 -219
- package/bygga-editor.js +2987 -2635
- package/element.d.ts +32 -1
- package/package.json +1 -1
- package/{urls-C1-J3Og2.js → urls-BO2HiDHB.js} +2819 -2651
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, H as s, I as c, J as l, K as u, L as d, M as f, O as p, R as m, S as h, T as ee, X as g, Z as _, _ as v, b as y, c as te, et as b, f as x, g as S, h as C, j as w, l as T, m as ne, p as E, r as D, rt as O, u as k, v as A, w as j, x as re, z as ie } from "./vue.runtime.esm-bundler-C8OyVIE3.js";
|
|
2
|
-
import { $ as ae,
|
|
2
|
+
import { $ as ae, $t as oe, E as M, J as se, Jt as ce, Q as le, Qt as ue, S as N, St as P, T as de, Xt as fe, Yt as pe, Zt as me, _t as F, an as he, at as ge, bt as _e, c as ve, ct as ye, dt as be, en as xe, et as Se, f as Ce, ft as I, gt as L, ht as R, it as we, l as Te, lt as z, m as Ee, mt as B, n as V, nt as De, o as Oe, ot as ke, pt as H, rt as U, s as Ae, sn as je, st as W, t as Me, tn as Ne, tt as Pe, ut as Fe, vt as Ie, w as Le, xt as G, yt as Re } from "./urls-BO2HiDHB.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 ze(e = {}) {
|
|
5
|
+
return new R({ view(t) {
|
|
6
|
+
return new Be(t, e);
|
|
7
7
|
} });
|
|
8
8
|
}
|
|
9
|
-
var
|
|
9
|
+
var Be = 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 = _e(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,13 +97,13 @@ var He = class {
|
|
|
97
97
|
dragleave(e) {
|
|
98
98
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, K = class e extends F {
|
|
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) : F.near(r);
|
|
107
107
|
}
|
|
108
108
|
content() {
|
|
109
109
|
return P.empty;
|
|
@@ -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 Ve(this.anchor);
|
|
126
126
|
}
|
|
127
127
|
static valid(e) {
|
|
128
128
|
let t = e.parent;
|
|
129
|
-
if (t.inlineContent || !
|
|
129
|
+
if (t.inlineContent || !Ue(e) || !We(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 && !B.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
|
+
K.prototype.visible = !1, K.findFrom = K.findGapCursorFrom, F.jsonID("gapcursor", K);
|
|
167
|
+
var Ve = 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 K.valid(t) ? new K(t) : F.near(t);
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
|
-
function
|
|
179
|
+
function He(e) {
|
|
180
180
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Ue(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 || He(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 We(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 || He(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 Ge() {
|
|
211
|
+
return new R({ props: {
|
|
212
|
+
decorations: Ye,
|
|
213
213
|
createSelectionBetween(e, t, n) {
|
|
214
|
-
return t.pos == n.pos &&
|
|
214
|
+
return t.pos == n.pos && K.valid(n) ? new K(n) : null;
|
|
215
215
|
},
|
|
216
|
-
handleClick:
|
|
217
|
-
handleKeyDown:
|
|
218
|
-
handleDOMEvents: { beforeinput:
|
|
216
|
+
handleClick: qe,
|
|
217
|
+
handleKeyDown: Ke,
|
|
218
|
+
handleDOMEvents: { beforeinput: Je }
|
|
219
219
|
} });
|
|
220
220
|
}
|
|
221
|
-
var
|
|
222
|
-
ArrowLeft:
|
|
223
|
-
ArrowRight:
|
|
224
|
-
ArrowUp:
|
|
225
|
-
ArrowDown:
|
|
221
|
+
var Ke = be({
|
|
222
|
+
ArrowLeft: q("horiz", -1),
|
|
223
|
+
ArrowRight: q("horiz", 1),
|
|
224
|
+
ArrowUp: q("vert", -1),
|
|
225
|
+
ArrowDown: q("vert", 1)
|
|
226
226
|
});
|
|
227
|
-
function
|
|
227
|
+
function q(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 Ie) {
|
|
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 = K.findGapCursorFrom(o, t, s);
|
|
236
|
+
return c ? (r && r(e.tr.setSelection(new K(c))), !0) : !1;
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function qe(e, t, n) {
|
|
240
240
|
if (!e || !e.editable) return !1;
|
|
241
241
|
let r = e.state.doc.resolve(t);
|
|
242
|
-
if (!
|
|
242
|
+
if (!K.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 && B.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new K(r))), !0);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
249
|
+
function Je(e, t) {
|
|
250
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof K)) 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 =
|
|
253
|
+
let i = G.empty;
|
|
254
|
+
for (let e = r.length - 1; e >= 0; e--) i = G.from(r[e].createAndFill(null, i));
|
|
255
255
|
let a = e.state.tr.replace(n.pos, n.pos, new P(i, 0, 0));
|
|
256
|
-
return a.setSelection(
|
|
256
|
+
return a.setSelection(Ie.near(a.doc.resolve(n.pos + 1))), e.dispatch(a), !1;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
if (!(e.selection instanceof
|
|
258
|
+
function Ye(e) {
|
|
259
|
+
if (!(e.selection instanceof K)) return null;
|
|
260
260
|
let t = document.createElement("div");
|
|
261
|
-
return t.className = "ProseMirror-gapcursor",
|
|
261
|
+
return t.className = "ProseMirror-gapcursor", H.create(e.doc, [I.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 Xe = 200, J = function() {};
|
|
266
|
+
J.prototype.append = function(e) {
|
|
267
|
+
return e.length ? (e = J.from(e), !this.length && e || e.length < Xe && this.leafAppend(e) || this.length < Xe && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
268
|
+
}, J.prototype.prepend = function(e) {
|
|
269
|
+
return e.length ? J.from(e).append(this) : this;
|
|
270
|
+
}, J.prototype.appendInner = function(e) {
|
|
271
|
+
return new Qe(this, e);
|
|
272
|
+
}, J.prototype.slice = function(e, t) {
|
|
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
|
+
}, J.prototype.get = function(e) {
|
|
275
275
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
276
|
-
},
|
|
276
|
+
}, J.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
|
+
}, J.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
|
+
}, J.from = function(e) {
|
|
285
|
+
return e instanceof J ? e : e && e.length ? new Ze(e) : J.empty;
|
|
286
286
|
};
|
|
287
|
-
var
|
|
287
|
+
var Ze = /* @__PURE__ */ function(e) {
|
|
288
288
|
function t(t) {
|
|
289
289
|
e.call(this), this.values = t;
|
|
290
290
|
}
|
|
@@ -304,17 +304,17 @@ var Qe = /* @__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 <= Xe) 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 <= Xe) 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
|
+
}(J);
|
|
316
|
+
J.empty = new Ze([]);
|
|
317
|
+
var Qe = /* @__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 $e = /* @__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
|
+
}(J), $e = 500, Y = class e {
|
|
345
345
|
constructor(e, t) {
|
|
346
346
|
this.items = e, this.eventCount = t;
|
|
347
347
|
}
|
|
@@ -361,9 +361,9 @@ var $e = /* @__PURE__ */ function(e) {
|
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
363
|
if (i) {
|
|
364
|
-
u.push(new
|
|
364
|
+
u.push(new X(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 X(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 $e = /* @__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 X(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 > tt && (s = et(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 Re();
|
|
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 X(e))), this.eventCount);
|
|
393
393
|
}
|
|
394
394
|
rebased(t, n) {
|
|
395
395
|
if (!this.eventCount) return this;
|
|
@@ -405,13 +405,13 @@ var $e = /* @__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 X(i, o, l));
|
|
409
|
+
} else r.push(new X(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 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() > $e && (u = u.compress(this.items.length - r.length)), u;
|
|
415
415
|
}
|
|
416
416
|
emptyItemCount() {
|
|
417
417
|
let e = 0;
|
|
@@ -428,21 +428,21 @@ var $e = /* @__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 X(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(J.from(i.reverse()), a);
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
|
-
|
|
439
|
-
function
|
|
438
|
+
Y.empty = new Y(J.empty, 0);
|
|
439
|
+
function et(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 X = 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 Y = class e {
|
|
|
452
452
|
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
},
|
|
455
|
+
}, Z = 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
|
|
459
|
+
}, tt = 20;
|
|
460
|
+
function nt(e, t, n, r) {
|
|
461
461
|
let i = n.getMeta(Q), a;
|
|
462
462
|
if (i) return i.historyState;
|
|
463
|
-
n.getMeta(ut) && (e = new
|
|
463
|
+
n.getMeta(ut) && (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
|
|
466
|
+
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r, lt(t)), e.undone, it(n.mapping.maps), e.prevTime, e.prevComposition) : new Z(e.done, e.undone.addTransform(n, void 0, r, lt(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 || !rt(n, e.prevRanges)), s = o ? at(e.prevRanges, n.mapping) : it(n.mapping.maps);
|
|
469
|
+
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, lt(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), at(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), at(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function rt(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 it(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 it(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 at(e, t) {
|
|
487
487
|
if (!e) return null;
|
|
488
488
|
let n = [];
|
|
489
489
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -492,40 +492,40 @@ function ot(e, t) {
|
|
|
492
492
|
}
|
|
493
493
|
return n;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
496
|
-
let r =
|
|
495
|
+
function ot(e, t, n) {
|
|
496
|
+
let r = lt(t), i = Q.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
|
|
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, {
|
|
500
500
|
redo: n,
|
|
501
501
|
historyState: c
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
|
-
var
|
|
505
|
-
function
|
|
504
|
+
var st = !1, ct = null;
|
|
505
|
+
function lt(e) {
|
|
506
506
|
let t = e.plugins;
|
|
507
|
-
if (
|
|
508
|
-
|
|
507
|
+
if (ct != t) {
|
|
508
|
+
st = !1, ct = t;
|
|
509
509
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
510
|
-
|
|
510
|
+
st = !0;
|
|
511
511
|
break;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
return
|
|
514
|
+
return st;
|
|
515
515
|
}
|
|
516
|
-
var Q = new
|
|
516
|
+
var Q = new L("history"), ut = new L("closeHistory");
|
|
517
517
|
function dt(e = {}) {
|
|
518
518
|
return e = {
|
|
519
519
|
depth: e.depth || 100,
|
|
520
520
|
newGroupDelay: e.newGroupDelay || 500
|
|
521
|
-
}, new
|
|
521
|
+
}, new R({
|
|
522
522
|
key: Q,
|
|
523
523
|
state: {
|
|
524
524
|
init() {
|
|
525
|
-
return new
|
|
525
|
+
return new Z(Y.empty, Y.empty, null, 0, -1);
|
|
526
526
|
},
|
|
527
527
|
apply(t, n, r) {
|
|
528
|
-
return
|
|
528
|
+
return nt(n, r, t, e);
|
|
529
529
|
}
|
|
530
530
|
},
|
|
531
531
|
config: e,
|
|
@@ -540,14 +540,14 @@ function ft(e, t) {
|
|
|
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 = ot(i, n, e);
|
|
544
544
|
a && r(t ? a.scrollIntoView() : a);
|
|
545
545
|
}
|
|
546
546
|
return !0;
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
549
|
var pt = ft(!1, !0), mt = ft(!0, !0);
|
|
550
|
-
|
|
550
|
+
U.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 R({
|
|
583
|
+
key: new L("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
|
+
}), U.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 [ze(this.options)];
|
|
622
622
|
}
|
|
623
|
-
}),
|
|
623
|
+
}), U.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 R({
|
|
633
|
+
key: new L("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 H.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(I.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
649
|
+
}), H.create(e, a);
|
|
650
650
|
} }
|
|
651
651
|
})];
|
|
652
652
|
}
|
|
653
|
-
}),
|
|
653
|
+
}), U.create({
|
|
654
654
|
name: "gapCursor",
|
|
655
655
|
addProseMirrorPlugins() {
|
|
656
|
-
return [
|
|
656
|
+
return [Ge()];
|
|
657
657
|
},
|
|
658
658
|
extendNodeSchema(e) {
|
|
659
|
-
return { allowGapCursor:
|
|
659
|
+
return { allowGapCursor: ge(W(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 ht = "placeholder", $ = new
|
|
666
|
+
var ht = "placeholder", $ = new L("tiptap__placeholder"), gt = 200;
|
|
667
667
|
function _t(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), I.node(i, i + a.nodeSize, {
|
|
670
670
|
class: u.join(" "),
|
|
671
671
|
[r]: typeof n == "function" ? n({
|
|
672
672
|
editor: t,
|
|
@@ -684,7 +684,7 @@ function yt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
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 && ye(c)) {
|
|
688
688
|
let r = a >= l && a <= l + c.nodeSize;
|
|
689
689
|
o.push(_t({
|
|
690
690
|
editor: e,
|
|
@@ -708,7 +708,7 @@ function yt({ 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 &&
|
|
711
|
+
let c = a >= i && a <= i + r.nodeSize, l = !r.isLeaf && ye(r);
|
|
712
712
|
return r.type.isTextblock && (c || !t.showOnlyCurrent) && l && o.push(_t({
|
|
713
713
|
editor: e,
|
|
714
714
|
isEmptyDoc: s,
|
|
@@ -729,7 +729,7 @@ function yt({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
729
729
|
})), t.includeChildren;
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
|
-
return
|
|
732
|
+
return H.create(r, o);
|
|
733
733
|
}
|
|
734
734
|
function bt(e) {
|
|
735
735
|
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
@@ -836,7 +836,7 @@ function Et(e) {
|
|
|
836
836
|
}
|
|
837
837
|
function Dt({ editor: e, options: t }) {
|
|
838
838
|
let n = t.dataAttribute ? `data-${bt(t.dataAttribute)}` : `data-${ht}`;
|
|
839
|
-
return new
|
|
839
|
+
return new R({
|
|
840
840
|
key: $,
|
|
841
841
|
state: Tt,
|
|
842
842
|
view: Et,
|
|
@@ -849,7 +849,7 @@ function Dt({ editor: e, options: t }) {
|
|
|
849
849
|
}) }
|
|
850
850
|
});
|
|
851
851
|
}
|
|
852
|
-
var Ot =
|
|
852
|
+
var Ot = U.create({
|
|
853
853
|
name: "placeholder",
|
|
854
854
|
addOptions() {
|
|
855
855
|
return {
|
|
@@ -869,17 +869,17 @@ var Ot = V.create({
|
|
|
869
869
|
})];
|
|
870
870
|
}
|
|
871
871
|
}), kt = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
872
|
-
|
|
872
|
+
U.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" && ke(kt, e.options.injectNonce, "selection"), [new R({
|
|
880
|
+
key: new L("selection"),
|
|
881
881
|
props: { decorations(n) {
|
|
882
|
-
return n.selection.empty || e.isFocused || !e.isEditable ||
|
|
882
|
+
return n.selection.empty || e.isFocused || !e.isEditable || z(n.selection) || e.view.dragging ? null : H.create(n.doc, [I.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
883
883
|
} }
|
|
884
884
|
})];
|
|
885
885
|
}
|
|
@@ -887,7 +887,7 @@ V.create({
|
|
|
887
887
|
function At({ types: e, node: t }) {
|
|
888
888
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
889
889
|
}
|
|
890
|
-
|
|
890
|
+
U.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 L(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 R({
|
|
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];
|
|
@@ -923,7 +923,7 @@ V.create({
|
|
|
923
923
|
})];
|
|
924
924
|
}
|
|
925
925
|
});
|
|
926
|
-
var jt =
|
|
926
|
+
var jt = U.create({
|
|
927
927
|
name: "undoRedo",
|
|
928
928
|
addOptions() {
|
|
929
929
|
return {
|
|
@@ -966,7 +966,7 @@ function Mt(e) {
|
|
|
966
966
|
}
|
|
967
967
|
}));
|
|
968
968
|
}
|
|
969
|
-
var Nt = class extends
|
|
969
|
+
var Nt = class extends De {
|
|
970
970
|
constructor(e = {}) {
|
|
971
971
|
return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = Mt(this.view.state), this.reactiveExtensionStorage = Mt(this.extensionStorage), this.on("beforeTransaction", ({ nextState: e }) => {
|
|
972
972
|
this.reactiveState.value = e, this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
@@ -1149,7 +1149,7 @@ var Rt = {
|
|
|
1149
1149
|
type: Object,
|
|
1150
1150
|
required: !0
|
|
1151
1151
|
}
|
|
1152
|
-
}, zt = class extends
|
|
1152
|
+
}, zt = 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();
|
|
@@ -1209,7 +1209,7 @@ var Rt = {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
handleSelectionUpdate() {
|
|
1211
1211
|
let e = this.getPos();
|
|
1212
|
-
if (typeof e == "number") if (
|
|
1212
|
+
if (typeof e == "number") if (Fe({
|
|
1213
1213
|
selection: this.editor.state.selection,
|
|
1214
1214
|
pos: e,
|
|
1215
1215
|
nodeSize: this.node.nodeSize,
|
|
@@ -1283,13 +1283,13 @@ var Vt = [
|
|
|
1283
1283
|
}, Wt = ["onClick"], Gt = { class: "merge-tag-option-label" }, Kt = { class: "merge-tag-option-id" }, qt = {
|
|
1284
1284
|
key: 1,
|
|
1285
1285
|
class: "merge-tag-empty"
|
|
1286
|
-
}, Jt = /*#__PURE__*/
|
|
1286
|
+
}, Jt = /*#__PURE__*/ M(/* @__PURE__ */ y({
|
|
1287
1287
|
__name: "MergeTagPicker",
|
|
1288
1288
|
emits: ["select"],
|
|
1289
1289
|
setup(n, { emit: i }) {
|
|
1290
|
-
let s = i, { t: c, locale: l } =
|
|
1290
|
+
let s = i, { t: c, locale: l } = Le(), u = r(N, x(() => ({}))), p = x(() => Object.keys(u.value).map((e) => ({
|
|
1291
1291
|
id: e,
|
|
1292
|
-
label:
|
|
1292
|
+
label: V(u.value, e, l.value)
|
|
1293
1293
|
}))), m = g(""), h = x(() => {
|
|
1294
1294
|
let e = m.value.trim().toLowerCase();
|
|
1295
1295
|
return e ? p.value.filter((t) => t.label.toLowerCase().includes(e) || t.id.toLowerCase().includes(e)) : p.value;
|
|
@@ -1322,7 +1322,7 @@ var Vt = [
|
|
|
1322
1322
|
"aria-haspopup": "dialog",
|
|
1323
1323
|
"aria-expanded": _.value,
|
|
1324
1324
|
onMousedown: r[0] ||= T(() => {}, ["prevent"])
|
|
1325
|
-
}, [A(
|
|
1325
|
+
}, [A(de, {
|
|
1326
1326
|
name: "braces",
|
|
1327
1327
|
size: 16
|
|
1328
1328
|
})], 42, Vt)) : C("", !0), p.value.length ? (t(), S("div", {
|
|
@@ -1337,7 +1337,7 @@ var Vt = [
|
|
|
1337
1337
|
onBeforetoggle: w,
|
|
1338
1338
|
onToggle: ne,
|
|
1339
1339
|
onFocusout: D
|
|
1340
|
-
}, [A(
|
|
1340
|
+
}, [A(Te, {
|
|
1341
1341
|
ref_key: "filterInput",
|
|
1342
1342
|
ref: te,
|
|
1343
1343
|
modelValue: m.value,
|
|
@@ -1361,7 +1361,7 @@ var Vt = [
|
|
|
1361
1361
|
__name: "MergeTagView",
|
|
1362
1362
|
props: Rt,
|
|
1363
1363
|
setup(i) {
|
|
1364
|
-
let a = i, { t: o, locale: s } =
|
|
1364
|
+
let a = i, { t: o, locale: s } = Le(), c = r(N, x(() => ({}))), l = x(() => String(a.node.attrs.id ?? "")), u = x(() => c.value[l.value] !== void 0), d = x(() => V(c.value, l.value, s.value)), f = x(() => o("blocks.text.mergeTagChip", { name: d.value }));
|
|
1365
1365
|
return (r, i) => (t(), ne(e(Ft), {
|
|
1366
1366
|
as: "span",
|
|
1367
1367
|
class: b(["merge-tag", { "is-unknown": !u.value }]),
|
|
@@ -1382,7 +1382,7 @@ var Vt = [
|
|
|
1382
1382
|
}
|
|
1383
1383
|
}), Xt = "textStyle";
|
|
1384
1384
|
function Zt(e) {
|
|
1385
|
-
let t =
|
|
1385
|
+
let t = ue(e);
|
|
1386
1386
|
return !t || t.key === "verdana" ? null : t.stack;
|
|
1387
1387
|
}
|
|
1388
1388
|
function Qt(e) {
|
|
@@ -1409,7 +1409,7 @@ function en(e) {
|
|
|
1409
1409
|
function tn(e) {
|
|
1410
1410
|
let t = [];
|
|
1411
1411
|
for (let n = 0; n < e.childCount; n++) t.push(en(e.child(n)));
|
|
1412
|
-
return
|
|
1412
|
+
return G.fromArray(t);
|
|
1413
1413
|
}
|
|
1414
1414
|
function nn(e) {
|
|
1415
1415
|
return new P(tn(e.content), e.openStart, e.openEnd);
|
|
@@ -1444,7 +1444,7 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1444
1444
|
"width",
|
|
1445
1445
|
"x",
|
|
1446
1446
|
"y"
|
|
1447
|
-
], wn = /*#__PURE__*/
|
|
1447
|
+
], wn = /*#__PURE__*/ M(/* @__PURE__ */ y({
|
|
1448
1448
|
__name: "TextEditor",
|
|
1449
1449
|
props: /*@__PURE__*/ j({
|
|
1450
1450
|
editable: {
|
|
@@ -1463,13 +1463,13 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1463
1463
|
}),
|
|
1464
1464
|
emits: ["update:text"],
|
|
1465
1465
|
setup(i) {
|
|
1466
|
-
let s = c(i, "text"), l = i, { t: u } =
|
|
1466
|
+
let s = c(i, "text"), l = i, { t: u } = Le(), p = [
|
|
1467
1467
|
"left",
|
|
1468
1468
|
"center",
|
|
1469
1469
|
"right",
|
|
1470
1470
|
"justify"
|
|
1471
1471
|
], h = x(() => u("blocks.text.label")), _ = It({
|
|
1472
|
-
...
|
|
1472
|
+
...ae,
|
|
1473
1473
|
editorProps: {
|
|
1474
1474
|
attributes: {
|
|
1475
1475
|
"aria-label": h.value,
|
|
@@ -1478,15 +1478,15 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1478
1478
|
},
|
|
1479
1479
|
transformPasted: (e) => nn(e)
|
|
1480
1480
|
},
|
|
1481
|
-
content:
|
|
1481
|
+
content: fe(s.value),
|
|
1482
1482
|
editable: l.editable,
|
|
1483
1483
|
extensions: [
|
|
1484
|
-
...
|
|
1484
|
+
...Se.map((e) => e.name === "mergeTag" ? e.extend({ addNodeView: () => Bt(Yt) }) : e),
|
|
1485
1485
|
jt,
|
|
1486
1486
|
Ot.configure({ placeholder: () => u("blocks.text.placeholder") })
|
|
1487
1487
|
],
|
|
1488
1488
|
onUpdate({ editor: e }) {
|
|
1489
|
-
s.value =
|
|
1489
|
+
s.value = ce(e.getJSON()), j();
|
|
1490
1490
|
},
|
|
1491
1491
|
onSelectionUpdate() {
|
|
1492
1492
|
j();
|
|
@@ -1496,7 +1496,7 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1496
1496
|
_.value?.setOptions({ editorProps: { attributes: { "aria-label": e } } });
|
|
1497
1497
|
}), m(s, (e) => {
|
|
1498
1498
|
let t = _.value;
|
|
1499
|
-
!t ||
|
|
1499
|
+
!t || pe(e, ce(t.getJSON())) || t.commands.setContent(fe(e), { emitUpdate: !1 });
|
|
1500
1500
|
}), m(() => l.editable, (e) => _.value?.setEditable(e));
|
|
1501
1501
|
let v = d("root"), y = d("toolbar");
|
|
1502
1502
|
function w() {
|
|
@@ -1538,7 +1538,7 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1538
1538
|
function re() {
|
|
1539
1539
|
let e = _.value;
|
|
1540
1540
|
if (!e) return "paragraph";
|
|
1541
|
-
let t =
|
|
1541
|
+
let t = le.find((t) => e.isActive("heading", { level: t }));
|
|
1542
1542
|
return t ? `h${t}` : "paragraph";
|
|
1543
1543
|
}
|
|
1544
1544
|
function ie(e) {
|
|
@@ -1546,54 +1546,54 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1546
1546
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1547
1547
|
let n = _.value?.chain().focus();
|
|
1548
1548
|
if (!n) return;
|
|
1549
|
-
let r =
|
|
1549
|
+
let r = le.find((e) => `h${e}` === t.value);
|
|
1550
1550
|
r ? n.setHeading({ level: r }).run() : n.setParagraph().run();
|
|
1551
1551
|
}
|
|
1552
|
-
let M = r(
|
|
1553
|
-
function
|
|
1554
|
-
return typeof e == "string" ?
|
|
1552
|
+
let M = r(Ee, x(() => me));
|
|
1553
|
+
function N(e) {
|
|
1554
|
+
return typeof e == "string" ? ue(e)?.key ?? M.value : M.value;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1556
|
+
function P() {
|
|
1557
1557
|
let e = _.value;
|
|
1558
1558
|
if (!e) return M.value;
|
|
1559
1559
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
1560
|
-
if (r) return
|
|
1560
|
+
if (r) return N(e.getAttributes("textStyle").fontFamily);
|
|
1561
1561
|
let i = /* @__PURE__ */ new Set();
|
|
1562
1562
|
e.state.doc.nodesBetween(t, n, (e) => {
|
|
1563
1563
|
if (!e.isText) return;
|
|
1564
1564
|
let t = e.marks.find((e) => e.type.name === "textStyle");
|
|
1565
|
-
i.add(
|
|
1565
|
+
i.add(N(t?.attrs.fontFamily));
|
|
1566
1566
|
});
|
|
1567
1567
|
let a = Array.from(i);
|
|
1568
1568
|
return a.length > 1 ? "mixed" : a[0] ?? M.value;
|
|
1569
1569
|
}
|
|
1570
|
-
function
|
|
1570
|
+
function F(e) {
|
|
1571
1571
|
let { target: t } = e;
|
|
1572
1572
|
if (!(t instanceof HTMLSelectElement)) return;
|
|
1573
1573
|
let n = t.value, r = _.value?.chain().focus();
|
|
1574
|
-
r &&
|
|
1574
|
+
r && xe(n) && (n === M.value ? r.unsetFontFamily().run() : r.setFontFamily(oe(n)).run());
|
|
1575
1575
|
}
|
|
1576
|
-
let
|
|
1577
|
-
let e =
|
|
1576
|
+
let ge = Oe(() => {
|
|
1577
|
+
let e = P();
|
|
1578
1578
|
return e === "mixed" ? void 0 : e;
|
|
1579
|
-
}),
|
|
1579
|
+
}), _e = x({
|
|
1580
1580
|
get: () => {
|
|
1581
|
-
let e = _.value?.getAttributes("textStyle").color, t = typeof e == "string" ?
|
|
1581
|
+
let e = _.value?.getAttributes("textStyle").color, t = typeof e == "string" ? he(e) : void 0;
|
|
1582
1582
|
return t ? {
|
|
1583
1583
|
type: "color",
|
|
1584
1584
|
...t
|
|
1585
|
-
} :
|
|
1585
|
+
} : Ne;
|
|
1586
1586
|
},
|
|
1587
1587
|
set: (e) => {
|
|
1588
|
-
e.type !== "transparent" && _.value?.chain().setColor(
|
|
1588
|
+
e.type !== "transparent" && _.value?.chain().setColor(je(e)).run();
|
|
1589
1589
|
}
|
|
1590
|
-
}),
|
|
1590
|
+
}), ye = {
|
|
1591
1591
|
left: "blocks.text.alignLeft",
|
|
1592
1592
|
center: "blocks.text.alignCenter",
|
|
1593
1593
|
right: "blocks.text.alignRight",
|
|
1594
1594
|
justify: "blocks.text.alignJustify"
|
|
1595
1595
|
};
|
|
1596
|
-
function
|
|
1596
|
+
function be(e) {
|
|
1597
1597
|
return (e === "justify" ? [
|
|
1598
1598
|
14,
|
|
1599
1599
|
14,
|
|
@@ -1613,48 +1613,48 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1613
1613
|
};
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
|
-
let I = o(), L = d("linkPopover"),
|
|
1617
|
-
function
|
|
1616
|
+
let I = o(), L = d("linkPopover"), R = d("linkInput"), we = d("linkTrigger"), z = g(""), B = g(!1), V = g(!1);
|
|
1617
|
+
function De(e) {
|
|
1618
1618
|
if (e.newState !== "open") return;
|
|
1619
1619
|
let t = _.value?.getAttributes("link")?.href;
|
|
1620
|
-
|
|
1621
|
-
let n = L.value, r =
|
|
1620
|
+
z.value = typeof t == "string" ? t : "", V.value = z.value !== "";
|
|
1621
|
+
let n = L.value, r = we.value?.getBoundingClientRect();
|
|
1622
1622
|
n && r && (n.style.left = `${r.left}px`, n.style.top = `${r.bottom + 4}px`);
|
|
1623
1623
|
}
|
|
1624
|
-
function
|
|
1625
|
-
if (
|
|
1624
|
+
function ke(e) {
|
|
1625
|
+
if (B.value = e.newState === "open", e.newState !== "open") return;
|
|
1626
1626
|
let t = L.value;
|
|
1627
1627
|
if (t) {
|
|
1628
1628
|
let e = window.innerWidth - t.offsetWidth - 8;
|
|
1629
1629
|
Number.parseFloat(t.style.left) > e && (t.style.left = `${Math.max(8, e)}px`);
|
|
1630
1630
|
}
|
|
1631
1631
|
a(() => {
|
|
1632
|
-
|
|
1632
|
+
R.value?.focus(), R.value?.select();
|
|
1633
1633
|
});
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function H(e) {
|
|
1636
1636
|
let t = e.relatedTarget, n = L.value;
|
|
1637
1637
|
t instanceof Node && n?.contains(t) || n?.hidePopover();
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function U() {
|
|
1640
1640
|
let e = _.value?.chain().focus();
|
|
1641
1641
|
if (!e) return;
|
|
1642
|
-
let t =
|
|
1642
|
+
let t = Me(z.value);
|
|
1643
1643
|
t === "" ? e.unsetLink().run() : e.setLink({
|
|
1644
1644
|
href: t,
|
|
1645
1645
|
target: t.startsWith("#") ? null : "_blank"
|
|
1646
1646
|
}).run(), L.value?.hidePopover();
|
|
1647
1647
|
}
|
|
1648
|
-
let
|
|
1649
|
-
function
|
|
1650
|
-
e === "" ?
|
|
1648
|
+
let W = r(Ce, x(() => [])), Fe = x(() => z.value.startsWith("#") && W.value.includes(z.value.slice(1)) ? z.value.slice(1) : "");
|
|
1649
|
+
function Ie(e) {
|
|
1650
|
+
e === "" ? z.value.startsWith("#") && (z.value = "") : z.value = `#${e}`;
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function G() {
|
|
1653
1653
|
_.value?.chain().focus().unsetLink().run(), L.value?.hidePopover();
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function Re(e) {
|
|
1656
1656
|
_.value?.chain().focus().insertContent({
|
|
1657
|
-
type:
|
|
1657
|
+
type: Pe,
|
|
1658
1658
|
attrs: { id: e }
|
|
1659
1659
|
}).run();
|
|
1660
1660
|
}
|
|
@@ -1669,7 +1669,7 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1669
1669
|
onFocusout: ne
|
|
1670
1670
|
}, [A(e(Pt), ee(l.editable ? { class: "text-input" } : {}, {
|
|
1671
1671
|
editor: e(_),
|
|
1672
|
-
style: e(
|
|
1672
|
+
style: e(se)(l)
|
|
1673
1673
|
}), null, 16, ["editor", "style"]), l.editable ? (t(), S("div", {
|
|
1674
1674
|
key: 0,
|
|
1675
1675
|
ref_key: "toolbar",
|
|
@@ -1683,7 +1683,7 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1683
1683
|
value: re(),
|
|
1684
1684
|
onChange: ie,
|
|
1685
1685
|
onMousedown: i[0] ||= T(() => {}, ["stop"])
|
|
1686
|
-
}, [E("option", an, O(e(u)("blocks.text.styleNormal")), 1), (t(!0), S(k, null, f(e(
|
|
1686
|
+
}, [E("option", an, O(e(u)("blocks.text.styleNormal")), 1), (t(!0), S(k, null, f(e(le), (n) => (t(), S("option", {
|
|
1687
1687
|
key: n,
|
|
1688
1688
|
value: `h${n}`
|
|
1689
1689
|
}, O(e(u)("blocks.text.styleHeading", { level: n })), 9, on))), 128))], 40, rn),
|
|
@@ -1691,16 +1691,16 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1691
1691
|
E("select", {
|
|
1692
1692
|
"aria-label": e(u)("blocks.text.font"),
|
|
1693
1693
|
class: "font",
|
|
1694
|
-
value:
|
|
1695
|
-
onChange:
|
|
1694
|
+
value: P(),
|
|
1695
|
+
onChange: F,
|
|
1696
1696
|
onMousedown: i[1] ||= T(() => {}, ["stop"])
|
|
1697
|
-
}, [E("option", cn, O(e(u)("blocks.text.fontMixed")), 1), (t(!0), S(k, null, f(e(
|
|
1697
|
+
}, [E("option", cn, O(e(u)("blocks.text.fontMixed")), 1), (t(!0), S(k, null, f(e(ge), (e) => (t(), S("option", {
|
|
1698
1698
|
key: e.key,
|
|
1699
1699
|
value: e.key
|
|
1700
1700
|
}, O(e.name), 9, ln))), 128))], 40, sn),
|
|
1701
|
-
A(
|
|
1702
|
-
modelValue:
|
|
1703
|
-
"onUpdate:modelValue": i[2] ||= (e) =>
|
|
1701
|
+
A(ve, {
|
|
1702
|
+
modelValue: _e.value,
|
|
1703
|
+
"onUpdate:modelValue": i[2] ||= (e) => _e.value = e,
|
|
1704
1704
|
"allow-transparent": !1,
|
|
1705
1705
|
label: e(u)("blocks.text.textColor"),
|
|
1706
1706
|
onMousedown: i[3] ||= T(() => {}, ["stop"])
|
|
@@ -1732,15 +1732,15 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1732
1732
|
}, [...i[18] ||= [E("u", null, "U", -1)]], 42, fn),
|
|
1733
1733
|
E("button", {
|
|
1734
1734
|
ref_key: "linkTrigger",
|
|
1735
|
-
ref:
|
|
1735
|
+
ref: we,
|
|
1736
1736
|
class: b({ active: e(_)?.isActive("link") }),
|
|
1737
1737
|
type: "button",
|
|
1738
1738
|
title: e(u)("blocks.text.link"),
|
|
1739
1739
|
popovertarget: e(I),
|
|
1740
1740
|
"aria-haspopup": "dialog",
|
|
1741
|
-
"aria-expanded":
|
|
1741
|
+
"aria-expanded": B.value,
|
|
1742
1742
|
onMousedown: i[10] ||= T(() => {}, ["prevent"])
|
|
1743
|
-
}, [A(
|
|
1743
|
+
}, [A(de, {
|
|
1744
1744
|
name: "link",
|
|
1745
1745
|
size: 16
|
|
1746
1746
|
})], 42, pn),
|
|
@@ -1753,34 +1753,34 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1753
1753
|
popover: "",
|
|
1754
1754
|
role: "dialog",
|
|
1755
1755
|
"aria-label": e(u)("blocks.text.link"),
|
|
1756
|
-
onBeforetoggle:
|
|
1757
|
-
onToggle:
|
|
1758
|
-
onFocusout:
|
|
1756
|
+
onBeforetoggle: De,
|
|
1757
|
+
onToggle: ke,
|
|
1758
|
+
onFocusout: H
|
|
1759
1759
|
}, [
|
|
1760
|
-
E("span", hn, [A(
|
|
1760
|
+
E("span", hn, [A(Te, {
|
|
1761
1761
|
ref_key: "linkInput",
|
|
1762
|
-
ref:
|
|
1763
|
-
modelValue:
|
|
1764
|
-
"onUpdate:modelValue": i[11] ||= (e) =>
|
|
1762
|
+
ref: R,
|
|
1763
|
+
modelValue: z.value,
|
|
1764
|
+
"onUpdate:modelValue": i[11] ||= (e) => z.value = e,
|
|
1765
1765
|
inputmode: "url",
|
|
1766
1766
|
spellcheck: "false",
|
|
1767
1767
|
autocomplete: "off",
|
|
1768
1768
|
placeholder: e(u)("blocks.text.linkPlaceholder"),
|
|
1769
1769
|
"aria-label": e(u)("blocks.text.linkPrompt"),
|
|
1770
|
-
onKeydown: te(T(
|
|
1770
|
+
onKeydown: te(T(U, ["prevent"]), ["enter"])
|
|
1771
1771
|
}, null, 8, [
|
|
1772
1772
|
"modelValue",
|
|
1773
1773
|
"placeholder",
|
|
1774
1774
|
"aria-label",
|
|
1775
1775
|
"onKeydown"
|
|
1776
1776
|
])]),
|
|
1777
|
-
e(
|
|
1777
|
+
e(W).length ? (t(), S("span", gn, [A(Ae, {
|
|
1778
1778
|
"aria-label": e(u)("blocks.common.anchorLink.label"),
|
|
1779
|
-
"model-value":
|
|
1780
|
-
"onUpdate:modelValue":
|
|
1779
|
+
"model-value": Fe.value,
|
|
1780
|
+
"onUpdate:modelValue": Ie,
|
|
1781
1781
|
onMousedown: i[12] ||= T(() => {}, ["stop"])
|
|
1782
1782
|
}, {
|
|
1783
|
-
default: n(() => [
|
|
1783
|
+
default: n(() => [Fe.value ? (t(), S("option", _n, O(e(u)("blocks.common.anchorLink.none")), 1)) : (t(), S("option", vn, O(e(u)("blocks.common.anchorLink.placeholder")), 1)), (t(!0), S(k, null, f(e(W), (e) => (t(), S("option", {
|
|
1784
1784
|
key: e,
|
|
1785
1785
|
value: e
|
|
1786
1786
|
}, " #" + O(e), 9, yn))), 128))]),
|
|
@@ -1789,32 +1789,32 @@ var rn = ["aria-label", "value"], an = { value: "paragraph" }, on = ["value"], s
|
|
|
1789
1789
|
E("button", {
|
|
1790
1790
|
class: "link-apply",
|
|
1791
1791
|
type: "button",
|
|
1792
|
-
onClick:
|
|
1792
|
+
onClick: U,
|
|
1793
1793
|
onMousedown: i[13] ||= T(() => {}, ["prevent"])
|
|
1794
1794
|
}, O(e(u)("blocks.text.linkApply")), 33),
|
|
1795
|
-
|
|
1795
|
+
V.value ? (t(), S("button", {
|
|
1796
1796
|
key: 1,
|
|
1797
1797
|
class: "link-remove",
|
|
1798
1798
|
type: "button",
|
|
1799
1799
|
title: e(u)("blocks.text.linkRemove"),
|
|
1800
1800
|
"aria-label": e(u)("blocks.text.linkRemove"),
|
|
1801
|
-
onClick:
|
|
1801
|
+
onClick: G,
|
|
1802
1802
|
onMousedown: i[14] ||= T(() => {}, ["prevent"])
|
|
1803
|
-
}, [A(
|
|
1803
|
+
}, [A(de, {
|
|
1804
1804
|
name: "trash",
|
|
1805
1805
|
size: 16
|
|
1806
1806
|
})], 40, bn)) : C("", !0)
|
|
1807
1807
|
], 40, mn)) : C("", !0),
|
|
1808
|
-
A(Jt, { onSelect:
|
|
1808
|
+
A(Jt, { onSelect: Re }),
|
|
1809
1809
|
i[21] ||= E("span", { class: "divider" }, null, -1),
|
|
1810
1810
|
(t(), S(k, null, f(p, (n) => E("button", {
|
|
1811
1811
|
key: n,
|
|
1812
1812
|
class: b({ active: e(_)?.isActive({ textAlign: n }) }),
|
|
1813
|
-
title: e(u)(
|
|
1813
|
+
title: e(u)(ye[n]),
|
|
1814
1814
|
type: "button",
|
|
1815
1815
|
onClick: (t) => e(_)?.chain().focus().setTextAlign(n).run(),
|
|
1816
1816
|
onMousedown: i[15] ||= T(() => {}, ["prevent"])
|
|
1817
|
-
}, [(t(), S("svg", Sn, [(t(!0), S(k, null, f(
|
|
1817
|
+
}, [(t(), S("svg", Sn, [(t(!0), S(k, null, f(be(n), (e, n) => (t(), S("rect", {
|
|
1818
1818
|
key: n,
|
|
1819
1819
|
fill: "currentColor",
|
|
1820
1820
|
height: "1.5",
|