From eedd5518284b94ec197bf3c4b8c4efc786493785 Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Mon, 10 Nov 2025 14:56:14 +0100 Subject: [PATCH] fix(comments): update the styles for the cursor to be the default cursor Addresses: https://linear.app/blocknote/issue/BLO-333/comments-cursor Introduced by: https://github.com/TypeCellOS/BlockNote/pull/2033 --- .../06-comments-with-sidebar/package.json | 5 ++-- .../06-comments-with-sidebar/src/App.tsx | 30 +++++++------------ .../threadstore/yjs/YjsThreadStoreBase.ts | 4 ++- packages/mantine/src/blocknoteStyles.css | 4 --- pnpm-lock.yaml | 9 ++++-- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/examples/07-collaboration/06-comments-with-sidebar/package.json b/examples/07-collaboration/06-comments-with-sidebar/package.json index 7902a3cdc2..545c30d05f 100644 --- a/examples/07-collaboration/06-comments-with-sidebar/package.json +++ b/examples/07-collaboration/06-comments-with-sidebar/package.json @@ -21,7 +21,8 @@ "@mantine/utils": "^6.0.22", "react": "^19.2.0", "react-dom": "^19.2.0", - "@y-sweet/react": "^0.6.3" + "y-partykit": "^0.0.25", + "yjs": "^13.6.27" }, "devDependencies": { "@types/react": "^19.2.2", @@ -29,4 +30,4 @@ "@vitejs/plugin-react": "^4.7.0", "vite": "^5.4.20" } -} \ No newline at end of file +} diff --git a/examples/07-collaboration/06-comments-with-sidebar/src/App.tsx b/examples/07-collaboration/06-comments-with-sidebar/src/App.tsx index ed7bf38473..d743eb3803 100644 --- a/examples/07-collaboration/06-comments-with-sidebar/src/App.tsx +++ b/examples/07-collaboration/06-comments-with-sidebar/src/App.tsx @@ -12,8 +12,9 @@ import { ThreadsSidebar, useCreateBlockNote, } from "@blocknote/react"; -import { YDocProvider, useYDoc, useYjsProvider } from "@y-sweet/react"; import { useMemo, useState } from "react"; +import YPartyKitProvider from "y-partykit/provider"; +import * as Y from "yjs"; import { SettingsSelect } from "./SettingsSelect"; import { HARDCODED_USERS, MyUserType, getRandomColor } from "./userdata"; @@ -31,23 +32,19 @@ async function resolveUsers(userIds: string[]) { return HARDCODED_USERS.filter((user) => userIds.includes(user.id)); } +// Sets up Yjs document and PartyKit Yjs provider. +const doc = new Y.Doc(); +const provider = new YPartyKitProvider( + "blocknote-dev.yousefed.partykit.dev", + // Use a unique name as a "room" for your application. + "comments-with-sidebar", + doc, +); + // This follows the Y-Sweet example to setup a collabotive editor // (but of course, you also use other collaboration providers // see the docs for more information) export default function App() { - const docId = "my-blocknote-document-with-comments-2"; - - return ( - - - - ); -} - -function Document() { const [activeUser, setActiveUser] = useState(HARDCODED_USERS[0]); const [commentFilter, setCommentFilter] = useState< "open" | "resolved" | "all" @@ -56,11 +53,6 @@ function Document() { "position" | "recent-activity" | "oldest" >("position"); - const provider = useYjsProvider(); - - // take the Y.Doc collaborative document from Y-Sweet - const doc = useYDoc(); - // setup the thread store which stores / and syncs thread / comment data const threadStore = useMemo(() => { // (alternative, use TiptapCollabProvider) diff --git a/packages/core/src/comments/threadstore/yjs/YjsThreadStoreBase.ts b/packages/core/src/comments/threadstore/yjs/YjsThreadStoreBase.ts index e178c35c73..331fbac3ce 100644 --- a/packages/core/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +++ b/packages/core/src/comments/threadstore/yjs/YjsThreadStoreBase.ts @@ -29,7 +29,9 @@ export abstract class YjsThreadStoreBase extends ThreadStore { public getThreads(): Map { const threadMap = new Map(); this.threadsYMap.forEach((yThread, id) => { - threadMap.set(id, yMapToThread(yThread)); + if (yThread instanceof Y.Map) { + threadMap.set(id, yMapToThread(yThread)); + } }); return threadMap; } diff --git a/packages/mantine/src/blocknoteStyles.css b/packages/mantine/src/blocknoteStyles.css index 7f0e3b74cd..8a3c4da1f1 100644 --- a/packages/mantine/src/blocknoteStyles.css +++ b/packages/mantine/src/blocknoteStyles.css @@ -635,10 +635,6 @@ box-shadow: none; } -.bn-mantine .bn-thread:not(.selected) { - cursor: pointer; -} - .bn-mantine .bn-thread-comments, .bn-mantine .bn-thread-composer { display: flex; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f885682517..be673987c8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3635,15 +3635,18 @@ importers: '@mantine/utils': specifier: ^6.0.22 version: 6.0.22(react@19.2.0) - '@y-sweet/react': - specifier: ^0.6.3 - version: 0.6.4(react@19.2.0)(yjs@13.6.27) react: specifier: ^19.2.0 version: 19.2.0 react-dom: specifier: ^19.2.0 version: 19.2.0(react@19.2.0) + y-partykit: + specifier: ^0.0.25 + version: 0.0.25 + yjs: + specifier: ^13.6.27 + version: 13.6.27 devDependencies: '@types/react': specifier: ^19.2.2