Enhancement: open the searchbox on paste (#2320)

* Open the searchbox when detecting Ctrl-V.

* support macOS, codestyle

---------

Co-authored-by: Joschka <kontakt@greiner-it.de>
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
pull/2326/head
Faqar 6 months ago committed by GitHub
parent d5608c46c3
commit 17b9b7e523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -223,7 +223,10 @@ function Home({ initialSettings }) {
useEffect(() => {
function handleKeyDown(e) {
if (e.target.tagName === "BODY" || e.target.id === "inner_wrapper") {
if (e.key.length === 1 && e.key.match(/(\w|\s)/g) && !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
if (
(e.key.length === 1 && e.key.match(/(\w|\s)/g) && !(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) ||
(e.key === "v" && (e.ctrlKey || e.metaKey))
) {
setSearching(true);
} else if (e.key === "Escape") {
setSearchString("");

Loading…
Cancel
Save