tiptap icon indicating copy to clipboard operation
tiptap copied to clipboard

[Bug]: Unable to update attributes for the doc node using editor.commands.updateAttributes

Open abhi204 opened this issue 1 year ago • 3 comments

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. 💖

abhi204 avatar Apr 10 '23 02:04 abhi204

Hi, nothing on this yet? Not being able to update attributes is a bit of a bummer

irg1008 avatar Nov 30 '23 16:11 irg1008

I'm facing this issue too. Are doc attributes meant to be mutable?

There's a discussion on the ProseMirror forums discussing this.

@bdbch

kongweiying2 avatar Mar 14 '24 05:03 kongweiying2

i have same issue。Is there any solution?

frankdiw avatar May 07 '24 06:05 frankdiw