How to get the indent buttons to work in TinyMCE?


#1

Silverstripe Version:

Question:

The HTML Editor has indent options but these don’t actually do anything, seem like these should work out of the box.

If I add the code below I can get them to work but only if I edit first edit the HTML and add the inline style (padding:10px;) to the element I want to indent. What do I need to do to make this work automatically?

$cmsEditor = TinyMCEConfig::get('cms');
$cmsEditor->setOption(
            'extended_valid_elements',
            'p[class|style]'
        )->setOption(
            'valid_styles',
            'color, padding'
        );

#2

Hi @LABCAT, I think those indent buttons are only intended to be used on list items, to let you create nested lists.

To indent a paragraph you could try wrapping it in a <blockquote> tag. Doesn’t look like the button for this is enabled out of the box in SS4, but it is available in TinyMCE so you can should be able switch it on through configuration.


#3

Nope, I was wrong. Looks like you can indent anything on the TinyMCE demo! For my needs I’m glad this only works on lists but I hope you work out a solution!