createBookmarkFromUrl

See source code

Creates a bookmark shape from a URL.

The shape is created immediately as a placeholder so the user gets visible feedback at the paste location, and the bookmark metadata (title, description, image, favicon) is fetched in the background. Once metadata resolves, the shape is patched with the resulting asset. If the fetch fails, the shape is left as a URL-only bookmark.

function createBookmarkFromUrl(
  editor: Editor,
  {
    url,
    center,
  }: {
    center?: {
      x: number;
      y: number;
    };
    url: string;
  },
): Promise<Result<TLBookmarkShape, string>>;

Parameters

NameDescription

editor

Editor;

{ url, center }

{
  center?: {
    x: number;
    y: number;
  };
  url: string;
};

Returns

Promise<Result<TLBookmarkShape, string>>;

A Result containing the created bookmark shape or an error

Prev
copyAs
Next
createEmptyBookmarkShape