1

I'm trying to get TinyMCE + WYSIWYG + D7 to produce HTML like this...

<ul>
    <li>
        <h2>Foo</h2>
        <p>bar</p>
    </li>
</ul>

According to my tests, TinyMCE can do this easily out of the box. Just create the list. Type some text, highlight Foo and select the Heading 2 format.

However, when I perform the same actions in Drupal, TinyMCE will change the entire contents of the <li> to be the selected format... producing markup like this...

<ul>
    <li>
        <h2>Foo<br/>
        bar</h2>
    </li>
</ul>

I expect this is because Drupal is setting the valid_children or valid_elements properties of TinyMCE but I dont see how to affect them in the configuration page.

How do I change Drupals config for these? How do I get the editor to produce the markup that I want?

  • Assuming you're talking about WYSIWYG+TinyMCE in Drupal 7...the only mention of valid_children or valid_elements is in wysiwyg/editors/tinymce.inc. You can probably make your changes there, I don't see any alter hooks provided by WYSIWYG – Clive Jan 30 '14 at 15:45
  • Yes. Sorry for the ambiguity. I will add that to the question. – Jeff Jan 30 '14 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.