Skip to main content

LinkPreview Plugin

Link Preview plugin allow the user to add a link preview. The Link Preview Plugin is implemented within the Link Plugin, and is activated once the user insert a link and press 'Enter' key. Link Preview with inline-embed: for this Usage, html plugin should also be installed.

Add an Link Preview - write a link and press enter key

Usage#

/* Editor */
import { RicosEditor } from 'ricos-editor';
import { pluginLinkPreview, LinkPreviewProviders } from 'wix-rich-content-plugin-link-preview';
import { pluginLink } from 'wix-rich-content-plugin-link';
const { Instagram, Twitter, TikTok } = LinkPreviewProviders;
const LinkPreviewConfig = { exposeEmbedButtons: [Instagram, Twitter, TikTok] };
<RicosEditor plugins={[pluginLinkPreview(LinkPreviewConfig), pluginLink({})]} />;
/* Viewer */
import { RicosViewer } from 'ricos-viewer';
import { pluginLinkPreview } from 'wix-rich-content-plugin-link-preview/viewer';
<RicosViewer plugins={[pluginLinkPreview(LinkPreviewConfig)]} />;

Link Preview Config API#

enableEmbed#

Allows to display provider embed if exist (can be true/false/[LinkPreviewProviders.Twitter, LinkPreviewProviders.Instagram,..]

enableEmbed?: one of boolean, array;

Default value:

true;

enableLinkPreview#

Allows to display link preview if exist

enableLinkPreview?: boolean;

Default value:

true;

fetchData#

A func that gets url and returns an object with title, image_url, description (optional) that related to the given url

fetchData?: function;

Default value:

none;

exposeEmbedButtons#

NOTE: LinkPreviewProviders.youTube is gonna be deprecate. To use youtube plugin you should consume video plugin and expose youtube button. See docs here https://ricos.js.org/docs/plugins_api/VideoPlugin#youtube-plugin#

Which embed buttons will display - array with LinkPreviewProvider types [LinkPreviewProviders.Instagram, LinkPreviewProviders.Twitter, ...]. For provide buttons type you should import LinkPreviewProvider.

LinkPreviewProviders?: array;

Default value:

[];