Im not a application/program maker.
But if i tired this in PHP, you would have to learn the functions for safely converting RAW HTML code into safely fit into and <textarea>.
Another Thing you would have to do is define a piece of code that can be inserted into the HTML code to divide sections of interest. This way your able to section your code off easily. Since im not a FLASH i would use javascript/AJAX to be able to select sections of the HTML so you can edit it.
If you really need more help with the details you can ask and i'll help assist you. Simply creating a PHP page to edit HTML documents should be less than 500 lines of code with a professional look and layout.