Skip to content

IContentSerializer

@blobs/sdk v0.1.0


@blobs/sdk / serializers / IContentSerializer

Defined in: serializers/types.ts:60

Strategy contract every content serializer implements.

Serializers convert between a canonical content string (plain text, Markdown, JSON, etc.) and the HTML rendered inside a contenteditable editor. Acquire instances via SerializerFactory.getSerializer (or the getSerializer convenience) so they can be cached.

Properties

format

readonly format: ContentFormat

Defined in: serializers/types.ts:62

The format type this serializer handles

Methods

toContent()

toContent(html): ParsedContent

Defined in: serializers/types.ts:69

Serialize HTML from contenteditable to content string

Parameters

html

string

The HTML content from contenteditable

Returns

ParsedContent

Parsed content with the serialized string


toHTML()

toHTML(content): RenderedHTML

Defined in: serializers/types.ts:76

Deserialize content string to HTML for contenteditable

Parameters

content

string

The content string to render

Returns

RenderedHTML

Rendered HTML for display


configure()

configure(config): void

Defined in: serializers/types.ts:82

Update serializer configuration

Parameters

config

SerializerConfig

New configuration options

Returns

void


getConfig()

getConfig(): SerializerConfig

Defined in: serializers/types.ts:87

Get current configuration

Returns

SerializerConfig