tiptap
tiptap copied to clipboard
[Bug]: Unable to update attributes for the doc node using editor.commands.updateAttributes
Which packages did you experience the bug in?
core
What Tiptap version are you using?
2.0.0
What’s the bug you are facing?
Considering that I want to add some attributes to the doc node (i.e. the top level node),
The following command doesn't work:
editor.commands.updateAttributes('doc', {someAttribute: 'xyz'})
Even if we call editor.commands.focus('all')
the above command doesn't work.
At the moment, I am doing this by performing a state update:
What browser are you using?
Chrome
Code example
https://codesandbox.io/s/magical-browser-qvxdui?file=/src/App.js
What did you expect to happen?
editor.commands.updateAttributes("doc", { newAttribute: "ABC" });
should have updated the doc node's attr values
Anything to add? (optional)
In a nutshell, I want a method to add/update root node's (which generally is the doc
node) attributes.
Did you update your dependencies?
- [X] Yes, I’ve updated my dependencies to use the latest version of all packages.
Are you sponsoring us?
- [ ] Yes, I’m a sponsor. 💖
Hi, nothing on this yet? Not being able to update attributes is a bit of a bummer
I'm facing this issue too. Are doc attributes meant to be mutable?
There's a discussion on the ProseMirror forums discussing this.
@bdbch
i have same issue。Is there any solution?