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.
Comment | File | Size | Author |
---|---|---|---|
#3 | wysiwyg-excludeSelectors.2828802.2.patch | 1.2 KB | TwoD |
Comments
Comment #2
MariaIoann CreditAttribution: MariaIoann commentedI 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.
Comment #3
TwoDThere'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?
Comment #4
MariaIoann CreditAttribution: MariaIoann commentedI have tested patch #3 and it works as a charm. Thank you!
Comment #6
TwoDThanks 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.