Quote

Blockquote block (quote). Renders from quote.template with editable inner <p> and optional <figcaption>. JSON data: { content: string, caption?, ...common }.

Type: quote · Class: QuoteBlock

Access:

app.block.get()
app.blocks.findByEl(el)
app.blocks.create(type)

App code:

const block = app.block.get();

Plugin:

const block = this.app.block.get();

getQuoteContent#

Reads content from the quote body (blockquote) or caption (figcaption). Defined on the base Block class for architecture, but intended for quote blocks.

Parameters:

  • part (string) — 'blockquote' (default) — quote body; 'caption' — figcaption text/HTML
  • format (string) — 'html' (default) or 'text'
  • stripBlocks (boolean) — when format is 'html', unwrap nested block-level tags into inline HTML

Returns: string

block.getQuoteContent();
block.getQuoteContent({ part: 'blockquote', format: 'html' });
block.getQuoteContent({ part: 'caption', format: 'text' });
block.getQuoteContent({ part: 'blockquote', format: 'html', stripBlocks: true });

getData#

Returns common fields plus serialized content and caption when a figcaption is present.

Returns: object

block.getData();

update#

Applies common fields, refreshes DOM refs, re-consolidates placeholder, then updates quote body and/or caption (caption only when a figcaption exists).

Parameters:

  • data (object) — object with the keys below
    • content (string) — quote body HTML
    • text (string) — alias for content when content is omitted
    • caption (string) — figcaption text when a caption element exists
    • id, classname, styles, attrs, … — common block fields (see Common update)

Returns: void

block.update({ content: '<p>Revised quote</p>' });

block.update({ text: 'Short quote' });

block.update({ content: '<p>Cited line</p>', caption: '— Author' });