|
|
@ -69,16 +69,18 @@ export default function QuickLaunch({ servicesAndBookmarks, searchString, setSea
|
|
|
|
}, [close, setSearchString, setCurrentItemIndex, setSearchSuggestions]);
|
|
|
|
}, [close, setSearchString, setCurrentItemIndex, setSearchSuggestions]);
|
|
|
|
|
|
|
|
|
|
|
|
function handleSearchChange(event) {
|
|
|
|
function handleSearchChange(event) {
|
|
|
|
const rawSearchString = event.target.value.toLowerCase();
|
|
|
|
const rawSearchString = event.target.value;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (!/.+[.:].+/g.test(rawSearchString)) throw new Error(); // basic test for probably a url
|
|
|
|
if (!/.+[.:].+/g.test(rawSearchString)) throw new Error(); // basic test for probably a url
|
|
|
|
let urlString = rawSearchString;
|
|
|
|
let urlString = rawSearchString;
|
|
|
|
if (urlString.indexOf("http") !== 0) urlString = `https://${rawSearchString}`;
|
|
|
|
if (urlString.toLowerCase().indexOf("http") !== 0) urlString = `https://${rawSearchString}`;
|
|
|
|
setUrl(new URL(urlString)); // basic validation
|
|
|
|
setUrl(new URL(urlString)); // basic validation
|
|
|
|
|
|
|
|
setSearchString(rawSearchString);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
setUrl(null);
|
|
|
|
setUrl(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setSearchString(rawSearchString);
|
|
|
|
setSearchString(rawSearchString.toLowerCase());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function handleSearchKeyDown(event) {
|
|
|
|
function handleSearchKeyDown(event) {
|
|
|
|