Log in or register to post comments
Last post
fredu's picture
Joined: 03/10/2009
Posts: 12
Problem with text-align
Hi everyone,

First I apologize for my bad english.

I'm a new to ckeditor and ckfinder (of which i bought a license) and I dont understand one thing.

In Ckeditor, if I type a line of text, then select it and hit the "text-align:center" button, the line goes as expected, in a centered position. But then, if I press Enter some times, type some more text on a new line, select the new line alone and press the "text-align:left" button (or another alignement button), both the lines go to the new alignement position, which is not what users of text-editors liks MSOffice would normally expect... I would have expected that only the second line would be aligned to the left as if it was a new paragraph but pressing Enter or pressing an alignement button for the second time just changes the first paragraph element and does not create a new one with the new alignement position.

If I display the source, I see that pressing Enter just introduce some <br /> tags in a <p style="text-align:center;"></p> element and that the second time I press the align:left button does not close the first <p> element (the centered one) and create a second one for the second line to align it alone to the left. Instead, it changes the text-align property of the first <p> element, moving to the left the whole text...

Am I doing something wrong? How do I do to have a new paragraphe created, and align it alone to the left after a centered paragraph?

Thanks a lot,

Frederic
comp615's picture
Joined: 02/07/2010
Posts: 295
Re: Problem with text-align
Depending on how you have it setup, shift-enter should be what you are looking for.
alfonsoml's picture
Joined: 31/12/2006
Posts: 3733
Re: Problem with text-align
You have changed the enter mode configuration too create a br instead of a p, so that's your problem
fredu's picture
Joined: 03/10/2009
Posts: 12
Re: Problem with text-align
You have changed the enter mode configuration too create a br instead of a p, so that's your problem


Do you mean on my OS or in the CKEditor config?

On my OS, I dont think I have done anything that modified the Enter mode. Openoffice, TextEdit or my IDEs (netbean, eclipse) work just fine and I have noticed no change since I own the machine.

Regarding the CkEditor configuration, I havent changed anything except for the CKFinder config.php file. And even in that file, I havent touched anything else than the CheckAuthentication() function, license key and baseUrl/baseDir...

I instanciate a new Ckeditor according to the javascript method, but through php. I know this is not the perfect way to do it, but it works and solves most of my client's prerogatives...

$s .= '
            <script type="text/javascript">

            var lang_block = document.getElementById("sessionLang");
            var lang = lang_block.innerHTML;
            lang = lang.toLowerCase();
            

            var editor = CKEDITOR.replace( \''.$this->name.'\',
            {
                defaultLanguage : lang,
                language : lang,
                colorButton_enableMore : false,
                contentsLangDirection : \'ltr\',
                toolbar : \'Full\',
                disableNativeSpellChecker : false,
                enterMode : CKEDITOR.ENTER_BR,
                height : 300,
                resize_enabled : false,
                uiColor : \'#E9E9E9\' ,

                toolbar_Full :
                [
                        [\'Maximize\',\'Preview\'],[\'Source\'],

                        [\'Undo\',\'Redo\',\'SelectAll\'],
                        [\'NumberedList\',\'BulletedList\',\'-\',\'Outdent\',\'Indent\'],
                        [\'Link\',\'Unlink\'],

                        [\'Font\',\'FontSize\'],
                        \'/\',
                        [\'Bold\',\'Italic\',\'Underline\',\'Strike\',\'-\',\'Subscript\',\'Superscript\'],

                        [\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\'],
                        [\'Image\',\'Table\',\'HorizontalRule\',\'Smiley\',\'SpecialChar\'],





                        [\'TextColor\',\'BGColor\'],

                ]
            }

            );
            CKFinder.setupCKEditor( editor, \'/csea/plugins/ckfinder/\' );
            </script>';


            return $s;


Depending on how you have it setup, shift-enter should be what you are looking for.

Shift+Enter works the same way as Enter alone.

I have tested the whole thing on a MacBook Pro with Snow Leopard on it. Could it be the reason?
alfonsoml's picture
Joined: 31/12/2006
Posts: 3733
Re: Problem with text-align
This is the line:
enterMode : CKEDITOR.ENTER_BR,
fredu's picture
Joined: 03/10/2009
Posts: 12
Re: Problem with text-align
Thanks... I changed it to:

enterMode : CKEDITOR.ENTER_P,


and Enter gives now a nice <p>... :) plus, I can get simple <br/>s with Shift+Enter :D

... so I guess my problem is solved...

thanks again