Opened 12 years ago

Closed 12 years ago

#9843 closed Bug (invalid)

"formatted" option from the Format dropdown adds extra line break

Reported by: vijendra Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 4.0
Keywords: Cc: vijendra.1007@…

Description

When I use CKEditor 4 with attached config.js and ontents.css files, then by hitting formatted option from the Format dropdown creates extra line break.

How to reproduce:

  1. Go to CKEditor 4 demo page.
  2. Set following configuration in config.js file
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.editorConfig = function (config) {
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
    config.extraPlugins = 'syntaxhighlight,button-pre';
    //config.toolbar_Full.push(['Code']);
    config.resize_enabled = false;
};

/*
http://stackoverflow.com/questions/6969081/why-does-ckeditor-add-line-breaks-and-paragraph-before-initial-text
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting
http://stackoverflow.com/questions/1977791/turn-off-enclosing-p-tags-in-ckeditor-3-0
*/
CKEDITOR.on('instanceReady', function (ev) {


    // Output paragraphs as <p>Text</p>.
    ev.editor.dataProcessor.writer.setRules('p',
{
    indent: false,
    breakBeforeOpen: false,
    breakAfterOpen: false,
    breakBeforeClose: false,
    breakAfterClose: false
});

    // Output paragraphs as <p>Text</p>.
    ev.editor.dataProcessor.writer.setRules('pre',
{
    indent: false,
    breakBeforeOpen: false,
    breakAfterOpen: false,
    breakBeforeClose: false,
    breakAfterClose: false
});

    // Output paragraphs as <p>Text</p>.
    ev.editor.dataProcessor.writer.setRules('br',
{
    indent: false,
    breakBeforeOpen: false,
    breakAfterOpen: false,
    breakBeforeClose: false,
    breakAfterClose: false
});

    // Output paragraphs as <p>Text</p>.
    ev.editor.dataProcessor.writer.setRules('div',
{
    indent: false,
    breakBeforeOpen: false,
    breakAfterOpen: false,
    breakBeforeClose: false,
    breakAfterClose: false
});

});

  1. et following CSS in the contents.css file
p, pre
{
	margin:0;
	padding:0;

}
  1. Add following text in the CKEditor

"Test
Test
Test
Test
"

  1. Select the 2,3 line and hit formatted option from the Format dropdown, you will notice that extra line breaks has been added.

Attachments (2)

config.js (2.0 KB) - added by vijendra 12 years ago.
contents.css (603 bytes) - added by vijendra 12 years ago.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by vijendra

Attachment: config.js added

Changed 12 years ago by vijendra

Attachment: contents.css added

comment:1 Changed 12 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

I have tried your editor from previous example. I don’t have this problem. There are no spaces between text and text in pre tag.

Please remember that if you want to apply neew CSS and reset some of the existing rules sometimes CRTL+F5 in not enough and cache refresh is needed.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy