How to update `attrs` of `doc`?


I’m trying t extending the basic doc node schema from

doc: {
  content: "block+"


doc: {
  content: "block+",
  attrs: {
    width: {default: null},

The idea is to be able to set the proper width of the current doc.

My problem is that I’m not sure who could I update doc.attrs. Unfortunately tr.setNodeMarkup() only allows me to update the attrs of doc’s children.

Any help will be much appreciated. Thanks!!

Just a follow up to my previous question. I’ve found out that others also had the same problem and had solved this nicely.