Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix cross-project reference highlight

Matheus Nogueira6b883524da9f
diff --git a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
index 7574b9ea31..56121512f3 100644
--- a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
+++ b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx
@@ -151,6 +151,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
clearTimeout(delay);
if (inputRef.current) {
const cursorPos = lhsValue.length + referenceContent.length + 1;
+ inputRef.current.selectionStart = cursorPos;
inputRef.current.selectionEnd = cursorPos;
}
}, 10);
@@ -482,7 +483,10 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
if (props.onBlur) props.onBlur(evt);
}}
- onChange={(e) => onChange?.(e.target.value)}
+ onChange={(e) => {
+ onChange?.(e.target.value);
+ setIsFocused.on();
+ }}
containerClassName={containerClassName}
onClickSegment={handleClickSegment}
/>
diff --git a/frontend/src/components/v2/SecretInput/SecretInput.tsx b/frontend/src/components/v2/SecretInput/SecretInput.tsx
index c3e939147f..cfc4fdb840 100644
--- a/frontend/src/components/v2/SecretInput/SecretInput.tsx
+++ b/frontend/src/components/v2/SecretInput/SecretInput.tsx
@@ -5,7 +5,7 @@ import { twMerge } from "tailwind-merge";
import { useToggle } from "@app/hooks";
import { HIDDEN_SECRET_VALUE } from "@app/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem";
-const REGEX = /(\${([a-zA-Z0-9-_. ]+)})/g;
+const REGEX = /(\${([@a-zA-Z0-9-_. ]+)})/g;
const syntaxHighlight = (
content?: string | null,
diff --git a/frontend/src/components/v3/platform/SecretInput/InfisicalSecretInput.tsx b/frontend/src/components/v3/platform/SecretInput/InfisicalSecretInput.tsx
index 63ab5bc7c9..763caa73d0 100644
--- a/frontend/src/components/v3/platform/SecretInput/InfisicalSecretInput.tsx
+++ b/frontend/src/components/v3/platform/SecretInput/InfisicalSecretInput.tsx
@@ -93,6 +93,7 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
clearTimeout(delay);
if (inputRef.current) {
const cursorPos = lhsValue.length + referenceContent.length + 1; // +1 for }
+ inputRef.current.selectionStart = cursorPos;
inputRef.current.selectionEnd = cursorPos;
}
}, 10);
@@ -236,7 +237,10 @@ export const InfisicalSecretInput = forwardRef<HTMLTextAreaElement, Props>(
setIsFocused.off();
if (props.onBlur) props.onBlur(evt);
}}
- onChange={(e) => onChange?.(e.target.value)}
+ onChange={(e) => {
+ onChange?.(e.target.value);
+ setIsFocused.on();
+ }}
containerClassName={containerClassName}
onClickSegment={handleClickSegment}
/>