diff -ur yui_editor/plugins/coder.js yui_editor/plugins/coder.js --- yui_editor/plugins/coder.js 2008-11-21 17:54:27.000000000 -0500 +++ yui_editor/plugins/coder.js 2009-06-24 09:17:04.000000000 -0400 @@ -14,6 +14,15 @@ }; this.toolbar.addButtonToGroup(codeConfig, 'plugins'); + // The handleSubmit config option handles if the editor will attach itself to the textareas parent form's submit handler. + // If it is set to true, the editor will attempt to attach a submit listener to the textareas parent form. + // Then it will trigger the editors save handler and place the new content back into the text area before the form is submitted. + // The editor's save handler removes php and javascript code and makes other modifications to the content of the editable textarea. + // Since at this point the 'editcode' button has been added to the toolbar we have to assume that the user may not want the editor's save + // handler to be used since it may modify the user's content. + // By setting the 'handleSubmit' to false the editor's submit handler gets removed and the textarea's content gets submitted untouched. + this.set('handleSubmit', false); //Remove the submit handler + this.toolbar.on('editcodeClick', function(ev) { var ta = this.get('element'), iframe = this.get('iframe').get('element'); @@ -33,7 +42,12 @@ } else { coderState = 'on'; - this.cleanHTML(); + + // The cleanHTML function call removes php and javascript code and makes other modifications to the content of the editable textarea. + // Commenting the cleanHTML function call prevents the editable textarea content from getting "cleaned up". + // That way when the "Edit HTML Code" button is clicked the untouched content of the textarea that lies beneath the yui_editor will be presented. + // this.cleanHTML(); + Dom.addClass(iframe, 'editor-hidden'); Dom.removeClass(ta, 'editor-hidden'); this.toolbar.set('disabled', true);