1

When I'm writing some text with CKeditor and I press enter and want to write something on the next line, the editor automatically inserts the text on the new line into <p> ... </p> tags instead of only <br/>
.

I tried to correct it with editing the config.js file and adding the line config.autoParagraph = false; but without success.

Do you know where is the fault?

8

Out of the box, the CKEditor configuration does a <p> on enter and a <br> on shift + enter.

If you wish to change this, you can visit admin/settings/ckeditor/edit/[profile], and scroll down to the "Cleanup and output" section.

5

Answer above fix this if you have a CKEditor module, but if you use WYSIWYG module you don't have that option (at least for now).

Here is how to override these settings with a module in CKEeditor in Drupal 7:

function YOURMODULENAME_wysiwyg_editor_settings_alter(&$settings, $context) {
  if($context['profile']->editor == 'ckeditor') {
    $settings['enterMode'] = 2; //<br />
    $settings['shiftEnterMode'] = 1; //<p>
  }
}

For TinyMCE here Drupal 7 - How to change p to br in CKEditor and TinyMCE.

2

There is a reason why the paragraph is the default: usually it's semantically more correct to use a <p> tag. I recommend in most cases to stick to the default and (if you don't like the whitespace) remove the margin on paragraphs using CSS.

2

Just go to admin/settings/filters/list; uncheck "Line break" in all filters, and "Full HTML."

1

I found it easier to hardcode this. Open the file sites/all/libraries/ckeditor/ckeditor.js in Notepad++ Go to line 22 or search for shiftEnterMode

Change following:

enterMode:1,forceEnterMode:false,shiftEnterMode:2,

into:

enterMode:2,forceEnterMode:false,shiftEnterMode:1,

done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.