@fileverse-dev/ddoc 3.0.96-zustand-15 → 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 +34 -22
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -41135,7 +41135,7 @@ function yS(e, t) {
41135
41135
  if (!(n != null && n.binding)) return Pt.empty;
41136
41136
  const { doc: r, type: o, binding: i } = n, s = [], a = t.doc.content.size;
41137
41137
  for (const l of e)
41138
- if (!l.deleted)
41138
+ if (!(l.deleted || l.resolved))
41139
41139
  try {
41140
41140
  const u = oa(
41141
41141
  r,
@@ -41149,10 +41149,9 @@ function yS(e, t) {
41149
41149
  i.mapping
41150
41150
  );
41151
41151
  if (u === null || c === null || u >= c || u < 0 || c > a) continue;
41152
- const d = l.resolved ? "inline-comment inline-comment--resolved" : "inline-comment inline-comment--unresolved";
41153
41152
  s.push(
41154
41153
  En.inline(u, c, {
41155
- class: d,
41154
+ class: "inline-comment inline-comment--unresolved",
41156
41155
  "data-comment-id": l.id
41157
41156
  })
41158
41157
  );
@@ -42537,35 +42536,43 @@ const nfe = () => D0e((e, t) => ({
42537
42536
  return i == null || i(g, b), g.id;
42538
42537
  },
42539
42538
  createFloatingDraft: () => {
42540
- 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();
42541
42546
  if (!n)
42542
42547
  return null;
42543
- 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, " ");
42544
42551
  if (!i)
42545
- return s ? o && e({ selectedText: o.selectedContent || "" }) : e({ selectedText: c }), e({ isCommentOpen: !0 }), r == null || r(), null;
42546
- 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())
42547
42554
  return null;
42548
- const d = `draft-${Fc()}`;
42549
- if (!n.commands.setDraftComment(d))
42555
+ const h = `draft-${Fc()}`;
42556
+ if (!n.commands.setDraftComment(h))
42550
42557
  return null;
42551
- const h = `draft:${d}`;
42552
- return e((f) => ({
42553
- selectedText: c,
42558
+ const g = `draft:${h}`;
42559
+ return e((m) => ({
42560
+ selectedText: p,
42554
42561
  isBubbleMenuSuppressed: !0,
42555
42562
  floatingItems: [
42556
- ...f.floatingItems.map((g) => ({ ...g, isFocused: !1 })),
42563
+ ...m.floatingItems.map((b) => ({ ...b, isFocused: !1 })),
42557
42564
  {
42558
- itemId: h,
42565
+ itemId: g,
42559
42566
  type: "draft",
42560
- draftId: d,
42561
- selectedText: c,
42567
+ draftId: h,
42568
+ selectedText: p,
42562
42569
  draftText: "",
42563
42570
  isAuthPending: !1,
42564
42571
  isOpen: !0,
42565
42572
  isFocused: !0
42566
42573
  }
42567
42574
  ]
42568
- })), r == null || r(), d;
42575
+ })), r == null || r(), h;
42569
42576
  },
42570
42577
  updateFloatingDraftText: (n, r) => {
42571
42578
  e((o) => ({
@@ -42692,13 +42699,18 @@ const nfe = () => D0e((e, t) => ({
42692
42699
  });
42693
42700
  },
42694
42701
  openFloatingThread: (n) => {
42695
- const { editor: r, setActiveCommentId: o } = Pn(t), i = t().tabComments.find(
42696
- (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
42697
42709
  );
42698
- !r || !(i != null && i.selectedContent) || (e((s) => ({
42699
- floatingItems: DS(s.floatingItems, {
42710
+ !r || !(a != null && a.selectedContent) || (e((l) => ({
42711
+ floatingItems: DS(l.floatingItems, {
42700
42712
  commentId: n,
42701
- selectedText: i.selectedContent || ""
42713
+ selectedText: a.selectedContent || ""
42702
42714
  })
42703
42715
  })), o(n), r.commands.setCommentActive(n));
42704
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-15",
5
+ "version": "3.0.96-zustand-17",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {