Skip to content
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

[cookbook] Prosemirror recipes are no longer reliable. #26

Open
c4lliope opened this issue Nov 7, 2024 · 3 comments
Open

[cookbook] Prosemirror recipes are no longer reliable. #26

c4lliope opened this issue Nov 7, 2024 · 3 comments

Comments

@c4lliope
Copy link

c4lliope commented Nov 7, 2024

Hello - I'm going through the guide on:
https://automerge.org/docs/cookbook/rich-text-prosemirror-react
-- there are a few errors.

Primarily, the import from this package is no longer called AutoMirror; the docs should be changed to import { init } from ..., as in the README here. Secondly, I keep running into this error, although I can see no difference in the code I am using. Occasionally, one of Vite's hot module reloads on a page save kicks in, and I can finally reach an on-screen editor. Usually, such as in a manual refresh, I can only see the error.

"cannot initialize ProseMirror document when handle is not ready",

"cannot initialize ProseMirror document when handle is not ready"

@c4lliope
Copy link
Author

c4lliope commented Nov 9, 2024

Looking through the VanillaJS Prosemirror recipe also...

I repaired many of the same errors from the React guide; mainly changing the AutoMirror reference to init() again.

In addition to the handle readiness error, I am also running up on:

Uncaught TypeError: mirror.intercept is not a function

@c4lliope c4lliope changed the title React & Prosemirror guide has been falling behind! [cookbook] Prosemirror recipes are no longer reliable. Nov 9, 2024
@c4lliope
Copy link
Author

c4lliope commented Nov 9, 2024

One more clue had been...
erasing the document hash from the URL and refreshing, usually is enough to kick prosemirror into gear; coupled with the DocHandle error message, I'm researching the background I need on:

https://automerge.org/docs/repositories/dochandles/

The description of a DocHandle as a "Live Document"; one that can manage and respond to interactions and changes; is a good explanation of how ProseMirror relies so much on this binding, rather than the basic document model.

The URL quirk also implies that Repo.create({ page: '' }) is succeeding, whereas the Repo.find(....) or other similar secondary paths are missing the mark. Maybe the issue is in the Repo initialization somehow.

@alexjg
Copy link
Collaborator

alexjg commented Nov 11, 2024

Thanks for spotting this. I have a PR to update the docs here: automerge/automerge.github.io#99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants