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

Possibility to use custom icons in buttons #1530

Closed
f1ames opened this issue Jan 30, 2018 · 0 comments
Closed

Possibility to use custom icons in buttons #1530

f1ames opened this issue Jan 30, 2018 · 0 comments
Labels
changelog:api A changelog entry should be put in the API section of the changelog. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Milestone

Comments

@f1ames
Copy link
Contributor

f1ames commented Jan 30, 2018

Are you reporting a feature request or a bug?

Feature request

Provide detailed reproduction steps (if any)

At the moment button icons can be defined only in two ways:

Automatically based on button/command name like:

editor.ui.addButton( 'Bold', {
    command: 'bold'
} );

The icons used this way must be registered earlier via CKEDITOR.skin.addIcon. Registration happens automatically when icons are defined via pluginDefinition.icons and this is the way it is used in all cases now:

https://github.com/ckeditor/ckeditor-dev/blob/9409e28dadf1564ec35987bcd888dfe6df23ef0d/plugins/basicstyles/plugin.js#L6-L10

This mechanism also assumes that icons are placed under the following path ckeditor_root_folder/plugins/plugin_name/icons/icon_name.png and ckeditor_root_folder/plugins/plugin_name/icons/hidpi/icon_name.png for HiDPI versions.

Reuse icons from other plugins

Button can be also defined like:

editor.ui.addButton( 'Button', {
    command: 'button_command',
    icon: 'name'
} );

And then it will reuse the icons defined (as described above) in other plugin with a given name.

Solution

For more flexibility we would like to add possibility to defined button icon only by passing path to icon image/file to button definition:

editorInstance.ui.addButton( 'MyBold', {
    command: 'bold',
    icon: 'icon_path.png',
    iconHidpi: 'hidpi_icon_path.png'
} );

For more detailed information how paths should be defined and how are resolved, you may refer to docs in the code (or CKEDITOR.ui.addButton SDK after 4.9.0 release):
https://github.com/ckeditor/ckeditor-dev/blob/9409e28dadf1564ec35987bcd888dfe6df23ef0d/plugins/button/plugin.js#L409-L435

@f1ames f1ames added type:feature A feature request. status:confirmed An issue confirmed by the development team. changelog:api A changelog entry should be put in the API section of the changelog. labels Jan 30, 2018
@mlewand mlewand added plugin:easyimage The plugin which probably causes the issue. and removed plugin:easyimage The plugin which probably causes the issue. labels Jan 30, 2018
@Comandeer Comandeer added this to the 4.9.0 milestone Feb 6, 2018
@mlewand mlewand added the target:major Any docs related issue that should be merged into a major branch. label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:api A changelog entry should be put in the API section of the changelog. status:confirmed An issue confirmed by the development team. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Projects
None yet
Development

No branches or pull requests

3 participants