Textedit Yosemite erase function
That can not be done with TextEdit application.

You were probably using the Preview and it will do as you say. 

Applications that allow you modifying the JPEG are many but the simplest one are Paintbrush or Gimp.