Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tinymce Line break problem on Safari and Chrome

Does anyone know how to fix the problem about Tinymce Line break problem on Safari and Chrome.

For example, Let's say, I have two line pure text. When I copy and paste through firefox or IE. It's under one p tag. So it's same formatting i saw in the text file which is two line.

But if i copy and paste through Chrome or Firefox, it becomes two p tag. So at display there,s one space between that two line.

I tried to add safari plugin, but nothing happens. And if i put the plugin called paste_auto_cleanup_on_paste : true, it's removing the space, but two line text became one line.

Cany anyone help me out by providing solution ? I noticed that at wordpress which is using Tinymce Editor also, doesn't occur that problem, because seems like they are using span instead of p at editor. If that's the solution, how can i change to span instead of p. Thanks for your help and greatly appreciated.


Here is when I paste through firefox and IE, firefox produces following code. That's what I want

<p>
This is line 1 <br />
This is line 2 <br />
This is line 3 <br /> 
</p>

But when I paste through Chrome and Safari, it produced following code. That's what I don't want.

<p> This is line 1 </p>
<p>This is line 2 </p>
<p>This is line 3 </p>
like image 375
knightrider Avatar asked Jun 10 '10 10:06

knightrider


1 Answers

Have you tried to enable the plugin paste in

tinyMCE.init({
...
    plugins : "paste",
...
});

?

As an example, this link is without paste enabled http://jsbin.com/obekev and will see Path: p » p if you try to paste several lines in safari or chrome

and this one has paste enabled http://jsbin.com/axipof/2 and this time you will see Path: p : proof that your problem is fixed with paste enabled :)

Hope that helped!

like image 71
Gueno Avatar answered Sep 28 '22 08:09

Gueno