Block Font Size

Adds a block control button for font size and line height on text blocks. Available for paragraphs, headings, lists, code blocks, and wrappers.

Select a supported block, open the control dropdown, and choose Text size. Enter font size in pixels and line height as a unitless number or CSS value.

Load the bundle

<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/block-font-size/block-font-size.js"></script>

Initialization

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

Options

  • icon (string)
    • SVG icon HTML for the block control button.
Redactor('#entry', {
    plugins: ['blockFontSize'],
    blockFontSize: {
        icon: '<svg...>'
    }
});

Language strings

en: {
    blockFontSize: {
        "text-size": "Text size",
        "line-height": "Line height",
        "eg": "e.g."
    }
}

Events

blockFontSize:open:data

Emitted when the font-size form opens.

Payload: { block, data }

Return: { data } to override the initial form values.

app.on('blockFontSize:open:data', ({ block, data }) => {
    if (!data.size) data.size = '18';
});

API

This plugin does not expose a public API.