How to just change node attributes

Hi is there a transition to change only a node attributes? I have a doc tree, and when user selects a node, I show them attributes to change, I want to dispatch these changes to doc, without touching node type, I read that if you send type null to setNodeMarkup it would update the node at position without touching the type, but I dont see an example to use it,

please help

Yes, passing null as type to setNodeMarkup should do what you’re asking for. I’m not sure what kind of example you’re looking for—don’t the docs provide all the information you need to call it?

I dont know what should I do with the result of state.tr.setNodeMarkup() I am calling this method as a command

edit: nevermind, found a sample from setBlockType and wrote this command

export const updateAttrOfNodeOfType = (pos, args) => {
    return (state, dispatch, editorView) => {
        const cmd = state.tr.setNodeMarkup(pos, null, args);
        if (dispatch) {
            dispatch(transform.scrollIntoView());
        }
        return true;
    }
}

thanks for feedback :blush: