Skip to content

Commit

Permalink
Merge pull request #15440 from ckeditor/ck/15414
Browse files Browse the repository at this point in the history
Other: The `undo` and `redo` toolbar components described in the `@ckeditor/ckeditor5-essentials/src/ckeditor5-metadata.json` file are now defined in the package that registers those buttons (`@ckeditor/ckeditor5-undo`). Closes #15414.

Internal: The metadata validator does not accept an empty value of the `iconPath` field when checking the availability of SVG icons in a package.
  • Loading branch information
pomek authored Dec 5, 2023
2 parents 767e681 + 2860d24 commit 0b9552b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
12 changes: 0 additions & 12 deletions packages/ckeditor5-essentials/ckeditor5-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@
"className": "Essentials",
"description": "Includes all essential editing features like the clipboard, <kbd>Enter</kbd> and <kbd>Shift</kbd>+<kbd>Enter</kbd> keystrokes, typing and the undo support.",
"path": "src/essentials.js",
"uiComponents": [
{
"type": "Button",
"name": "undo",
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/undo.svg"
},
{
"type": "Button",
"name": "redo",
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/redo.svg"
}
],
"htmlOutput": [
{
"elements": "br"
Expand Down
6 changes: 3 additions & 3 deletions packages/ckeditor5-image/ckeditor5-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
"type": "Button",
"name": "imageTextAlternative",
"iconPath": "",
"iconPath": "@ckeditor/ckeditor5-core/theme/icons/text-alternative.svg",
"toolbars": [
"image.toolbar"
]
Expand Down Expand Up @@ -57,7 +57,7 @@
{
"type": "Button",
"name": "imageTextAlternative",
"iconPath": "",
"iconPath": "@ckeditor/ckeditor5-core/theme/icons/text-alternative.svg",
"toolbars": [
"image.toolbar"
]
Expand Down Expand Up @@ -97,7 +97,7 @@
{
"type": "Button",
"name": "toggleImageCaption",
"iconPath": "",
"iconPath": "@ckeditor/ckeditor5-core/theme/icons/caption.svg",
"toolbars": [
"image.toolbar"
]
Expand Down
23 changes: 23 additions & 0 deletions packages/ckeditor5-undo/ckeditor5-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"plugins": [
{
"name": "Undo",
"className": "Undo",
"description": "Support the undo and redo functionalities.",
"docs": "features/undo-redo.html",
"path": "src/undo.js",
"uiComponents": [
{
"type": "Button",
"name": "undo",
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/undo.svg"
},
{
"type": "Button",
"name": "redo",
"iconPath": "@ckeditor/ckeditor5-undo/theme/icons/redo.svg"
}
]
}
]
}
14 changes: 11 additions & 3 deletions scripts/ci/validate-metadata-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,17 @@ function getMissingExports( packageData ) {
function getMissingIcons( packageData, options ) {
return packageData.metadata.plugins
.filter( plugin => plugin.uiComponents )
.flatMap( plugin => plugin.uiComponents.map( uiComponent => uiComponent.iconPath ) )
.filter( Boolean )
.map( iconPath => {
.flatMap( plugin => plugin.uiComponents.map( uiComponent => ( {
...plugin,
iconPath: uiComponent.iconPath,
uiComponentName: uiComponent.name
} ) ) )
.filter( ( { iconPath } ) => iconPath !== undefined )
.map( ( { iconPath, name, uiComponentName } ) => {
if ( iconPath === '' ) {
return `${ name } (\`${ uiComponentName }\`) has an empty \`iconPath\` value. Either define or remove it.`;
}

if ( iconPath.startsWith( '@ckeditor/' ) ) {
return iconPath;
}
Expand Down

0 comments on commit 0b9552b

Please sign in to comment.