mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
add url previewer in post content
This commit is contained in:
@ -152,3 +152,10 @@ export const frameArea = (
|
||||
// point the camera to look at the center of the box
|
||||
camera.lookAt(boxCenter.x, boxCenter.y, boxCenter.z);
|
||||
};
|
||||
|
||||
export const isUrl = (url: string) => {
|
||||
const urlRegex = new RegExp(
|
||||
'^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$',
|
||||
);
|
||||
return urlRegex.test(url);
|
||||
};
|
||||
|
Reference in New Issue
Block a user