in drupal ckeditor. Where does the deletion occur when changing text formats?

I need to know where is the code that removes the formats when you change from HTML to rich text or vice versa in the ckeditor that is in drupal 8. I need to modify what is deleted. Where can I find that?
Thank you