fix: close dropdown after creating a tag
This commit is contained in:
@@ -43,7 +43,7 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
|
|||||||
setTagResults(getActiveNoteTagResults(''));
|
setTagResults(getActiveNoteTagResults(''));
|
||||||
};
|
};
|
||||||
|
|
||||||
const [closeOnBlur, setLockCloseOnBlur] = useCloseOnBlur(
|
const [closeOnBlur] = useCloseOnBlur(
|
||||||
dropdownRef,
|
dropdownRef,
|
||||||
(visible: boolean) => {
|
(visible: boolean) => {
|
||||||
setDropdownVisible(visible);
|
setDropdownVisible(visible);
|
||||||
@@ -65,18 +65,14 @@ export const AutocompleteTagInput: FunctionalComponent<Props> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onTagOptionClick = async (tag: SNTag) => {
|
const onTagOptionClick = async (tag: SNTag) => {
|
||||||
setLockCloseOnBlur(true);
|
|
||||||
await appState.activeNote.addTagToActiveNote(tag);
|
await appState.activeNote.addTagToActiveNote(tag);
|
||||||
inputRef.current.focus();
|
clearResults();
|
||||||
setTagResults(getActiveNoteTagResults(searchQuery));
|
|
||||||
setLockCloseOnBlur(false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createAndAddNewTag = async () => {
|
const createAndAddNewTag = async () => {
|
||||||
const newTag = await application.findOrCreateTag(searchQuery);
|
const newTag = await application.findOrCreateTag(searchQuery);
|
||||||
await appState.activeNote.addTagToActiveNote(newTag);
|
await appState.activeNote.addTagToActiveNote(newTag);
|
||||||
clearResults();
|
clearResults();
|
||||||
inputRef.current.focus();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTagHintClick = async () => {
|
const onTagHintClick = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user