• Resolved MathiasAeschlimann

    (@mathiasaeschlimann)


    I have a markup structure set up like this:

    <a href="">
          <div>
            <h2>
            Header</h2>
              <img alt=""
              src="" />
          </div>
        </a>

    CKEditor breaks this valid markup and outputs:

    <div>
           <a href="">
            <h2>
            Header</h2></a>
             <a href="">
              <img alt=""
              src="" />
            </a>
          </div>

    This is very annoying – How can I prevent this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • michal

    (@michal_cksource)

    Hi,
    CKEditor always validate HTML code and try fix it when it is incorrect.
    In your example you have div element into a element. This is not valid in HTML. This is a reason why CKEditor try ‘fix’ ii to create valid markup.
    There is no way to turn off code validation in CKEditor.

    Thread Starter MathiasAeschlimann

    (@mathiasaeschlimann)

    @michal_cksource:
    Hey, thanks for answering, but my markup is in fact not incorrect:

    The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).

    Source (HTML5 spec)

    It may be incorrect in other versions/dialects of HTML, it surely isn’t per se.

    I think that this built-in ‘validator’ was a very unfortunate design choice.

    michal

    (@michal_cksource)

    CKEditor is not ‘full’ ready for HTML 5. CKEditor’s developers working on it but this takes time.
    In general it is designed for HTML 4.

    I think that this built-in ‘validator’ was a very unfortunate design choice.

    Please remember that CKEditor is made for ‘everyone’ not only webdevelopers. So it should be easy to use by all users.

    Thread Starter MathiasAeschlimann

    (@mathiasaeschlimann)

    CKEditor is not ‘full’ ready for HTML 5. CKEditor’s developers working on it but this takes time.

    Well, yes of course. As HTML5 is still a draft that wouldn’t be possible anyway. But I don’t think it’s a sustainable solution to force this HTML ‘correcting’ as the language won’t stop developping and the validator will continue to lack behind.

    In general it is designed for HTML 4.

    Ah, ok, I didn’t knew about that. It’s advertised as being a rich text editor.

    Please remember that CKEditor is made for ‘everyone’ not only webdevelopers. So it should be easy to use by all users.

    Well yes, that’s exactly my problem. I don’t need the CKE, I have it installed solely for my client so he can edit content I wrote. But as it is, he can’t do that without messing things up.
    Honestly I believe a validation on/off-switch would be a prerequisite for an editor that is made for everyone.

    michal

    (@michal_cksource)

    Turn off validation will break parsing of document by rich editor like CKEditor. In this way user will see total mess and there is no sense use rich editor. Every ‘browser’ wysiwyg editor try to handle invalid html in some way to have chance show users some results.
    This discussion goes to nowhere ??

    Thread Starter MathiasAeschlimann

    (@mathiasaeschlimann)

    Well, an editor would need to check whether a document is well-formed, but it wouldn’t have to handle html nesting to ‘show users some results’ (and I believe it shouldn’t).

    Over at dev.ckeditor.com I was told that in v4 of ckeditor this issue will be resolved, so this discussion doesn’t need to go anywhere atm. =)

    michal

    (@michal_cksource)

    @mathiasaeschlimann
    this kind of changes (formatting html code inside CKEditor) will be added to this pluigin with new versions of CKEditor library.
    Plesae , can you close this issue ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: CKEditor For WordPress] How to stop CKEditor from breaking my markup?’ is closed to new replies.