Wysiwyg-editor: We need Support for Font Awesome 5

Created on 13 Dec 2017  路  6Comments  路  Source: froala/wysiwyg-editor

Expected behavior.

Just upgraded our site to font awesome-5 using the provided shim. We expected everything to work

Actual behavior.

Froala toolbar looks bad:

  1. Each icon takes variable amount of space
  2. Wherever there is a caret it shows on top of the previous icon

screen shot 2017-12-13 at 12 15 09 pm

enhancement

Most helpful comment

FWIW, you can probably just do this:

$.FE.DefineIcon('undo', { NAME: 'undo' });
$.FE.DefineIcon('redo', { NAME: 'redo' });

All 6 comments

As a really really ugly workaround for missing icons, I use this until froala will support FA5

$('.my-textarea').on('froalaEditor.initialized', (e, editor) => {
    editor.$box.find('.fr-toolbar').find('i').each((_, i) => {
        const $i = $(i);

        $i.removeClass('fa')
            .addClass('fa-lg')
            .addClass('fal')
            .css({fontSize: 'inherit'});

        const replace = {
            'fa-rotate-left': 'fa-undo',
            'fa-rotate-right': 'fa-redo',
            'fa-video-camera': 'fa-camera-retro',
            'fa-file-o': 'fa-file'
        }

        Object.keys(replace).forEach(key => {
            if ($i.hasClass(key)) {
                $i.removeClass(key).addClass(replace[key])
            }
        })
    })
});

FWIW, you can probably just do this:

$.FE.DefineIcon('undo', { NAME: 'undo' });
$.FE.DefineIcon('redo', { NAME: 'redo' });

@gae123 last commit should do the trick. Please follow the instructions from for including the shim https://fontawesome.com/how-to-use/upgrading-from-4.

@stefanneculai do you have a rough estimation on when this will be flagged as a release and for the ember version to follow suit?

@gae123 @robclancy in the meantime if you switch to using web fonts with FA5, it will work properly (still need the shim). They're directly styling i tags in their css, so you don't want FA5 to change those to SVG.

Our update still won't be out for a week or 2 that includes the font awesome update so can probably wait. And I don't like that they force old icons to work with the new ones, I want them both to be able to work together during a transition period but they have hardcoded it in FA5 to use SVG icons for FA4. So I am more likely to run a custom version with that stuff hacked out (it's 3 lines I need to comment out to make it work, FA5 should have it wrapped in an option tbh).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kikeso77 picture kikeso77  路  3Comments

studiotemple picture studiotemple  路  3Comments

adilsonb picture adilsonb  路  3Comments

cristianst picture cristianst  路  4Comments

bbugh picture bbugh  路  3Comments