Oleg Patrushev
Oleg Patrushev

Reputation: 265

Prevent tinymce autoformatting

I have some troubles with tinymce. My html code is given below

                <div class="columns home-page-image-block" id="box-c-wrap">
                    <a href="/category/skeletons"><img src="/img/content/home-image-3.png" alt=""/></a>
                    <a href="/category/skeletons" class="home-page-image-block-title-3 image-title">
                        <span>Catalog of:</span>
                        <h4>Fossils</h4>
                    </a>
                </div>

and after inserting into editor I get this in "View source"

<div id="box-c-wrap" class="columns home-page-image-block">
<a href="/category/skeletons">
<img src="/img/content/home-image-3.png" alt="" />
</a> 
<a class="home-page-image-block-title-3 image-title" href="/category/skeletons">Catalog of:</a>
<h4>Fossils</h4>
</div>

The tinymce formats the code and changes it's structure by itself... How can I disable this?

Upvotes: 1

Views: 711

Answers (1)

cari
cari

Reputation: 2300

TinyMCE's auto-formatting is a pain. There is no option to stop it from doing so. Not switching from Text to Visual Editor helps.

In wordpress there's TinyMCE Advanced, which removes some of the autoformatting options, but its far from perfect.

For your backend better try using CKEditor and add this to config.js:

CKEDITOR.config.allowedContent = true

Upvotes: 1

Related Questions