Luca Santaniello
Luca Santaniello

Reputation: 199

CKEditor Configuration, why it remove my html code?

my ckeditor has this configuration: config.allowedContent = true;

If I insert this code into my editor:

<a href="#" class="circle large border"> <span class="icojam_anchor"></span> </a>

this is a simple link with span content

The script will be remove. Why? I need to disable the HTML correction. Is it possible?

Thanks Luca

Upvotes: 0

Views: 366

Answers (1)

Matt
Matt

Reputation: 147

You need to disable removing empty span tags using CKEDITOR.dtd.$removeEmpty

For example, adding the following to the config.js

// allow span tags to be empty
CKEDITOR.dtd.$removeEmpty.span = 0;`

//The following allows i tags to be empty
CKEDITOR.dtd.$removeEmpty['i'] = false

Source: CKEditor strips <i> Tag

Upvotes: 1

Related Questions