WordPress.org

Ready to get started?Download WordPress

Forums

editor filtering code (4 posts)

  1. Tdude
    Member
    Posted 7 years ago #

    Hi!
    In all of my WP installs, 2 of them the latest 2.12, the wysiwyg editor messes up the div tags I insert in code view and changes them to p tags. It just adds a paragraph tag and a no breking space in between them. What is this? I'm a programmer and all that, but want to use the wysiwyg editor anyway. Is there an easy way to get into the regexp filtering of the editor?

    Here's what i want to do with the wysiwyg editor on, but in html mode:

    <div class="column">
    first column
    </div>
    <div class="column">
    second column
    </div>

    It turns into something like this after I save and open it again:

    <p class="column">&nbsp;</p>
    first column
    <p class="column">&nbsp;</p>
    second column

    As you can see, this gets serious from a layout point of view. It happens if I open a previous post which is correct and validated.
    I've tried to dig into the TinyMCE files, but couldn't find what I was looking for (yet)
    I've also tried posting questions about this here and there. Any hints anyone? (except "turn the wysiwyg editor off")

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Here's what i want to do with the wysiwyg editor on, but in html mode:
    <div class="column">
    first column
    </div>
    <div class="column">
    second column
    </div>

    You do realize that this code is invalid markup, right? Div is a block level element which can only contain other block level elements. Straight text is an inline element. You could do something like <div><p>text</p></div> and that would be valid, since P is a block level element which can only contain inline elements.

    I admit that the editor is annoying, but when you feed it bad markup and it tries to fix it, it's probably going to do it badly.

  3. sauceyman
    Member
    Posted 7 years ago #

    Otto, I think somewhere along the way you've been misled. His code Is valid code. A Div tag may contain both block and inline elements.

    Tdude, the answer to your problem can be found at this post...

    http://wordpress.org/support/topic/102696?replies=4

  4. Tdude
    Member
    Posted 6 years ago #

    Never mind. Thanks Sauceyman! Otto too!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.