[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] ObjectSelector js: allow using a beforeSearch handler to modify searched...
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69f31988bd342_3818f998924a2@gitlab-sidekiq-low-urgency-cpu-bound-v2-5599fc94bd-fhkpb.mail> |
Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
c5b745f6 by Victor Emanouilov at 2026-04-30T11:57:34+03:00
[FIX] ObjectSelector js: allow using a beforeSearch handler to modify searched string - useful when users paste various kinds of data in the search form and there should exist some custom logic to reformat the data before searching
- - - - -
1 changed file:
- lib/jquery_tiki/tiki-jquery.js
Changes:
=====================================
lib/jquery_tiki/tiki-jquery.js
=====================================
@@ -2117,11 +2117,13 @@ $.fn.tiki = function(func) {
$(input).data('use-threshold', 0);
}
if ($filter.val()) {
- if (wildcard === 'y') {
- filter[searchField] = '*' + $filter.val() + '*';
- } else {
- filter[searchField] = $filter.val();
- }
+ var ctx = {
+ value: $filter.val(),
+ field: searchField,
+ wildcard: wildcard === 'y'
+ };
+ $(input).trigger('beforeSearch.object_selector', [ctx, filter, selectorArgs]);
+ filter[ctx.field || searchField] = ctx.wildcard ? '*' + ctx.value + '*' : ctx.value;
}
loadSelectorData(filter, selectorArgs, function (data) {
$container._object_selector_update_results('radio', data.resultset.result, false);
@@ -2237,11 +2239,13 @@ $.fn.tiki = function(func) {
$textarea.data('use-threshold', 0);
}
if ($filter.val()) {
- if (wildcard === 'y') {
- filter[searchField] = '*' + $filter.val() + '*';
- } else {
- filter[searchField] = $filter.val();
- }
+ const ctx = {
+ value: $filter.val(),
+ field: searchField,
+ wildcard: wildcard === 'y'
+ };
+ $textarea.trigger('beforeSearch.object_selector', [ctx, filter, selectorArgs]);
+ filter[ctx.field || searchField] = ctx.wildcard ? '*' + ctx.value + '*' : ctx.value;
}
loadSelectorData(filter, selectorArgs, function (data) {
$container._object_selector_update_results('checkbox', data.resultset.result, false);
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c5b745f6989e9bc42ccedc50a1247c6a60d16588
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c5b745f6989e9bc42ccedc50a1247c6a60d16588
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs