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

[Bug]: Creating new NodePos throws error NodeType.create can't construct text nodes #6019

Open
1 task done
philiprenich opened this issue Jan 13, 2025 · 0 comments
Open
1 task done
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@philiprenich
Copy link

Affected Packages

core

Version(s)

2.9+

Bug Description

Here's a minimal reproduction of the issue: https://jsfiddle.net/qrwg9s4m/1/

When creating a NodePos with the purpose of updating a Node attribute, no node type is sent to Prosemirror so it defaults to Text which is not allowed to have attributes. This throws the error "NodeType.create can't construct text nodes"

You can see this in the fiddle's console. It goes away and the attribute is set if you change the version from 2.9 to 2.8. (it looks like I'm doing something with transactions wrong anyway though so there is a recursion error thrown in this case, I think this can be ignored and I'd guess is an issue in how I'm trying to update the node)

It appears this issue was introduced while fixing other bugs: /~https://github.com/ueberdosis/tiptap/pull/5716/files#diff-deab15d8918868fc71b9ad8ee3afa808f6b4be07c48e915fd0aed512493fd90cR241

I don't know exactly what the PR was solving to know the context or other knock-on effects.

(while I hope this helps solve an actual issue, if there is something obviously stupid this example is doing when it comes to updating the "id" attribute, I'd appreciate a tip there too, thanks! :) )

Browser Used

Firefox

Code Example URL

https://jsfiddle.net/qrwg9s4m/1/

Expected Behavior

No errors to be thrown and the attribute of the node to be updated appropriately. (Perhaps in this case, a recursion error to be thrown as there appears to be a more business-logic like bug afterward)

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@philiprenich philiprenich added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant