In other words, OpenWYSIWYG edits the text area exactly as expected with all buttons functioning. However, on preview or submit, the contents are deleted. "Comment field is required." error message.

Same result in FF, SeaMonkey, Opera and IE (running in WINE).

CommentFileSizeAuthor
#4 wysiwyg-HEAD.detach-editor.patch1.06 KBsun

Comments

sun’s picture

Status: Active » Postponed (maintainer needs more info)

Can you test in an environment without virtualization? We encountered many issues recently that could only be replicated in a virtualization.

eyecon-1’s picture

Sorry but I am not sure which virtualization you are referring to. I am testing on a local machine.

OS=Fedora 11
Webserver=Lighttpd
db=mysql
php=5.2.x

I am not running any virtual machines (if that is what you mean) nor do I have any of the VM modules loaded.

BTW, I removed the devel and installed (clean) the release version of WYSIWYG. Same result.

robloach’s picture

Status: Postponed (maintainer needs more info) » Needs work

I ran into something where the openWYSIWYG editor wouldn't save the changes that you made and discovered that disabling the WYSIWYG editor before saving it fixed it.

Drupal.behaviors.attachWysiwyg = function(context) {
  // This breaks in Konqueror. Prevent it from running.
  if (/KDE/.test(navigator.vendor)) {
    return;
  }

  $('.wysiwyg:not(.wysiwyg-processed)', context).each(function() {
    var params = Drupal.wysiwyg.getParams(this);
    var $this = $(this);
    // Directly attach this editor, if the input format is enabled or there is
    // only one input format at all.
    if (($this.is(':input') && $this.is(':checked')) || $this.is('div')) {
      Drupal.wysiwygAttach(context, params);
    }
    // Attach onChange handlers to input format selector elements.
    if ($this.is(':input')) {
      $this.change(function() {
        // If not disabled, detach the current and attach a new editor.
        Drupal.wysiwygDetach(context, params);
        Drupal.wysiwygAttach(context, params);
      });
      // IE triggers onChange after blur only.
      if ($.browser.msie) {
        $this.click(function () {
          this.blur();
        });
      }
    }


    // Disable the editor!!!!!!!
    $('input:submit').click(function() {
      Drupal.wysiwygDetach(context, params);
    });
    // End the hack for openWYSIWYG


    $this.addClass('wysiwyg-processed');
  });
};
sun’s picture

Title: OpenW clears text area on submit » Some editors are not detached upon form submit
Status: Needs work » Needs review
StatusFileSize
new1.06 KB

I only tested this with TinyMCE. I always wanted to add something like that. Not sure why openWysiwyg fails to attach its own form submit handler, but anyway, I hope this patch fixes it for all edge-cases.

robloach’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for sticking what I posted into a patch, I was rather tied up on Thursday to translate it into a patch.... The only concern I have with this is that it might have a negative effect on other editors? I've only tested it with openWYSIWYG, TinyMCE and MarkItUp and all seemed fine. Might be worth it to just commit this, and then see if anyone runs into troubles with it during the -dev life cycle.

sun’s picture

Status: Reviewed & tested by the community » Fixed

Agreed.

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.

Status: Fixed » Closed (fixed)

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

BruceDawson’s picture

I just tried the patch, and there was no change in behavior. Its still dropping the content.

However, I did notice that if I disable and then re-enable the "Rich Text" option, then did a save or preview, it kept the contents.

Note: I was using OpenWysiwyg and Wysiwig 6.x-2.0. This is on drupal 6.15.

jamix’s picture

Version: 6.x-2.x-dev » 5.x-2.1

There is a special case negative effect of the #4 patch in 5.x-2.1. When an editor is attached to the body textarea in node form and there's an ImageField upload widget, hitting the "Upload" button in the latter causes the editor to disappear. This is because the widget's "Upload" button also triggers the form submit event, although it's normally intercepted by JavaScript so no page reload takes place.