OP this hurts. I have been there.
I think your emotions are misplaced though - your colleague got the job, but she didn't make the decision.
It's galling that someone is given a job that YOU have been doing.
There could be any number of reasons - they wanted to get 'new blood'; she's done something recently that the appointing panel liked the sound of, maybe she performed REALLY well in the interview. You can't know, and probably no-one will ever really tell you. Be prepared for a vague 'she had more experience' or whatever at best.
So think about whether senior management at your school is investing in you. Don't wait passively for another opportunity. Is someone actively helping you with your development? Have you asked for this? Despite her appointment, do you feel that there is 'somewhere for you to go' in the school in future?
If so, you can nurture that and work towards it.
If not, then you have to make peace with the fact that for whatever reason, there may not be career progression there for you. So you decide to plod along for a bit, or look elsewhere. They're your only two decisions.
I think that the behaviour of her class is a red herring. They were off with you. You were maybe a bit prickly with them. It's no more than that.
You can acknowledge how you feel, but to really understand it, try to get to the bottom of where the senior management see you in future. That will help you know what to do next.