Collapse

Adds a block control button on headings to collapse and expand content below. Collapsed sections hide following blocks until the next heading of equal or higher level.

Select a heading, open the block control menu (after Add), and choose Toggle collapse to fold or unfold its section.

Load the bundle

<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/collapse/collapse.js"></script>

Initialization

const app = Redactor('#entry', {
    plugins: ['collapse']
});

Options

  • icon (string)
    • SVG icon HTML for the block control button on heading blocks.
Redactor('#entry', {
    plugins: ['collapse']
});

Language strings

en: {
    collapse: {
        'toggle-collapse': 'Toggle collapse'
    }
}

Events

This plugin does not emit events.

API

collapse

Toggles collapse on the current heading block and closes the dropdown.

app.collapse.collapse();