Hi everyone,
I got stuck with the problem of <p> </p> tags being added to the whole text.(the start and end of the writing).
I can do shift+enter, but it only puts <br> inside the text and I can find no way to remove the <p> tags from the beginning of the input.
Please help or develop a function to make this part customizable.
Thanks a lot
Sina
Mon, 08/24/2009 - 05:32
#1
Re: Prevent first <p> tags in CKeditor
Thanks!
Re: Prevent first <p> tags in CKeditor
Re: Prevent first <p> tags in CKeditor
I think the developers must know why they put the <p> </p> tags at the beginning and end of the codes! and surely there must be some way to prevent it from happening !!!
Please help guys ...
Re: Prevent first <p> tags in CKeditor
CKEDITOR.replace( 'editor1' ,
{
enterMode : Number(2),
Re: Prevent first <p> tags in CKeditor
is probably more correct - that also works.
it is set in the config.js file
/**
* Sets the behavior for the ENTER key. It also dictates other behaviour
* rules in the editor, like whether the <br> element is to be used
* as a paragraph separator when indenting text.
* The allowed values are the following constants, and their relative
* behavior:
* <ul>
* <li>{@link CKEDITOR.ENTER_P} (1): new <p> paragraphs are created;</li>
* <li>{@link CKEDITOR.ENTER_BR} (2): lines are broken with <br> elements;</li>
* <li>{@link CKEDITOR.ENTER_DIV} (3): new <div> blocks are created.</li>
* </ul>
* <strong>Note</strong>: It's recommended to use the
* {@link CKEDITOR.ENTER_P} value because of its semantic value and
* correctness. The editor is optimized for this value.
* @type Number
* @default {@link CKEDITOR.ENTER_P}
* @example
* // Not recommended.
* config.enterMode = CKEDITOR.ENTER_BR;
*/
enterMode : CKEDITOR.ENTER_P,
so you can override it with your own setting
Re: Prevent first <p> tags in CKeditor
Re: Prevent first <p> tags in CKeditor
Should I add enterMode : CKEDITOR.ENTER_BR to the end of config.js file?
And everything will get fine?
I did so, but its still not working.
Please tell me what exactly I should do.
Thank you
Sina
Re: Prevent first <p> tags in CKeditor
my config.js looks like this:
/*
Copyright (c) 2003-2009, 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.uiColor = '#949AAA';
};
I added enterMode : CKEDITOR.ENTER_BR; , but it didn't work.
Please help guys.
thanks
Re: Prevent first <p> tags in CKeditor
CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.uiColor = '#949AAA';
config.enterMode = CKEDITOR.ENTER_BR;
};
Re: Prevent first <p> tags in CKeditor
The required syntax is slightly different depending on whether you define your configurations "in page" or in a config file ...
Setting Configurations http://docs.fckeditor.net/CKEditor_3.x/ ... igurations
Defining Configurations In-Page
CKEDITOR.replace( 'editor1',
{
toolbar : 'basic',
uiColor : '# 9AB8F3',
enterMode : CKEDITOR.ENTER_BR
});
Using the config.js File
CKEDITOR.editorConfig = function( config )
{
config.language = 'fr';
config.uiColor = '#AADC6E';
config.enterMode = CKEDITOR.ENTER_BR;
};
Re: Prevent first <p> tags in CKeditor
Yeah, I tried same exact thing, but it didn't work!
I'm wondering how your's work.
Even the enter mode is with <p>.
Its so Sad. Someone pleaaase help
Re: Prevent first <p> tags in CKeditor
Oh, Just saw your second reply
It works now. But one problem!
How to put <p> tags now ?:D I thought shift-enter will put <p> now, but shift+enter puts <br> too!
Any help with this?
Re: Prevent first <p> tags in CKeditor
Guys Found the Solutions.
Enter(default): BR
Shift Enter: P
replace this with your config.js:
Re: Prevent first <p> tags in CKeditor
I use the "in page" method, ... I find I have to clear the browser cache after each change - else the old version of the file is used and the changes don't appear.
Defining Configurations In-Page
CKEDITOR.replace( 'editor1',
{
toolbar : 'basic',
uiColor : '# 9AB8F3',
enterMode : CKEDITOR.ENTER_BR,
shiftEnterMode : CKEDITOR.ENTER_P
});
Using the config.js File
CKEDITOR.editorConfig = function( config )
{
config.language = 'fr';
config.uiColor = '#AADC6E';
config.enterMode = CKEDITOR.ENTER_BR;
config.shiftEnterMode = CKEDITOR.ENTER_P;
};
Re: Prevent first <p> tags in CKeditor
Re: Prevent first <p> tags in CKeditor
Re: Prevent first <p> tags in CKeditor
please set
config.enterMode = 2
it s worked
Re: Prevent first <p> tags in CKeditor
when you just type
you get
as it seems in the querystring which sends the output from the editor the following when your textarea is named "editortext" you get:
which means <p> CR TAB LF test </p> CR LF
so i just filtered the non-printables (my thing is ASP)
then the normal <p> and </p> remain which you can easily filter also
and all that remains to be saved in your database is
Re: Prevent first <p> tags in CKeditor
where do you put those lines?