Add autoFocus to search input and improve code formatting
This commit is contained in:
@@ -44,6 +44,7 @@ export default function Search(props: {
|
|||||||
<hr />
|
<hr />
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
|
autoFocus
|
||||||
className="m-1 p-1 w-full border"
|
className="m-1 p-1 w-full border"
|
||||||
type="text"
|
type="text"
|
||||||
onInput={async (event: any) => {
|
onInput={async (event: any) => {
|
||||||
@@ -81,7 +82,9 @@ export default function Search(props: {
|
|||||||
if (now !== searchingNow) setSearchingNow(now);
|
if (now !== searchingNow) setSearchingNow(now);
|
||||||
|
|
||||||
const value: ChatStore = await db.get("chatgpt-api-web", key);
|
const value: ChatStore = await db.get("chatgpt-api-web", key);
|
||||||
const content = value.contents_for_index.join(" ").toLowerCase();
|
const content = value.contents_for_index
|
||||||
|
.join(" ")
|
||||||
|
.toLowerCase();
|
||||||
if (content.includes(query)) {
|
if (content.includes(query)) {
|
||||||
const beginIndex: number = content.indexOf(query);
|
const beginIndex: number = content.indexOf(query);
|
||||||
const preview = content.slice(
|
const preview = content.slice(
|
||||||
|
|||||||
Reference in New Issue
Block a user