A Greenock man has admitted assaulting his former partner after dragging her into a flat and detaining her against her will.