Is there a way to get tinymce to generate valid html? It's generating lists like开发者_运维问答 this:
<li>text</li>
<li>text</li>
<li>text</li>
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
<ul>
<li>text</li>
<ul>
<li>text</li>
</ul>
</ul>
</ul>
</ul>
Unicorn outputs:
Element ul not allowed as child of element ul in this context.
I'd prefer lists like this:
<ul>
<li>text</li>
<li>text</li>
<li>
text
<ul>
<li>text</li>
<li>text</li>
<li>
text
<ul>
<li>text</li>
</ul>
</li>
</ul>
</li>
</ul>
I was happy to find that this question solved the issue (setting source_formatting
to false
when initializing tinymce); however it seems when tinymce parses some markup (for example if you put some in a textarea and then initilize tinymce) tinymce re-parses it as in example 1. Any ideas on how to make tinymce not change the markup originally in the editor I initialize it on?
Add the lists plugin when initialising TinyMCE
tinyMCE.init({
...
plugins : "lists",
...
});
Edit: I believe this only applies to TinyMCE 3.x
Check the latest version 3.4.4. It should be fixed there.
try setting option,
fix_list_elements : true
in init method.
精彩评论