Skip to content

editable: false deletes the whole content if collaboration is enabled #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sradu opened this issue Jan 10, 2024 · 3 comments · Fixed by #538
Closed

editable: false deletes the whole content if collaboration is enabled #511

sradu opened this issue Jan 10, 2024 · 3 comments · Fixed by #538
Labels
bug Something isn't working prio:mid Medium priority

Comments

@sradu
Copy link

sradu commented Jan 10, 2024

If I start writing a page which is saved via collaboration, and then I open the same page with editable: false blocknote deletes the whole content. Reproduced via this nextjs component with the latest version:

"use client";
import { BlockNoteEditor } from "@blocknote/core";
import { BlockNoteView, useBlockNote } from "@blocknote/react";
import "@blocknote/react/style.css";

import * as Y from 'yjs'

import { HocuspocusProvider } from '@hocuspocus/provider'

export default function Editor() {
  const ydoc = new Y.Doc()

  const provider = new HocuspocusProvider({
    url: "ws://localhost:1234",
    name: 'page~~c758cb5d-e8ab-425a-a79d-276711e9b572',
    document: ydoc
  })

  const editor = useBlockNote({
    editable: false, // If editable is false it deletes existing content
    collaboration: {
      provider,
      fragment: ydoc.getXmlFragment('document-store'),
      user: {
        name: 'My Username',
        color: '#ff0000'
      }
    },
  });

  return <BlockNoteView editor={editor} />;
}
@sradu sradu added the bug Something isn't working label Jan 10, 2024
@matthewlipski matthewlipski added the prio:mid Medium priority label Jan 18, 2024
@sradu
Copy link
Author

sradu commented Jan 18, 2024

@matthewlipski I feel bad saying this, but this bug deletes the whole contents with editable: false and collaboration enabled, perhaps it should be prio:high?

@YousefED
Copy link
Collaborator

@sradu thanks for reporting, I found the bug

Would be great to welcome you as a sponsor, so we can assign higher priority to items that are critical for you

@sradu
Copy link
Author

sradu commented Jan 22, 2024

@YousefED I know! I want that too, as soon as you know....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working prio:mid Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants