magefan / module-wysiwyg-advanced

Extend TinyMCE 4 & 5 tools in Magento 2
https://magefan.com/magento2-extensions
71 stars 18 forks source link

Configure to not remove i elements or modify them to em when using for icons e.g. css classes are present. #13

Open LiamKarlMitchell opened 4 years ago

LiamKarlMitchell commented 4 years ago

The i tag is used for icons in the front end WeltPixel Pearl theme for example.

image

Test
<i class="footer-icon icon-line-clock"></i>
Test

Click show editor. Click hide editor.

image

The html is modified the i tag was removed as part of cleanup because it is "empty".

<p>Test Test</p>

Their theme installs sample data to modify which includes a lot of various tags, which all get wiped when editing.

You can work around it by using an html comment inside the i tag, which works but then the i tag is changed to an em tag. Seems to still work but weird behavior.

Related: https://github.com/magento/magento2/issues/21602 https://github.com/tinymce/tinymce/issues/2689#issuecomment-391686340

Additionally, when in WYSIWYG edit, no icon shows but I think that is because admin does not load child theme css. Any workaround for this?

Is there a hook or way to modify the Tiny MCE to not remove such tags?

Thanks