Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent <p> wrapping #149

Open
schnittchen opened this issue Feb 20, 2014 · 8 comments
Open

Inconsistent <p> wrapping #149

schnittchen opened this issue Feb 20, 2014 · 8 comments

Comments

@schnittchen
Copy link

Hi,

When the container div contains only, say, a single line of text, the text will jump as soon as the User moves around using cursor keys. The reason is that the line gets wrapped in a <p>. This does not happen when I make the initial content end in <br/>.

@nmielnik nmielnik removed the bug label Jun 22, 2015
@nmielnik
Copy link
Member

@schnittchen apologies it's been so long, but we're trying to go back and cleanup some issues.

Are you able to help us determine if this issue still happens?

@j0k3r
Copy link
Contributor

j0k3r commented Jun 25, 2015

And if it still happens, tell us on which version you are testing. Also, give some precision on which browsers your problem happens

@schnittchen
Copy link
Author

I won't find time soon. Feel free to ping me some time.

@schnittchen
Copy link
Author

Looks like this is still an issue: when the initial text value is ddd, the editor will change it to ddd<br>. After inserting a newline in the middle of the word and removing it again, the word is wrapped in a <p> tag. That's three times the same thing (to the user) being potentially rendered differently.

@nmielnik
Copy link
Member

nmielnik commented Jul 2, 2015

Thanks for the clarification, looks like this is yet another issue of weird browser handling of contenteditable content. I've had thoughts about trying to enforce that there can only be only block elements as direct children of the contenteditable <div>, meaning ddd could never be the content, it would always have to be <p>ddd</p>...

This is definitely something the medium-editor code could try to fix-up if anyone wants to give it a shot.

@nmielnik
Copy link
Member

nmielnik commented Jul 2, 2015

This issue seems somewhat related to #34 and #251 . When they are addressed, it seems like we should at least consider all 3 issues during the effort.

@nmielnik
Copy link
Member

As reported by @yoshokatana in #34

Ditto on that. I set disableReturn to true (which gets rid of it in most cases), but those extraneous <p> tags are still being added if I paste in text. I even did this, but it doesn't seem to be doing anything:

paste: {
      forcePlainText: false,
      cleanPastedHTML: true,
      cleanTags: [
        'meta',
        'script',
        'style',
        'img',
        'object',
        'iframe'
      ],
      cleanReplacements: [
        [/<p>/ig, ''], // this isn't actually getting rid of them?
        [/<\/p>/ig, '']
      ]
    }

@nelsonpecora
Copy link
Contributor

By the by, if I have forcePlainText: true, it doesn't add the extraneous <p> tags, so at least that's working. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants