As you edit your code using the HTML code editor, it does not automatically save. It is advised that you click the 'Save' button from time to time as seen on the screenshot below.
However, if you do forget to save your work and exit back to messages, a prompt will be show:
Simply click on the "Keep edits" to make sure anything you've changed recently are saved.