Problem/Motivation

The svg for the icons in the Admin Toolbar UI added in [] was manually copied. In the future it would be better if there was a way to automate this, both for this project and any contrib that used icons that are embedded in the plugin code / repo.

Proposed resolution

@reinmar suggested a possible way forward, using an instantiated editor with the plugin added, calling:
editor.ui.componentFactory.create('toolbarItemName')
This returns an object with a number of useful methods, specifically a getter for icon
which returns a string of the svg.

The ckeditor 4 module in core uses a "hidden" fully loaded instance of ckeditor to get the icons for the toolbar,
we could do something similar in a build step- load the editor with the given plugin(s) and write the output svg to a file.

This same method may be useful for getting translated labels as well, since there is also a getter for the tooltip string.

Remaining tasks

  • Determine the best way to automate future icon changes / additions / replacements.
  • Determine how to use the icon, whether that is saved to a file, loaded dynamically in the toolbar ui etc.
  • Decide whether to also get the tooltip label the same way so that tooltips are consistent and also take advantage of CKEditor 5's translation system
CommentFileSizeAuthor
#6 3202598-6.patch1.95 KBwim leers

Comments

zrpnr created an issue. See original summary.

zrpnr’s picture

wim leers’s picture

Talked to Piotr from CKE5.

In ~ few months these icons should be made publicly available, instead of in the current private repo.

wim leers’s picture

Status: Active » Postponed
Issue tags: +Needs upstream feature
wim leers’s picture

We should bring this up in tomorrow’s meeting with the CKEditor 5 team.

wim leers’s picture

Project: CKEditor 5 » Drupal core
Version: 1.0.x-dev » 9.3.x-dev
Component: Code » ckeditor5.module
Status: Postponed » Needs review
Issue tags: -Needs upstream feature
StatusFileSize
new1.95 KB

In ~ few months these icons should be made publicly available, instead of in the current private repo.

Not sure I understand this, because this has been available for years: https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-cor....

This would allow us to delete most of the icons in core/modules/ckeditor5/icons — not the ones that are Drupal-specific.

The issue summary still outlines accurate remaining tasks — plenty of things still need to be figured out.

wim leers’s picture

Title: Follow-up for #3198297 Automate plugin icon extraction » Follow-up for #3198297: automate plugin icon extraction, button label, etc.
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +maintainability

Marking Needs work for getting rid of the other icons in core/modules/ckeditor5/icons … or automatically extracting them as part of the yarn ckeditor5:build command that lives in core/package.json.

The issue summary also covers more than what the title conveys: it also says we should/could be updating the button labels (in ckeditor5.ckeditor5.yml) automatically. Clarified that.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

IOW: the question is whether we should automate the copying of SVGs from https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-cor... into core/modules/ckeditor5/icons.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

Status: Needs work » Closed (works as designed)

We never had this for CKEditor 4 either. This never became an issue there. So let's be pragmatic and retire this issue after ~1.5 years.