mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 12:40:09 +01:00
handle onblur for emebed domains (#2199)
bump browser extension commit handle onblur for emebed domains
This commit is contained in:
parent
334fd9cdd0
commit
bc0cc20678
@ -1 +1 @@
|
||||
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",
|
||||
|
Loading…
Reference in New Issue
Block a user