Search code examples
htmltinymceumbraco

Make tinymce in umbraco accept html 5 standards


I'm trying to publish a piece of html to umbraco.

I managed to setup tinymce to accept all the html tags, however, there is still some wrong transformations being done.

When I publish this piece of html:

<div class="col-md-4">
    <a href="" class="card-link">
      <div class="panel panel-default">
        <div class="panel-body">
          <h2 class="card-link-title">Currencies</h2>
          <i class="card-link-icon icon icon-money-currencies"></i>
        </div>
      </div>
    </a>
</div>

It is transformed to:

 <div class="col-md-4">     
      <div class="panel panel-default">
        <div class="panel-body">
          <h2 class="card-link-title">Currencies</h2>
          <i class="card-link-icon icon icon-money-currencies"></i>
        </div>
      </div>
</div>

The a tag is removed. According to new html5 standards, div under a tag is valid (http://w3c.github.io/html-reference/a.html#a-changes), so I'm wondering if there's a way to make tinymce in umbraco accept the piece of html as it is


Solution

  • You need to edit the javascript in umbraco/lib/tinymce/tinymce.min.js. (The file mentioned by Jannik Anker in the other answer is a legacy version of tinymce, no longer used)

    Look for a line

    n("a","href target rel media hreflang type",u)
    

    and try amending it to

    n("a","href target rel media hreflang type",u,"div")
    

    Make sure to clear your browser cache after editing so the updated file is used.