A quantum approach to electromagnetic wave propagation inside a dielectric