[Bug]: Creating new NodePos throws error NodeType.create can't construct text nodes #6019
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
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
The text was updated successfully, but these errors were encountered: