i've installed module with dependencies and correct libraries entry.

on switching between source and rendered output <i class="icon-twitter"></i> Twitter becomes <p>Twitter </p>

the module has no UI I can see but the report page says its installed and there are no errors but i can't see it listed as a css file in the browser debugger.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

laurencefass created an issue. See original summary.

Syntapse’s picture

Title: cekditor is stripping tags » drupal 8 editor is stripping <i> tags
Issue summary: View changes
Daniel.Moberly’s picture

Very true. Unfortunately this is the way the Drupal editor works out of the gate - you have to include a character in the tag normally to keep it in place. For example
<i class="fa fa-flag">&nbsp;</i>
will keep the tag visible. However, this is very counter-intuitive for normal users, as they are expecting to simply use the tags, especially since that is how they are demonstrated on the fontawesome site.

Introducing a patch to prevent both <i> and <span> tags from being stripped when empty in the Drupal CKEditor.

Daniel.Moberly’s picture

Status: Active » Needs review

  • Daniel.Moberly committed c5a804c on 8.x-1.x
    Issue #2925519 by Daniel.Moberly: drupal 8 editor is stripping <i> tags
    
Daniel.Moberly’s picture

Status: Needs review » Reviewed & tested by the community
Syntapse’s picture

adding the nbsp; worked ok but still not displaying font-awesome. cant see any errors in the report.

Syntapse’s picture

applying patch has broken my site...

drupal842@virtualmin:~/public_html/drupal-8.4.2/modules/fontawesome$
config                                          fontawesome.info.yml       fontawesome.module
drupal_8_editor_stripping_tags-2925519-3.patch  fontawesome.install        LICENSE.txt
drush                                           fontawesome.libraries.yml  README.txt
drupal842@virtualmin:~/public_html/drupal-8.4.2/modules/fontawesome$ patch -p1 < drupal_8_editor_stripping_tags-2925519-3.patch
patching file fontawesome.module
Hunk #1 FAILED at 6.
Hunk #2 succeeded at 202 with fuzz 2 (offset 37 lines).
1 out of 2 hunks FAILED -- saving rejects to file fontawesome.module.rej
patching file js/allowEmptyTags.config.js
drupal842@virtualmin:~/public_html/drupal-8.4.2/modules/fontawesome$ drush cr
Cache rebuild complete.                                                                       [ok]
drupal842@virtualmin:~/public_html/drupal-8.4.2/modules/fontawesome$ 
Syntapse’s picture

moved this comment to a new issue.

Daniel.Moberly’s picture

Are you applying the patch against dev or live? The dev version should already have this patch included as it has been committed.

Syntapse’s picture

Status: Reviewed & tested by the community » Closed (works as designed)
Daniel.Moberly’s picture

Status: Closed (works as designed) » Fixed
Daniel.Moberly’s picture

Released in 8.x-1.3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

selwynpolit’s picture

When using basic HTML text format and limiting allowed HTML tags, CKeditor continues to strip out <i> tags even if you add <i class=""> to the allowed HTML tags. I found a workaround that will hopefully help others at https://drupal.stackexchange.com/questions/198783/ckeditor-strips-i-tags

TLDR;
change the Fontawesome Admin>Configuration>Font Awesome settings>Font Awesome Tag from “i” to “span” and add <span class=""> tags to allowed HTML tags. This way Fontawesome won't use <i> tags but will rather use <span> and you can get ckeditor to not strip those out.