@fileverse-dev/ddoc 3.2.2-sg-1 → 3.2.2-sg-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.es.js +36 -21
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -41829,8 +41829,8 @@ function Ege(e, t) {
41829
41829
  s.mapping
41830
41830
  );
41831
41831
  if (a === null || l === null || a < 0 || l > n.doc.content.size) return !1;
41832
- const { suggestionType: u, suggestedContent: c } = t;
41833
- return u === "add" ? c ? e.commands.insertContentAt(a, c) : !1 : u === "delete" ? a >= l ? !1 : e.commands.deleteRange({ from: a, to: l }) : u === "replace" ? a >= l || !c ? !1 : e.chain().deleteRange({ from: a, to: l }).insertContentAt(a, c).run() : !1;
41832
+ const { suggestionType: u, suggestedContent: c } = t, d = (p) => ({ type: "text", text: p });
41833
+ return u === "add" ? c ? e.chain().focus().insertContentAt(a, d(c)).run() : !1 : u === "delete" ? a >= l ? !1 : e.chain().focus().deleteRange({ from: a, to: l }).run() : u === "replace" ? a >= l || !c ? !1 : e.chain().focus().deleteRange({ from: a, to: l }).insertContentAt(a, d(c)).run() : !1;
41834
41834
  } catch {
41835
41835
  return !1;
41836
41836
  }
@@ -43697,7 +43697,12 @@ const dme = () => Jge((e, t) => ({
43697
43697
  })), t().activeCommentId === n && s(null);
43698
43698
  },
43699
43699
  acceptSuggestion: (n) => {
43700
- const { editor: r, onResolveComment: o, setActiveCommentId: i, commentAnchorsRef: s } = un(t);
43700
+ const {
43701
+ editor: r,
43702
+ onResolveComment: o,
43703
+ setActiveCommentId: i,
43704
+ commentAnchorsRef: s
43705
+ } = un(t);
43701
43706
  if (!r) return;
43702
43707
  const a = s == null ? void 0 : s.current.find(
43703
43708
  (u) => u.id === n && u.isSuggestion
@@ -184060,37 +184065,47 @@ const CKe = { status: "idle" }, _Ke = (e) => {
184060
184065
  onLocalUpdate: e,
184061
184066
  ignoredOrigins: [d]
184062
184067
  }), F = Te(async () => {
184063
- const w = d.current;
184064
- if (w && await w.destroy(), t && n) {
184068
+ const k = d.current;
184069
+ if (k && await k.destroy(), t && n) {
184065
184070
  a(!1);
184066
184071
  try {
184067
- const k = new x$e(n, i);
184068
- d.current = k, await k.whenSynced, a(!0);
184069
- } catch (k) {
184070
- console.error("IndexedDB initialization failed:", k), d.current = null, a(!0), o == null || o(
184071
- k instanceof Error ? k : new Error(String(k))
184072
+ const E = new x$e(n, i);
184073
+ d.current = E, await E.whenSynced, a(!0);
184074
+ } catch (E) {
184075
+ console.error("IndexedDB initialization failed:", E), d.current = null, a(!0), o == null || o(
184076
+ E instanceof Error ? E : new Error(String(E))
184072
184077
  );
184073
184078
  }
184074
184079
  } else
184075
184080
  a(!0);
184076
184081
  }, [t, n, i, o]), x = je(
184077
184082
  null
184078
- ), D = Te(() => {
184079
- x.current && (clearTimeout(x.current), x.current = null), e == null || e(Xn(lo(i)), "");
184080
- }, [i, e]);
184083
+ ), D = je(e);
184084
+ _e(() => {
184085
+ D.current = e;
184086
+ }, [e]);
184087
+ const w = Te(() => {
184088
+ var k;
184089
+ x.current && (clearTimeout(x.current), x.current = null), (k = D.current) == null || k.call(D, Xn(lo(i)), "");
184090
+ }, [i]);
184081
184091
  return _e(() => {
184082
- const w = (k, E) => {
184083
- if (E === "self" || E === d.current)
184092
+ const k = (E, A) => {
184093
+ if (A === "self" || A === d.current)
184084
184094
  return;
184085
- const A = Xn(k);
184095
+ const O = Xn(E);
184086
184096
  x.current && clearTimeout(x.current), x.current = setTimeout(() => {
184087
- x.current = null, e == null || e(Xn(lo(i)), A);
184097
+ var j;
184098
+ x.current = null, (j = D.current) == null || j.call(
184099
+ D,
184100
+ Xn(lo(i)),
184101
+ O
184102
+ );
184088
184103
  }, 300);
184089
184104
  };
184090
- return i && i.on("update", w), () => {
184091
- i == null || i.off("update", w), x.current && clearTimeout(x.current);
184105
+ return i && i.on("update", k), () => {
184106
+ i == null || i.off("update", k);
184092
184107
  };
184093
- }, [e, i]), {
184108
+ }, [i]), {
184094
184109
  ydoc: i,
184095
184110
  onConnect: p,
184096
184111
  isReady: h,
@@ -184101,7 +184116,7 @@ const CKe = { status: "idle" }, _Ke = (e) => {
184101
184116
  isIndexeddbSynced: s,
184102
184117
  initialiseYjsIndexedDbProvider: F,
184103
184118
  refreshYjsIndexedDbProvider: F,
184104
- flushPendingUpdate: D,
184119
+ flushPendingUpdate: w,
184105
184120
  collabState: y
184106
184121
  };
184107
184122
  }, Xee = ({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "3.2.2-sg-1",
5
+ "version": "3.2.2-sg-3",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {