Fixes hover preview going out of window bounds (#6776)

* fix: hover preview out of bounds

* fix: pop

* fix: check for both element and data

* fix: show loading indicator

* fix: width
This commit is contained in:
Apoorv Mishra
2024-04-13 18:31:40 +05:30
committed by GitHub
parent 054bddb666
commit 90ed6a5366
4 changed files with 137 additions and 124 deletions

View File

@@ -1,5 +1,7 @@
import isNil from "lodash/isNil";
import isUUID from "validator/lib/isUUID";
import { z } from "zod";
import { UrlHelper } from "@shared/utils/UrlHelper";
import { isUrl } from "@shared/utils/urls";
import { ValidateURL } from "@server/validation";
import { BaseSchema } from "../schema";
@@ -24,7 +26,16 @@ export const UrlsUnfurlSchema = BaseSchema.extend({
},
{ message: ValidateURL.message }
),
documentId: z.string().uuid().optional(),
documentId: z
.string()
.optional()
.refine(
(val) =>
val ? isUUID(val) || UrlHelper.SLUG_URL_REGEX.test(val) : true,
{
message: "must be uuid or url slug",
}
),
})
.refine(
(val) =>