Skip to content
Snippets Groups Projects
Unverified Commit bc0cc206 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

handle onblur for emebed domains (#2199)

bump browser extension commit
handle onblur for emebed domains
parent 334fd9cd
No related branches found
No related tags found
No related merge requests found
Subproject commit d9b28cc1e23b64fdb4e666d5b5b49cc8e583aabd
Subproject commit f2715e950e3c8afc471609afe518bf5452bc1049
......@@ -250,6 +250,25 @@ export const PermittedDomains = ({ defaultValue = [] }) => {
setDomains(validDomains);
};
const handleBlur = (event) => {
const currentInput = event.target.value;
if (!currentInput) return;
const validDomains = [...domains, currentInput].map((input) => {
let url = input;
if (!url.includes("http://") && !url.includes("https://"))
url = `https://${url}`;
try {
new URL(url);
return url;
} catch {
return null;
}
});
event.target.value = "";
setDomains(validDomains);
};
return (
<div>
<div className="flex flex-col mb-2">
......@@ -270,6 +289,7 @@ export const PermittedDomains = ({ defaultValue = [] }) => {
<TagsInput
value={domains}
onChange={handleChange}
onBlur={handleBlur}
placeholder="https://mysite.com, https://anythingllm.com"
classNames={{
tag: "bg-blue-300/10 text-zinc-800 m-1",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment