Cables can only have their sheaths removed inside junction boxes. A fan or similar equipment will often have an integral junction box for making connections. This must be fixed.
It appears that there is a few inches of cable sheath visible towards the right side in picture one. Assuming that is indeed the case:
- Install a metal box above the fan. Ideal would be to mount it to the wood that is on the right side. But I have a feeling you can't do that without it blocking physical installation of the fan. In which case it may just have to be loose so that when you push up the fan it gets pushed up and out of the way. USE A METAL BOX. One knockout with clamp for the existing cable, one for a new cable.
- Add a short cable (probably between one and two feet) between the new box and the fan. 14/2 if a 15A circuit, 12/2 if a 20A circuit. Clamp it in the new box, strip a few inches of the cable sheath inside the box, ground to the box directly, wire nut black and white to the old black and white.
- The other end of the new cable should be wire-nutted to the fan wires INSIDE THE FAN BOX. That fan box is itself a junction box. There should be a clamp on circular hole for the new cable going in (which currently has the fan's wires coming out) to keep the cable secure and to keep the box properly protected from bugs crawling in, etc. If you can't find the clamp, measure the hole and get a new clamp from a hardware store - I'm sure it is a standard size.
You don't want the new cable way too long, but a little longer than absolutely necessary will make the installation easier.
While a junction box inside the ceiling is normally not allowed, it is normal to have a junction in the ceiling above equipment (lights, fans, etc.) where the junction box is 100% accessible as soon as you remove the equipment.
However, checking a little further, it looks like probably some combination of (a) my memory not 100% as to what is/isn't permitted and/or (b) a lot of stuff out there that isn't 100% code-compliant. The normal rule for junction boxes is "accessible without tools". An exception is made for junction boxes attached to a device - but that is not the case here, or rather it is with the original fan fixture but not with my solution. There is an allowance for boxes way up above a drop-ceiling with cables down to fixtures installed in the ceiling, but that is not the case here either. Or for a junction box behind an appliance - e.g., in the back of a cabinet where tools are needed to remove the appliance but the box is permanently installed in the cabinet to service the appliance. That last case is close to this, except in that case the box is not simply sitting in the ceiling but is inside the cabinet that holds the appliance, which is a little different.
The end result is that my solution is a lot better than the existing situation, but the junction box accessibility could still be a real code issue.
A slight variation from a comment from Huesmann, which should be 100% code-compliant, is to find a ceiling location that the existing cable with sheath can reach and put a box there with a plain cover plate. Run the new cable from there to the fan. That results in an extra blank plate on the ceiling, but if the plate is painted (or naturally if white plate and white ceiling) to match the ceiling it won't be very noticeable.
One other solution is to install a very large box such that it can reach from the existing cable sheath on one end all the way over to where the fan wires exit the fan's integral box on the other end, and screw everything together. That should be 100% compliant, but would like be a real pain to install.
Also, as noted in another comment, condo, so no attic access is a real concern as well. In most jurisdictions work in a multi-tenant building must be done by licensed electricians.