This closed wysiwyg issue has introduced a pre-serialize callback/hook which tries to filter the ajax_html_ids list from wysiwyg selectors in order to avoid submitting unnecessary post parameters and avoid hitting server limit.

However, the code implementing the filtering assumes that all html element ids are included in the ajax_html_ids list and re-generates it with all html element ids, excluding the wysiwyg ones.

However, there are cases where some or all html element ids have already been filtered by the ajax_html_ids list, eg. by views exposed filters ajax. And this code re-adds them which may result in a HTTP 414 “Request URI too long” error.

My proposed solution would be sth like the following:

wysiwyg.js:
From:

    if (excludeSelectors.length > 0) {
      options.data['ajax_html_ids[]'] = [];
      $('[id]:not(' + excludeSelectors.join(',') + ')').each(function () {
      options.data['ajax_html_ids[]'].push(this.id);
      });
    }

To:

    if (excludeSelectors.length > 0) {
      var ajaxHtmlIdsArray = options.data['ajax_html_ids[]'];
      if (ajaxHtmlIdsArray === undefined || ajaxHtmlIdsArray.length == 0) {
		  return;
      }
      options.data['ajax_html_ids[]'] = [];
      $('[id]:not(' + excludeSelectors.join(',') + ')').each(function () {
		  if ($.inArray(this.id, ajaxHtmlIdsArray) != -1) {
			options.data['ajax_html_ids[]'].push(this.id);
		  }
      });

I do now know how to write module patches, please feel free to write one if my suggestion is right.

CommentFileSizeAuthor
#3 wysiwyg-excludeSelectors.2828802.2.patch1.2 KBTwoD
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MariaIoann created an issue. See original summary.

MariaIoann’s picture

I encountered the bug in a node edit form with Wysiwyg Ckeditor fields and Entity Reference fields when trying to use exposed filters in a Entity Reference View Widget modal form.

TwoD’s picture

Version: 7.x-2.2 » 7.x-2.x-dev
Status: Active » Needs review
FileSize
1.2 KB

There's an introduction to patches on https://www.drupal.org/patch if you're interested.

I made a few small modifications and also decided to exclude id's starting with 'token-' while we're at it, based on very similar code in the LinkIt module.

I'm not sure how to set up the exact same scenario you had so would you mind testing the patch?

MariaIoann’s picture

I have tested patch #3 and it works as a charm. Thank you!

  • TwoD committed 1145355 on 7.x-2.x authored by MariaIoann
    - #2828802 by Marialoann, TwoD: Fixed filtering of ajax_html_ids adding...
TwoD’s picture

Status: Needs review » Fixed

Thanks for testing! Sorry, I missed your reply.

This is now part of 7.x-2.x-dev and will be in the next release, which I intend to make very soon.

Status: Fixed » Closed (fixed)

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