Changes don't get saved

g.idema - April 28, 2008 - 09:07
Project:YUI Rich Text Editor
Version:5.x-2.6-9
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm not sure if this should be a bug report or a support request, because I'm the first to report this.
When I make changes using the editor, these changes don't get saved unless I change to the plain text editor first. (Which I can only do if I remove the Drupal.t() function calls, see http://drupal.org/node/252087 )

#1

g.idema - April 28, 2008 - 09:30

Same in 6.x-1.2-9

#2

g.idema - April 28, 2008 - 15:51
Status:active» patch (code needs review)

I added a form submit handler to yui_editor.js to be sure the changes get saved:

Just after the first 2 lines in render_editor add the following line:

    addEvent(document.getElementById(id).form, 'submit', function(ev) {myEditor.saveHTML() });

The addEvent function makes sure the event works in all recent browsers.
Add the function at the end of the file:

/**
* function addEvent
* Also works on browsers that don't support addEventListener (IE)
*/
function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj.attachEvent( 'on'+type, fn );
  }
  else
    obj.addEventListener( type, fn, false );
}

#3

jeffcd - May 5, 2008 - 23:08
Status:patch (code needs review)» closed

Fixed.

 
 

Drupal is a registered trademark of Dries Buytaert.