mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-22 07:23:01 +01:00
fix: showAndFocus to use a specific search form
This commit is contained in:
@@ -78,8 +78,9 @@ define('forum/topic', [
|
||||
require(['search'], function (search) {
|
||||
mousetrap.bind(['command+f', 'ctrl+f'], function (e) {
|
||||
e.preventDefault();
|
||||
$('[component="search/fields"] input[name="query"]').val('in:topic-' + ajaxify.data.tid + ' ');
|
||||
search.showAndFocusInput();
|
||||
const form = $('[component="navbar"] [component="search/form"]');
|
||||
form.find('[component="search/fields"] input[name="query"]').val('in:topic-' + ajaxify.data.tid + ' ');
|
||||
search.showAndFocusInput(form);
|
||||
});
|
||||
|
||||
hooks.onPage('action:ajaxify.cleanup', () => {
|
||||
|
||||
@@ -63,7 +63,7 @@ define('search', ['translator', 'storage', 'hooks', 'alerts'], function (transla
|
||||
}
|
||||
e.stopPropagation();
|
||||
|
||||
Search.showAndFocusInput();
|
||||
Search.showAndFocusInput(searchForm);
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -221,10 +221,10 @@ define('search', ['translator', 'storage', 'hooks', 'alerts'], function (transla
|
||||
});
|
||||
};
|
||||
|
||||
Search.showAndFocusInput = function () {
|
||||
$('[component="search/fields"]').removeClass('hidden');
|
||||
$('[component="search/button"]').addClass('hidden');
|
||||
$('[component="search/fields"] input[name="query"]').trigger('focus');
|
||||
Search.showAndFocusInput = function (form) {
|
||||
form.find('[component="search/fields"]').removeClass('hidden');
|
||||
form.find('[component="search/button"]').addClass('hidden');
|
||||
form.find('[component="search/fields"] input[name="query"]').trigger('focus');
|
||||
};
|
||||
|
||||
Search.query = function (data, callback) {
|
||||
|
||||
Reference in New Issue
Block a user