BookmarkAssetUtil

See source code
Table of contents

Extends AssetUtil<TLBookmarkAsset>.

class BookmarkAssetUtil extends AssetUtil<TLBookmarkAsset> {}

Constructor

Constructs a new instance of the AssetUtil class

Parameters

NameDescription

editor

Editor;

Properties

migrations

static
static migrations: import("@tldraw/store").MigrationSequence;

props

static
static props: {
  description: import("@tldraw/validate").Validator<string>;
  favicon: import("@tldraw/validate").Validator<string>;
  image: import("@tldraw/validate").Validator<string>;
  src: import("@tldraw/validate").Validator<null | string>;
  title: import("@tldraw/validate").Validator<string>;
};

type

static
static type: "bookmark";

editor

editor: Editor;

options

Options for this asset util. Override this to provide customization options for your asset. Use AssetUtil.configure to customize existing asset utils.

options: {};

Methods

configure( )

static

Configure this asset util's options.

static configure<T extends TLAssetUtilConstructor<any, any>>(
  this: T,
  options: T extends new (...args: any[]) => {
    options: infer Options;
  }
    ? Partial<Options>
    : never,
): T;

Parameters

NameDescription

this

T;

options

T extends new (...args: any[]) => {
  options: infer Options;
}
  ? Partial<Options>
  : never;

Returns

T;

acceptsMimeType( )

Check whether this asset type accepts a given MIME type.

acceptsMimeType(mimeType: string): boolean;

Parameters

NameDescription

mimeType

string;

Returns

boolean;

getAssetFromFile( )

Create an asset from a file. Return null if this asset type can't handle the file.

getAssetFromFile(_file: File, _assetId: TLAssetId): Promise<Asset | null>;

Parameters

NameDescription

_file

File;

_assetId

Returns

Promise<Asset | null>;

getDefaultProps( )

getDefaultProps(): TLBookmarkAsset["props"];

getSupportedMimeTypes( )

Get the MIME types that this asset type supports. Return an empty array if this asset type doesn't support files (e.g. bookmarks).

getSupportedMimeTypes(): readonly string[];

Prev
ArrowShapeUtil
Next
BookmarkShapeUtil