(null);
+ const tags = useSelector(loadoutsHashtagsSelector);
+ useAutocomplete(ref, tags);
+
return (
()
);
+export const loadoutsHashtagsSelector = createSelector(loadoutsSelector, (loadouts) => [
+ ...new Set(
+ loadouts.flatMap((loadout) => [
+ ...getHashtagsFromNote(loadout.name),
+ ...getHashtagsFromNote(loadout.notes),
+ ])
+ ),
+]);
+
export interface LoadoutsByItem {
[itemId: string]: { loadout: Loadout; loadoutItem: LoadoutItem }[] | undefined;
}
diff --git a/src/app/utils/textarea-caret.ts b/src/app/utils/textarea-caret.ts
index 91da97c122a..3da2c3bbdd0 100644
--- a/src/app/utils/textarea-caret.ts
+++ b/src/app/utils/textarea-caret.ts
@@ -49,7 +49,10 @@ const properties = [
const isBrowser = typeof window !== 'undefined';
const isFirefox = isBrowser && (window as any).mozInnerScreenX !== null;
-export default function getCaretCoordinates(element: HTMLTextAreaElement, position: number) {
+export default function getCaretCoordinates(
+ element: HTMLTextAreaElement | HTMLInputElement,
+ position: number
+) {
if (!isBrowser) {
throw new Error(
'textarea-caret-position#getCaretCoordinates should only be called in a browser'