1

Topic: How Converting \r\n in <br> instead of <p> during a copy/paste ?

Hello,
All is in the subject, I wish I could replace the CR (\r\n) from the source text by <br /> instead of <p> </p> as actually in the target text.
Thanks for your help,

2

Re: How Converting \r\n in <br> instead of <p> during a copy/paste ?

You should do this on your server side logic.

3

Re: How Converting \r\n in <br> instead of <p> during a copy/paste ?

clem_alain wrote:

Hello,
All is in the subject, I wish I could replace the CR (\r\n) from the source text by <br /> instead of <p> </p> as actually in the target text.
Thanks for your help,

See this: http://www.tinymce.com/wiki.php/Plugin:paste

Particularly the "paste_text_linebreaktype" option (at the bottom of the list of options).

"Anything that is complex is not useful and anything that is useful is simple. This has been my whole life's motto." -- Mikhail T. Kalashnikov

4

Re: How Converting \r\n in <br> instead of <p> during a copy/paste ?

Hello,
Thank you for your response :
> Particularly the "paste_text_linebreaktype" option (at the bottom of the list of options).

I do that but it doesn't work, here is my code, is there something wrong ?
tinyMCE.init({
            language: 'fr',
            mode: "textareas",
            theme: "advanced",
            force_br_newlines: true,
            force_p_newlines: false,
            forced_root_block: false,
            convert_newlines_to_brs: true,
            paste_text_linebreaktype : "br",
            editor_selector: "taSaisie",
            plugins: "style,pagebreak,layer, ...

5

Re: How Converting \r\n in <br> instead of <p> during a copy/paste ?

clem_alain wrote:

Hello,
Thank you for your response :
> Particularly the "paste_text_linebreaktype" option (at the bottom of the list of options).

You can also "capture" the paste data and operate on it before it's pasted. Try this in your config:

    'paste_preprocess' : function(pl, o) {
        o.content = o.content.replace(/\r?\n/gi,'<br />');
    },

That regex says "take any nl or cr/nl and change it into <br />".

Hope this helps.

"Anything that is complex is not useful and anything that is useful is simple. This has been my whole life's motto." -- Mikhail T. Kalashnikov

6

Re: How Converting \r\n in <br> instead of <p> during a copy/paste ?

Hi,
I replace my old tiny MCE version 3',minorVersion : '2.0.2' files with new TinyMCE 3.5b3 version to support IE9 .
After Replacing with new version my IE9 browser issue get resolved but with Ipad device (safari browser) we are facing new issue.
When ever we type any thing on text area for eg: test and save it.
After saving we are getting on text area <P> test </P>.
could any one help me out on this issue.