I'd still be interested in seeing a more automatic way of doing this, but after reading through the TinyMCE documentation for days I don't see an easy way of doing this. Here's how I solved my own issue using jQuery. These are additions to the methods above:
function edit() {
//Save the current state of the content
initialBody = $('#body').html();
initialTitle = $('#title').html();
// Rest of the method above goes here
}
This saves the state of the data at the time the user pressed Edit. Now if the user presses Cancel I do the following:
function cancel() {
// Rest of the method above goes here
//Disable edit mode
//Only remove the current editor if it's active
if (tinymce.activeEditor) {
tinymce.execCommand('mceRemoveEditor', true, 'title');
tinymce.execCommand('mceRemoveEditor', true, 'body');
}
//Reset the content
$('#title').html(initialTitle);
$('#body').html(initialBody);
}
I hope this helps someone out. Let me know if there's a better way.