|
|
@ -10,8 +10,6 @@ import type { ExcalidrawTextElement } from "../element/types";
|
|
|
|
import { measureText } from "../element/textElement";
|
|
|
|
import { measureText } from "../element/textElement";
|
|
|
|
import { addEventListener, getFontString } from "../utils";
|
|
|
|
import { addEventListener, getFontString } from "../utils";
|
|
|
|
import { KEYS } from "../keys";
|
|
|
|
import { KEYS } from "../keys";
|
|
|
|
|
|
|
|
|
|
|
|
import "./SearchMenu.scss";
|
|
|
|
|
|
|
|
import clsx from "clsx";
|
|
|
|
import clsx from "clsx";
|
|
|
|
import { atom, useAtom } from "jotai";
|
|
|
|
import { atom, useAtom } from "jotai";
|
|
|
|
import { jotaiScope } from "../jotai";
|
|
|
|
import { jotaiScope } from "../jotai";
|
|
|
@ -21,6 +19,8 @@ import { randomInteger } from "../random";
|
|
|
|
import { CLASSES, EVENT } from "../constants";
|
|
|
|
import { CLASSES, EVENT } from "../constants";
|
|
|
|
import { useStable } from "../hooks/useStable";
|
|
|
|
import { useStable } from "../hooks/useStable";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import "./SearchMenu.scss";
|
|
|
|
|
|
|
|
|
|
|
|
const searchKeywordAtom = atom<string>("");
|
|
|
|
const searchKeywordAtom = atom<string>("");
|
|
|
|
export const searchItemInFocusAtom = atom<number | null>(null);
|
|
|
|
export const searchItemInFocusAtom = atom<number | null>(null);
|
|
|
|
|
|
|
|
|
|
|
@ -229,6 +229,7 @@ export const SearchMenu = () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
searchInputRef.current?.focus();
|
|
|
|
searchInputRef.current?.focus();
|
|
|
|
|
|
|
|
searchInputRef.current?.select();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setAppState({
|
|
|
|
setAppState({
|
|
|
|
openSidebar: null,
|
|
|
|
openSidebar: null,
|
|
|
@ -264,16 +265,6 @@ export const SearchMenu = () => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, [setAppState, stableState, app]);
|
|
|
|
}, [setAppState, stableState, app]);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* NOTE:
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* for testing purposes, we're manually focusing instead of
|
|
|
|
|
|
|
|
* setting `selectOnRender` on <TextField>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
searchInputRef.current?.focus();
|
|
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const matchCount = `${searchMatches.items.length} ${
|
|
|
|
const matchCount = `${searchMatches.items.length} ${
|
|
|
|
searchMatches.items.length === 1
|
|
|
|
searchMatches.items.length === 1
|
|
|
|
? t("search.singleResult")
|
|
|
|
? t("search.singleResult")
|
|
|
@ -292,6 +283,7 @@ export const SearchMenu = () => {
|
|
|
|
onChange={(value) => {
|
|
|
|
onChange={(value) => {
|
|
|
|
setKeyword(value);
|
|
|
|
setKeyword(value);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
|
|
|
|
selectOnRender
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|