Hi, I would like to wrap every line with span tag.
For example, when I enter text in the editor I get:
this is the first line
<br>
this is the second line of text
<br>
and the third one
I want it to be by default:
<span style="font-size:12px;">this is the first line</span>
<br>
<span style="font-size:12px;">this is the second line of text</span>
<br>
<span style="font-size:12px;">and the third one</span>
I know there is something called "dataProcessor" but I don't understand how to use it.
If it is possible to add this rule also to pasted text it will be even better.
Thanks!
Don't do this...
What you are asking to do here is very bad practice. Instead, you should convert the <br> tags to <p> tags using a regex or string replace function. If necessary you can add a class to the <p> tags, eg <p class='mediumfont'>. Tip: you do not need to add </p> since CK will do that to any code with unbalanced <p> tags anyway.
You can then add any required font declarations to the stylesheet. Once.
config entermode
I have done it like this:
in config.js
CKEDITOR.editorConfig = function (config) {
...
config.enterMode = CKEDITOR.ENTER_P;
config.shiftEnterMode = CKEDITOR.ENTER_P;
...
};
The information about this enter mode is defined in the api on: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode
options are:
CKEDITOR.ENTER_P
(1) – new<p>
paragraphs are created;CKEDITOR.ENTER_BR
(2) – lines are broken with<br>
elements;CKEDITOR.ENTER_DIV
(3) – new<div>
blocks are created.I hope this helps you further.