Reema
Reema

Reputation: 647

How to decrease the line height in ckeditor 4.4.5?

How can the default line-height be reduced on the ck-editor. It's little too high at the moment, since I have upgraded it to the version 4.4.5

Is there any property available to do this?

Upvotes: 3

Views: 12875

Answers (2)

Reema
Reema

Reputation: 647

Was upgrading ckeditor to 4.6.2 and ran across the same problem again. The problem was the line height was more when i pressed enter key to go to the next line. This time I found a new solution.

ckeditor adds <p> tags instead of <br> tags on clicking Enter. This is its default behaviour. We can change this to either <br> or <div> tags based on what is required.

There is a config.js file in the ckeditor library with the below code:

CKEDITOR.editorConfig = function( config ) {};

You can update this function with any of the below properties:

CKEDITOR.ENTER_DIV – new <div> blocks are created
CKEDITOR.ENTER_P – new <p> paragraphs are created
CKEDITOR.ENTER_BR – new <br> line breaks are created.

Example:

CKEDITOR.editorConfig = function( config ) { config.enterMode = CKEDITOR.ENTER_BR; };

Upvotes: 6

Reema
Reema

Reputation: 647

There is a file contents.css in the ckeditor library with the class .cke_editable with the line-height property set to 1.6. Update it with the value required. This will update the line-height in all the places its used in your application.

This is what i did.

.cke_editable
{
    font-size: 13px;
    line-height: 1.0;
}

Upvotes: 4

Related Questions