Developer forum

Currently discussing: Plans to implement a Consent module for GDPR compliance.

Join the discussion!

Forum » CMS - Standard features » The editor "throws out" Font Awesome

The editor "throws out" Font Awesome

Hans Ravnsfjall
Hans Ravnsfjall
Reply

the editor automatically deletes font avesome, like:

    <i class="fa fa-facebook" aria-hidden="true"></i>

<i class="fa fa-instagram" aria-hidden="true"></i>

I have tried setting the configuration to developer, but that does not solve the problem.

Replies

 
Nicolai Pedersen
Nicolai Pedersen
Reply

Hi Hans

Yes, it does that. You can configure your way out of it:

http://ckeditor.com/forums/CKEditor/FontAwesome-tags-removed-when-switching-between-Source-and-Wysiwyg

BR Nicolai

 
Martin Christensen
Reply

A short follow-up to the solution suggested on the ckeditor-forums:

protectedSource does preserve the code, but it also prevents the icons from being rendered in the WISIWYG area after switching to source or simply reopening the paragraph:

config.protectedSource.push( /<i class[\s\S]*?\>/g );
config.protectedSource.push( /<\/i>/g );

Adding the following line outside the CKEDITOR.editorConfig function line preserves the empty tags:

CKEDITOR.dtd.$removeEmpty['i'] = false;

In order to preserve the class and style attributes, I added the following:

config.extraAllowedContent = 'i(*){*}[*]';

To make the fontawesome function in DW9 work properly with our config, I added those two lines - except I allowed span-tags instead of i-tags.

 

You must be logged in to post in the forum