Are we guaranteed that `modeData` will always be defined in this case even if there's no nested mode? Maybe this needs to be something like `(modeData ? modeData.state.tagName : ctx.token.state.tagName) || null`.