The drama between reality TV personalities Rob Kardashian and Blac Chyna has made its way to the court system.

A week after the reality TV family member’s stunning social media meltdown — Kardashian posted nude photos of his ex-fiancee, accused her of drug use and published a video of her kissing another man — Blac Chyna was granted a temporary restraining order against him in a California court.

Revenge porn, or “nonconsensual pornography,” has been illegal in the state since 2014. It’s defined as intentionally distributing photos or videos that were meant to be private and with the knowledge that sharing the images would cause “serious emotional distress.”

“I was devastated, of course,” Chyna, whose real name is Angela White, told ABC News on Monday. “This is a person that I trusted. … I felt comfortable, you know, with even sending these pictures and even talking to him about certain things.”

Chyna appeared outside of a courthouse Monday, where a judge had issued an order that prohibits Kardashian from “coming near her and restraining him from cyber bullying,” including posting anything about her online of “a personal nature,” according to her attorney Lisa Bloom.

“We had a complete and total victory. The judge gave us everything we asked for, which is a set of very strong and enforceable restraining orders against Rob Kardashian,” Bloom said outside the courthouse. “Revenge porn is a form of domestic abuse, it is also a crime in California and 38 other states, and it is a civil wrong.”

Bloom has represented women in other recent high-profile cases involving allegations of sexual harassment and assault, including Bill Cosby accuser Janice Dickinson and Los Angeles radio personality Wendy Walsh, who made sexual harassment claims against Fox News Channel’s Bill O’Reilly.

Kardashian and Chyna have an 8-month-old daughter.

A representative for the famed Kardashian family referred inquires to Rob Kardashian’s attorney, Robert Shapiro. The famed lawyer (who was on the O.J. Simpson trial “Dream Team” along with Kardashian’s late father) told reporters Monday that they agreed to a temporary restraining order.

“Our primary interest going forward for Mr. Kardashian is the health and welfare of the baby, and both parents are going to work toward that goal,” he said outside the courthouse, adding that the baby is with Kardashian.

Shapiro also offered an apology on behalf of Kardashian, who reportedly did not appear in court. “[We] offered our regrets for what has taken place in the past couple of days.”

The pair’s short-lived relationship (as well as many of its problems) was on painful display during E!’s “Rob & Chyna.” As the show’s first season ended, Kardashian went on social media to accuse Chyna of cheating on him and taking away the baby, which she denied.

On ABC News, Chyna said they broke up in December but that Kardashian kept bothering her and she thought, “Maybe if I send this video [of her with another man] to him, then he’ll just leave me alone.” Kardashian posted not only that video, but also explicit images and accusations that soon led to Instagram suspending his account.

He also wrote that Chyna used him and his family for fame and that she conceived a child with him to get back at ex-boyfriend Tyga. The rapper, who has a son with Chyna, went on to date Kardashian’s half-sister Kylie Jenner.

“I was already Blac Chyna before the Kardashians,” Chyna said on ABC News, later adding that she once loved Kardashian. “Nobody was out to make a baby out of spite.”

Chyna also used her social media platform to accuse Kardashian of beating her. She told ABC News that she took legal action after talking “to Rob about everything. The moral of the story is, he doesn’t respect me, so if you can’t respect me, you have to respect the law.”

Although some may dismiss this very public falling out as just celebrity drama, Kardashian’s posts were broadcast to his massive social media following. Last week, Bloom told The Post that California’s revenge porn law “clearly applies” to Kardashian’s actions.

“The main point of it is that even if Chyna sent him nude photos, if she didn’t want them posted publicly, the law protects her,” Bloom told The Post.

Chyna, a model, business executive and former stripper, also responded to criticism that she posts provocative photos of herself: “I am Angela White, I’m Blac Chyna. I can do whatever I want. It’s my body.”

Bloom added that “any explicit photos that she may have chosen to post in the past, that’s her choice.”

“I’m not asking victims to change their behavior. I’m asking perpetrators not to commit crimes,” she told ABC News. “It is a crime to post pictures like this. And if you do it, I hope that the full impact of the law rains down upon you.”

Chyna said she hopes her actions will inspire women in similar situations. “You know, you’re not the only one that’s probably going through something,” she told ABC News. “If one person speaks up, maybe it, hopefully, it will be a domino effect.”

This post has been updated.