kopia lustrzana https://github.com/wagtail/wagtail
Retain other query params in header search behaviour
rodzic
4bedf6e045
commit
5a957a629a
|
@ -83,6 +83,7 @@ Changelog
|
|||
* Add HTML-aware max_length validation on RichTextField and RichTextBlock (Matt Westcott)
|
||||
* Remove undocumented `SearchableListMixin` (Sage Abdullah)
|
||||
* Extract filtering code from ReportView to generic IndexView (Sage Abdullah)
|
||||
* Retain other query params in header search behaviour (Sage Abdullah)
|
||||
* Fix: Typo in `ResumeWorkflowActionFormatter` message (Stefan Hammer)
|
||||
* Fix: Throw a meaningful error when saving an image to an unrecognised image format (Christian Franke)
|
||||
* Fix: Remove extra padding for headers with breadcrumbs on mobile viewport (Steven Steinwand)
|
||||
|
|
|
@ -318,15 +318,21 @@ $(() => {
|
|||
$inputContainer.addClass(workingClasses);
|
||||
searchNextIndex++;
|
||||
const index = searchNextIndex;
|
||||
|
||||
// Update q, reset to first page, and keep other query params
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
searchParams.set('q', newQuery);
|
||||
searchParams.delete('p');
|
||||
const queryString = searchParams.toString();
|
||||
|
||||
$.ajax({
|
||||
url: window.headerSearch.url,
|
||||
// eslint-disable-next-line id-length
|
||||
data: { q: newQuery },
|
||||
data: queryString,
|
||||
success(data) {
|
||||
if (index > searchCurrentIndex) {
|
||||
searchCurrentIndex = index;
|
||||
$(window.headerSearch.targetOutput).html(data).slideDown(800);
|
||||
window.history.replaceState(null, null, '?q=' + newQuery);
|
||||
window.history.replaceState(null, null, '?' + queryString);
|
||||
$input[0].dispatchEvent(new Event('search-success'));
|
||||
}
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue