diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index 6783b80a4..66ee433d4 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -135,7 +135,7 @@ const AddMemoRelationPopover = (props: Props) => { -
+
{ inputValue={searchText} value={selectedMemos} multiple - onInputChange={(_, value) => setSearchText(value.trim())} + onInputChange={(_, value) => setSearchText(value.trimStart())} getOptionKey={(memo) => memo.name} getOptionLabel={(memo) => memo.content} isOptionEqualToValue={(memo, value) => memo.name === value.name} diff --git a/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx b/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx index 38b342e1e..16a1b2358 100644 --- a/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx +++ b/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx @@ -105,7 +105,7 @@ const LocationSelector = (props: Props) => { -
+
diff --git a/web/src/components/MemoEditor/ActionButton/TagSelector.tsx b/web/src/components/MemoEditor/ActionButton/TagSelector.tsx index a7749a1ae..dbf66dfa4 100644 --- a/web/src/components/MemoEditor/ActionButton/TagSelector.tsx +++ b/web/src/components/MemoEditor/ActionButton/TagSelector.tsx @@ -1,8 +1,6 @@ import { Button } from "@usememos/mui"; import { HashIcon } from "lucide-react"; import { observer } from "mobx-react-lite"; -import { useRef, useState } from "react"; -import useClickAway from "react-use/lib/useClickAway"; import OverflowTip from "@/components/kit/OverflowTip"; import { userStore } from "@/store/v2"; import { useTranslate } from "@/utils/i18n"; @@ -16,17 +14,11 @@ interface Props { const TagSelector = observer((props: Props) => { const t = useTranslate(); const { editorRef } = props; - const [open, setOpen] = useState(false); - const containerRef = useRef(null); const tags = Object.entries(userStore.state.tagCount) .sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => b[1] - a[1]) .map(([tag]) => tag); - useClickAway(containerRef, () => { - setOpen(false); - }); - const handleTagClick = (tag: string) => { const current = editorRef.current; if (current === null) return; @@ -41,34 +33,32 @@ const TagSelector = observer((props: Props) => { }; return ( - + -
- {tags.length > 0 ? ( -
- {tags.map((tag) => { - return ( -
handleTagClick(tag)} - > - #{tag} -
- ); - })} -
- ) : ( -

e.stopPropagation()}> - {t("tag.no-tag-found")} -

- )} -
+ {tags.length > 0 ? ( +
+ {tags.map((tag) => { + return ( +
handleTagClick(tag)} + > + #{tag} +
+ ); + })} +
+ ) : ( +

e.stopPropagation()}> + {t("tag.no-tag-found")} +

+ )}
);