mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: be tidier and explicitly clean up ctrl-f hotkey on topic page
This commit is contained in:
@@ -76,11 +76,13 @@ define('forum/topic', [
|
|||||||
if (config.topicSearchEnabled) {
|
if (config.topicSearchEnabled) {
|
||||||
require(['mousetrap', 'search'], function (mousetrap, search) {
|
require(['mousetrap', 'search'], function (mousetrap, search) {
|
||||||
mousetrap.bind(['command+f', 'ctrl+f'], function (e) {
|
mousetrap.bind(['command+f', 'ctrl+f'], function (e) {
|
||||||
if (ajaxify.data.template.topic) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('#search-fields input').val('in:topic-' + ajaxify.data.tid + ' ');
|
$('#search-fields input').val('in:topic-' + ajaxify.data.tid + ' ');
|
||||||
search.showAndFocusInput();
|
search.showAndFocusInput();
|
||||||
}
|
});
|
||||||
|
|
||||||
|
hooks.onPage('action:ajaxify.cleanup', () => {
|
||||||
|
mousetrap.unbind(['command+f', 'ctrl+f']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user