Hi
I am using ckeditor 3.5 and I would like to generate html with the following structure:
I have enterMode = p. If I enter the text "Introduction P...", press enter and type "Introduction P..." the source is as I would expect:
I then created a block style "Introduction Text" with element = 'div' and class='introduction'.
If I select the text and apply the style the <p> tags are changed to <div>:
As an experiment I typed
"Introduction paragraph 1 text Introduction paragraph 2 text" and applied the Introduction Text style. The source was:
I then placed the cursor before the second Introduction and pressed return, expecting each piece of text to be enclosed in <p> tags, inside the <div>. Instead the source was again:
Is there a way to configure ckeditor to allow <p> tags inside <div> tags instead of replacing each <p> with a <div>?
Regards
P
I am using ckeditor 3.5 and I would like to generate html with the following structure:
<div class="introduction"> <p> Introduction paragraph 1 text </p> <p> Introduction paragraph 2 text </p> </div>
I have enterMode = p. If I enter the text "Introduction P...", press enter and type "Introduction P..." the source is as I would expect:
<p> Introduction paragraph 1 text </p> <p> Introduction paragraph 2 text </p>
I then created a block style "Introduction Text" with element = 'div' and class='introduction'.
If I select the text and apply the style the <p> tags are changed to <div>:
<div class="introduction"> Introduction paragraph 1 text </div> <div class="introduction"> Introduction paragraph 2 text </div>
As an experiment I typed
"Introduction paragraph 1 text Introduction paragraph 2 text" and applied the Introduction Text style. The source was:
<div class="introduction"> Introduction paragraph 1 text Introduction paragraph 2 text </div>
I then placed the cursor before the second Introduction and pressed return, expecting each piece of text to be enclosed in <p> tags, inside the <div>. Instead the source was again:
<div class="introduction"> Introduction paragraph 1 text </div> <div class="introduction"> Introduction paragraph 2 text </div>
Is there a way to configure ckeditor to allow <p> tags inside <div> tags instead of replacing each <p> with a <div>?
Regards
P
Re: <p> inside <div>
You have to add the following code to your config.js file:
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Re: <p> inside <div>
Hi Sebastian
Thanks for the quick reply.
I tried setting
but it hasn't helped.
The example:
still generates:
I also tried placing the cursor before the second Introduction and pressing enter 3 times:
this resulted in source:
This isn't what I expected because <p> elements have been added but not between the <div>s and the class definition from the <div> has been added to the <p> elements.
I double checked the api to see if the order of application was important and found "pressing the Enter key inside a <div> element will create a new paragraph with <p> instead of a <div>" which is what I am doing. I admit that the api doesn't say that the <p> will be created inside the <div></div> elements so the behaviour does match the api but doesn't create the output we require.
As another experiment I tried placing the cursor before the second Introduction and pressing shift+enter 3 times (ShiftEnterMode= br):
The created source was:
which is the sort of structure we require (except <br>s instead of <p>s)
I also ran it through firebug to check that forceEnterMode was indeed set to true (which it was).
Regards
P
Re: <p> inside <div>
1) Typed: Introduction paragraph 1 text Introduction paragraph 2 text
2) Selected the text
3) Pressed "Create Div Container" button and added "introduction" to Stylesheet Classes, then pressed OK
4) Put the cursor between "1 text" and "Introduction"
5) Pressed Enter
It gave me the following source code:
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Re: <p> inside <div>
Thank you again for your reply. I will investigate your suggestion.
I have also found that it is possible to set up a template with the <div class="introduction"><p>Type your text here</p></div>.
If I type text and press enter a new paragraph is created. The source is:
which is what we require. It may also be easier for users who are not familiar with the create div button.
Regards
P