summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/ComboBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'extension/react-app/src/components/ComboBox.tsx')
-rw-r--r--extension/react-app/src/components/ComboBox.tsx31
1 files changed, 12 insertions, 19 deletions
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx
index c08c05de..1d0ca1a5 100644
--- a/extension/react-app/src/components/ComboBox.tsx
+++ b/extension/react-app/src/components/ComboBox.tsx
@@ -285,15 +285,13 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
useEffect(() => {
if (!inputRef.current) return;
- if (inputRef.current.scrollHeight > inputRef.current.clientHeight) {
- inputRef.current.style.height = "auto";
- inputRef.current.style.height =
- Math.min(inputRef.current.scrollHeight, 300) + "px";
- }
+ inputRef.current.style.height = "auto";
+ inputRef.current.style.height =
+ Math.min(inputRef.current.scrollHeight, 300) + "px";
}, [
inputRef.current?.scrollHeight,
inputRef.current?.clientHeight,
- props.value,
+ inputRef.current?.value,
]);
// Whether the current input follows an '@' and should be treated as context query
@@ -344,7 +342,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
useEffect(() => {
if (!nestedContextProvider) {
- dispatch(setTakenActionTrue(null));
setItems(
contextProviders?.map((provider) => ({
name: provider.display_title,
@@ -437,7 +434,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
setNestedContextProvider(undefined);
// Handle slash commands
- dispatch(setTakenActionTrue(null));
setItems(
availableSlashCommands?.filter((slashCommand) => {
const sc = slashCommand.name.toLowerCase();
@@ -445,6 +441,10 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
return sc.startsWith(iv) && sc !== iv;
}) || []
);
+
+ if (inputValue.startsWith("/") || inputValue.startsWith("@")) {
+ dispatch(setTakenActionTrue(null));
+ }
},
[
availableSlashCommands,
@@ -756,6 +756,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
props.index
);
inputRef.current?.focus();
+ setPreviewingContextItem(undefined);
+ setFocusedContextItem(undefined);
}}
onKeyDown={(e: any) => {
if (e.key === "Backspace") {
@@ -880,6 +882,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
paddingLeft: "12px",
cursor: "default",
paddingTop: getFontSize(),
+ width: "fit-content",
}}
>
{props.active ? "Using" : "Used"} {selectedContextItems.length}{" "}
@@ -937,17 +940,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
{...getInputProps({
onCompositionStart: () => setIsComposing(true),
onCompositionEnd: () => setIsComposing(false),
- onChange: (e) => {
- const target = e.target as HTMLTextAreaElement;
- // Update the height of the textarea to match the content, up to a max of 200px.
- target.style.height = "auto";
- target.style.height = `${Math.min(
- target.scrollHeight,
- 300
- ).toString()}px`;
-
- // setShowContextDropdown(target.value.endsWith("@"));
- },
+ onChange: (e) => {},
onFocus: (e) => {
setInputFocused(true);
dispatch(setBottomMessage(undefined));