Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

tinyMCE force_br_newlines does not work


Go to End


2 Posts   3169 Views

Avatar
theTigerDuck

Community Member, 20 Posts

14 July 2011 at 2:38am

Hi all,

I've problems with tinyMCE. I want to have <br /> as newlines when I paste something from Word.
Since update to 2.4.5 it uses <p>.
I tryed the force_br_newlines option but it doesn't work.

In my config.php:

Object::add_extension("LeftAndMain", "MyLeftAndMainDecorator");

MyLeftAndMainDecorator.php looks like this:

<?php
class MyLeftAndMainDecorator extends LeftAndMainDecorator
{
	function init()	{
		$htmlEditorConfig = HtmlEditorConfig::get('cms');
		$htmlEditorConfig->setOption('force_br_newlines',true);
		$htmlEditorConfig->setOption('force_p_newlines',false);
		$htmlEditorConfig->setOption('forced_root_block','');
		$htmlEditorConfig->setOption('paste_auto_cleanup_on_past',true);
		$htmlEditorConfig->setOption('paste_remove_styles','true');
		$htmlEditorConfig->setOption('paste_remove_styles_if_webkit','true');
		$htmlEditorConfig->setOption('paste_strip_class_attributes','true');
	}
}
?>

paste_strip_class_attributes or paste_remove_styles theme to work.

Any Ideas?

Avatar
copernican

Community Member, 189 Posts

14 July 2011 at 4:56am

I haven't tested but check out - http://tinymce.moxiecode.com/wiki.php/Configuration:force_br_newlines

Looks like there might be another option or two you have to modify to make it work correctly.