Support url-only link previews in stories

This commit is contained in:
Fedor Indutny
2022-10-06 13:22:59 -07:00
committed by GitHub
parent 89e25fb7e3
commit b950480d36
8 changed files with 92 additions and 37 deletions

View File

@@ -15,7 +15,7 @@ export type LinkPreviewImage = AttachmentType & {
};
export type LinkPreviewResult = {
title: string;
title: string | null;
url: string;
image?: LinkPreviewImage;
description: string | null;
@@ -32,6 +32,15 @@ export enum LinkPreviewSourceType {
StoryCreator,
}
export type MaybeGrabLinkPreviewOptionsType = Readonly<{
caretLocation?: number;
mode?: 'conversation' | 'story';
}>;
export type AddLinkPreviewOptionsType = Readonly<{
disableFetch?: boolean;
}>;
const linkify = LinkifyIt();
export function shouldPreviewHref(href: string): boolean {