I think you can use like this way dispatch(tr.setNodeMarkup($from.before(), undefined, { ...attrs, someValue }))
dispatch(tr.setNodeMarkup($from.before(), undefined, { ...attrs, someValue }))