Skip to content

Conversation

@AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Dec 8, 2024

Purpose

The initial document creation could create bug with collaboration. As soon as a char was enter and saved, this bug stopped to appear (basically after 1 mn).

The initial creation involving collaboration seems more complicated that what we were doing:
https://github.com/TypeCellOS/BlockNote/blob/71792c2fbdc99785cd8ce5b540d1a468e6c66131/packages/core/src/editor/BlockNoteTipTapEditor.ts#L73-L131

Proposal

We will let Blocknote managing the initial creation, and we will update the Blocknote initial creation with our initial creation.
Collaborating issue are gone, the document sync correctly between collaborators.

@AntoLC AntoLC self-assigned this Dec 8, 2024
@AntoLC AntoLC linked an issue Dec 8, 2024 that may be closed by this pull request
@AntoLC AntoLC force-pushed the fix/save-initial-content branch from e86b157 to 1feb271 Compare December 9, 2024 06:43
@AntoLC AntoLC requested a review from YousefED December 9, 2024 07:11
@AntoLC AntoLC marked this pull request as ready for review December 9, 2024 07:11
@AntoLC AntoLC force-pushed the fix/save-initial-content branch from 1feb271 to 4204eff Compare December 9, 2024 07:13
@AntoLC AntoLC changed the title 🐛(frontend) Save initial content 🐛(frontend) fix initial content with collaboration Dec 9, 2024
@AntoLC AntoLC mentioned this pull request Dec 9, 2024
Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work, though I think it's a bit cleaner to do this on the server, so there's 1 place responsible for creating a new document (both the metadata and the document data), and initialDoc would always be set.

Having said that, I do think this approach should work, there might be a small bug with two headings appearing if 2 users open a new document at the same time, but this is very unlikely

@AntoLC
Copy link
Collaborator Author

AntoLC commented Dec 11, 2024

This should work, though I think it's a bit cleaner to do this on the server, so there's 1 place responsible for creating a new document (both the metadata and the document data), and initialDoc would always be set.

Yes but the server is in python, and we are a SPA, so we cannot use @blocknote/server-util for the moment.

@PanchoutNathan
Copy link
Contributor

@YousefED Hi youseff, Do you think it is possible to add an "editor is ready" event to avoid timeouts and to perform actions on the editor when we are sure that it is possible?

The way the initial content was created was causing
issues with the collaboration server.
As soon a user started typing, the problem was gone.
This commit fixes that by letting Blocknote
managing the initial content, then we update the
Blocknote initial content with our initial content.
@YousefED
Copy link
Collaborator

YousefED commented Dec 11, 2024 via email

@AntoLC
Copy link
Collaborator Author

AntoLC commented Dec 11, 2024

I have this on a dev branch already, I'll let you know once it's merged

Nice.

We will have the possibility soon to create it from the server as well.
I will create an issue to keep it in mind.

@AntoLC AntoLC force-pushed the fix/save-initial-content branch from 4204eff to 37d772b Compare December 11, 2024 14:39
@AntoLC AntoLC merged commit fc36ed0 into main Dec 11, 2024
15 of 16 checks passed
@AntoLC AntoLC deleted the fix/save-initial-content branch December 11, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initial document creation

3 participants