ai-word-editor 0.0.29 → 0.0.31

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/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { useUmoEditor as bo } from "@umoteam/editor";
2
- import { ref as z, computed as Ne, openBlock as q, createElementBlock as rt, createElementVNode as y, createTextVNode as Ln, toDisplayString as Y, createCommentVNode as le, unref as oe, Fragment as hr, renderList as pr, normalizeClass as mr, onMounted as gr, createBlock as Ie, Teleport as yr, withModifiers as ze, withDirectives as vo, withKeys as dn, vModelText as So, watch as hn, normalizeStyle as Co, onUnmounted as To, resolveComponent as Ao, mergeProps as Mo, withCtx as Eo, createVNode as No, createApp as Io, h as Oo } from "vue";
3
- import { e as $o, a as Bo, s as Ro } from "./wordDocxExport-HUc5glnu.js";
4
- import wr from "jszip";
2
+ import { ref as z, computed as Ne, openBlock as q, createElementBlock as rt, createElementVNode as y, createTextVNode as Jn, toDisplayString as Y, createCommentVNode as le, unref as oe, Fragment as hr, renderList as pr, normalizeClass as mr, onMounted as gr, createBlock as Ie, Teleport as yr, withModifiers as ze, withDirectives as vo, withKeys as dn, vModelText as So, watch as hn, normalizeStyle as Co, onUnmounted as To, resolveComponent as Ao, mergeProps as Mo, withCtx as Eo, createVNode as No, createApp as Io, h as Oo } from "vue";
3
+ import { J as wr, e as $o, a as Bo, s as Ro } from "./wordDocxExport-D5RLS3sU.js";
5
4
  const zo = "http://localhost:8000";
6
5
  async function Tt(r, t = {}) {
7
6
  const e = {
@@ -86,17 +85,17 @@ function Do(r, t) {
86
85
  const e = yt.get(r) || {};
87
86
  yt.set(r, { ...e, ...t });
88
87
  }
89
- function Jn(r) {
88
+ function Ln(r) {
90
89
  if (ft.has(r)) {
91
90
  ft.delete(r), yt.delete(r), xt.delete(r);
92
91
  return;
93
92
  }
94
93
  yt.delete(r), xt.add(r);
95
94
  }
96
- function Lo(r) {
95
+ function Jo(r) {
97
96
  xt.delete(r);
98
97
  }
99
- function Jo() {
98
+ function Lo() {
100
99
  ft.clear(), yt.clear(), xt.clear();
101
100
  }
102
101
  async function Wo(r) {
@@ -168,7 +167,7 @@ function xr() {
168
167
  const l = Ct.value.slice();
169
168
  Ct.value = Ct.value.filter((a) => a.id !== s), ve.value === s && (ve.value = null);
170
169
  try {
171
- Jn(s);
170
+ Ln(s);
172
171
  } catch (a) {
173
172
  Ct.value = l, console.error("删除批注入队失败:", a);
174
173
  }
@@ -185,10 +184,10 @@ function xr() {
185
184
  return `${l.getMonth() + 1}/${l.getDate()} ${a(l.getHours())}:${a(l.getMinutes())}`;
186
185
  },
187
186
  flushPending: Wo,
188
- resetPending: Jo,
187
+ resetPending: Lo,
189
188
  // 供 App.vue 的“孤立批注软删除/撤销”逻辑使用
190
- queueDelete: Jn,
191
- cancelPendingDelete: Lo
189
+ queueDelete: Ln,
190
+ cancelPendingDelete: Jo
192
191
  };
193
192
  }
194
193
  const He = (r, t) => {
@@ -215,7 +214,7 @@ const He = (r, t) => {
215
214
  return (u, f) => (q(), rt("aside", jo, [
216
215
  y("div", Vo, [
217
216
  y("h3", qo, [
218
- f[0] || (f[0] = Ln(" 批注 ", -1)),
217
+ f[0] || (f[0] = Jn(" 批注 ", -1)),
219
218
  l.value ? (q(), rt("span", Ho, Y(l.value), 1)) : le("", !0)
220
219
  ])
221
220
  ]),
@@ -237,7 +236,7 @@ const He = (r, t) => {
237
236
  }, [
238
237
  y("div", Xo, [
239
238
  f[2] || (f[2] = y("span", { class: "comment-item__quote-icon" }, "❝", -1)),
240
- Ln(" " + Y(a(d.selectedText, 40)), 1)
239
+ Jn(" " + Y(a(d.selectedText, 40)), 1)
241
240
  ]),
242
241
  y("div", Zo, Y(d.note), 1),
243
242
  y("div", Qo, [
@@ -757,7 +756,7 @@ function Pe(r, t) {
757
756
  }
758
757
  return !0;
759
758
  }
760
- let J = class pn {
759
+ let L = class pn {
761
760
  /**
762
761
  @internal
763
762
  */
@@ -862,7 +861,7 @@ let J = class pn {
862
861
  return e.sort((n, o) => n.type.rank - o.type.rank), e;
863
862
  }
864
863
  };
865
- J.none = [];
864
+ L.none = [];
866
865
  class Fe extends Error {
867
866
  }
868
867
  class S {
@@ -1160,7 +1159,7 @@ class fe {
1160
1159
  marks() {
1161
1160
  let t = this.parent, e = this.index();
1162
1161
  if (t.content.size == 0)
1163
- return J.none;
1162
+ return L.none;
1164
1163
  if (this.textOffset)
1165
1164
  return t.child(e).marks;
1166
1165
  let n = t.maybeChild(e - 1), o = t.maybeChild(e);
@@ -1327,7 +1326,7 @@ class kt {
1327
1326
  /**
1328
1327
  @internal
1329
1328
  */
1330
- constructor(t, e, n, o = J.none) {
1329
+ constructor(t, e, n, o = L.none) {
1331
1330
  this.type = t, this.attrs = e, this.marks = o, this.content = n || x.empty;
1332
1331
  }
1333
1332
  /**
@@ -1441,7 +1440,7 @@ class kt {
1441
1440
  attributes, and marks.
1442
1441
  */
1443
1442
  hasMarkup(t, e, n) {
1444
- return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) && J.sameSet(this.marks, n || J.none);
1443
+ return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) && L.sameSet(this.marks, n || L.none);
1445
1444
  }
1446
1445
  /**
1447
1446
  Create a new node with the same markup as this node, containing
@@ -1651,12 +1650,12 @@ class kt {
1651
1650
  */
1652
1651
  check() {
1653
1652
  this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
1654
- let t = J.none;
1653
+ let t = L.none;
1655
1654
  for (let e = 0; e < this.marks.length; e++) {
1656
1655
  let n = this.marks[e];
1657
1656
  n.type.checkAttrs(n.attrs), t = n.addToSet(t);
1658
1657
  }
1659
- if (!J.sameSet(t, this.marks))
1658
+ if (!L.sameSet(t, this.marks))
1660
1659
  throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
1661
1660
  this.content.forEach((e) => e.check());
1662
1661
  }
@@ -1693,7 +1692,7 @@ class kt {
1693
1692
  }
1694
1693
  }
1695
1694
  kt.prototype.text = void 0;
1696
- class Le extends kt {
1695
+ class Je extends kt {
1697
1696
  /**
1698
1697
  @internal
1699
1698
  */
@@ -1715,10 +1714,10 @@ class Le extends kt {
1715
1714
  return this.text.length;
1716
1715
  }
1717
1716
  mark(t) {
1718
- return t == this.marks ? this : new Le(this.type, this.attrs, this.text, t);
1717
+ return t == this.marks ? this : new Je(this.type, this.attrs, this.text, t);
1719
1718
  }
1720
1719
  withText(t) {
1721
- return t == this.text ? this : new Le(this.type, this.attrs, t, this.marks);
1720
+ return t == this.text ? this : new Je(this.type, this.attrs, t, this.marks);
1722
1721
  }
1723
1722
  cut(t = 0, e = this.text.length) {
1724
1723
  return t == 0 && e == this.text.length ? this : this.withText(this.text.slice(t, e));
@@ -2120,7 +2119,7 @@ function Br(r, t) {
2120
2119
  e[n] = new Ei(r, n, t[n]);
2121
2120
  return e;
2122
2121
  }
2123
- class Je {
2122
+ class Le {
2124
2123
  /**
2125
2124
  @internal
2126
2125
  */
@@ -2199,7 +2198,7 @@ class Je {
2199
2198
  create(t = null, e, n) {
2200
2199
  if (this.isText)
2201
2200
  throw new Error("NodeType.create can't construct text nodes");
2202
- return new kt(this, this.computeAttrs(t), x.from(e), J.setFrom(n));
2201
+ return new kt(this, this.computeAttrs(t), x.from(e), L.setFrom(n));
2203
2202
  }
2204
2203
  /**
2205
2204
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
@@ -2207,7 +2206,7 @@ class Je {
2207
2206
  if it doesn't match.
2208
2207
  */
2209
2208
  createChecked(t = null, e, n) {
2210
- return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e, J.setFrom(n));
2209
+ return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e, L.setFrom(n));
2211
2210
  }
2212
2211
  /**
2213
2212
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
@@ -2225,7 +2224,7 @@ class Je {
2225
2224
  e = s.append(e);
2226
2225
  }
2227
2226
  let o = this.contentMatch.matchFragment(e), i = o && o.fillBefore(x.empty, !0);
2228
- return i ? new kt(this, t, e.append(i), J.setFrom(n)) : null;
2227
+ return i ? new kt(this, t, e.append(i), L.setFrom(n)) : null;
2229
2228
  }
2230
2229
  /**
2231
2230
  Returns true if the given fragment is valid content for this node
@@ -2281,14 +2280,14 @@ class Je {
2281
2280
  let e;
2282
2281
  for (let n = 0; n < t.length; n++)
2283
2282
  this.allowsMarkType(t[n].type) ? e && e.push(t[n]) : e || (e = t.slice(0, n));
2284
- return e ? e.length ? e : J.none : t;
2283
+ return e ? e.length ? e : L.none : t;
2285
2284
  }
2286
2285
  /**
2287
2286
  @internal
2288
2287
  */
2289
2288
  static compile(t, e) {
2290
2289
  let n = /* @__PURE__ */ Object.create(null);
2291
- t.forEach((i, s) => n[i] = new Je(i, e, s));
2290
+ t.forEach((i, s) => n[i] = new Le(i, e, s));
2292
2291
  let o = e.spec.topNode || "doc";
2293
2292
  if (!n[o])
2294
2293
  throw new RangeError("Schema is missing its top node type ('" + o + "')");
@@ -2322,7 +2321,7 @@ class kn {
2322
2321
  constructor(t, e, n, o) {
2323
2322
  this.name = t, this.rank = e, this.schema = n, this.spec = o, this.attrs = Br(t, o.attrs), this.excluded = null;
2324
2323
  let i = Ir(this.attrs);
2325
- this.instance = i ? new J(this, i) : null;
2324
+ this.instance = i ? new L(this, i) : null;
2326
2325
  }
2327
2326
  /**
2328
2327
  Create a mark of this type. `attrs` may be `null` or an object
@@ -2330,7 +2329,7 @@ class kn {
2330
2329
  they have defaults, will be added.
2331
2330
  */
2332
2331
  create(t = null) {
2333
- return !t && this.instance ? this.instance : new J(this, Or(this.attrs, t));
2332
+ return !t && this.instance ? this.instance : new L(this, Or(this.attrs, t));
2334
2333
  }
2335
2334
  /**
2336
2335
  @internal
@@ -2379,7 +2378,7 @@ class Ni {
2379
2378
  let e = this.spec = {};
2380
2379
  for (let o in t)
2381
2380
  e[o] = t[o];
2382
- e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Je.compile(this.spec.nodes, this), this.marks = kn.compile(this.spec.marks, this);
2381
+ e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Le.compile(this.spec.nodes, this), this.marks = kn.compile(this.spec.marks, this);
2383
2382
  let n = /* @__PURE__ */ Object.create(null);
2384
2383
  for (let o in this.nodes) {
2385
2384
  if (o in this.marks)
@@ -2398,7 +2397,7 @@ class Ni {
2398
2397
  let i = this.marks[o], s = i.spec.excludes;
2399
2398
  i.excluded = s == null ? [i] : s == "" ? [] : qn(this, s.split(" "));
2400
2399
  }
2401
- this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) => J.fromJSON(this, o), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2400
+ this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) => L.fromJSON(this, o), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
2402
2401
  }
2403
2402
  /**
2404
2403
  Create a node in this schema. The `type` may be a string or a
@@ -2409,7 +2408,7 @@ class Ni {
2409
2408
  node(t, e = null, n, o) {
2410
2409
  if (typeof t == "string")
2411
2410
  t = this.nodeType(t);
2412
- else if (t instanceof Je) {
2411
+ else if (t instanceof Le) {
2413
2412
  if (t.schema != this)
2414
2413
  throw new RangeError("Node type from different schema used (" + t.name + ")");
2415
2414
  } else throw new RangeError("Invalid node type: " + t);
@@ -2421,7 +2420,7 @@ class Ni {
2421
2420
  */
2422
2421
  text(t, e) {
2423
2422
  let n = this.nodes.text;
2424
- return new Le(n, n.defaultAttrs, t, J.setFrom(e));
2423
+ return new Je(n, n.defaultAttrs, t, L.setFrom(e));
2425
2424
  }
2426
2425
  /**
2427
2426
  Create a mark with the given type and attributes.
@@ -2488,7 +2487,7 @@ let rn = class gn {
2488
2487
  */
2489
2488
  parse(t, e = {}) {
2490
2489
  let n = new Un(this, e, !1);
2491
- return n.addAll(t, J.none, e.from, e.to), n.finish();
2490
+ return n.addAll(t, L.none, e.from, e.to), n.finish();
2492
2491
  }
2493
2492
  /**
2494
2493
  Parses the content of the given DOM node, like
@@ -2500,7 +2499,7 @@ let rn = class gn {
2500
2499
  */
2501
2500
  parseSlice(t, e = {}) {
2502
2501
  let n = new Un(this, e, !0);
2503
- return n.addAll(t, J.none, e.from, e.to), S.maxOpen(n.finish());
2502
+ return n.addAll(t, L.none, e.from, e.to), S.maxOpen(n.finish());
2504
2503
  }
2505
2504
  /**
2506
2505
  @internal
@@ -2622,7 +2621,7 @@ function Hn(r, t, e) {
2622
2621
  }
2623
2622
  class Ce {
2624
2623
  constructor(t, e, n, o, i, s) {
2625
- this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks = J.none, this.match = i || (s & ce ? null : t.contentMatch);
2624
+ this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks = L.none, this.match = i || (s & ce ? null : t.contentMatch);
2626
2625
  }
2627
2626
  findWrapping(t) {
2628
2627
  if (!this.match) {
@@ -2657,7 +2656,7 @@ class Un {
2657
2656
  constructor(t, e, n) {
2658
2657
  this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
2659
2658
  let o = e.topNode, i, s = Hn(null, e.preserveWhitespace, 0) | (n ? ce : 0);
2660
- o ? i = new Ce(o.type, o.attrs, J.none, !0, e.topMatch || o.type.contentMatch, s) : n ? i = new Ce(null, null, J.none, !0, null, s) : i = new Ce(t.schema.topNodeType, null, J.none, !0, null, s), this.nodes = [i], this.find = e.findPositions, this.needsBlock = !1;
2659
+ o ? i = new Ce(o.type, o.attrs, L.none, !0, e.topMatch || o.type.contentMatch, s) : n ? i = new Ce(null, null, L.none, !0, null, s) : i = new Ce(t.schema.topNodeType, null, L.none, !0, null, s), this.nodes = [i], this.find = e.findPositions, this.needsBlock = !1;
2661
2660
  }
2662
2661
  get top() {
2663
2662
  return this.nodes[this.open];
@@ -2820,7 +2819,7 @@ class Un {
2820
2819
  this.closeExtra();
2821
2820
  let i = this.top;
2822
2821
  i.match && (i.match = i.match.matchType(t.type));
2823
- let s = J.none;
2822
+ let s = L.none;
2824
2823
  for (let l of o.concat(t.marks))
2825
2824
  (i.type ? i.type.allowsMarkType(l.type) : Kn(l.type, t.type)) && (s = l.addToSet(s));
2826
2825
  return i.content.push(t.mark(s)), !0;
@@ -2840,7 +2839,7 @@ class Un {
2840
2839
  s.match = s.match && s.match.matchType(t);
2841
2840
  let l = Hn(t, i, s.options);
2842
2841
  s.options & ce && s.content.length == 0 && (l |= ce);
2843
- let a = J.none;
2842
+ let a = L.none;
2844
2843
  return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Kn(c.type, t)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Ce(t, e, a, o, null, l)), this.open++, n;
2845
2844
  }
2846
2845
  // Make sure all nodes above this.open are finished and added to
@@ -2978,7 +2977,7 @@ function Xn(r) {
2978
2977
  function Pi(r) {
2979
2978
  return (r - (r & Pr)) / Fr;
2980
2979
  }
2981
- const _r = 1, Dr = 2, $e = 4, Lr = 8;
2980
+ const _r = 1, Dr = 2, $e = 4, Jr = 8;
2982
2981
  class Zn {
2983
2982
  /**
2984
2983
  @internal
@@ -2992,7 +2991,7 @@ class Zn {
2992
2991
  argument from the document.
2993
2992
  */
2994
2993
  get deleted() {
2995
- return (this.delInfo & Lr) > 0;
2994
+ return (this.delInfo & Jr) > 0;
2996
2995
  }
2997
2996
  /**
2998
2997
  Tells you whether the token before the mapped position was deleted.
@@ -3056,7 +3055,7 @@ class lt {
3056
3055
  if (n)
3057
3056
  return h;
3058
3057
  let m = t == (e < 0 ? a : f) ? null : zi(l / 3, t - a), p = t == a ? Dr : t == f ? _r : $e;
3059
- return (e < 0 ? t != a : t != f) && (p |= Lr), new Zn(h, p, m);
3058
+ return (e < 0 ? t != a : t != f) && (p |= Jr), new Zn(h, p, m);
3060
3059
  }
3061
3060
  o += u - c;
3062
3061
  }
@@ -3274,7 +3273,7 @@ class Dt extends nt {
3274
3273
  }
3275
3274
  }
3276
3275
  nt.jsonID("removeMark", Dt);
3277
- class Lt extends nt {
3276
+ class Jt extends nt {
3278
3277
  /**
3279
3278
  Create a node mark step.
3280
3279
  */
@@ -3295,15 +3294,15 @@ class Lt extends nt {
3295
3294
  if (n.length == e.marks.length) {
3296
3295
  for (let o = 0; o < e.marks.length; o++)
3297
3296
  if (!e.marks[o].isInSet(n))
3298
- return new Lt(this.pos, e.marks[o]);
3299
- return new Lt(this.pos, this.mark);
3297
+ return new Jt(this.pos, e.marks[o]);
3298
+ return new Jt(this.pos, this.mark);
3300
3299
  }
3301
3300
  }
3302
3301
  return new he(this.pos, this.mark);
3303
3302
  }
3304
3303
  map(t) {
3305
3304
  let e = t.mapResult(this.pos, 1);
3306
- return e.deletedAfter ? null : new Lt(e.pos, this.mark);
3305
+ return e.deletedAfter ? null : new Jt(e.pos, this.mark);
3307
3306
  }
3308
3307
  toJSON() {
3309
3308
  return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
@@ -3314,10 +3313,10 @@ class Lt extends nt {
3314
3313
  static fromJSON(t, e) {
3315
3314
  if (typeof e.pos != "number")
3316
3315
  throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
3317
- return new Lt(e.pos, t.markFromJSON(e.mark));
3316
+ return new Jt(e.pos, t.markFromJSON(e.mark));
3318
3317
  }
3319
3318
  }
3320
- nt.jsonID("addNodeMark", Lt);
3319
+ nt.jsonID("addNodeMark", Jt);
3321
3320
  class he extends nt {
3322
3321
  /**
3323
3322
  Create a mark-removing step.
@@ -3334,7 +3333,7 @@ class he extends nt {
3334
3333
  }
3335
3334
  invert(t) {
3336
3335
  let e = t.nodeAt(this.pos);
3337
- return !e || !this.mark.isInSet(e.marks) ? this : new Lt(this.pos, this.mark);
3336
+ return !e || !this.mark.isInSet(e.marks) ? this : new Jt(this.pos, this.mark);
3338
3337
  }
3339
3338
  map(t) {
3340
3339
  let e = t.mapResult(this.pos, 1);
@@ -3492,7 +3491,7 @@ function Qt(r) {
3492
3491
  }
3493
3492
  return null;
3494
3493
  }
3495
- function Jr(r, t, e = null, n = r) {
3494
+ function Lr(r, t, e = null, n = r) {
3496
3495
  let o = _i(r, t), i = o && Di(n, t);
3497
3496
  return i ? o.map(Qn).concat({ type: t, attrs: e }).concat(i.map(Qn)) : null;
3498
3497
  }
@@ -3536,7 +3535,7 @@ function qt(r, t) {
3536
3535
  let e = r.resolve(t), n = e.index();
3537
3536
  return Wr(e.nodeBefore, e.nodeAfter) && e.parent.canReplace(n, n + 1);
3538
3537
  }
3539
- function Li(r, t) {
3538
+ function Ji(r, t) {
3540
3539
  t.content.size || r.type.compatibleContent(t.type);
3541
3540
  let e = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
3542
3541
  for (let o = 0; o < t.childCount; o++) {
@@ -3547,7 +3546,7 @@ function Li(r, t) {
3547
3546
  return e.validEnd;
3548
3547
  }
3549
3548
  function Wr(r, t) {
3550
- return !!(r && t && !r.isLeaf && Li(r, t));
3549
+ return !!(r && t && !r.isLeaf && Ji(r, t));
3551
3550
  }
3552
3551
  function Ue(r, t, e = -1) {
3553
3552
  let n = r.resolve(t);
@@ -3564,9 +3563,9 @@ function vn(r, t, e = t, n = S.empty) {
3564
3563
  if (t == e && !n.size)
3565
3564
  return null;
3566
3565
  let o = r.resolve(t), i = r.resolve(e);
3567
- return Ji(o, i, n) ? new st(t, e, n) : new Wi(o, i, n).fit();
3566
+ return Li(o, i, n) ? new st(t, e, n) : new Wi(o, i, n).fit();
3568
3567
  }
3569
- function Ji(r, t, e) {
3568
+ function Li(r, t, e) {
3570
3569
  return !e.openStart && !e.openEnd && r.start() == t.start() && r.parent.canReplace(r.index(), t.index(), e.content);
3571
3570
  }
3572
3571
  class Wi {
@@ -4620,7 +4619,7 @@ function ro(r) {
4620
4619
  const ns = ro(-1), rs = ro(1);
4621
4620
  function is(r, t = null) {
4622
4621
  return function(e, n) {
4623
- let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s && Jr(s, r, t);
4622
+ let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s && Lr(s, r, t);
4624
4623
  return l ? (n && n(e.tr.wrap(s, l).scrollIntoView()), !0) : !1;
4625
4624
  };
4626
4625
  }
@@ -4683,7 +4682,7 @@ function ls(r, t, e, n = null) {
4683
4682
  let a = s.resolve(t.start - 2);
4684
4683
  i = new De(a, a, t.depth), t.endIndex < t.parent.childCount && (t = new De(t.$from, s.resolve(t.$to.end(t.depth)), t.depth)), o = !0;
4685
4684
  }
4686
- let l = Jr(i, e, n, t);
4685
+ let l = Lr(i, e, n, t);
4687
4686
  return l ? (r && as(r, t, l, o, e), !0) : !1;
4688
4687
  }
4689
4688
  function as(r, t, e, n, o) {
@@ -5115,7 +5114,7 @@ const $s = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
5115
5114
  function lo(r) {
5116
5115
  return r instanceof D;
5117
5116
  }
5118
- function Jt(r = 0, t = 0, e = 0) {
5117
+ function Lt(r = 0, t = 0, e = 0) {
5119
5118
  return Math.min(Math.max(r, t), e);
5120
5119
  }
5121
5120
  function Rs(r, t = null) {
@@ -5127,7 +5126,7 @@ function Rs(r, t = null) {
5127
5126
  if (t === "end")
5128
5127
  return n;
5129
5128
  const o = e.from, i = n.to;
5130
- return t === "all" ? D.create(r, Jt(0, o, i), Jt(r.content.size, o, i)) : D.create(r, Jt(t, o, i), Jt(t, o, i));
5129
+ return t === "all" ? D.create(r, Lt(0, o, i), Lt(r.content.size, o, i)) : D.create(r, Lt(t, o, i), Lt(t, o, i));
5131
5130
  }
5132
5131
  function zs() {
5133
5132
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
@@ -5232,7 +5231,7 @@ function Ds(r, t, e) {
5232
5231
  s === 0 && (s = u);
5233
5232
  }), r.setSelection($.near(r.doc.resolve(s), e));
5234
5233
  }
5235
- const Ls = (r) => !("type" in r), Js = (r, t, e) => ({ tr: n, dispatch: o, editor: i }) => {
5234
+ const Js = (r) => !("type" in r), Ls = (r, t, e) => ({ tr: n, dispatch: o, editor: i }) => {
5236
5235
  var s;
5237
5236
  if (o) {
5238
5237
  e = {
@@ -5261,7 +5260,7 @@ const Ls = (r) => !("type" in r), Js = (r, t, e) => ({ tr: n, dispatch: o, edito
5261
5260
  }), !1;
5262
5261
  }
5263
5262
  let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, f = !0;
5264
- if ((Ls(l) ? l : [l]).forEach((m) => {
5263
+ if ((Js(l) ? l : [l]).forEach((m) => {
5265
5264
  m.check(), u = u ? m.isText && m.marks.length === 0 : !1, f = f ? m.isBlock : !1;
5266
5265
  }), a === c && f) {
5267
5266
  const { parent: m } = n.doc.resolve(a);
@@ -5456,8 +5455,8 @@ function ml(r, t, e = {}) {
5456
5455
  if (!p.isText && !p.marks.length)
5457
5456
  return;
5458
5457
  const b = Math.max(h, k), I = Math.min(m, k + p.nodeSize), R = I - b;
5459
- s += R, l.push(...p.marks.map((L) => ({
5460
- mark: L,
5458
+ s += R, l.push(...p.marks.map((J) => ({
5459
+ mark: J,
5461
5460
  from: b,
5462
5461
  to: I
5463
5462
  })));
@@ -5551,13 +5550,13 @@ const yl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
5551
5550
  return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) => rr(i, { ...s, ...t })(e) ? !0 : l.clearNodes()).command(({ state: l }) => rr(i, { ...s, ...t })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
5552
5551
  }, kl = (r) => ({ tr: t, dispatch: e }) => {
5553
5552
  if (e) {
5554
- const { doc: n } = t, o = Jt(r, 0, n.content.size), i = P.create(n, o);
5553
+ const { doc: n } = t, o = Lt(r, 0, n.content.size), i = P.create(n, o);
5555
5554
  t.setSelection(i);
5556
5555
  }
5557
5556
  return !0;
5558
5557
  }, bl = (r) => ({ tr: t, dispatch: e }) => {
5559
5558
  if (e) {
5560
- const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a = Jt(o, s, l), c = Jt(i, s, l), u = D.create(n, a, c);
5559
+ const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a = Lt(o, s, l), c = Lt(i, s, l), u = D.create(n, a, c);
5561
5560
  t.setSelection(u);
5562
5561
  }
5563
5562
  return !0;
@@ -5615,10 +5614,10 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
5615
5614
  const I = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
5616
5615
  for (let W = a.depth - I; W >= a.depth - 3; W -= 1)
5617
5616
  b = x.from(a.node(W).copy(b));
5618
- const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, L = {
5617
+ const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, J = {
5619
5618
  ...Be(d, a.node().type.name, a.node().attrs),
5620
5619
  ...t
5621
- }, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(L)) || void 0;
5620
+ }, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(J)) || void 0;
5622
5621
  b = b.append(x.from(l.createAndFill(null, H) || void 0));
5623
5622
  const Z = a.before(a.depth - (I - 1));
5624
5623
  e.replace(Z, a.after(-R), new S(b, 4 - I, 0));
@@ -5646,10 +5645,10 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
5646
5645
  if (!Mt(e.doc, a.pos, 2))
5647
5646
  return !1;
5648
5647
  if (o) {
5649
- const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager, L = I || b.$to.parentOffset && b.$from.marks();
5650
- if (e.split(a.pos, 2, k).scrollIntoView(), !L || !o)
5648
+ const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager, J = I || b.$to.parentOffset && b.$from.marks();
5649
+ if (e.split(a.pos, 2, k).scrollIntoView(), !J || !o)
5651
5650
  return !0;
5652
- const H = L.filter((Z) => R.includes(Z.type.name));
5651
+ const H = J.filter((Z) => R.includes(Z.type.name));
5653
5652
  e.ensureMarks(H);
5654
5653
  }
5655
5654
  return !0;
@@ -5672,7 +5671,7 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
5672
5671
  const o = r.doc.nodeAt(n);
5673
5672
  return e.node.type === o?.type && qt(r.doc, n) && r.join(n), !0;
5674
5673
  }, Tl = (r, t, e, n = {}) => ({ editor: o, tr: i, state: s, dispatch: l, chain: a, commands: c, can: u }) => {
5675
- const { extensions: f, splittableMarks: d } = o.extensionManager, h = et(r, s.schema), m = et(t, s.schema), { selection: p, storedMarks: k } = s, { $from: b, $to: I } = p, R = b.blockRange(I), L = k || p.$to.parentOffset && p.$from.marks();
5674
+ const { extensions: f, splittableMarks: d } = o.extensionManager, h = et(r, s.schema), m = et(t, s.schema), { selection: p, storedMarks: k } = s, { $from: b, $to: I } = p, R = b.blockRange(I), J = k || p.$to.parentOffset && p.$from.marks();
5676
5675
  if (!R)
5677
5676
  return !1;
5678
5677
  const H = $n((Z) => sr(Z.type.name, f))(p);
@@ -5682,8 +5681,8 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
5682
5681
  if (sr(H.node.type.name, f) && h.validContent(H.node.content) && l)
5683
5682
  return a().command(() => (i.setNodeMarkup(H.pos, h), !0)).command(() => un(i, h)).command(() => fn(i, h)).run();
5684
5683
  }
5685
- return !e || !L || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run() : a().command(() => {
5686
- const Z = u().wrapInList(h, n), at = L.filter((W) => d.includes(W.type.name));
5684
+ return !e || !J || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run() : a().command(() => {
5685
+ const Z = u().wrapInList(h, n), at = J.filter((W) => d.includes(W.type.name));
5687
5686
  return i.ensureMarks(at), Z ? !0 : c.clearNodes();
5688
5687
  }).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run();
5689
5688
  }, Al = (r, t = {}, e = {}) => ({ state: n, commands: o }) => {
@@ -5792,7 +5791,7 @@ var zl = /* @__PURE__ */ Object.freeze({
5792
5791
  focus: Ps,
5793
5792
  forEach: Fs,
5794
5793
  insertContent: _s,
5795
- insertContentAt: Js,
5794
+ insertContentAt: Ls,
5796
5795
  joinBackward: Vs,
5797
5796
  joinDown: js,
5798
5797
  joinForward: qs,
@@ -6124,7 +6123,7 @@ const ar = [
6124
6123
  class: "comment-gutter",
6125
6124
  style: { "margin-top": "-100px" },
6126
6125
  "aria-label": "批注贴行栏"
6127
- }, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" }, Ll = { class: "gutter-item__note" }, Jl = { class: "gutter-item__meta" }, Wl = { class: "gutter-item__author" }, jl = { class: "gutter-item__time" }, Vl = {
6126
+ }, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" }, Jl = { class: "gutter-item__note" }, Ll = { class: "gutter-item__meta" }, Wl = { class: "gutter-item__author" }, jl = { class: "gutter-item__time" }, Vl = {
6128
6127
  __name: "CommentGutter",
6129
6128
  props: {
6130
6129
  anchors: { type: Array, default: () => [] },
@@ -6201,8 +6200,8 @@ const ar = [
6201
6200
  onKeydown: dn(ze((u) => l.$emit("activate", c.id), ["prevent"]), ["enter"])
6202
6201
  }, [
6203
6202
  y("div", Dl, Y(e(c.selectedText, 28)), 1),
6204
- y("div", Ll, Y(e(c.note, 36)), 1),
6205
- y("div", Jl, [
6203
+ y("div", Jl, Y(e(c.note, 36)), 1),
6204
+ y("div", Ll, [
6206
6205
  y("span", Wl, Y(c.author), 1),
6207
6206
  y("span", jl, Y(r.formatTime(c.createdAt)), 1)
6208
6207
  ])
@@ -6258,12 +6257,12 @@ const ar = [
6258
6257
  if (!u) return;
6259
6258
  const f = r?.(), h = t?.() || f || u, m = h.getBoundingClientRect(), p = typeof h.scrollTop == "number" ? h.scrollTop : 0, k = u.querySelectorAll("span[data-comment-id]") || [], b = /* @__PURE__ */ new Map();
6260
6259
  k.forEach((R) => {
6261
- const L = R.getAttribute("data-comment-id");
6262
- if (!L) return;
6260
+ const J = R.getAttribute("data-comment-id");
6261
+ if (!J) return;
6263
6262
  const H = R.getClientRects()[0] || R.getBoundingClientRect();
6264
6263
  if (!H) return;
6265
- const Z = H.top - m.top + p, at = H.height || 0, W = b.get(L);
6266
- (!W || Z < W.top) && b.set(L, { id: L, top: Z, height: at });
6264
+ const Z = H.top - m.top + p, at = H.height || 0, W = b.get(J);
6265
+ (!W || Z < W.top) && b.set(J, { id: J, top: Z, height: at });
6267
6266
  });
6268
6267
  const I = Array.from(b.values());
6269
6268
  e?.(I);
@@ -6554,8 +6553,8 @@ function yo(r, t, e, n = 0) {
6554
6553
  } else
6555
6554
  I = 1;
6556
6555
  const R = b > 0 && p.length > 0 ? p.map((T) => (T / b * 100).toFixed(2)) : Array.from({ length: I }, () => (100 / I).toFixed(2));
6557
- let L = "";
6558
- R.length && (L = `<colgroup>${R.map((O) => `<col style="width:${O}%"/>`).join("")}</colgroup>`);
6556
+ let J = "";
6557
+ R.length && (J = `<colgroup>${R.map((O) => `<col style="width:${O}%"/>`).join("")}</colgroup>`);
6559
6558
  const Z = (o ? v(o, "jc") : null)?.getAttribute("w:val") || "left", at = `border-collapse:collapse;table-layout:fixed;width:${u};${Z === "center" ? "margin:0 auto;" : ""}`, W = [];
6560
6559
  for (const T of r.childNodes) {
6561
6560
  if (T.nodeType !== 1 || T.localName !== "tr") continue;
@@ -6603,7 +6602,7 @@ function yo(r, t, e, n = 0) {
6603
6602
  Ht += `<tr>${O}</tr>`;
6604
6603
  }
6605
6604
  const Ke = s ? ` data-word-tbl-borders='${JSON.stringify(s)}'` : "";
6606
- return `<table style="${at}"${Ke}>${L}${Ht}</table>`;
6605
+ return `<table style="${at}"${Ke}>${J}${Ht}</table>`;
6607
6606
  }
6608
6607
  function aa(r) {
6609
6608
  if (!r) return !0;
@@ -6869,7 +6868,7 @@ const pa = { class: "app-layout" }, ma = { class: "editor-wrapper" }, ga = { cla
6869
6868
  cancelPendingDelete: R
6870
6869
  } = xr();
6871
6870
  z(!0);
6872
- const L = z(null), H = z([]), Z = () => L.value, at = () => L.value?.querySelector?.(".umo-scrollable-container") || L.value?.querySelector?.(".umo-scrollable") || L.value, W = (g, w) => {
6871
+ const J = z(null), H = z([]), Z = () => J.value, at = () => J.value?.querySelector?.(".umo-scrollable-container") || J.value?.querySelector?.(".umo-scrollable") || J.value, W = (g, w) => {
6873
6872
  if (!g || g.__gutterMounted) return;
6874
6873
  g.__gutterMounted = !0, Io({
6875
6874
  setup() {
@@ -7223,7 +7222,7 @@ const pa = { class: "app-layout" }, ma = { class: "editor-wrapper" }, ga = { cla
7223
7222
  y("div", ga, [
7224
7223
  y("div", {
7225
7224
  ref_key: "editorStageRef",
7226
- ref: L,
7225
+ ref: J,
7227
7226
  class: "umo-editor-stage"
7228
7227
  }, [
7229
7228
  oe(ut) ? (q(), Ie(C, Mo({
@@ -7462,15 +7461,15 @@ const pa = { class: "app-layout" }, ma = { class: "editor-wrapper" }, ga = { cla
7462
7461
  };
7463
7462
  }
7464
7463
  }, Ba = /* @__PURE__ */ He($a, [["__scopeId", "data-v-d6ad3b04"]]);
7465
- function _a() {
7464
+ function Fa() {
7466
7465
  }
7467
- const Da = {
7466
+ const _a = {
7468
7467
  install(r, t) {
7469
7468
  r.use(bo, t ?? {}), r.component("UmoEditorApp", Ba);
7470
7469
  }
7471
7470
  };
7472
7471
  export {
7473
7472
  Ba as UmoEditorApp,
7474
- Da as UmoEditorAppPlugin,
7475
- _a as ensureUmoEditorGlobals
7473
+ _a as UmoEditorAppPlugin,
7474
+ Fa as ensureUmoEditorGlobals
7476
7475
  };