Skip to content

Commit

Permalink
Merge pull request #9197 from ckeditor/i/9196-caption-icon
Browse files Browse the repository at this point in the history
Feature (core): Created the universal caption icon. Closes #9196.

Docs (ckeditor5): Aligned the SVG icons section of the Development environment guide to the latest clean-up-svg-icons behavior (see #9196).
  • Loading branch information
Magdalena Chrześcian authored Mar 10, 2021
2 parents 97366f8 + d110ef2 commit 6dce730
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,5 @@ The script reduces the icon size up to 70%, depending on the software used to cr

**Note**: You may still need to tweak the source code of the SVG files manually after using the script:

* The icons should have the `viewBox` attribute (instead of `width` and `height`). The `removeDimensions` SVGO plugin will not remove `width` and `height` if there is no `viewBox` attribute so make sure it is present.
* Sometimes SVGO leaves empty (transparent) groups `<g>...</g>`. They should be removed from the source.
* Sometimes SVGO leaves empty (transparent) groups `<g>...</g>`. They should be removed from the source and running `clean-up-svg-icons` again usually does that.
* Make sure the number of `<path>` elements is minimal. Merge paths whenever possible in the image processor before saving the file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"style-loader": "^1.2.1",
"stylelint": "^13.5.0",
"stylelint-config-ckeditor5": "^2.0.0",
"svgo": "^1.3.2",
"svgo": "^2.2.2",
"terser-webpack-plugin": "^3.0.2",
"tippy.js": "^6.2.7",
"umberto": "^1.6.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/ckeditor5-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export { default as secureSourceElement } from './editor/utils/securesourceeleme
export { default as PendingActions } from './pendingactions';

import cancel from './../theme/icons/cancel.svg';
import caption from './../theme/icons/caption.svg';
import check from './../theme/icons/check.svg';
import eraser from './../theme/icons/eraser.svg';
import lowVision from './../theme/icons/low-vision.svg';
Expand All @@ -51,6 +52,7 @@ import threeVerticalDots from './../theme/icons/three-vertical-dots.svg';

export const icons = {
cancel,
caption,
check,
eraser,
lowVision,
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-core/theme/icons/caption.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/clean-up-svg-icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ do
then
echo "\x1B[33m[clean-up-svg-icons]\x1B[0m Note: \"$i\" is blacklisted, skipping."
else
svgo --config=./scripts/svgo.config.json -i $i
svgo --config=./scripts/svgo.config.js -i $i
fi
done
34 changes: 34 additions & 0 deletions scripts/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* eslint-env node */

const { extendDefaultPlugins } = require( 'svgo' );

module.exports = {
plugins: extendDefaultPlugins( [
{
name: 'removeViewBox',
active: false
},
{ name: 'collapseGroups' },
{ name: 'removeDimensions' },
{
name: 'removeAttrs',
params: {
attrs: '(fill|stroke|fill-rule)'
}
},
{
name: 'convertPathData',
params: {
noSpaceAfterFlags: false
}
},
{ name: 'removeTitle' },
{ name: 'removeComments' },
{ name: 'removeMetadata' }
] )
};
11 changes: 0 additions & 11 deletions scripts/svgo.config.json

This file was deleted.

0 comments on commit 6dce730

Please sign in to comment.