froala/wordpress-froala-wysiwyg

Issue with paragraphs when pasting in rich text content

KTS915 opened this issue · 10 comments

I have tried pasting in content from both traditional wordprocessors (like MS Word) and simpler, rich-text editors. In each case, Froala adds an extra (empty) paragraph between each paragraph.

To start with, I thought this was probably caused by WordPress's own wpautop function, but it isn't. (In fact, if I disable wpautop, I just get a line break added to the phantom paragraph, thus making the gap between the real paragraphs even bigger.)

@KTS915 if you would like to disable this, then you should change the option enter to $.FroalaEditor.ENTER_BR: https://www.froala.com/wysiwyg-editor/examples/enter/.

Sorry, @stefanneculai, but that's not a solution. It's just a kludgy workaround. All that does is strip out paragraphs altogether, so that you end up with one long div with line breaks.

@KTS915 could you send us the document you're pasting from?

I just saw it on your own CodePen: https://codepen.io/Froala/pen/aJxPJP

You just need to interpret two consecutive strikes of the ENTER key as one. (You could instead change Froala's default behavior, so that two consecutive strikes of the ENTER key are required to end a paragraph and start a new one, but I assume you don't want to do that.)

@KTS915 I see what you mean now. You would want that when you hit enter inside a paragraph, it would make a new line inside it instead of outside. We believe the current behavior is the correct one.

@stefanneculai, I take it from this "We believe the current behavior is the correct one" that you aren't going to change anything. In which case, I'm afraid, Froala will be useless for almost all WordPress users I know, because they paste in content from Word all the time.

Could you send us the document you're pasting from so we could check that? Thanks.

I haven't actually tried -- just saw the CodePen and realized it was pointless.

If you want me to try it, tell me where to put the JS code to modify Froala's behavior.

Word paste is different from the typing behavior. We would be happy to look into it if you are willing to collaborate with us. Thank you.

Sure, I'm willing, but you have to tell me where to paste the JS code to which you referred. On a regular html page, I'd know eactly how to do it, and for the front-end on WordPress, I'd put it in the theme's javascript file.

But your JS function needs to affect the admin side of WordPress. I have no idea where I need to put it to get it to work.