Caption

Editable table caption (caption). Renders as <caption> inside a <table>. JSON data: { content: string, ...common }.

Type: caption · Class: CaptionBlock

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();

getData#

Returns the serializable JSON data object for this block, including type-specific fields.

Returns: object

block.getData();

update#

Applies common fields, syncs caption HTML from content, and optionally sets the placeholder.

Parameters:

  • data (object) — object with the keys below
    • content (string) — caption inner HTML
    • placeholder (string) — data-placeholder text; when omitted and empty, a default table caption placeholder is applied
    • id, classname, styles, attrs, … — common block fields (see Common update)

Returns: void

block.update({ content: 'Table 1. Revenue by quarter' });

block.update({ content: '', placeholder: 'Add a caption…' });

getTable#

Returns the parent TableBlock instance for this <caption>, or null when the caption is not inside a table.

Returns: TableBlock | null

block.getTable();