Blac Chyna was granted a temporary restraining order barring Rob Kardashian from coming near her or posting about her online.
The reality star appeared in court Monday morning with her attorneys as she sought to stop what she alleges is cyber-bullying by Kardashian.
Kardashian posted personal information last week about his relationship with Chyna on his Instagram account, including sexually explicit images of his former fiancée whom he accused of cheating on him and using him for his fortune.
Outside of court, Chyna's attorney Lisa Bloom said they were granted everything they sought in their petition.
"As we have said all along, revenge porn is a form of domestic abuse," Bloom said. "It is also a crime in California and 38 other states."
Attorney Robert Shapiro represented Kardashian, who did not appear in court.
Shapiro said his client stipulated to the restraining order and agreed to follow all the conditions.
The attorney said Kardashian's concern now "is the health and welfare of the baby and both parents are going to work toward that goal."
"I, personally, on Mr. Kardahsian's behalf apologized and offered our regrets as to what happened in the past couple of days," Shapiro said. "Now we move forward to do one thing and one thing only, what ever is in the best interest of the child."
Chyna echoed that sentiment in a brief statement she made after the hearing.
"I'm just going to get back to co-parenting Dream," she said.
In the petition, Chyna, whose legal name is Angela White, alleged that Kardashian swore at her in front of her 4-year-old son, King, and got angered when she attempted to call King's father during an argument back in April.
"Rob immediately grabbed my phone and pushed me to the ground by aggressively shoving me by the side of my arm and hitting me on the side," the declaration read. "I fell down from the blow to my side. I was sore and it hurt to walk."
The next hearing in the case has been set for August 8.
Earlier the model and entrepreneur appeared on "Good Morning America" with Bloom in an interview which aired Monday morning before the hearing.
Chyna told "GMA" she was "devastated" by Kardashian's actions.
"Like, this is a person I trusted," she said. "I just felt...betrayed."
She denied claims she engaged with the photos by liking some of the images her ex posted, saying she has Kardashian blocked on Instagram.
She said she decided to pursue legal action after speaking with her former love with whom she shares an eight-month-old daughter, Dream.
"The moral of the story is he doesn't respect me," said Chyna, whose real name is Angela White. "If you can't respect me, you have to respect the law."
Bloom said on Friday she had filed for a temporary restraining order against Kardashian on behalf of her client.
California has laws regarding "revenge porn" in which a person can be charged for publicly releasing unauthorized nude images of another person to cause them emotional distress.
The former couple has had a tumultuous relationship that's been documented on both social media and their E! reality series "Rob & Chyna."
Things were also complicated by the fact Chyna shares a son with rapper Tyga, who left her to begin dating Kardashian's younger sister, Kylie Jenner.
On Monday's "GMA" appearance, Bloom defended Chyna against those who say the reality star already exposes a great deal of herself in her own social media postings.
"Any explicit photos that she may have chosen to post in the past that's her choice," Bloom said. "This is like saying that a woman can't be raped if she previously chose to have sex with someone. It's her body, it's her choice,each and every time."
Chyna said she and Kardashian split in December and there is absolutely no hope of a reconciliation. She said she has not heard from any of his family members since Kardashian's social media postings last Wednesday.
Chyna addressed speculation that she got pregnant as a revenge ploy against the Kardashians or to get money out of the reality mogul family, Chyna denied it.
"I was already Blac Chyna before the Kardsahians," she said.