postyou/headline-tiny-mce

HTML headline for Contao

4.0.0 2024-11-06 08:27 UTC

This package is auto-updated.

Last update: 2024-12-06 08:48:33 UTC


README

This Contao CMS extension adds a small TinyMCE editor to all DCA headline fields and allows HTML tags for them.

Template

The be_tinyHeadlineMCE.html5 template is used by default. It restricts the menu and the valid elements. Only phrasing content should be allowed inside of HTML headings.

Since TinyMce 6 the option to disable forced_root_block is no longer available. The headline is now always saved with a surrounding <p> tag. For this reason we use striptags to remove all tags that are not allowed in be_tinyHeadlineMCE.html5:

// be_tinyHeadlineMCE.html5

valid_elements: 'a[href|target|title],strong,em,span[style],br',
{# @Contao/component/_headline.html.twig #}

{{ headline.text|...|striptags('<a><strong><em><span><br>')|raw }}