-
Notifications
You must be signed in to change notification settings - Fork 18
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
TypeError: root.getSelection is not a function #149
Comments
Is this a server-side error or are you seeing this in the browser console? |
(Funny enough, I was just working on SSR in Next.js (#148), but I didn't run into this, which is... odd!) |
I'm seeing it in the browser console! |
Ok, that makes more sense than in the server logs, at least! What browser are you using? |
Chrome Version 131.0.6778.140 (Official Build) (arm64) The error appears when I try to type anything into the editor. If you have an existing setup that works in Next.js I would love to see how it's structured. |
I don't have anything public facing right now, unfortunately :/. But this looks right to me, and I don't see why this would be happening -- that should be running Would you be able to set a breakpoint in the browser debugger and see what value |
No problem! This is super weird, and almost certainly a bug in React ProseMirror, though I don't know... how?? I'll have to try to reproduce tomorrow and see if I can figure out the cause. Thanks for reporting! |
@legitmaxwu which version of Next.js and React are you using? |
Ah, ok. The short term solution is to downgrade your prosemirror-view version - and internal API that we rely on has changed. Make sure you use the prosemirror-view version that React ProseMirror specifies in its peer dependencies, currently |
Thanks so much for your help!! I locked to Since React Prosemirror uses internal Prosemirror APIs, maybe it makes sense to lock the peer dependencies to a specific version? (e.g. |
Great! Glad it's fixed. We do actually pin to a specific version of prosemirror-view for just that reason: https://github.com/nytimes/react-prosemirror/blob/main/package.json#L102 but most package managers don't make it very clear when a peer dep version constraint is violated, unfortunately |
Oh wow, yeah, my |
Going to close this issue! I'll open a PR to bump us up to the latest prosemirror-view |
Hi, thanks for this library! I like the idea of using React to render the editor.
I'm trying to set it up in my Next.js project. I have
@nytimes/[email protected]
installed, and I have a minimal setup:However, I'm getting the following error when I try to interact with the editor:
Any idea why this might be the case?
The text was updated successfully, but these errors were encountered: