Skip to content

Commit

Permalink
fix incomplete text display when pasting text into the tags field
Browse files Browse the repository at this point in the history
  • Loading branch information
hgaol committed Feb 6, 2024
1 parent 5132cb3 commit 9f34983
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ui/src/components/TagSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,6 @@ const TagSelector: FC<IProps> = ({
console.log('handleSearch');
const searchStr = e.currentTarget.value.replace(';', '');
setSearchValue(searchStr);
const ele = document.querySelector('.a-input-width') as HTMLElement;
if (ele.offsetWidth > 60) {
inputRef.current?.setAttribute(
'style',
`width:${ele.offsetWidth + 16}px`,
);
} else {
inputRef.current?.setAttribute('style', 'width: 60px');
}
fetchTags(searchStr);
};

Expand Down Expand Up @@ -329,6 +320,17 @@ const TagSelector: FC<IProps> = ({
inputRef.current?.focus();
}
}

// set width of tag Form.Control
const ele = document.querySelector('.a-input-width') as HTMLElement;
if (ele.offsetWidth > 60) {
inputRef.current?.setAttribute(
'style',
`width:${ele.offsetWidth + 16}px`,
);
} else {
inputRef.current?.setAttribute('style', 'width: 60px');
}
}, [focusState, tags, hiddenCreateBtn, searchValue, maxTagLength]);

return (
Expand Down

0 comments on commit 9f34983

Please sign in to comment.