Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with adding icons with capital letters #5059

Closed
ScottYeadon opened this issue Jul 2, 2019 · 1 comment · Fixed by #5717
Closed

Problem with adding icons with capital letters #5059

ScottYeadon opened this issue Jul 2, 2019 · 1 comment · Fixed by #5717

Comments

@ScottYeadon
Copy link

Icons display a bomb icon instead of loading the correct icon. See issue #4887 as it still seems to be a problem in 5.0.9

So I create the file:

/icons/custom/icons.js:

tinymce.IconManager.add('custom', {
icons: {
'myCustomIcon': '...'
}
});

Init code:
tinymce.init({
...
icons: 'custom'
});

When you do the addButton operation in a plugin the icon is not displayed. No errors are shown in the console.
tinymce.PluginManager.add('adbplugins', function(editor, url) {
editor.ui.registry.addButton('customButton', {
tooltip: 'A sample custom button',
icon: 'myCustomIcon',
onAction: function(buttonApi) { /* some code */}
});

I have only tested on 5.0.9.

@lnewson
Copy link
Contributor

lnewson commented Jul 2, 2019

@ScottYeadon thanks for the report! I was able to verify the issue, however it's not the same as #4887. The problem appears to be that because we lowercase everything when adding it to the registry, the icon name in the button spec doesn't match so it fallsback to our "placeholder" icon. So it seems as though the issue is that when doing the name lookup for the button icon we aren't lowercasing the name. I'll log an internal task for us to fix that up.

Here's a working example from your snippets above, where all I did to get it working was to change myCustomIcon to mycustomicon: http://fiddle.tinymce.com/ILgaab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants