@fileverse-dev/ddoc 3.0.77-fix-1 → 3.0.78-fix-1

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.es.js CHANGED
@@ -169654,31 +169654,31 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169654
169654
  initialContent: i,
169655
169655
  collaboration: s,
169656
169656
  isReady: a,
169657
- awareness: l,
169658
- disableInlineComment: u,
169659
- onCommentInteraction: c,
169660
- onError: d,
169661
- ipfsImageUploadFn: p,
169662
- metadataProxyUrl: h,
169663
- onCopyHeadingLink: f,
169664
- ipfsImageFetchFn: g,
169665
- fetchV1ImageFn: m,
169666
- isConnected: b,
169667
- activeModel: y,
169668
- maxTokens: x,
169669
- isAIAgentEnabled: v,
169670
- setCharacterCount: k,
169671
- setWordCount: w,
169672
- setIsContentLoading: D,
169673
- setIsCollabContentLoading: C,
169674
- unFocused: A,
169675
- zoomLevel: M,
169676
- isPresentationMode: j,
169677
- onInvalidContentError: _,
169678
- ignoreCorruptedData: O,
169679
- onCollaboratorChange: E,
169680
- onConnect: T,
169681
- hasCollabContentInitialised: S,
169657
+ isSyncing: l,
169658
+ awareness: u,
169659
+ disableInlineComment: c,
169660
+ onCommentInteraction: d,
169661
+ onError: p,
169662
+ ipfsImageUploadFn: h,
169663
+ metadataProxyUrl: f,
169664
+ onCopyHeadingLink: g,
169665
+ ipfsImageFetchFn: m,
169666
+ fetchV1ImageFn: b,
169667
+ isConnected: y,
169668
+ activeModel: x,
169669
+ maxTokens: v,
169670
+ isAIAgentEnabled: k,
169671
+ setCharacterCount: w,
169672
+ setWordCount: D,
169673
+ setIsContentLoading: C,
169674
+ setIsCollabContentLoading: A,
169675
+ unFocused: M,
169676
+ zoomLevel: j,
169677
+ isPresentationMode: _,
169678
+ onInvalidContentError: O,
169679
+ ignoreCorruptedData: E,
169680
+ onCollaboratorChange: T,
169681
+ onConnect: S,
169682
169682
  initialiseYjsIndexedDbProvider: L,
169683
169683
  externalExtensions: P,
169684
169684
  isContentLoading: $,
@@ -169686,20 +169686,20 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169686
169686
  theme: z,
169687
169687
  editorRef: U
