mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 13:06:32 +00:00
Nothing ish about the new check
This commit is contained in:
parent
8d0575937c
commit
0e9aa805e1
1 changed files with 3 additions and 4 deletions
|
@ -19,9 +19,9 @@ function isCodeFragment(event: KeyboardEvent): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a naive check to ensure something is a EAN13 or UPC-A code.
|
* Performs a check to ensure something is a EAN13 or UPC-A code.
|
||||||
*/
|
*/
|
||||||
function isValidIshCode(code: string): boolean {
|
function isValidCode(code: string): boolean {
|
||||||
try {
|
try {
|
||||||
// We check the format in advance, since we're only accepting EAN13 and UPC-A here.
|
// We check the format in advance, since we're only accepting EAN13 and UPC-A here.
|
||||||
// There's no -real- reason for this limitation, besides protecting against feature
|
// There's no -real- reason for this limitation, besides protecting against feature
|
||||||
|
@ -93,7 +93,7 @@ export function useQuickSearch() {
|
||||||
// Reset the buffer:
|
// Reset the buffer:
|
||||||
codeBuffer.value = fragment;
|
codeBuffer.value = fragment;
|
||||||
}
|
}
|
||||||
} else if (event.key === "Enter" && isValidIshCode(codeBuffer.value)) {
|
} else if (event.key === "Enter" && isValidCode(codeBuffer.value)) {
|
||||||
// If we have an active code buffer that seems valid, and the user presses Enter,
|
// If we have an active code buffer that seems valid, and the user presses Enter,
|
||||||
// we want to generate a new search query from this code, as long as it seems valid.
|
// we want to generate a new search query from this code, as long as it seems valid.
|
||||||
//
|
//
|
||||||
|
@ -130,7 +130,6 @@ export function useQuickSearch() {
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
codeBuffer,
|
|
||||||
isActive,
|
isActive,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue