[embed] Fix bug 58449

This commit is contained in:
JuliaSvinareva
2023-07-17 16:34:00 +03:00
parent e390c56e08
commit da8dc95898
2 changed files with 72 additions and 4 deletions

View File

@ -51,7 +51,41 @@
searchText: ''
},
_lastInputChange,
_searchTimer;
_searchTimer,
_mods = {
ctrl: false,
f: false,
other: false
};
var init = function (config) {
appConfig = config;
$(document.body).on('keydown', function (event) {
if (event.keyCode === 27 && $searchBar && $searchBar.is(':visible')) {
highlightResults(false);
$searchBar.hide();
return;
}
if (event.keyCode === 70) {
_mods.f = true;
}
if (event.ctrlKey || event.metaKey) {
_mods.ctrl = true;
}
if (event.altKey || event.shiftKey) {
_mods.other = true;
}
if (_mods.f && _mods.ctrl && !_mods.other) {
event.preventDefault()
onShow();
}
}).on('keyup', function () {
for (var key in _mods) {
_mods[key] = false;
}
});
};
var setApi = function (appApi) {
api = appApi;
@ -165,7 +199,7 @@
};
return {
init: function(config) { appConfig = config; },
init: init,
setApi: setApi,
show: onShow
};

View File

@ -51,7 +51,41 @@
searchText: ''
},
_lastInputChange,
_searchTimer;
_searchTimer,
_mods = {
ctrl: false,
f: false,
other: false
};
var init = function (config) {
appConfig = config;
$(document.body).on('keydown', function (event) {
if (event.keyCode === 27 && $searchBar && $searchBar.is(':visible')) {
highlightResults(false);
$searchBar.hide();
return;
}
if (event.keyCode === 70) {
_mods.f = true;
}
if (event.ctrlKey || event.metaKey) {
_mods.ctrl = true;
}
if (event.altKey || event.shiftKey) {
_mods.other = true;
}
if (_mods.f && _mods.ctrl && !_mods.other) {
event.preventDefault()
onShow();
}
}).on('keyup', function () {
for (var key in _mods) {
_mods[key] = false;
}
});
};
var setApi = function (appApi) {
api = appApi;
@ -171,7 +205,7 @@
};
return {
init: function(config) { appConfig = config; },
init: init,
setApi: setApi,
show: onShow
};