First time changing brake pads…piston came out

As the description states, it was my first attempt changing brake pads and when it was time to compress the caliper piston it popped out…fluid started coming out as well. It did not fully fall out but stayed hanging as shown in the picture, I was able to put it back into place with a compressor tool and finished the job, BUT now my brake pedal feels very light/spongy. I’m assuming due to air possibly being trapped due to the piston coming out? Any help/advice would be appreciated.

As the description states, it was my first attempt changing brake pads and when it was time to compress the caliper piston it popped out…fluid started coming out as well. It did not fully fall out but stayed hanging as shown in the picture, I was able to put it back into place with a compressor tool and finished the job, BUT now my brake pedal feels very light/spongy. I’m assuming due to air possibly being trapped due to the piston coming out? Any help/advice would be appreciated.