169688
169688
  }) => {
169689
- const X = (s == null ? void 0 : s.enabled) === !0, oe = X ? s.connection : null, { activeCommentId: ee, setActiveCommentId: K, focusCommentWithActiveId: re } = NRe(), J = !!(y && v), { tocItems: ae, setTocItems: B, handleTocUpdate: Y } = MRe(q), { extensions: Q } = ORe({
169689
+ const X = (s == null ? void 0 : s.enabled) === !0, oe = X ? s.connection : null, { activeCommentId: ee, setActiveCommentId: K, focusCommentWithActiveId: re } = NRe(), J = !!(x && k), { tocItems: ae, setTocItems: B, handleTocUpdate: Y } = MRe(q), { extensions: Q } = ORe({
169690
169690
  ydoc: e,
169691
- onError: d,
169692
- ipfsImageUploadFn: p,
169693
- metadataProxyUrl: h,
169694
- onCopyHeadingLink: f,
169695
- ipfsImageFetchFn: g,
169696
- fetchV1ImageFn: m,
169691
+ onError: p,
169692
+ ipfsImageUploadFn: h,
169693
+ metadataProxyUrl: f,
169694
+ onCopyHeadingLink: g,
169695
+ ipfsImageFetchFn: m,
169696
+ fetchV1ImageFn: b,
169697
169697
  enableCollaboration: X,
169698
- disableInlineComment: u,
169699
- isConnected: b,
169700
- activeModel: y,
169701
- maxTokens: x,
169702
- isAIAgentEnabled: v,
169698
+ disableInlineComment: c,
169699
+ isConnected: y,
169700
+ activeModel: x,
169701
+ maxTokens: v,
169702
+ isAIAgentEnabled: k,
169703
169703
  hasAvailableModels: J,
169704
169704
  onCommentActivated: (Te) => {
169705
169705
  K(Te), Te && setTimeout(() => re(Te));
@@ -169708,7 +169708,7 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169708
169708
  externalExtensions: P,
169709
169709
  activeTabId: q
169710
169710
  }), { handleCommentInteraction: ce, handleCommentClick: N } = RRe({
169711
- onCommentInteraction: c
169711
+ onCommentInteraction: d
169712
169712
  }), te = Ve(!0), [le, G] = Be([]), V = Ft(() => Q, [Q]);
169713
169713
  Re(() => {
169714
169714
  q && K(null);
@@ -169768,11 +169768,11 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169768
169768
  spellCheck: "true"
169769
169769
  }
169770
169770
  },
169771
- autofocus: A || !te.current ? !1 : "start",
169771
+ autofocus: M || !te.current ? !1 : "start",
169772
169772
  immediatelyRender: !1,
169773
169773
  shouldRerenderOnTransaction: !1
169774
169774
  },
169775
- [V, j, o]
169775
+ [V, _, o]
169776
169776
  );
169777
169777
  Re(() => {
169778
169778
  U && (U.current = he ?? null);
@@ -169793,16 +169793,11 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169793
169793
  he.off("update", Te), be.current && clearTimeout(be.current);
169794
169794
  };
169795
169795
  }, [he]);
169796
- const de = Ft(() => De ? !!(S && a) : !o, [
169797
- De,
169798
- S,
169799
- o,
169800
- a
169801
- ]);
169796
+ const de = Ft(() => o ? !1 : De ? !l : !0, [o, De, l]);
169802
169797
  Re(() => {
169803
169798
  he == null || he.setEditable(de);
169804
169799
  }, [he, de]), Re(() => {
169805
- De && C(!a);
169800
+ De && A(!a);
169806
169801
  }, [De, a]);
169807
169802
  const ue = Ve(!1), ge = Ve(null), R = Se(
169808
169803
  (Te) => {
@@ -169818,39 +169813,39 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169818
169813
  if (!he || !e)
169819
169814
  return;
169820
169815
  if (X) {
169821
- D(!1);
169816
+ C(!1);
169822
169817
  return;
169823
169818
  }
169824
169819
  if (i === null) {
169825
- D(!0);
169820
+ C(!0);
169826
169821
  return;
169827
169822
  }
169828
169823
  if (t && n && !q) {
169829
- D(!0);
169824
+ C(!0);
169830
169825
  return;
169831
169826
  }
169832
169827
  const Ne = `${r || "no-version-id"}:${q || "default"}`;
169833
169828
  if (!t && ue.current) {
169834
- D(!1);
169829
+ C(!1);
169835
169830
  return;
169836
169831
  }
169837
169832
  if (t && ge.current === Ne) {
169838
- D(!1);
169833
+ C(!1);
169839
169834
  return;
169840
169835
  }
169841
- D(!0), queueMicrotask(() => {
169836
+ C(!0), queueMicrotask(() => {
169842
169837
  if (i !== "" && i !== void 0 && (W(i) ? Array.isArray(i) ? R(i) : na(e, io(i), "self") : he.commands.setContent(
169843
169838
  fX({
169844
169839
  data: i,
169845
- ignoreCorruptedData: O,
169846
- onInvalidContentError: _
169840
+ ignoreCorruptedData: E,
169841
+ onInvalidContentError: O
169847
169842
  })
169848
- )), M && b6.setZoom(M), t) {
169849
- ge.current = Ne, D(!1);
169843
+ )), j && b6.setZoom(j), t) {
169844
+ ge.current = Ne, C(!1);
169850
169845
  return;
169851
169846
  }
169852
169847
  L().finally(() => {
169853
- D(!1);
169848
+ C(!1);
169854
169849
  });
169855
169850
  }), ue.current = !0;
169856
169851
  }, [
@@ -169858,14 +169853,14 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169858
169853
  X,
169859
169854
  he,
169860
169855
  e,
169861
- M,
169856
+ j,
169862
169857
  t,
169863
169858
  n,
169864
169859
  q,
169865
169860
  r,
169866
- D,
169861
+ C,
169862
+ E,
169867
169863
  O,
169868
- _,
169869
169864
  R,
169870
169865
  W,
169871
169866
  L
@@ -169875,18 +169870,18 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169875
169870
  IRe({
169876
169871
  editor: he,
169877
169872
  isReady: a,
169878
- awareness: l,
169873
+ awareness: u,
169879
169874
  collaboration: s,
169880
169875
  collaborationCleanupRef: ne,
169881
- onCollaboratorChange: E
169876
+ onCollaboratorChange: T
169882
169877
  }), Re(() => {
169883
- if (!M) return;
169884
- b6.setZoom(M);
169878
+ if (!j) return;
169879
+ b6.setZoom(j);
169885
169880
  const Te = window.setTimeout(() => {
169886
- b6.setZoom(M);
169881
+ b6.setZoom(j);
169887
169882
  }, 100);
169888
169883
  return () => clearTimeout(Te);
169889
- }, [M, $, i, he == null ? void 0 : he.isEmpty]), Re(() => {
169884
+ }, [j, $, i, he == null ? void 0 : he.isEmpty]), Re(() => {
169890
169885
  if (!he) return;
169891
169886
  const Te = ({ editor: Ne }) => {
169892
169887
  const Je = Ne.state.selection.from;
@@ -169921,7 +169916,7 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169921
169916
  if (!he) return;
169922
169917
  const Te = () => {
169923
169918
  ye.current && clearTimeout(ye.current), ye.current = setTimeout(() => {
169924
- ye.current = null, he && !he.isDestroyed && (k == null || k(he.storage.characterCount.characters() ?? 0), w == null || w(he.storage.characterCount.words() ?? 0));
169919
+ ye.current = null, he && !he.isDestroyed && (w == null || w(he.storage.characterCount.characters() ?? 0), D == null || D(he.storage.characterCount.words() ?? 0));
169925
169920
  }, 500);
169926
169921
  };
169927
169922
  return Te(), he.on("update", Te), () => {
@@ -169929,12 +169924,12 @@ User prompt: ${u} /no_think` : `${u} /no_think`;
169929
169924
  };
169930
169925
  }, [he]), Re(() => {
169931
169926
  const Te = (Ne) => {
169932
- (Ne.ctrlKey || Ne.metaKey) && Ne.key === "p" && (Ne.preventDefault(), he && (j ? QL(le) : tx(he.getHTML())));
169927
+ (Ne.ctrlKey || Ne.metaKey) && Ne.key === "p" && (Ne.preventDefault(), he && (_ ? QL(le) : tx(he.getHTML())));
169933
169928
  };
169934
169929
  return window.addEventListener("keydown", Te), () => {
169935
169930
  window.removeEventListener("keydown", Te);
169936
169931
  };
169937
- }, [he, j, le]), Re(() => (X && oe && T(oe), () => {
169932
+ }, [he, _, le]), Re(() => (X && oe && S(oe), () => {
169938
169933
  ne.current();
169939
169934
  }), [
169940
169935
  X,
@@ -179764,47 +179759,48 @@ const l$e = { status: "idle" }, u$e = (e) => {
179764
179759
  r.current || (r.current = new a$e(e, n));
179765
179760
  const o = r.current;
179766
179761
  o.updateRefs(e.services, e.callbacks, e.onLocalUpdate);
179767
- const i = o.isReady, s = o.isConnected, a = o.awareness, l = Ve(!1);
179768
- i && a && (l.current = !0), Re(() => {
179769
- if (!s || !e.ydoc) return;
179770
- const f = (g, m) => {
179771
- m === "self" || !o.isConnected || o.enqueueLocalUpdate(g);
179762
+ const i = o.isConnected, s = o.awareness;
179763
+ Re(() => {
179764
+ if (!i || !e.ydoc) return;
179765
+ const h = (f, g) => {
179766
+ g === "self" || !o.isConnected || o.enqueueLocalUpdate(f);
179772
179767
  };
179773
- return e.ydoc.on("update", f), () => {
179774
- e.ydoc.off("update", f);
179768
+ return e.ydoc.on("update", h), () => {
179769
+ e.ydoc.off("update", h);
179775
179770
  };
179776
- }, [e.ydoc, s]), Re(() => {
179777
- if (!a) return;
179778
- const f = () => {
179779
- Wc(a, [e.ydoc.clientID], "window unload");
179771
+ }, [e.ydoc, i]), Re(() => {
179772
+ if (!s) return;
179773
+ const h = () => {
179774
+ Wc(s, [e.ydoc.clientID], "window unload");
179780
179775
  };
179781
- return typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("beforeunload", f), () => {
179782
- Wc(a, [e.ydoc.clientID], "hook unmount"), typeof window < "u" && typeof window.removeEventListener == "function" && window.removeEventListener("beforeunload", f);
179776
+ return typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("beforeunload", h), () => {
179777
+ Wc(s, [e.ydoc.clientID], "hook unmount"), typeof window < "u" && typeof window.removeEventListener == "function" && window.removeEventListener("beforeunload", h);
179783
179778
  };
179784
- }, [a !== void 0]), Re(() => () => {
179785
- var f;
179786
- (f = r.current) == null || f.forceCleanup();
179779
+ }, [s !== void 0]), Re(() => () => {
179780
+ var h;
179781
+ (h = r.current) == null || h.forceCleanup();
179787
179782
  }, []);
179788
- const u = Se(
179789
- (f) => {
179790
- o.connect(f).catch((g) => {
179791
- console.error("useSyncManager: connect failed", g);
179783
+ const a = Se(
179784
+ (h) => {
179785
+ o.connect(h).catch((f) => {
179786
+ console.error("useSyncManager: connect failed", f);
179792
179787
  });
179793
179788
  },
179794
179789
  // eslint-disable-next-line react-hooks/exhaustive-deps
179795
179790
  [e.ydoc]
179796
- ), c = Se(() => {
179791
+ ), l = Se(() => {
179797
179792
  o.disconnect();
179798
- }, [o]), d = Se(() => {
179793
+ }, [o]), u = Se(() => {
179799
179794
  o.terminateSession();
179800
- }, [o]), p = l.current || t.status === "ready" || t.status === "reconnecting", h = l.current && !!a || t.status === "ready" && !!a;
179795
+ }, [o]), c = t.status === "syncing", d = t.status === "ready" && !!s, p = t.status === "ready" || t.status === "reconnecting";
179801
179796
  return {
179802
179797
  state: t,
179803
- connect: u,
179804
- disconnect: c,
179805
- terminateSession: d,
179806
- isReady: h,
179807
- awareness: a,
179798
+ connect: a,
179799
+ disconnect: l,
179800
+ terminateSession: u,
179801
+ isReady: d,
179802
+ isSyncing: c,
179803
+ awareness: s,
179808
179804
  hasCollabContentInitialised: p
179809
179805
  };
179810
179806
  }, c$e = ({
@@ -179817,53 +179813,55 @@ const l$e = { status: "idle" }, u$e = (e) => {
179817
179813
  const [i] = Be(new Cl()), s = (r == null ? void 0 : r.enabled) === !0, a = s ? r.services : void 0, l = s ? r.on : void 0, {
179818
179814
  connect: u,
179819
179815
  isReady: c,
179820
- terminateSession: d,
179821
- awareness: p,
179822
- hasCollabContentInitialised: h,
179823
- state: f
179816
+ isSyncing: d,
179817
+ terminateSession: p,
179818
+ awareness: h,
179819
+ hasCollabContentInitialised: f,
179820
+ state: g
179824
179821
  } = u$e({
179825
179822
  ydoc: i,
179826
179823
  services: a,
179827
179824
  callbacks: l,
179828
179825
  onLocalUpdate: e
179829
- }), g = Ve(null), m = Se(async () => {
179830
- const x = g.current;
179831
- if (x && await x.destroy(), t && n)
179826
+ }), m = Ve(null), b = Se(async () => {
179827
+ const v = m.current;
179828
+ if (v && await v.destroy(), t && n)
179832
179829
  try {
179833
- const v = new tIe(n, i);
179834
- await v.whenSynced, g.current = v;
179835
- } catch (v) {
179836
- console.error("IndexedDB initialization failed:", v), o == null || o(
179837
- v instanceof Error ? v : new Error(String(v))
179830
+ const k = new tIe(n, i);
179831
+ await k.whenSynced, m.current = k;
179832
+ } catch (k) {
179833
+ console.error("IndexedDB initialization failed:", k), o == null || o(
179834
+ k instanceof Error ? k : new Error(String(k))
179838
179835
  );
179839
179836
  }
179840
- }, [t, n, i, o]), b = Ve(
179837
+ }, [t, n, i, o]), y = Ve(
179841
179838
  null
179842
- ), y = Se(() => {
179843
- b.current && (clearTimeout(b.current), b.current = null), e == null || e(Vr(Wo(i)), "");
179839
+ ), x = Se(() => {
179840
+ y.current && (clearTimeout(y.current), y.current = null), e == null || e(Vr(Wo(i)), "");
179844
179841
  }, [i, e]);
179845
179842
  return Re(() => {
179846
- const x = (v, k) => {
179847
- if (k === "self") return;
179848
- const w = Vr(v);
179849
- b.current && clearTimeout(b.current), b.current = setTimeout(() => {
179850
- b.current = null, e == null || e(Vr(Wo(i)), w);
179843
+ const v = (k, w) => {
179844
+ if (w === "self") return;
179845
+ const D = Vr(k);
179846
+ y.current && clearTimeout(y.current), y.current = setTimeout(() => {
179847
+ y.current = null, e == null || e(Vr(Wo(i)), D);
179851
179848
  }, 300);
179852
179849
  };
179853
- return i && i.on("update", x), () => {
179854
- i == null || i.off("update", x), b.current && clearTimeout(b.current);
179850
+ return i && i.on("update", v), () => {
179851
+ i == null || i.off("update", v), y.current && clearTimeout(y.current);
179855
179852
  };
179856
179853
  }, [i]), {
179857
179854
  ydoc: i,
179858
179855
  onConnect: u,
179859
179856
  isReady: c,
179860
- terminateSession: d,
179861
- awareness: p,
179862
- hasCollabContentInitialised: h,
179863
- initialiseYjsIndexedDbProvider: m,
179864
- refreshYjsIndexedDbProvider: m,
179865
- flushPendingUpdate: y,
179866
- collabState: f
179857
+ isSyncing: d,
179858
+ terminateSession: p,
179859
+ awareness: h,
179860
+ hasCollabContentInitialised: f,
179861
+ initialiseYjsIndexedDbProvider: b,
179862
+ refreshYjsIndexedDbProvider: b,
179863
+ flushPendingUpdate: x,
179864
+ collabState: g
179867
179865
  };
179868
179866
  }, qZ = ({
179869
179867
  isPreviewMode: e,
@@ -179923,6 +179921,7 @@ const l$e = { status: "idle" }, u$e = (e) => {
179923
179921
  collaboration: r,
179924
179922
  versionId: n == null ? void 0 : n.versionId,
179925
179923
  isReady: X.isReady,
179924
+ isSyncing: X.isSyncing,
179926
179925
  awareness: X.awareness,
179927
179926
  disableInlineComment: O,
179928
179927
  onCommentInteraction: s,
@@ -179948,7 +179947,6 @@ const l$e = { status: "idle" }, u$e = (e) => {
179948
179947
  ignoreCorruptedData: b,
179949
179948
  onCollaboratorChange: i,
179950
179949
  onConnect: X.onConnect,
179951
- hasCollabContentInitialised: X.hasCollabContentInitialised,
179952
179950
  initialiseYjsIndexedDbProvider: X.initialiseYjsIndexedDbProvider,
179953
179951
  externalExtensions: v,
179954
179952
  activeTabId: oe.activeTabId,
@@ -14,6 +14,7 @@ interface UseTabEditorArgs {
14
14
  initialContent: DdocProps['initialContent'];
15
15
  collaboration?: CollaborationProps;
16
16
  isReady?: boolean;
17
+ isSyncing?: boolean;
17
18
  awareness?: any;
18
19
  disableInlineComment?: boolean;
19
20
  onCommentInteraction?: DdocProps['onCommentInteraction'];
@@ -46,7 +47,7 @@ interface UseTabEditorArgs {
46
47
  theme?: 'dark' | 'light';
47
48
  editorRef?: MutableRefObject<Editor | null>;
48
49
  }
49
- export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
50
+ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
50
51
  editor: Editor | null;
51
52
  ref: import('react').RefObject<HTMLDivElement>;
52
53
  slides: string[];
@@ -12,6 +12,7 @@ export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, coll
12
12
  ydoc: Y.Doc;
13
13
  onConnect: (connectConfig: import('../types').CollabConnectionConfig) => void;
14
14
  isReady: boolean;
15
+ isSyncing: boolean;
15
16
  terminateSession: () => void;
16
17
  awareness: import('y-protocols/awareness.js').Awareness | null;
17
18
  hasCollabContentInitialised: boolean;
@@ -6,6 +6,7 @@ export declare const useSyncManager: (config: SyncManagerConfig) => {
6
6
  disconnect: () => void;
7
7
  terminateSession: () => void;
8
8
  isReady: boolean;
9
+ isSyncing: boolean;
9
10
  awareness: import('y-protocols/awareness.js').Awareness | null;
10
11
  hasCollabContentInitialised: boolean;
11
12
  };
@@ -23,6 +23,7 @@ export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHis
23
23
  orderTab: (destinationTabId: string, movedTabId: string) => void;
24
24
  onConnect: (connectConfig: import('./types').CollabConnectionConfig) => void;
25
25
  isReady: boolean;
26
+ isSyncing: boolean;
26
27
  hasCollabContentInitialised: boolean;
27
28
  initialiseYjsIndexedDbProvider: () => Promise<void>;
28
29
  flushPendingUpdate: () => void;