@fileverse-dev/ddoc 2.4.15-patch-1 → 2.4.15-patch-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.
@@ -1,4 +1,4 @@
1
- import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-BgiXnXAu.mjs";
1
+ import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-Cpapkwxs.mjs";
2
2
  class S extends p {
3
3
  constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
4
4
  var o;
@@ -89868,7 +89868,7 @@ async function Sk(e, t) {
89868
89868
  });
89869
89869
  return V === "0x" ? { data: void 0 } : { data: V };
89870
89870
  } catch (B) {
89871
- const L = OWt(B), { offchainLookup: j, offchainLookupSignature: N } = await import("./ccip-DLQvO9JX.mjs");
89871
+ const L = OWt(B), { offchainLookup: j, offchainLookupSignature: N } = await import("./ccip-DXudxOW5.mjs");
89872
89872
  if (e.ccipRead !== !1 && (L == null ? void 0 : L.slice(0, 10)) === N && b)
89873
89873
  return { data: await j(e, { data: L, to: b }) };
89874
89874
  throw S && (L == null ? void 0 : L.slice(0, 10)) === "0x101bb98d" ? new qVt({ factory: c }) : cpe(B, {
@@ -256532,6 +256532,7 @@ const e_n = (e) => e.context.awareness, t_n = (e) => !!(e.context.isReady && e.c
256532
256532
  const W = rt(null), ee = async () => {
256533
256533
  const Ie = W.current;
256534
256534
  if (Ie && await Ie.destroy(), d && c) {
256535
+ console.log("Initialising IndexedDB persistence for ddocId:", c);
256535
256536
  const $e = new PMn(c, j);
256536
256537
  W.current = $e;
256537
256538
  }
@@ -256593,23 +256594,37 @@ const e_n = (e) => e.context.awareness, t_n = (e) => !!(e.context.isReady && e.c
256593
256594
  window.removeEventListener("keydown", Ie);
256594
256595
  };
256595
256596
  }, [he, m]), He(() => {
256596
- !ke(t) && he && !ye.current && j ? (M(!0), queueMicrotask(() => {
256597
- t !== "" && (be(t) ? Array.isArray(t) ? de(t) : Kc(
256598
- j,
256599
- er(t),
256600
- "self"
256601
- ) : he.commands.setContent(
256602
- F9e({
256603
- data: t,
256604
- ignoreCorruptedData: g,
256605
- onInvalidContentError: p
256606
- })
256607
- )), h && BS.setZoom(h), ee().then(() => {
256608
- M(!1);
256609
- }).catch((Ie) => {
256610
- console.log(Ie);
256611
- });
256612
- }), ye.current = !0) : t !== null && M(!1);
256597
+ try {
256598
+ console.log({ initialContent: t, editor: he, ydoc: j }, "useDdocEditor useEffect"), !ke(t) && he && !ye.current && j ? (M(!0), queueMicrotask(() => {
256599
+ if (t !== "") {
256600
+ const Ie = be(t);
256601
+ console.log({ isYjsEncoded: Ie, initialContent: t }), Ie ? Array.isArray(t) ? (console.log(
256602
+ "Merging Yjs update for initial content:",
256603
+ t
256604
+ ), de(t)) : (console.log(
256605
+ "Applying Yjs update for initial content:",
256606
+ t
256607
+ ), Kc(
256608
+ j,
256609
+ er(t),
256610
+ "self"
256611
+ )) : (console.log("Setting JSON content for initial content"), he.commands.setContent(
256612
+ F9e({
256613
+ data: t,
256614
+ ignoreCorruptedData: g,
256615
+ onInvalidContentError: p
256616
+ })
256617
+ ));
256618
+ }
256619
+ h && BS.setZoom(h), ee().then(() => {
256620
+ console.log("Initial content set successfully"), M(!1);
256621
+ }).catch((Ie) => {
256622
+ console.log(Ie);
256623
+ });
256624
+ }), ye.current = !0) : t !== null && (console.log("Initial content already set"), M(!1));
256625
+ } catch (Ie) {
256626
+ console.log("Error in useDdocEditor useEffect:", Ie);
256627
+ }
256613
256628
  }, [t, he, j]), He(() => (n && (P != null && P.collaborationId) && (P != null && P.roomKey) && N({
256614
256629
  username: P == null ? void 0 : P.username,
256615
256630
  roomKey: P == null ? void 0 : P.roomKey,
@@ -258854,7 +258869,7 @@ const ioe = Ne.memo(c7e), S_n = ({
258854
258869
  return mn.addEventListener("keydown", Mn), () => {
258855
258870
  mn.removeEventListener("keydown", Mn);
258856
258871
  };
258857
- }, [ve]), He(() => {
258872
+ }, [ve]), console.log({ isContentLoading: at, initialContent: t }), He(() => {
258858
258873
  if (!Be || !ve) return;
258859
258874
  const Mn = () => {
258860
258875
  ze.current && ze.current.scrollIntoView();
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-BgiXnXAu.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-Cpapkwxs.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as Editor,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "2.4.15-patch-1",
5
+ "version": "2.4.15-patch-3",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {