1

Topic: how to stop tinymce from validating the html content.

Dear guys,

I have a piece of html like following:

<span class="text">
<p> Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum  </p>
</span>

Apparently a <p> tag is not allowed to be the child of a <span> tag by xhtml rules. But I would like to allow that in my application.

I've tried the following three alternatives:

valid_children : "*[*]"
cleanup: false
validate_children: false

none of them worked, Tinymce still stripped the outer <span>tag.

Need your help guys, is it possible to stop validating the html content?

2

Re: how to stop tinymce from validating the html content.

larryzhao wrote:

Apparently a <p> tag is not allowed to be the child of a <span> tag by xhtml rules.

Indeed.

larryzhao wrote:

But I would like to allow that in my application.

Why? This is what <div> elements are for!

Greetings from Germany,

Felix Riesterer.
(-> about me and this forum <-)

3

Re: how to stop tinymce from validating the html content.

Yeah, I would do that. But this html content are from some of the customer's legacy source. With their legacy css, so..I need to keep this html structure...

4

Re: how to stop tinymce from validating the html content.

Use the valid_children option to override the default schema. However I doubt that will work well since the browsers them selfs will probably split the spans. A better solution would be to replace these spans with div and making the code valid.

Best regards,
Spocke - Main developer of TinyMCE

5

Re: how to stop tinymce from validating the html content.

@spocke, thanks a lot for the help, I've tried both

valid_children: "span[p]",
valid_children: "*[*]",

neither works. Does it mean there's no way to get this around?

---
Best Regards.
Larry.