Some editors are not detached upon form submit

eyecon - July 3, 2009 - 17:51
Project:Wysiwyg
Version:6.x-2.x-dev
Component:Editor - OpenWYSIWYG
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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).

#1

sun - July 3, 2009 - 19:44
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.

#2

eyecon - July 3, 2009 - 20:17

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.

#3

Rob Loach - July 16, 2009 - 21:11
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');
  });
};

#4

sun - July 18, 2009 - 18:39
Title:OpenW clears text area on submit» Some editors are not detached upon form submit
Status:needs work» needs review

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.

AttachmentSize
wysiwyg-HEAD.detach-editor.patch 1.06 KB

#5

Rob Loach - July 19, 2009 - 00:31
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.

#6

sun - July 23, 2009 - 16:36
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.

#7

System Message - August 6, 2009 - 16:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.