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

Webkit browsers insert DIV after closing UL #48

Closed
sitesense opened this issue Mar 1, 2013 · 1 comment
Closed

Webkit browsers insert DIV after closing UL #48

sitesense opened this issue Mar 1, 2013 · 1 comment

Comments

@sitesense
Copy link

Normally when creating a new line by pressing enter, a new paragraph is created.

If you press enter twice after an unordered list to create a new line, Webkit browsers will insert a DIV element instead of a paragraph.

There is a fix for this in the formatNewLine function, however if the element that you transform into the editor (in my case a div) already has a class name, the function won't work because the class name no longer matches in this line:

if (parent.nodeName === 'DIV' && parent.className === 'redactor_editor')

Changing this line as below will fix this issue:

if (parent.nodeName === 'DIV' && parent.className.indexOf('redactor_editor') >= 0)

There is also another issue in that depending on the css that the editor is using, Webkit browsers may insert more than an empty DIV. In my case the line below is inserted after a closing UL instead:

<div><span style="line-height: 18px;"><br></span></div>

Therefore this line never matches and the cleanup fails:

if (element.get(0).tagName === 'DIV' && (element.html() === '' || element.html() === '<br>'))

I don't think it's really necessary to check the contents of the new line, so perhaps we can safely replace this line with the code below:

if (element.get(0).tagName === 'DIV')
@agis
Copy link

agis commented Apr 23, 2013

@sitesense What browser/version are you using? Your first proposed fix didn't work for me. When I press enter after

    I get this markup:

    <p>
      <ul>
        <li><font color="#404040">hi there</font></li>
      </ul>
      <div>
        should be paragraph
      </div>
    </p>
    

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

No branches or pull requests

3 participants