It looks like the 6.x-2.x-dev branch of the wysiwyg drupal module can recognize version 2.8 of the yui library.

But version 2.8.0r4 has a weird failure mode: it appears to clear the entire textarea just before submitting a page.

This has the potential to be seriously damaging and frustrating! version 2.7.0b does not exhibit this problem.

CommentFileSizeAuthor
#7 wysiwyg-yui-detach.patch979 bytesTwoD
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Status: Active » Closed (duplicate)

Oops, didn't read the issue properly, ignore this post.

TwoD’s picture

Status: Closed (duplicate) » Active

I'll look into this ASAP.

dkg’s picture

thanks! I saw this behavior with iceweasel (firefox, unbranded) version 3.5.5

TwoD’s picture

Status: Active » Postponed (maintainer needs more info)

I just tested with FF 3.5.5 on Ubuntu Karmic. Seems to work just fine here. Detaching and re-attaching the editor using the rich-edit link works, as does submitting, preview and saving.
Can you please make sure you're not getting partially cached files or something left over when switching library versions?
Have you tried with the Garland theme?
If you are able, can you set breakpoints using Firebug or a similar tool and step though the detach call in the JS implementation of YUI to find out when the content is cleared?

If it still doesn't work, mind providing me with access to a sandbox environment where I can debug this?

gpk’s picture

Title: Using YUI Rich Text Editor fails nastily with 2.8.0r4 version of the YUI library » Using YUI Rich Text Editor with 2.8.0r4 version of the YUI library causes page content to be lost

Same problem with same versions of wysiwyg module and yui editor (i.e. 6.x-2.x-dev (22 Nov 2009) of wysiwyg module and 2.8.0r4 of yui library).

On IE8 or Ff 3.0.16.

Same with custom theme or Garland theme.

There is a sort of clunky workaround: edit the page ad lib using the editor, then click the "disable rich-text" link, then hit Preview or Save, and the textarea is not then cleared immediately prior to submit.

gpk’s picture

Status: Postponed (maintainer needs more info) » Active
TwoD’s picture

Status: Active » Needs review
FileSize
979 bytes

I made a second test using IE8 on WinXP and now I do see this problem. I recalled an issue which said something about the destroy() method already calling saveHTML() but I can't find that issue now.
Removing the calls to saveHTML() did seem to do the trick at least in IE.

sun’s picture

Hm, this actually sounds similar to #667848: FCKeditor is not properly detached in IE

If this patch does not break other browsers, I'm fine with committing it to all branches.

In the long run, i.e. possibly for 3.x, we want to revisit the entire native event handling of all editors. Since Wysiwyg module already takes care of attaching/detaching/serializing values, it should probably make sure that there are no native event handlers of any editor attached to any element in the form.

TwoD’s picture

Yeah I was thinking the same thing, properly cleaning up after an editor is a bit tricky as many don't seem to expect to be disabled. But it shouldn't be impossible. The brute force way would simply be purging all event handlers for onSubmit etc, but I bet that would cause problems in other modules similar to what we experience with AJAXed fields. Ideally it should of course be done by getting references to the attached functions, like in that FCKeditor patch does.

No, the change above didn't create problems in other browsers I tested with.

sun’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

...let's figure out where to put that @todo before this issue will be auto-closed ;)

jide’s picture

@TwoD #7 : That was #614402: Plugin API support for YUI Editor comment #5.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.