@fileverse-dev/ddoc 3.0.96-zustand-16 → 3.0.96-zustand-17

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 +32 -19
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -42536,35 +42536,43 @@ const nfe = () => D0e((e, t) => ({
42536
42536
  return i == null || i(g, b), g.id;
42537
42537
  },
42538
42538
  createFloatingDraft: () => {
42539
- const { editor: n, onInlineComment: r } = Pn(t), { activeComment: o, isDesktopFloatingEnabled: i, isCommentActive: s } = t();
42539
+ const { editor: n, onInlineComment: r } = Pn(t), {
42540
+ activeComment: o,
42541
+ isDesktopFloatingEnabled: i,
42542
+ isCommentActive: s,
42543
+ isConnected: a,
42544
+ setCommentDrawerOpen: l
42545
+ } = t();
42540
42546
  if (!n)
42541
42547
  return null;
42542
- const { state: a } = n, { from: l, to: u } = a.selection, c = a.doc.textBetween(l, u, " ");
42548
+ if (!a)
42549
+ return l == null || l(!0), null;
42550
+ const { state: u } = n, { from: c, to: d } = u.selection, p = u.doc.textBetween(c, d, " ");
42543
42551
  if (!i)
42544
- return s ? o && e({ selectedText: o.selectedContent || "" }) : e({ selectedText: c }), e({ isCommentOpen: !0 }), r == null || r(), null;
42545
- if (l >= u || !c.trim())
42552
+ return s ? o && e({ selectedText: o.selectedContent || "" }) : e({ selectedText: p }), e({ isCommentOpen: !0 }), r == null || r(), null;
42553
+ if (c >= d || !p.trim())
42546
42554
  return null;
42547
- const d = `draft-${Fc()}`;
42548
- if (!n.commands.setDraftComment(d))
42555
+ const h = `draft-${Fc()}`;
42556
+ if (!n.commands.setDraftComment(h))
42549
42557
  return null;
42550
- const h = `draft:${d}`;
42551
- return e((f) => ({
42552
- selectedText: c,
42558
+ const g = `draft:${h}`;
42559
+ return e((m) => ({
42560
+ selectedText: p,
42553
42561
  isBubbleMenuSuppressed: !0,
42554
42562
  floatingItems: [
42555
- ...f.floatingItems.map((g) => ({ ...g, isFocused: !1 })),
42563
+ ...m.floatingItems.map((b) => ({ ...b, isFocused: !1 })),
42556
42564
  {
42557
- itemId: h,
42565
+ itemId: g,
42558
42566
  type: "draft",
42559
- draftId: d,
42560
- selectedText: c,
42567
+ draftId: h,
42568
+ selectedText: p,
42561
42569
  draftText: "",
42562
42570
  isAuthPending: !1,
42563
42571
  isOpen: !0,
42564
42572
  isFocused: !0
42565
42573
  }
42566
42574
  ]
42567
- })), r == null || r(), d;
42575
+ })), r == null || r(), h;
42568
42576
  },
42569
42577
  updateFloatingDraftText: (n, r) => {
42570
42578
  e((o) => ({
@@ -42691,13 +42699,18 @@ const nfe = () => D0e((e, t) => ({
42691
42699
  });
42692
42700
  },
42693
42701
  openFloatingThread: (n) => {
42694
- const { editor: r, setActiveCommentId: o } = Pn(t), i = t().tabComments.find(
42695
- (s) => s.id === n && !s.deleted && !s.resolved
42702
+ const { editor: r, setActiveCommentId: o } = Pn(t), { isConnected: i, setCommentDrawerOpen: s } = t();
42703
+ if (!i) {
42704
+ s == null || s(!0);
42705
+ return;
42706
+ }
42707
+ const a = t().tabComments.find(
42708
+ (l) => l.id === n && !l.deleted && !l.resolved
42696
42709
  );
42697
- !r || !(i != null && i.selectedContent) || (e((s) => ({
42698
- floatingItems: DS(s.floatingItems, {
42710
+ !r || !(a != null && a.selectedContent) || (e((l) => ({
42711
+ floatingItems: DS(l.floatingItems, {
42699
42712
  commentId: n,
42700
- selectedText: i.selectedContent || ""
42713
+ selectedText: a.selectedContent || ""
42701
42714
  })
42702
42715
  })), o(n), r.commands.setCommentActive(n));
42703
42716
  },
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.0.96-zustand-16",
5
+ "version": "3.0.96-zustand-17",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {