Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.

Wrap text outside of <p> in <p> when hitting enter with useLineBreaks==false #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DouweM
Copy link

@DouweM DouweM commented Mar 7, 2013

Suppose that for some reason the body ends up like this (and it has for me):

<p>Hey</p>
Just testing|

Currently, when hitting return with the caret after Just testing, we end up with this:

<p>Hey</p>
Just testing<br>
|

Or worse (in Chrome), this:

<p>Hey</p>
Just testing
<div>|</div>

Using this fix, when useLineBreaks == false, the result will be a clean:

<p>Hey</p>
<p>Just testing</p>
<p>|<br></p>

(The <br> is just there to give the <p> some height, exactly as Wysihtml5 currently behaves when hitting enter from within a <p>.)

It also works great with Shift-Enter, in which case the result would be:

<p>Hey</p>
<p>Just testing<br>
|</p>

@steverandy
Copy link

@DouweM, does shift enter also work on safari with this commit?

@DouweM
Copy link
Author

DouweM commented Mar 7, 2013

I've only tested Shift-Enter in Chrome, so I'm not sure. I'll check it out tomorrow.

everplays added a commit to bookingexperts/wysihtml5-rails that referenced this pull request Oct 13, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants