From 6acff1d0f2364c6bba5a67c43f62bc028eb72663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Fri, 30 Oct 2020 14:26:44 +0100 Subject: [PATCH 1/9] Renamed buttons and commands --- CHANGELOG.md | 4 +- docs/_snippets/examples/inline-editor.js | 8 +- docs/_snippets/examples/multi-root-editor.js | 2 +- .../guides/integration/advanced-setup.md | 4 +- .../guides/integration/installing-plugins.md | 2 +- .../framework/guides/custom-editor-creator.md | 2 +- .../tests/manual/uploadadapter.js | 2 +- .../src/ckeditor.js | 2 +- .../ckeditor5-build-balloon/src/ckeditor.js | 2 +- .../ckeditor5-build-classic/src/ckeditor.js | 2 +- .../src/ckeditor.js | 2 +- .../ckeditor5-build-inline/src/ckeditor.js | 2 +- packages/ckeditor5-ckfinder/CHANGELOG.md | 2 +- .../features/ckfinder-upload-only.js | 2 +- .../docs/features/ckfinder.md | 8 +- .../ckeditor5-ckfinder/src/ckfindercommand.js | 8 +- .../tests/ckfindercommand.js | 4 +- packages/ckeditor5-core/src/command.js | 2 +- .../docs/features/easy-image.md | 2 +- .../ckeditor5-easy-image/tests/easyimage.js | 2 +- .../tests/manual/easyimage.js | 2 +- .../docs/_snippets/features/title.js | 2 +- .../ckeditor5-heading/tests/manual/title.js | 4 +- .../_snippets/features/horizontal-line.js | 2 +- .../tests/horizontallineediting.js | 2 +- .../tests/manual/horizontalline.js | 2 +- .../docs/_snippets/features/html-embed.js | 2 +- packages/ckeditor5-image/CHANGELOG.md | 12 +-- .../features/image-insert-via-url.js | 2 +- .../features/image-resize-buttons-dropdown.js | 8 +- .../features/image-resize-buttons.js | 12 +-- .../_snippets/features/image-resize-px.js | 8 +- .../features/image-style-presentational.js | 8 +- .../ckeditor5-image/docs/features/image.md | 54 ++++++------- .../ckeditor5-image/src/image/imageediting.js | 11 ++- .../src/image/imageinsertcommand.js | 11 +-- packages/ckeditor5-image/src/imageinsert.js | 2 +- .../src/imageinsert/imageinsertui.js | 22 +++--- packages/ckeditor5-image/src/imageresize.js | 42 +++++------ .../src/imageresize/imageresizebuttons.js | 21 +++--- .../src/imageresize/imageresizecommand.js | 8 +- .../src/imageresize/imageresizeediting.js | 16 ++-- .../src/imageresize/imageresizehandles.js | 4 +- .../src/imageupload/imageuploadcommand.js | 11 +-- .../src/imageupload/imageuploadediting.js | 14 ++-- .../src/imageupload/imageuploadui.js | 17 +++-- .../tests/image/imageediting.js | 10 ++- .../tests/image/imageinsertcommand.js | 6 +- .../tests/imageinsert/imageinsertui.js | 25 ++++--- .../tests/imageresize/imageresizebuttons.js | 75 ++++++++++--------- .../tests/imageresize/imageresizecommand.js | 4 +- .../tests/imageresize/imageresizeediting.js | 18 +++-- .../tests/imageresize/imageresizehandles.js | 12 +-- .../tests/imageupload/imageuploadcommand.js | 6 +- .../tests/imageupload/imageuploadediting.js | 34 +++++---- .../tests/imageupload/imageuploadprogress.js | 14 ++-- .../tests/imageupload/imageuploadui.js | 51 +++++++------ .../tests/manual/imageinsertviaurl.js | 2 +- .../tests/manual/imageinsertviaurl.md | 6 +- .../tests/manual/imageresize.js | 2 +- .../tests/manual/imageresizebuttons.js | 20 ++--- .../tests/manual/imageresizepx.js | 2 +- .../tests/manual/imageupload.js | 2 +- .../docs/_snippets/features/lists-basic.js | 2 +- .../docs/_snippets/features/lists-style.js | 2 +- .../src/todolistcheckcommand.js | 8 +- .../ckeditor5-list/src/todolistediting.js | 18 +++-- .../tests/todolistcheckcommand.js | 6 +- .../ckeditor5-list/tests/todolistediting.js | 22 +++--- .../docs/_snippets/features/page-break.js | 2 +- .../tests/manual/pagebreak.js | 2 +- .../tests/pagebreakediting.js | 2 +- .../_snippets/features/paste-from-office.js | 2 +- .../special-characters-extended-category.js | 2 +- .../special-characters-limited-categories.js | 2 +- .../special-characters-new-category.js | 2 +- .../_snippets/features/special-characters.js | 2 +- .../tests/manual/specialcharacters.js | 2 +- .../docs/_snippets/features/blocktoolbar.js | 2 +- .../docs/features/blocktoolbar.md | 4 +- packages/ckeditor5-upload/CHANGELOG.md | 8 +- packages/ckeditor5-widget/src/widgetresize.js | 2 +- tests/manual/all-features.js | 10 +-- tests/manual/mathtype.js | 2 +- tests/manual/memory/memory.js | 2 +- tests/manual/wproofreader.js | 2 +- 86 files changed, 413 insertions(+), 347 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d2bdcb3a9..c9ed27ef313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ The CKEditor 5 Collaboration features changelog can be found here: https://ckedi ### MAJOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes) -* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: In order to use the "insert image via URL" feature you now need to load the `ImageInsert` plugin and use the `imageInsert` button instead of the `imageUpload` button that implemented this functionality previously. +* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: In order to use the "insert image via URL" feature you now need to load the `ImageInsert` plugin and use the `insertImage` button instead of the `uploadImage` button that implemented this functionality previously. ### MINOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes) @@ -57,7 +57,7 @@ The CKEditor 5 Collaboration features changelog can be found here: https://ckedi ### Other changes * **[cloud-services-core](https://www.npmjs.com/package/@ckeditor/ckeditor-cloud-services-core)**: Change the token refreshing mechanism to depend on the token expiration time. ([commit](https://github.com/ckeditor/ckeditor5/commit/501490a5729c413ee00311fe3c9a965fab2bb2ad)) -* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `config.image.upload.panel.items` option does not need to be set anymore in order to show the "insert image via URL form". It is enough to load the new `ImageInsert` plugin and use the new `imageInsert` button. See [#8034](https://github.com/ckeditor/ckeditor5/issues/8034). ([commit](https://github.com/ckeditor/ckeditor5/commit/48a9e943122e4cdd0e2647f03ebc7b17c402710e)) +* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `config.image.upload.panel.items` option does not need to be set anymore in order to show the "insert image via URL form". It is enough to load the new `ImageInsert` plugin and use the new `insertImage` button. See [#8034](https://github.com/ckeditor/ckeditor5/issues/8034). ([commit](https://github.com/ckeditor/ckeditor5/commit/48a9e943122e4cdd0e2647f03ebc7b17c402710e)) * **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: Introduced `ImageInsert` as a standalone plugin that contains the `ImageUpload` functionality. Closes [#7890](https://github.com/ckeditor/ckeditor5/issues/7890). ([commit](https://github.com/ckeditor/ckeditor5/commit/4671ed10a4af4c507abd594414771b714ff31cf7)) * **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `ImageUploadPanelView` form label should change depending on whether the image is selected or not. Closes [#7878](https://github.com/ckeditor/ckeditor5/issues/7878). ([commit](https://github.com/ckeditor/ckeditor5/commit/288fb97e00181a130dd2833d6e3aa74bdab5b7cc)) * **[link](https://www.npmjs.com/package/@ckeditor/ckeditor5-link)**: The link plugin now comes with the autolink feature enabled by default. Closes [#7682](https://github.com/ckeditor/ckeditor5/issues/7682). ([commit](https://github.com/ckeditor/ckeditor5/commit/c9533f1752057fd833998a356282f8a625f4e39c)) diff --git a/docs/_snippets/examples/inline-editor.js b/docs/_snippets/examples/inline-editor.js index 694a421b75b..7d811dde634 100644 --- a/docs/_snippets/examples/inline-editor.js +++ b/docs/_snippets/examples/inline-editor.js @@ -38,17 +38,17 @@ Array.from( inlineInjectElements ).forEach( inlineElement => { config.image = { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } @@ -59,7 +59,7 @@ Array.from( inlineInjectElements ).forEach( inlineElement => { 'imageStyle:full', 'imageStyle:alignRight', '|', - 'imageResize', + 'resizeImage', '|', 'imageTextAlternative' ] diff --git a/docs/_snippets/examples/multi-root-editor.js b/docs/_snippets/examples/multi-root-editor.js index b23a7c8f23d..d0a8c63240c 100644 --- a/docs/_snippets/examples/multi-root-editor.js +++ b/docs/_snippets/examples/multi-root-editor.js @@ -401,7 +401,7 @@ MultirootEditor }, { plugins: [ Essentials, Paragraph, Heading, Bold, Italic, List, Link, BlockQuote, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Table, TableToolbar, MediaEmbed, EasyImage ], - toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'imageUpload', 'blockQuote', + toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', 'undo', 'redo' ], image: { toolbar: [ 'imageTextAlternative', '|', 'imageStyle:full', diff --git a/docs/builds/guides/integration/advanced-setup.md b/docs/builds/guides/integration/advanced-setup.md index dd331f83412..f3805d56096 100644 --- a/docs/builds/guides/integration/advanced-setup.md +++ b/docs/builds/guides/integration/advanced-setup.md @@ -257,7 +257,7 @@ ClassicEditor.defaultConfig = { 'link', 'bulletedList', 'numberedList', - 'imageUpload', + 'uploadImage', 'blockQuote', 'undo', 'redo' @@ -344,7 +344,7 @@ ClassicEditor 'link', 'bulletedList', 'numberedList', - 'imageUpload', + 'uploadImage', 'blockQuote', 'undo', 'redo' diff --git a/docs/builds/guides/integration/installing-plugins.md b/docs/builds/guides/integration/installing-plugins.md index 82cce989133..8a84e6e0b4c 100644 --- a/docs/builds/guides/integration/installing-plugins.md +++ b/docs/builds/guides/integration/installing-plugins.md @@ -106,7 +106,7 @@ ClassicEditor.defaultConfig = { 'link', 'bulletedList', 'numberedList', - 'imageUpload', + 'uploadImage', 'blockQuote', 'undo', 'redo' diff --git a/docs/framework/guides/custom-editor-creator.md b/docs/framework/guides/custom-editor-creator.md index 71892d5ae64..ad14644b4ea 100644 --- a/docs/framework/guides/custom-editor-creator.md +++ b/docs/framework/guides/custom-editor-creator.md @@ -450,7 +450,7 @@ MultirootEditor }, { plugins: [ Essentials, Paragraph, Heading, Bold, Italic, List, Link, BlockQuote, Image, ImageCaption, ImageStyle, ImageToolbar, ImageUpload, Table, TableToolbar, MediaEmbed, EasyImage ], - toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'imageUpload', 'blockQuote', + toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', 'undo', 'redo' ], image: { toolbar: [ 'imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight' ], diff --git a/packages/ckeditor5-adapter-ckfinder/tests/manual/uploadadapter.js b/packages/ckeditor5-adapter-ckfinder/tests/manual/uploadadapter.js index c3a6a0a42bb..73606eb01e8 100644 --- a/packages/ckeditor5-adapter-ckfinder/tests/manual/uploadadapter.js +++ b/packages/ckeditor5-adapter-ckfinder/tests/manual/uploadadapter.js @@ -28,7 +28,7 @@ ClassicEditor Enter, Typing, Paragraph, Heading, Undo, Bold, Italic, Heading, List, Image, ImageToolbar, Clipboard, ImageCaption, ImageStyle, ImageUpload, CKFinderUploadAdapter ], - toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'imageUpload' ], + toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'uploadImage' ], ckfinder: { // eslint-disable-next-line max-len uploadUrl: 'https://cksource.com/weuy2g4ryt278ywiue/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json' diff --git a/packages/ckeditor5-build-balloon-block/src/ckeditor.js b/packages/ckeditor5-build-balloon-block/src/ckeditor.js index 9aa2961d6a3..e65d1bbc22e 100644 --- a/packages/ckeditor5-build-balloon-block/src/ckeditor.js +++ b/packages/ckeditor5-build-balloon-block/src/ckeditor.js @@ -74,7 +74,7 @@ BalloonEditor.defaultConfig = { 'indent', 'outdent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', diff --git a/packages/ckeditor5-build-balloon/src/ckeditor.js b/packages/ckeditor5-build-balloon/src/ckeditor.js index 41f741f8b0f..09ee4f6d0f5 100644 --- a/packages/ckeditor5-build-balloon/src/ckeditor.js +++ b/packages/ckeditor5-build-balloon/src/ckeditor.js @@ -74,7 +74,7 @@ BalloonEditor.defaultConfig = { 'indent', 'outdent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', diff --git a/packages/ckeditor5-build-classic/src/ckeditor.js b/packages/ckeditor5-build-classic/src/ckeditor.js index 7289c2e1c40..3d2d4359310 100644 --- a/packages/ckeditor5-build-classic/src/ckeditor.js +++ b/packages/ckeditor5-build-classic/src/ckeditor.js @@ -74,7 +74,7 @@ ClassicEditor.defaultConfig = { 'indent', 'outdent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', diff --git a/packages/ckeditor5-build-decoupled-document/src/ckeditor.js b/packages/ckeditor5-build-decoupled-document/src/ckeditor.js index a89cef6a75a..cf169139e6c 100644 --- a/packages/ckeditor5-build-decoupled-document/src/ckeditor.js +++ b/packages/ckeditor5-build-decoupled-document/src/ckeditor.js @@ -103,7 +103,7 @@ DecoupledEditor.defaultConfig = { '|', 'link', 'blockquote', - 'imageUpload', + 'uploadImage', 'insertTable', 'mediaEmbed', '|', diff --git a/packages/ckeditor5-build-inline/src/ckeditor.js b/packages/ckeditor5-build-inline/src/ckeditor.js index 0b706f66554..97eba44f0fb 100644 --- a/packages/ckeditor5-build-inline/src/ckeditor.js +++ b/packages/ckeditor5-build-inline/src/ckeditor.js @@ -74,7 +74,7 @@ InlineEditor.defaultConfig = { 'indent', 'outdent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', diff --git a/packages/ckeditor5-ckfinder/CHANGELOG.md b/packages/ckeditor5-ckfinder/CHANGELOG.md index 940eb729491..09314bb4563 100644 --- a/packages/ckeditor5-ckfinder/CHANGELOG.md +++ b/packages/ckeditor5-ckfinder/CHANGELOG.md @@ -33,7 +33,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* CKFinderCommand should work when either `'link'` or `'imageInsert'` command is enabled. Closes [#48](https://github.com/ckeditor/ckeditor5-ckfinder/issues/48). ([d82a762](https://github.com/ckeditor/ckeditor5-ckfinder/commit/d82a762)) +* CKFinderCommand should work when either `'link'` or `'insertImage'` command is enabled. Closes [#48](https://github.com/ckeditor/ckeditor5-ckfinder/issues/48). ([d82a762](https://github.com/ckeditor/ckeditor5-ckfinder/commit/d82a762)) ### Other changes diff --git a/packages/ckeditor5-ckfinder/docs/_snippets/features/ckfinder-upload-only.js b/packages/ckeditor5-ckfinder/docs/_snippets/features/ckfinder-upload-only.js index a1f2f767545..0cfe46e23c5 100644 --- a/packages/ckeditor5-ckfinder/docs/_snippets/features/ckfinder-upload-only.js +++ b/packages/ckeditor5-ckfinder/docs/_snippets/features/ckfinder-upload-only.js @@ -9,7 +9,7 @@ ClassicEditor .create( document.querySelector( '#snippet-ckfinder-upload-only' ), { toolbar: { items: [ - 'imageUpload', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo' + 'uploadImage', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo' ], viewportTopOffset: 100 }, diff --git a/packages/ckeditor5-ckfinder/docs/features/ckfinder.md b/packages/ckeditor5-ckfinder/docs/features/ckfinder.md index 4928d39ff89..f1c110daf8a 100644 --- a/packages/ckeditor5-ckfinder/docs/features/ckfinder.md +++ b/packages/ckeditor5-ckfinder/docs/features/ckfinder.md @@ -72,7 +72,7 @@ ClassicEditor plugins: [ CKFinder, ... ], // Enable the "Insert image" button in the toolbar. - toolbar: [ 'imageUpload', ... ], + toolbar: [ 'uploadImage', ... ], ckfinder: { // Upload the images to the server using the CKFinder QuickUpload command. @@ -189,7 +189,7 @@ import CKFinder from '@ckeditor/ckeditor5-ckfinder/src/ckfinder'; ClassicEditor .create( document.querySelector( '#editor' ), { plugins: [ CKFinder, ... ], - toolbar: [ 'ckfinder', 'imageUpload' ... ], // Depending on your preference. + toolbar: [ 'ckfinder', 'uploadImage' ... ], // Depending on your preference. ckfinder: { // Feature configuration. } @@ -213,8 +213,8 @@ The {@link module:ckfinder/ckfinder~CKFinder} plugin registers: Additionally, in the "image upload only" integration, you can use the following button and command registered by the {@link module:image/imageupload~ImageUpload} plugin: -* The `'imageUpload'` UI button component. -* The `'imageUpload'` command implemented by the {@link module:image/imageupload/imageuploadcommand~ImageUploadCommand}. +* The `'uploadImage'` UI button component. +* The `'uploadImage'` command implemented by the {@link module:image/imageupload/uploadimagecommand~UploadImageCommand}. We recommend using the official {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more. diff --git a/packages/ckeditor5-ckfinder/src/ckfindercommand.js b/packages/ckeditor5-ckfinder/src/ckfindercommand.js index 551b36e16f4..7a35a90cbb8 100644 --- a/packages/ckeditor5-ckfinder/src/ckfindercommand.js +++ b/packages/ckeditor5-ckfinder/src/ckfindercommand.js @@ -19,7 +19,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; * editor.execute( 'ckfinder' ); * * **Note:** This command uses other features to perform tasks: - * - To insert images the {@link module:image/image/imageinsertcommand~ImageInsertCommand 'imageInsert'} command + * - To insert images the {@link module:image/image/insertimagecommand~InsertImageCommand 'insertImage'} command * from the {@link module:image/image~Image Image feature}. * - To insert links to files the {@link module:link/linkcommand~LinkCommand 'link'} command * from the {@link module:link/link~Link Link feature}. @@ -44,7 +44,7 @@ export default class CKFinderCommand extends Command { * @inheritDoc */ refresh() { - const imageCommand = this.editor.commands.get( 'imageInsert' ); + const imageCommand = this.editor.commands.get( 'insertImage' ); const linkCommand = this.editor.commands.get( 'link' ); // The CKFinder command is enabled when one of image or link command is enabled. @@ -135,7 +135,7 @@ export default class CKFinderCommand extends Command { } function insertImages( editor, urls ) { - const imageCommand = editor.commands.get( 'imageInsert' ); + const imageCommand = editor.commands.get( 'insertImage' ); // Check if inserting an image is actually possible - it might be possible to only insert a link. if ( !imageCommand.isEnabled ) { @@ -150,5 +150,5 @@ function insertImages( editor, urls ) { return; } - editor.execute( 'imageInsert', { source: urls } ); + editor.execute( 'insertImage', { source: urls } ); } diff --git a/packages/ckeditor5-ckfinder/tests/ckfindercommand.js b/packages/ckeditor5-ckfinder/tests/ckfindercommand.js index f4793098ac9..659392686cd 100644 --- a/packages/ckeditor5-ckfinder/tests/ckfindercommand.js +++ b/packages/ckeditor5-ckfinder/tests/ckfindercommand.js @@ -105,9 +105,9 @@ describe( 'CKFinderCommand', () => { expect( command.isEnabled ).to.be.false; } ); - it( 'should be true when imageInsert or link command is enabled', () => { + it( 'should be true when insertImage or link command is enabled', () => { setModelData( model, '[]' ); - const insertImage = editor.commands.get( 'imageInsert' ); + const insertImage = editor.commands.get( 'insertImage' ); const linkCommand = editor.commands.get( 'link' ); insertImage.isEnabled = false; diff --git a/packages/ckeditor5-core/src/command.js b/packages/ckeditor5-core/src/command.js index f822727b125..7b469d85276 100644 --- a/packages/ckeditor5-core/src/command.js +++ b/packages/ckeditor5-core/src/command.js @@ -45,7 +45,7 @@ export default class Command { * For example, the `'bold'` command's value indicates whether the selection starts in a bolded text. * And the value of the `'link'` command may be an object with links details. * - * It is possible for a command to have no value (e.g. for stateless actions such as `'imageUpload'`). + * It is possible for a command to have no value (e.g. for stateless actions such as `'uploadImage'`). * * A concrete command class should control this value by overriding the {@link #refresh `refresh()`} method. * diff --git a/packages/ckeditor5-easy-image/docs/features/easy-image.md b/packages/ckeditor5-easy-image/docs/features/easy-image.md index c64a10e1db3..e47c85d893d 100644 --- a/packages/ckeditor5-easy-image/docs/features/easy-image.md +++ b/packages/ckeditor5-easy-image/docs/features/easy-image.md @@ -132,7 +132,7 @@ import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage'; ClassicEditor .create( document.querySelector( '#editor' ), { plugins: [ EasyImage, ... ], - toolbar: [ 'imageUpload', ... ], + toolbar: [ 'uploadImage', ... ], // Configure the endpoint. See the "Configuration" section above. cloudServices: { diff --git a/packages/ckeditor5-easy-image/tests/easyimage.js b/packages/ckeditor5-easy-image/tests/easyimage.js index 79fcf2b8aac..0c2108deb8c 100644 --- a/packages/ckeditor5-easy-image/tests/easyimage.js +++ b/packages/ckeditor5-easy-image/tests/easyimage.js @@ -122,7 +122,7 @@ describe( 'EasyImage', () => { } } ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); setTimeout( () => { upload._uploadGateway.resolveLastUpload(); diff --git a/packages/ckeditor5-easy-image/tests/manual/easyimage.js b/packages/ckeditor5-easy-image/tests/manual/easyimage.js index 68ef38b891d..7e445363ab2 100644 --- a/packages/ckeditor5-easy-image/tests/manual/easyimage.js +++ b/packages/ckeditor5-easy-image/tests/manual/easyimage.js @@ -25,7 +25,7 @@ ClassicEditor 'bulletedList', 'numberedList', 'blockQuote', - 'imageUpload', + 'uploadImage', 'insertTable', 'mediaEmbed', 'undo', diff --git a/packages/ckeditor5-heading/docs/_snippets/features/title.js b/packages/ckeditor5-heading/docs/_snippets/features/title.js index 3baa5639c5d..6cc3d0af9fc 100644 --- a/packages/ckeditor5-heading/docs/_snippets/features/title.js +++ b/packages/ckeditor5-heading/docs/_snippets/features/title.js @@ -22,7 +22,7 @@ BaloonBlockEditor 'outdent', 'indent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed' diff --git a/packages/ckeditor5-heading/tests/manual/title.js b/packages/ckeditor5-heading/tests/manual/title.js index e7826aa0173..99213b53be6 100644 --- a/packages/ckeditor5-heading/tests/manual/title.js +++ b/packages/ckeditor5-heading/tests/manual/title.js @@ -21,7 +21,7 @@ import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment'; ClassicEditor .create( document.querySelector( '#editor1' ), { plugins: [ Enter, Typing, Undo, Heading, Title, Clipboard, Image, ImageUpload, Bold, Alignment ], - toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'imageUpload', 'alignment' ] + toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'uploadImage', 'alignment' ] } ) .then( editor => { window.editor = editor; @@ -35,7 +35,7 @@ ClassicEditor ClassicEditor .create( document.querySelector( '#editor2' ), { plugins: [ Enter, Typing, Undo, Heading, Title, Clipboard, Image, ImageUpload, Bold, Alignment ], - toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'imageUpload', 'alignment' ], + toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'uploadImage', 'alignment' ], placeholder: 'Custom body placeholder', title: { placeholder: 'Custom title placeholder' diff --git a/packages/ckeditor5-horizontal-line/docs/_snippets/features/horizontal-line.js b/packages/ckeditor5-horizontal-line/docs/_snippets/features/horizontal-line.js index 48310eec928..e2d05bc910d 100644 --- a/packages/ckeditor5-horizontal-line/docs/_snippets/features/horizontal-line.js +++ b/packages/ckeditor5-horizontal-line/docs/_snippets/features/horizontal-line.js @@ -32,7 +32,7 @@ ClassicEditor 'horizontalLine', 'blockQuote', 'link', - 'imageUpload', + 'uploadImage', 'mediaEmbed', 'insertTable', '|', diff --git a/packages/ckeditor5-horizontal-line/tests/horizontallineediting.js b/packages/ckeditor5-horizontal-line/tests/horizontallineediting.js index 4e366863542..a118b452fd1 100644 --- a/packages/ckeditor5-horizontal-line/tests/horizontallineediting.js +++ b/packages/ckeditor5-horizontal-line/tests/horizontallineediting.js @@ -46,7 +46,7 @@ describe( 'HorizontalLineEditing', () => { expect( model.schema.checkChild( [ '$root', '$block' ], 'horizontalLine' ) ).to.be.false; } ); - it( 'should register imageInsert command', () => { + it( 'should register horizontalLine command', () => { expect( editor.commands.get( 'horizontalLine' ) ).to.be.instanceOf( HorizontalLineCommand ); } ); diff --git a/packages/ckeditor5-horizontal-line/tests/manual/horizontalline.js b/packages/ckeditor5-horizontal-line/tests/manual/horizontalline.js index 16a31e778a0..0d9ebea3f61 100644 --- a/packages/ckeditor5-horizontal-line/tests/manual/horizontalline.js +++ b/packages/ckeditor5-horizontal-line/tests/manual/horizontalline.js @@ -21,7 +21,7 @@ ClassicEditor '|', 'bold', 'italic', 'numberedList', 'bulletedList', '|', - 'link', 'blockquote', 'imageUpload', 'insertTable', 'mediaEmbed', + 'link', 'blockquote', 'uploadImage', 'insertTable', 'mediaEmbed', '|', 'undo', 'redo', '|', diff --git a/packages/ckeditor5-html-embed/docs/_snippets/features/html-embed.js b/packages/ckeditor5-html-embed/docs/_snippets/features/html-embed.js index 68ca1d7e14e..6d560d3b026 100644 --- a/packages/ckeditor5-html-embed/docs/_snippets/features/html-embed.js +++ b/packages/ckeditor5-html-embed/docs/_snippets/features/html-embed.js @@ -69,7 +69,7 @@ async function reloadEditor( config = {} ) { '|', 'blockQuote', 'link', - 'imageUpload', + 'uploadImage', 'mediaEmbed', 'insertTable', 'htmlEmbed', diff --git a/packages/ckeditor5-image/CHANGELOG.md b/packages/ckeditor5-image/CHANGELOG.md index 39c89121927..86cf765ff73 100644 --- a/packages/ckeditor5-image/CHANGELOG.md +++ b/packages/ckeditor5-image/CHANGELOG.md @@ -159,7 +159,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Features * Improved responsiveness of the text alternative view in narrow viewports (see [ckeditor/ckeditor5#416](https://github.com/ckeditor/ckeditor5/issues/416)). ([ff5394a](https://github.com/ckeditor/ckeditor5-image/commit/ff5394a)) -* Introduced the `'imageInsert'` command. Closes [#245](https://github.com/ckeditor/ckeditor5-image/issues/245). Closes [#251](https://github.com/ckeditor/ckeditor5-image/issues/251). ([cc1e7a3](https://github.com/ckeditor/ckeditor5-image/commit/cc1e7a3)) +* Introduced the `'insertImage'` command. Closes [#245](https://github.com/ckeditor/ckeditor5-image/issues/245). Closes [#251](https://github.com/ckeditor/ckeditor5-image/issues/251). ([cc1e7a3](https://github.com/ckeditor/ckeditor5-image/commit/cc1e7a3)) * Support for uploading images pasted with a base64 source. Closes [#246](https://github.com/ckeditor/ckeditor5-image/issues/246). Closes [ckeditor/ckeditor5-paste-from-office#24](https://github.com/ckeditor/ckeditor5-paste-from-office/issues/24). ([89ab27e](https://github.com/ckeditor/ckeditor5-image/commit/89ab27e)) ### Bug fixes @@ -176,7 +176,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### BREAKING CHANGES -* The `ImageUploadCommand#execute()`'s `files` parameter was renamed to `file`. It can still accept an array of files. +* The `UploadImageCommand#execute()`'s `files` parameter was renamed to `file`. It can still accept an array of files. ## [11.0.0](https://github.com/ckeditor/ckeditor5-image/compare/v10.2.0...v11.0.0) (2018-10-08) @@ -185,13 +185,13 @@ Internal changes only (updated dependencies, documentation, etc.). * Aligned `ImageToolbar` to use the new widget toolbar repository. ([980681d](https://github.com/ckeditor/ckeditor5-image/commit/980681d)) * Image feature should insert image the same way as other widget features do. ([26638f5](https://github.com/ckeditor/ckeditor5-image/commit/26638f5)) -* The `ImageUploadCommand` should check whether it can be executed in the context of the current document selection. Closes [#225](https://github.com/ckeditor/ckeditor5-image/issues/225). Closes [#227](https://github.com/ckeditor/ckeditor5-image/issues/227). Closes [#235](https://github.com/ckeditor/ckeditor5-image/issues/235). ([4c1f27f](https://github.com/ckeditor/ckeditor5-image/commit/4c1f27f)) +* The `UploadImageCommand` should check whether it can be executed in the context of the current document selection. Closes [#225](https://github.com/ckeditor/ckeditor5-image/issues/225). Closes [#227](https://github.com/ckeditor/ckeditor5-image/issues/227). Closes [#235](https://github.com/ckeditor/ckeditor5-image/issues/235). ([4c1f27f](https://github.com/ckeditor/ckeditor5-image/commit/4c1f27f)) * Updated translations. ([59f3604](https://github.com/ckeditor/ckeditor5-image/commit/59f3604)) ### BREAKING CHANGES -* The `options.file` property was renamed to `options.files` in `ImageUploadCommand#execute()`. -* The `options.insertAt` property of `ImageUploadCommand#execute()` was removed. The command will now use model's selection. +* The `options.file` property was renamed to `options.files` in `UploadImageCommand#execute()`. +* The `options.insertAt` property of `UploadImageCommand#execute()` was removed. The command will now use model's selection. * Removed `findOptimalInsertionPosition()` from utils. This method can now be found in the `@ckeditor/ckeditor5-widget/src/utils` module. @@ -222,7 +222,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* Made image upload by drag&drop work when the `ImageUploadCommand` is disabled. Closes [#208](https://github.com/ckeditor/ckeditor5-image/issues/208). ([6908ec6](https://github.com/ckeditor/ckeditor5-image/commit/6908ec6)) +* Made image upload by drag&drop work when the `UploadImageCommand` is disabled. Closes [#208](https://github.com/ckeditor/ckeditor5-image/issues/208). ([6908ec6](https://github.com/ckeditor/ckeditor5-image/commit/6908ec6)) ### Other changes diff --git a/packages/ckeditor5-image/docs/_snippets/features/image-insert-via-url.js b/packages/ckeditor5-image/docs/_snippets/features/image-insert-via-url.js index 0b662bd3849..0d6e90e13a2 100644 --- a/packages/ckeditor5-image/docs/_snippets/features/image-insert-via-url.js +++ b/packages/ckeditor5-image/docs/_snippets/features/image-insert-via-url.js @@ -9,7 +9,7 @@ import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud const toolbarItems = [ ...ClassicEditor.defaultConfig.toolbar.items ]; -toolbarItems.splice( toolbarItems.indexOf( 'imageUpload' ), 1, 'imageInsert' ); +toolbarItems.splice( toolbarItems.indexOf( 'uploadImage' ), 1, 'insertImage' ); ClassicEditor .create( document.querySelector( '#snippet-image-insert-via-url' ), { diff --git a/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons-dropdown.js b/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons-dropdown.js index 80712c8daed..d36a00bf3e3 100644 --- a/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons-dropdown.js +++ b/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons-dropdown.js @@ -16,17 +16,17 @@ ClassicEditor image: { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } @@ -41,7 +41,7 @@ ClassicEditor 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize' + 'resizeImage' ] }, cloudServices: CS_CONFIG diff --git a/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons.js b/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons.js index cac84a746a0..cb0926b07b8 100644 --- a/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons.js +++ b/packages/ckeditor5-image/docs/_snippets/features/image-resize-buttons.js @@ -16,19 +16,19 @@ ClassicEditor image: { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null, icon: 'original' }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75', icon: 'large' @@ -44,9 +44,9 @@ ClassicEditor 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize:50', - 'imageResize:75', - 'imageResize:original' + 'resizeImage:50', + 'resizeImage:75', + 'resizeImage:original' ] }, cloudServices: CS_CONFIG diff --git a/packages/ckeditor5-image/docs/_snippets/features/image-resize-px.js b/packages/ckeditor5-image/docs/_snippets/features/image-resize-px.js index e51cae24a0d..da749714fa9 100644 --- a/packages/ckeditor5-image/docs/_snippets/features/image-resize-px.js +++ b/packages/ckeditor5-image/docs/_snippets/features/image-resize-px.js @@ -14,17 +14,17 @@ ClassicEditor resizeUnit: 'px', resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null }, { - name: 'imageResize:250', + name: 'resizeImage:250', label: '250px', value: '250' }, { - name: 'imageResize:400', + name: 'resizeImage:400', label: '400px', value: '400' } @@ -39,7 +39,7 @@ ClassicEditor 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize' + 'resizeImage' ] }, toolbar: { diff --git a/packages/ckeditor5-image/docs/_snippets/features/image-style-presentational.js b/packages/ckeditor5-image/docs/_snippets/features/image-style-presentational.js index d70e7f4b449..6de01479a64 100644 --- a/packages/ckeditor5-image/docs/_snippets/features/image-style-presentational.js +++ b/packages/ckeditor5-image/docs/_snippets/features/image-style-presentational.js @@ -18,17 +18,17 @@ ClassicEditor ], resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } @@ -38,7 +38,7 @@ ClassicEditor 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize', + 'resizeImage', '|', 'imageTextAlternative' ] diff --git a/packages/ckeditor5-image/docs/features/image.md b/packages/ckeditor5-image/docs/features/image.md index 1e5e97c030e..2971b708cbb 100644 --- a/packages/ckeditor5-image/docs/features/image.md +++ b/packages/ckeditor5-image/docs/features/image.md @@ -89,7 +89,7 @@ See the {@link features/image-upload Image upload} guide. Besides the ability to insert images by uploading them directly from your disk or via CKFinder, you can also configure CKEditor 5 to allow inserting images via source URL. -In order to enable this option, install the `ImageInsert` plugin and add the `imageInsert` button to the toolbar (it replaces the standard `imageUpload` button). +In order to enable this option, install the `ImageInsert` plugin and add the `insertImage` button to the toolbar (it replaces the standard `uploadImage` button). ```js import ImageInsert from '@ckeditor/ckeditor5-image/src/imageinsert'; @@ -97,7 +97,7 @@ import ImageInsert from '@ckeditor/ckeditor5-image/src/imageinsert'; ClassicEditor .create( document.querySelector( '#editor' ), { plugins: [ ... , ImageInsert ], - toolbar: [ ... , 'imageInsert' ] + toolbar: [ ... , 'insertImage' ] } ) ``` @@ -212,17 +212,17 @@ ClassicEditor // Configure the available image resize options. resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } @@ -233,7 +233,7 @@ ClassicEditor toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize', + 'resizeImage', '|', 'imageTextAlternative' ] @@ -245,7 +245,7 @@ ClassicEditor The code sample above uses predefined presentational image styles: `'alignLeft'`, `'alignCenter'` and `'alignRight'`. They apply, respectively, the `.image-style-align-left`, `.image-style-align-center` and `.image-style-align-right` classes to the `
` element. -In addition to that, the sample is configured to use the [image resize feature](#resizing-images) with three {@link module:image/image~ImageConfig#resizeOptions resize options} available: `'imageResize:original'`, `'imageResize:50'` and `'imageResize:75'`. They allow you to set the image width in the editor to the original image size, 50% and 75%, respectively. +In addition to that, the sample is configured to use the [image resize feature](#resizing-images) with three {@link module:image/image~ImageConfig#resizeOptions resize options} available: `'resizeImage:original'`, `'resizeImage:50'` and `'resizeImage:75'`. They allow you to set the image width in the editor to the original image size, 50% and 75%, respectively. See the result below: @@ -334,22 +334,22 @@ To use this option, you need to [enable image resizing](#enabling-image-resizing const imageConfiguration = { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, label: 'Original' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', label: '50%' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', label: '75%' } ], - toolbar: [ ..., 'imageResize' ] + toolbar: [ ..., 'resizeImage' ] } ``` @@ -367,26 +367,26 @@ To use this option, you need to [enable image resizing](#enabling-image-resizing const imageConfiguration = { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } ], toolbar: [ ..., - 'imageResize:50', - 'imageResize:75' - 'imageResize:original', + 'resizeImage:50', + 'resizeImage:75' + 'resizeImage:original', ] } ``` @@ -414,26 +414,26 @@ ClassicEditor image: { resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } ], toolbar: [ // ..., - 'imageResize:50', - 'imageResize:75', - 'imageResize:original', + 'resizeImage:50', + 'resizeImage:75', + 'resizeImage:original', ] } } ) @@ -589,7 +589,7 @@ The {@link module:image/image~Image} plugin registers: * The `'imageTextAlternative'` button. * The {@link module:image/imagetextalternative/imagetextalternativecommand~ImageTextAlternativeCommand `'imageTextAlternative'` command} -* The {@link module:image/image/imageinsertcommand~ImageInsertCommand `'imageInsert'` command} that accepts a source (e.g. a URL) of an image to insert. +* The {@link module:image/image/insertimagecommand~InsertImageCommand `'insertImage'` command} that accepts a source (e.g. a URL) of an image to insert. The {@link module:image/imagestyle~ImageStyle} plugin registers: @@ -602,12 +602,12 @@ The {@link module:image/imagestyle~ImageStyle} plugin registers: The {@link module:image/imageupload~ImageUpload} plugin registers: -* The `'imageUpload'` button that opens the native file browser to let you upload a file directly from your disk. -* The {@link module:image/imageupload/imageuploadcommand~ImageUploadCommand `'imageUpload'` command} that accepts the file to upload. +* The `'uploadImage'` button that opens the native file browser to let you upload a file directly from your disk. +* The {@link module:image/imageupload/uploadimagecommand~UploadImageCommand `'uploadImage'` command} that accepts the file to upload. The {@link module:image/imageresize~ImageResize} plugin registers: -* The {@link module:image/imageresize/imageresizecommand~ImageResizeCommand `'imageResize'` command} that accepts the target width. +* The {@link module:image/imageresize/resizeimagecommand~ResizeImageCommand `'resizeImage'` command} that accepts the target width. We recommend using the official {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more. diff --git a/packages/ckeditor5-image/src/image/imageediting.js b/packages/ckeditor5-image/src/image/imageediting.js index 0014c2cdb54..5b7a2b8dcb9 100644 --- a/packages/ckeditor5-image/src/image/imageediting.js +++ b/packages/ckeditor5-image/src/image/imageediting.js @@ -18,7 +18,7 @@ import { import { toImageWidget } from './utils'; -import ImageInsertCommand from './imageinsertcommand'; +import InsertImageCommand from './imageinsertcommand'; /** * The image engine plugin. @@ -27,7 +27,8 @@ import ImageInsertCommand from './imageinsertcommand'; * * * `` as a block element in the document schema, and allows `alt`, `src` and `srcset` attributes. * * converters for editing and data pipelines. - * * `'imageInsert'` command. + * * `'insertImage'` command. + * * `'imageInsert'` command as an alias for `insertImage` command. * * @extends module:core/plugin~Plugin */ @@ -113,7 +114,11 @@ export default class ImageEditing extends Plugin { } ) .add( viewFigureToModel() ); - editor.commands.add( 'imageInsert', new ImageInsertCommand( editor ) ); + const insertImageCommand = new InsertImageCommand( editor ); + + // Register `insertImage` command and add `imageInsert` command as an alias for backward compatibility. + editor.commands.add( 'insertImage', insertImageCommand ); + editor.commands.add( 'imageInsert', insertImageCommand ); } } diff --git a/packages/ckeditor5-image/src/image/imageinsertcommand.js b/packages/ckeditor5-image/src/image/imageinsertcommand.js index 2419e4f989f..fd5c0e68342 100644 --- a/packages/ckeditor5-image/src/image/imageinsertcommand.js +++ b/packages/ckeditor5-image/src/image/imageinsertcommand.js @@ -7,23 +7,24 @@ import Command from '@ckeditor/ckeditor5-core/src/command'; import { insertImage, isImageAllowed } from './utils'; /** - * @module image/image/imageinsertcommand + * @module image/image/insertimagecommand */ /** * Insert image command. * - * The command is registered by the {@link module:image/image/imageediting~ImageEditing} plugin as `'imageInsert'`. + * The command is registered by the {@link module:image/image/imageediting~ImageEditing} plugin as `'insertImage'` + * and it is also available via aliased `imageInsert` name. * * In order to insert an image at the current selection position * (according to the {@link module:widget/utils~findOptimalInsertionPosition} algorithm), * execute the command and specify the image source: * - * editor.execute( 'imageInsert', { source: 'http://url.to.the/image' } ); + * editor.execute( 'insertImage', { source: 'http://url.to.the/image' } ); * * It is also possible to insert multiple images at once: * - * editor.execute( 'imageInsert', { + * editor.execute( 'insertImage', { * source: [ * 'path/to/image.jpg', * 'path/to/other-image.jpg' @@ -32,7 +33,7 @@ import { insertImage, isImageAllowed } from './utils'; * * @extends module:core/command~Command */ -export default class ImageInsertCommand extends Command { +export default class InsertImageCommand extends Command { /** * @inheritDoc */ diff --git a/packages/ckeditor5-image/src/imageinsert.js b/packages/ckeditor5-image/src/imageinsert.js index 0ccc02c8ce1..a3e7015602d 100644 --- a/packages/ckeditor5-image/src/imageinsert.js +++ b/packages/ckeditor5-image/src/imageinsert.js @@ -55,7 +55,7 @@ export default class ImageInsert extends Plugin { * .create( editorElement, { * image: { * insert: { - * ... // settings for "imageInsert" view goes here + * ... // settings for "insertImage" view goes here * } * } * } ) diff --git a/packages/ckeditor5-image/src/imageinsert/imageinsertui.js b/packages/ckeditor5-image/src/imageinsert/imageinsertui.js index ed726c94a4c..df26a7ddd7d 100644 --- a/packages/ckeditor5-image/src/imageinsert/imageinsertui.js +++ b/packages/ckeditor5-image/src/imageinsert/imageinsertui.js @@ -19,7 +19,8 @@ import { isImage } from '../image/utils'; * For a detailed overview, check the {@glink features/image-upload/image-upload Image upload feature} * and {@glink features/image#inserting-images-via-source-url Insert images via source URL} documentation. * - * Adds the `'imageInsert'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory}. + * Adds the `'insertImage'` dropdown to the {@link module:ui/componentfactory~ComponentFactory UI component factory} + * and also the `imageInsert` dropdown as an alias for backward compatibility. * * @extends module:core/plugin~Plugin */ @@ -36,10 +37,13 @@ export default class ImageInsertUI extends Plugin { */ init() { const editor = this.editor; - - editor.ui.componentFactory.add( 'imageInsert', locale => { + const componentCreator = locale => { return this._createDropdownView( locale ); - } ); + }; + + // Register `insertImage` dropdown and add `imageInsert` dropdown as an alias for backward compatibility. + editor.ui.componentFactory.add( 'insertImage', componentCreator ); + editor.ui.componentFactory.add( 'imageInsert', componentCreator ); } /** @@ -53,13 +57,13 @@ export default class ImageInsertUI extends Plugin { _createDropdownView( locale ) { const editor = this.editor; const imageInsertView = new ImageInsertPanelView( locale, prepareIntegrations( editor ) ); - const command = editor.commands.get( 'imageUpload' ); + const command = editor.commands.get( 'uploadImage' ); const dropdownView = imageInsertView.dropdownView; const splitButtonView = dropdownView.buttonView; - splitButtonView.actionView = editor.ui.componentFactory.create( 'imageUpload' ); - // After we replaced action button with `imageUpload` component, + splitButtonView.actionView = editor.ui.componentFactory.create( 'uploadImage' ); + // After we replaced action button with `uploadImage` component, // we have lost a proper styling and some minor visual quirks have appeared. // Brining back original split button classes helps fix the button styling // See https://github.com/ckeditor/ckeditor5/issues/7986. @@ -77,7 +81,7 @@ export default class ImageInsertUI extends Plugin { * * @param {module:ui/dropdown/dropdownview~DropdownView} dropdownView A dropdownView. * @param {module:image/imageinsert/ui/imageinsertpanelview~ImageInsertPanelView} imageInsertView An imageInsertView. - * @param {module:core/command~Command} command An imageInsert command + * @param {module:core/command~Command} command An insertImage command * * @private * @returns {module:ui/dropdown/dropdownview~DropdownView} @@ -140,7 +144,7 @@ export default class ImageInsertUI extends Plugin { writer.removeAttribute( 'sizes', selectedElement ); } ); } else { - editor.execute( 'imageInsert', { source: imageInsertView.imageURLInputValue } ); + editor.execute( 'insertImage', { source: imageInsertView.imageURLInputValue } ); } } diff --git a/packages/ckeditor5-image/src/imageresize.js b/packages/ckeditor5-image/src/imageresize.js index 3281e87de52..362f57de423 100644 --- a/packages/ckeditor5-image/src/imageresize.js +++ b/packages/ckeditor5-image/src/imageresize.js @@ -67,7 +67,7 @@ export default class ImageResize extends Plugin { * {@link module:core/editor/editorui~EditorUI#componentFactory component factory} of the editor, * representing the button a user can click to change the size of an image, * * value: An actual image width applied when a user clicks the mentioned button - * ({@link module:image/imageresize/imageresizecommand~ImageResizeCommand} gets executed). + * ({@link module:image/imageresize/resizeimagecommand~ResizeImageCommand} gets executed). * The value property is combined with the {@link module:image/image~ImageConfig#resizeUnit `config.image.resizeUnit`} (`%` by default). * For instance: `value: '50'` and `resizeUnit: '%'` will render as `'50%'` in the UI. * @@ -82,15 +82,15 @@ export default class ImageResize extends Plugin { * image: { * resizeUnit: "%", * resizeOptions: [ { - * name: 'imageResize:original', + * name: 'resizeImage:original', * value: null * }, * { - * name: 'imageResize:50', + * name: 'resizeImage:50', * value: '50' * }, * { - * name: 'imageResize:75', + * name: 'resizeImage:75', * value: '75' * } ] * } @@ -101,7 +101,7 @@ export default class ImageResize extends Plugin { * **Resizing images using a dropdown** * * With resize options defined, you can decide whether you want to display them as a dropdown or as standalone buttons. - * For the dropdown, you need to pass only the `imageResize` token to the + * For the dropdown, you need to pass only the `resizeImage` token to the {@link module:image/image~ImageConfig#toolbar `config.image.toolbar`}. The dropdown contains all defined options by default: * * ClassicEditor @@ -109,18 +109,18 @@ export default class ImageResize extends Plugin { * image: { * resizeUnit: "%", * resizeOptions: [ { - * name: 'imageResize:original', + * name: 'resizeImage:original', * value: null * }, * { - * name: 'imageResize:50', + * name: 'resizeImage:50', * value: '50' * }, * { - * name: 'imageResize:75', + * name: 'resizeImage:75', * value: '75' * } ], - * toolbar: [ 'imageResize', ... ], + * toolbar: [ 'resizeImage', ... ], * } * } ) * .then( ... ) @@ -138,26 +138,26 @@ export default class ImageResize extends Plugin { * image: { * resizeUnit: "%", * resizeOptions: [ { - * name: 'imageResize:original', + * name: 'resizeImage:original', * value: null, * icon: 'original' * }, * { - * name: 'imageResize:25', + * name: 'resizeImage:25', * value: '25', * icon: 'small' * }, * { - * name: 'imageResize:50', + * name: 'resizeImage:50', * value: '50', * icon: 'medium' * }, * { - * name: 'imageResize:75', + * name: 'resizeImage:75', * value: '75', * icon: 'large' * } ], - * toolbar: [ 'imageResize:25', 'imageResize:50', 'imageResize:75', 'imageResize:original', ... ], + * toolbar: [ 'resizeImage:25', 'resizeImage:50', 'resizeImage:75', 'resizeImage:original', ... ], * } * } ) * .then( ... ) @@ -175,19 +175,19 @@ export default class ImageResize extends Plugin { * image: { * resizeUnit: "%", * resizeOptions: [ { - * name: 'imageResize:original', + * name: 'resizeImage:original', * value: null, * label: 'Original size' * // Note: add the "icon" property if you're configuring a standalone button. * }, * { - * name: 'imageResize:50', + * name: 'resizeImage:50', * value: '50', * label: 'Medium size' * // Note: add the "icon" property if you're configuring a standalone button. * }, * { - * name: 'imageResize:75', + * name: 'resizeImage:75', * value: '75', * label: 'Large size' * // Note: add the "icon" property if you're configuring a standalone button. @@ -203,22 +203,22 @@ export default class ImageResize extends Plugin { * * resizeOptions = [ * { - * name: 'imageResize:original', + * name: 'resizeImage:original', * value: null, * icon: 'original' * }, * { - * name: 'imageResize:25', + * name: 'resizeImage:25', * value: '25', * icon: 'small' * }, * { - * name: 'imageResize:50', + * name: 'resizeImage:50', * value: '50', * icon: 'medium' * }, * { - * name: 'imageResize:75', + * name: 'resizeImage:75', * value: '75', * icon: 'large' * } diff --git a/packages/ckeditor5-image/src/imageresize/imageresizebuttons.js b/packages/ckeditor5-image/src/imageresize/imageresizebuttons.js index b38c796214e..dc23f9af2b2 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizebuttons.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizebuttons.js @@ -75,7 +75,7 @@ export default class ImageResizeButtons extends Plugin { init() { const editor = this.editor; const options = editor.config.get( 'image.resizeOptions' ); - const command = editor.commands.get( 'imageResize' ); + const command = editor.commands.get( 'resizeImage' ); this.bind( 'isEnabled' ).to( command ); @@ -99,7 +99,7 @@ export default class ImageResizeButtons extends Plugin { editor.ui.componentFactory.add( name, locale => { const button = new ButtonView( locale ); - const command = editor.commands.get( 'imageResize' ); + const command = editor.commands.get( 'resizeImage' ); const labelText = this._getOptionLabelValue( option, true ); if ( !RESIZE_ICONS[ icon ] ) { @@ -133,7 +133,7 @@ export default class ImageResizeButtons extends Plugin { button.bind( 'isOn' ).to( command, 'value', getIsOnButtonCallback( optionValueWithUnit ) ); this.listenTo( button, 'execute', () => { - editor.execute( 'imageResize', { width: optionValueWithUnit } ); + editor.execute( 'resizeImage', { width: optionValueWithUnit } ); } ); return button; @@ -152,9 +152,8 @@ export default class ImageResizeButtons extends Plugin { const t = editor.t; const originalSizeOption = options.find( option => !option.value ); - // Register dropdown. - editor.ui.componentFactory.add( 'imageResize', locale => { - const command = editor.commands.get( 'imageResize' ); + const componentCreator = locale => { + const command = editor.commands.get( 'resizeImage' ); const dropdownView = createDropdown( locale, DropdownButtonView ); const dropdownButton = dropdownView.buttonView; @@ -189,7 +188,11 @@ export default class ImageResizeButtons extends Plugin { } ); return dropdownView; - } ); + }; + + // Register `resizeImage` dropdown and add `imageResize` dropdown as an alias for backward compatibility. + editor.ui.componentFactory.add( 'resizeImage', componentCreator ); + editor.ui.componentFactory.add( 'imageResize', componentCreator ); } /** @@ -226,7 +229,7 @@ export default class ImageResizeButtons extends Plugin { * * @private * @param {Array.} options The resize options. - * @param {module:image/imageresize/imageresizecommand~ImageResizeCommand} command The resize image command. + * @param {module:image/imageresize/resizeimagecommand~ResizeImageCommand} command The resize image command. * @returns {Iterable.} Dropdown item definitions. */ _getResizeDropdownListItemDefinitions( options, command ) { @@ -237,7 +240,7 @@ export default class ImageResizeButtons extends Plugin { const definition = { type: 'button', model: new Model( { - commandName: 'imageResize', + commandName: 'resizeImage', commandValue: optionValueWithUnit, label: this._getOptionLabelValue( option ), withText: true, diff --git a/packages/ckeditor5-image/src/imageresize/imageresizecommand.js b/packages/ckeditor5-image/src/imageresize/imageresizecommand.js index 12c39ceb5de..971886ea6f3 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizecommand.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizecommand.js @@ -4,7 +4,7 @@ */ /** - * @module image/imageresize/imageresizecommand + * @module image/imageresize/resizeimagecommand */ import Command from '@ckeditor/ckeditor5-core/src/command'; @@ -15,7 +15,7 @@ import { isImage } from '../image/utils'; * * @extends module:core/command~Command */ -export default class ImageResizeCommand extends Command { +export default class ResizeImageCommand extends Command { /** * @inheritDoc */ @@ -38,10 +38,10 @@ export default class ImageResizeCommand extends Command { * Executes the command. * * // Sets the width to 50%: - * editor.execute( 'imageResize', { width: '50%' } ); + * editor.execute( 'resizeImage', { width: '50%' } ); * * // Removes the width attribute: - * editor.execute( 'imageResize', { width: null } ); + * editor.execute( 'resizeImage', { width: null } ); * * @param {Object} options * @param {String|null} options.width The new width of the image. diff --git a/packages/ckeditor5-image/src/imageresize/imageresizeediting.js b/packages/ckeditor5-image/src/imageresize/imageresizeediting.js index e35f64af220..4a958840da2 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizeediting.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizeediting.js @@ -8,7 +8,7 @@ */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ImageResizeCommand from './imageresizecommand'; +import ResizeImageCommand from './imageresizecommand'; /** * The image resize editing feature. @@ -35,22 +35,22 @@ export default class ImageResizeEditing extends Plugin { editor.config.define( 'image', { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:25', + name: 'resizeImage:25', value: '25', icon: 'small' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } ] @@ -62,12 +62,14 @@ export default class ImageResizeEditing extends Plugin { */ init() { const editor = this.editor; - const command = new ImageResizeCommand( editor ); + const resizeImageCommand = new ResizeImageCommand( editor ); this._registerSchema(); this._registerConverters(); - editor.commands.add( 'imageResize', command ); + // Register `resizeImage` command and add `imageResize` command as an alias for backward compatibility. + editor.commands.add( 'resizeImage', resizeImageCommand ); + editor.commands.add( 'imageResize', resizeImageCommand ); } /** diff --git a/packages/ckeditor5-image/src/imageresize/imageresizehandles.js b/packages/ckeditor5-image/src/imageresize/imageresizehandles.js index c5e1725c60f..33694d70f0c 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizehandles.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizehandles.js @@ -38,7 +38,7 @@ export default class ImageResizeHandles extends Plugin { */ init() { const editor = this.editor; - const command = editor.commands.get( 'imageResize' ); + const command = editor.commands.get( 'resizeImage' ); this.bind( 'isEnabled' ).to( command ); @@ -68,7 +68,7 @@ export default class ImageResizeHandles extends Plugin { }, onCommit( newValue ) { - editor.execute( 'imageResize', { width: newValue } ); + editor.execute( 'resizeImage', { width: newValue } ); } } ); diff --git a/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js b/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js index e6e53e38428..4be12fb20d1 100644 --- a/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js +++ b/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js @@ -8,13 +8,14 @@ import Command from '@ckeditor/ckeditor5-core/src/command'; import { insertImage, isImageAllowed } from '../image/utils'; /** - * @module image/imageupload/imageuploadcommand + * @module image/imageupload/uploadimagecommand */ /** * The image upload command. * - * The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `'imageUpload'`. + * The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `'uploadImage'` + * and it is also available via aliased `imageUpload` name. * * In order to upload an image at the current selection position * (according to the {@link module:widget/utils~findOptimalInsertionPosition} algorithm), @@ -25,12 +26,12 @@ import { insertImage, isImageAllowed } from '../image/utils'; * const images = Array.from( data.dataTransfer.files ); * * // Upload the first image: - * editor.execute( 'imageUpload', { file: images[ 0 ] } ); + * editor.execute( 'uploadImage', { file: images[ 0 ] } ); * } ); * * It is also possible to insert multiple images at once: * - * editor.execute( 'imageUpload', { + * editor.execute( 'uploadImage', { * file: [ * file1, * file2 @@ -39,7 +40,7 @@ import { insertImage, isImageAllowed } from '../image/utils'; * * @extends module:core/command~Command */ -export default class ImageUploadCommand extends Command { +export default class UploadImageCommand extends Command { /** * @inheritDoc */ diff --git a/packages/ckeditor5-image/src/imageupload/imageuploadediting.js b/packages/ckeditor5-image/src/imageupload/imageuploadediting.js index 7dcaa143861..24f232416aa 100644 --- a/packages/ckeditor5-image/src/imageupload/imageuploadediting.js +++ b/packages/ckeditor5-image/src/imageupload/imageuploadediting.js @@ -14,13 +14,14 @@ import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import UpcastWriter from '@ckeditor/ckeditor5-engine/src/view/upcastwriter'; import env from '@ckeditor/ckeditor5-utils/src/env'; -import ImageUploadCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; import { fetchLocalImage, isLocalImage } from '../../src/imageupload/utils'; import { createImageTypeRegExp } from './utils'; import { getViewImgFromWidget } from '../image/utils'; /** - * The editing part of the image upload feature. It registers the `'imageUpload'` command. + * The editing part of the image upload feature. It registers the `'uploadImage'` command + * and `imageUpload` command as an aliased name. * * @extends module:core/plugin~Plugin */ @@ -66,8 +67,11 @@ export default class ImageUploadEditing extends Plugin { allowAttributes: [ 'uploadId', 'uploadStatus' ] } ); - // Register imageUpload command. - editor.commands.add( 'imageUpload', new ImageUploadCommand( editor ) ); + const uploadImageCommand = new UploadImageCommand( editor ); + + // Register `uploadImage` command and add `imageUpload` command as an alias for backward compatibility. + editor.commands.add( 'uploadImage', uploadImageCommand ); + editor.commands.add( 'imageUpload', uploadImageCommand ); // Register upcast converter for uploadId. conversion.for( 'upcast' ) @@ -110,7 +114,7 @@ export default class ImageUploadEditing extends Plugin { // Upload images after the selection has changed in order to ensure the command's state is refreshed. editor.model.enqueueChange( 'default', () => { - editor.execute( 'imageUpload', { file: images } ); + editor.execute( 'uploadImage', { file: images } ); } ); } } ); diff --git a/packages/ckeditor5-image/src/imageupload/imageuploadui.js b/packages/ckeditor5-image/src/imageupload/imageuploadui.js index ee33a955a9b..d8d17ca5458 100644 --- a/packages/ckeditor5-image/src/imageupload/imageuploadui.js +++ b/packages/ckeditor5-image/src/imageupload/imageuploadui.js @@ -18,7 +18,8 @@ import imageIcon from '@ckeditor/ckeditor5-core/theme/icons/image.svg'; * * For a detailed overview, check the {@glink features/image-upload/image-upload Image upload feature} documentation. * - * Adds the `'imageUpload'` button to the {@link module:ui/componentfactory~ComponentFactory UI component factory}. + * Adds the `'uploadImage'` button to the {@link module:ui/componentfactory~ComponentFactory UI component factory} + * and also the `imageUpload` button as an alias for backward compatibility. * * @extends module:core/plugin~Plugin */ @@ -36,11 +37,9 @@ export default class ImageUploadUI extends Plugin { init() { const editor = this.editor; const t = editor.t; - - // Setup `imageUpload` button. - editor.ui.componentFactory.add( 'imageUpload', locale => { + const componentCreator = locale => { const view = new FileDialogButtonView( locale ); - const command = editor.commands.get( 'imageUpload' ); + const command = editor.commands.get( 'uploadImage' ); const imageTypes = editor.config.get( 'image.upload.types' ); const imageTypesRegExp = createImageTypeRegExp( imageTypes ); @@ -61,11 +60,15 @@ export default class ImageUploadUI extends Plugin { const imagesToUpload = Array.from( files ).filter( file => imageTypesRegExp.test( file.type ) ); if ( imagesToUpload.length ) { - editor.execute( 'imageUpload', { file: imagesToUpload } ); + editor.execute( 'uploadImage', { file: imagesToUpload } ); } } ); return view; - } ); + }; + + // Setup `uploadImage` button and add `imageUpload` button as an alias for backward compatibility. + editor.ui.componentFactory.add( 'uploadImage', componentCreator ); + editor.ui.componentFactory.add( 'imageUpload', componentCreator ); } } diff --git a/packages/ckeditor5-image/tests/image/imageediting.js b/packages/ckeditor5-image/tests/image/imageediting.js index 580cf49e0f4..081eb35dd58 100644 --- a/packages/ckeditor5-image/tests/image/imageediting.js +++ b/packages/ckeditor5-image/tests/image/imageediting.js @@ -9,7 +9,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import ImageEditing from '../../src/image/imageediting'; import ImageLoadObserver from '../../src/image/imageloadobserver'; -import ImageInsertCommand from '../../src/image/imageinsertcommand'; +import InsertImageCommand from '../../src/image/imageinsertcommand'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; import { isImageWidget } from '../../src/image/utils'; @@ -59,8 +59,12 @@ describe( 'ImageEditing', () => { expect( view.getObserver( ImageLoadObserver ) ).to.be.instanceOf( ImageLoadObserver ); } ); - it( 'should register imageInsert command', () => { - expect( editor.commands.get( 'imageInsert' ) ).to.be.instanceOf( ImageInsertCommand ); + it( 'should register insertImage command', () => { + expect( editor.commands.get( 'insertImage' ) ).to.be.instanceOf( InsertImageCommand ); + } ); + + it( 'should register imageInsert command as an alias for insertImage command', () => { + expect( editor.commands.get( 'imageInsert' ) ).to.equal( editor.commands.get( 'insertImage' ) ); } ); // See https://github.com/ckeditor/ckeditor5-image/issues/142. diff --git a/packages/ckeditor5-image/tests/image/imageinsertcommand.js b/packages/ckeditor5-image/tests/image/imageinsertcommand.js index d16ff546346..87d8f49be42 100644 --- a/packages/ckeditor5-image/tests/image/imageinsertcommand.js +++ b/packages/ckeditor5-image/tests/image/imageinsertcommand.js @@ -5,13 +5,13 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import ImageInsertCommand from '../../src/image/imageinsertcommand'; +import InsertImageCommand from '../../src/image/imageinsertcommand'; import Image from '../../src/image/imageediting'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import { setData as setModelData, getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; -describe( 'ImageInsertCommand', () => { +describe( 'InsertImageCommand', () => { let editor, command, model; beforeEach( () => { @@ -23,7 +23,7 @@ describe( 'ImageInsertCommand', () => { editor = newEditor; model = editor.model; - command = new ImageInsertCommand( editor ); + command = new InsertImageCommand( editor ); const schema = model.schema; schema.extend( 'image', { allowAttributes: 'uploadId' } ); diff --git a/packages/ckeditor5-image/tests/imageinsert/imageinsertui.js b/packages/ckeditor5-image/tests/imageinsert/imageinsertui.js index 2e044121e9a..503d66dfd90 100644 --- a/packages/ckeditor5-image/tests/imageinsert/imageinsertui.js +++ b/packages/ckeditor5-image/tests/imageinsert/imageinsertui.js @@ -46,7 +46,7 @@ describe( 'ImageInsertUI', () => { return ClassicEditor .create( editorElement, { plugins: [ Paragraph, Image, ImageInsert, ImageInsertUI, FileRepository, UploadAdapterPluginMock, Clipboard ], - toolbar: [ 'imageInsert' ], + toolbar: [ 'insertImage' ], image: { insert: { integrations: [ @@ -72,10 +72,17 @@ describe( 'ImageInsertUI', () => { return editor.destroy(); } ); - it( 'should register the "imageInsert" dropdown', () => { - const button = editor.ui.componentFactory.create( 'imageInsert' ); + it( 'should register the "insertImage" dropdown', () => { + const dropdown = editor.ui.componentFactory.create( 'insertImage' ); - expect( button ).to.be.instanceOf( DropdownView ); + expect( dropdown ).to.be.instanceOf( DropdownView ); + } ); + + it( 'should register "imageInsert" dropdown as an alias for the "insertImage" dropdown', () => { + const dropdownCreator = editor.ui.componentFactory._components.get( 'insertImage'.toLowerCase() ); + const dropdownAliasCreator = editor.ui.componentFactory._components.get( 'imageInsert'.toLowerCase() ); + + expect( dropdownCreator.callback ).to.equal( dropdownAliasCreator.callback ); } ); it( 'should not insert panel view children until dropdown is not open for the first time', () => { @@ -89,7 +96,7 @@ describe( 'ImageInsertUI', () => { describe( 'dropdown action button', () => { it( 'should be an instance of FileDialogButtonView', () => { - const dropdown = editor.ui.componentFactory.create( 'imageInsert' ); + const dropdown = editor.ui.componentFactory.create( 'insertImage' ); expect( dropdown.buttonView.actionView ).to.be.instanceOf( FileDialogButtonView ); } ); @@ -209,7 +216,7 @@ describe( 'ImageInsertUI', () => { it( 'should remove all attributes from model except "src" when updating the image source URL', () => { const viewDocument = editor.editing.view.document; - const commandSpy = sinon.spy( editor.commands.get( 'imageInsert' ), 'execute' ); + const commandSpy = sinon.spy( editor.commands.get( 'insertImage' ), 'execute' ); const submitSpy = sinon.spy(); dropdown.buttonView.fire( 'open' ); @@ -246,7 +253,7 @@ describe( 'ImageInsertUI', () => { describe( 'events', () => { it( 'should emit "submit" event when clicking on submit button', () => { - const commandSpy = sinon.spy( editor.commands.get( 'imageInsert' ), 'execute' ); + const commandSpy = sinon.spy( editor.commands.get( 'insertImage' ), 'execute' ); const submitSpy = sinon.spy(); dropdown.buttonView.fire( 'open' ); @@ -263,7 +270,7 @@ describe( 'ImageInsertUI', () => { } ); it( 'should emit "cancel" event when clicking on cancel button', () => { - const commandSpy = sinon.spy( editor.commands.get( 'imageInsert' ), 'execute' ); + const commandSpy = sinon.spy( editor.commands.get( 'insertImage' ), 'execute' ); const cancelSpy = sinon.spy(); dropdown.buttonView.fire( 'open' ); @@ -317,7 +324,7 @@ describe( 'ImageInsertUI', () => { } } ); - const dropdown = editor.ui.componentFactory.create( 'imageInsert' ); + const dropdown = editor.ui.componentFactory.create( 'insertImage' ); dropdown.buttonView.fire( 'open' ); diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js b/packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js index 856444c3f02..5739824075c 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js @@ -28,19 +28,19 @@ describe( 'ImageResizeButtons', () => { let plugin, command, editor, editorElement; const resizeOptions = [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null }, { - name: 'imageResize:25', + name: 'resizeImage:25', value: '25' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75' } ]; @@ -58,7 +58,7 @@ describe( 'ImageResizeButtons', () => { } } ); - command = editor.commands.get( 'imageResize' ); + command = editor.commands.get( 'resizeImage' ); plugin = editor.plugins.get( 'ImageResizeButtons' ); } ); @@ -100,7 +100,7 @@ describe( 'ImageResizeButtons', () => { describe( 'resize options dropdown', () => { it( 'should be disabled when plugin is disabled', () => { - const dropdownView = editor.ui.componentFactory.create( 'imageResize' ); + const dropdownView = editor.ui.componentFactory.create( 'resizeImage' ); plugin.isEnabled = true; @@ -112,11 +112,18 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be an instance of `DropdownView` if component is created without a value suffix', () => { - expect( editor.ui.componentFactory.create( 'imageResize' ) ).to.be.instanceof( DropdownView ); + expect( editor.ui.componentFactory.create( 'resizeImage' ) ).to.be.instanceof( DropdownView ); } ); - it( 'should have 4 resize options in the `imageResize` dropdown', () => { - const dropdownView = editor.ui.componentFactory.create( 'imageResize' ); + it( 'should register `imageResize dropdown as an alias for the `resizeImage` dropdown', () => { + const dropdownCreator = editor.ui.componentFactory._components.get( 'resizeImage'.toLowerCase() ); + const dropdownAliasCreator = editor.ui.componentFactory._components.get( 'imageResize'.toLowerCase() ); + + expect( dropdownCreator.callback ).to.equal( dropdownAliasCreator.callback ); + } ); + + it( 'should have 4 resize options in the `resizeImage` dropdown', () => { + const dropdownView = editor.ui.componentFactory.create( 'resizeImage' ); expect( dropdownView.listView.items.length ).to.equal( 4 ); expect( dropdownView.listView.items.first.element.textContent ).to.equal( 'Original' ); @@ -125,13 +132,13 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be created with a proper tooltip', () => { - const dropdownView = editor.ui.componentFactory.create( 'imageResize' ); + const dropdownView = editor.ui.componentFactory.create( 'resizeImage' ); expect( dropdownView.buttonView.tooltip ).to.equal( 'Resize image' ); } ); it( 'should execute resize command with a proper value', () => { - const dropdownView = editor.ui.componentFactory.create( 'imageResize' ); + const dropdownView = editor.ui.componentFactory.create( 'resizeImage' ); const commandSpy = sinon.spy( command, 'execute' ); const resizeBy50Percent = dropdownView.listView.items._items[ 1 ].children._items[ 0 ]; @@ -154,26 +161,26 @@ describe( 'ImageResizeButtons', () => { image: { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:25', + name: 'resizeImage:25', value: '25', icon: 'small' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } ], - toolbar: [ 'imageResize:original', 'imageResize:25', 'imageResize:50', 'imageResize:75' ] + toolbar: [ 'resizeImage:original', 'resizeImage:25', 'resizeImage:50', 'resizeImage:75' ] } } ); @@ -191,7 +198,7 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be bound to `#isEnabled`', () => { - const buttonView = editor.ui.componentFactory.create( 'imageResize:50' ); + const buttonView = editor.ui.componentFactory.create( 'resizeImage:50' ); plugin.isEnabled = true; @@ -203,7 +210,7 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be an instance of `ButtonView` if component is created with a value suffix', () => { - expect( editor.ui.componentFactory.create( 'imageResize:50' ) ).to.be.instanceof( ButtonView ); + expect( editor.ui.componentFactory.create( 'resizeImage:50' ) ).to.be.instanceof( ButtonView ); } ); it( 'should be created with invisible "Resize image: 30%" label when is provided', async () => { @@ -213,16 +220,16 @@ describe( 'ImageResizeButtons', () => { image: { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:30', + name: 'resizeImage:30', value: '30', label: 'Resize image: 30%', icon: 'small' } ], - toolbar: [ 'imageResize:30' ] + toolbar: [ 'resizeImage:30' ] } } ); - const buttonView = editor.ui.componentFactory.create( 'imageResize:30' ); + const buttonView = editor.ui.componentFactory.create( 'resizeImage:30' ); buttonView.render(); expect( buttonView.withText ).to.be.false; @@ -233,7 +240,7 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be created with invisible "Resize image to 50%" label when is not provided', async () => { - const buttonView = editor.ui.componentFactory.create( 'imageResize:50' ); + const buttonView = editor.ui.componentFactory.create( 'resizeImage:50' ); buttonView.render(); expect( buttonView.withText ).to.be.false; @@ -244,8 +251,8 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should be created with a proper tooltip, depends on the set value', () => { - const buttonViewOriginal = editor.ui.componentFactory.create( 'imageResize:original' ); - const buttonView50 = editor.ui.componentFactory.create( 'imageResize:50' ); + const buttonViewOriginal = editor.ui.componentFactory.create( 'resizeImage:original' ); + const buttonView50 = editor.ui.componentFactory.create( 'resizeImage:50' ); buttonViewOriginal.render(); buttonView50.render(); @@ -254,9 +261,9 @@ describe( 'ImageResizeButtons', () => { expect( buttonView50.tooltip ).to.equal( 'Resize image to 50%' ); } ); - it( 'should execute `imageResize` command with "50%" value', () => { - const buttonView = editor.ui.componentFactory.create( 'imageResize:50' ); - const command = editor.commands.get( 'imageResize' ); + it( 'should execute `resizeImage` command with "50%" value', () => { + const buttonView = editor.ui.componentFactory.create( 'resizeImage:50' ); + const command = editor.commands.get( 'resizeImage' ); const commandSpy = sinon.spy( command, 'execute' ); command.isEnabled = true; @@ -268,10 +275,10 @@ describe( 'ImageResizeButtons', () => { } ); it( 'should have set a proper icon', () => { - const buttonOriginal = editor.ui.componentFactory.create( 'imageResize:original' ); - const button25 = editor.ui.componentFactory.create( 'imageResize:25' ); - const button50 = editor.ui.componentFactory.create( 'imageResize:50' ); - const button75 = editor.ui.componentFactory.create( 'imageResize:75' ); + const buttonOriginal = editor.ui.componentFactory.create( 'resizeImage:original' ); + const button25 = editor.ui.componentFactory.create( 'resizeImage:25' ); + const button50 = editor.ui.componentFactory.create( 'resizeImage:50' ); + const button75 = editor.ui.componentFactory.create( 'resizeImage:75' ); expect( buttonOriginal.icon ).to.deep.equal( iconFull ); expect( button25.icon ).to.deep.equal( iconSmall ); @@ -286,15 +293,15 @@ describe( 'ImageResizeButtons', () => { image: { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:noicon', + name: 'resizeImage:noicon', value: '100' } ], - toolbar: [ 'imageResize:noicon' ] + toolbar: [ 'resizeImage:noicon' ] } } ); expectToThrowCKEditorError( () => { - editor.ui.componentFactory.create( 'imageResize:noicon' ); + editor.ui.componentFactory.create( 'resizeImage:noicon' ); }, 'imageresizebuttons-missing-icon', editor ); editor.destroy(); diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js b/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js index 7f219053c67..3c5b28e8755 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js @@ -4,7 +4,7 @@ */ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; -import ImageResizeCommand from '../../src/imageresize/imageresizecommand'; +import ResizeImageCommand from '../../src/imageresize/imageresizecommand'; import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; describe( 'ImageStyleCommand', () => { @@ -14,7 +14,7 @@ describe( 'ImageStyleCommand', () => { return ModelTestEditor.create() .then( newEditor => { model = newEditor.model; - command = new ImageResizeCommand( newEditor ); + command = new ResizeImageCommand( newEditor ); model.schema.register( 'p', { inheritAllFrom: '$block' } ); diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js b/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js index 963782b9f2d..5ac9e9f3207 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js @@ -12,7 +12,7 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import Image from '../../src/image'; import ImageResizeEditing from '../../src/imageresize/imageresizeediting'; -import ImageResizeCommand from '../../src/imageresize/imageresizecommand'; +import ResizeImageCommand from '../../src/imageresize/imageresizecommand'; import ImageStyle from '../../src/imagestyle'; import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; @@ -58,22 +58,22 @@ describe( 'ImageResizeEditing', () => { it( 'should define the default value for config.image.resizeOptions', () => { expect( editor.config.get( 'image.resizeOptions' ) ).to.deep.equal( [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:25', + name: 'resizeImage:25', value: '25', icon: 'small' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } ] ); @@ -156,8 +156,12 @@ describe( 'ImageResizeEditing', () => { editor = await createEditor(); } ); - it( 'defines the imageResize command', () => { - expect( editor.commands.get( 'imageResize' ) ).to.be.instanceOf( ImageResizeCommand ); + it( 'defines the resizeImage command', () => { + expect( editor.commands.get( 'resizeImage' ) ).to.be.instanceOf( ResizeImageCommand ); + } ); + + it( 'defines the imageResize command as an alias for resizeImage command', () => { + expect( editor.commands.get( 'imageResize' ) ).to.equal( editor.commands.get( 'resizeImage' ) ); } ); } ); diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizehandles.js b/packages/ckeditor5-image/tests/imageresize/imageresizehandles.js index 833c8f120fe..c9438352bd7 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizehandles.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizehandles.js @@ -77,7 +77,7 @@ describe( 'ImageResizeHandles', () => { } ); it( 'uses the command on commit', async () => { - const spy = sinon.spy( editor.commands.get( 'imageResize' ), 'execute' ); + const spy = sinon.spy( editor.commands.get( 'resizeImage' ), 'execute' ); setData( editor.model, `foo[]` ); widget = viewDocument.getRoot().getChild( 1 ); @@ -98,27 +98,27 @@ describe( 'ImageResizeHandles', () => { let isEnabled = false; - editor.commands.get( 'imageResize' ).on( 'set:isEnabled', evt => { + editor.commands.get( 'resizeImage' ).on( 'set:isEnabled', evt => { evt.return = isEnabled; evt.stop(); }, { priority: 'highest' } ); - editor.commands.get( 'imageResize' ).refresh(); + editor.commands.get( 'resizeImage' ).refresh(); expect( resizer.isEnabled ).to.be.false; isEnabled = true; - editor.commands.get( 'imageResize' ).refresh(); + editor.commands.get( 'resizeImage' ).refresh(); expect( resizer.isEnabled ).to.be.true; } ); it( 'the resizer is disabled from the beginning when the command is disabled when the image is inserted', async () => { setData( editor.model, 'foo[]' ); - editor.commands.get( 'imageResize' ).on( 'set:isEnabled', evt => { + editor.commands.get( 'resizeImage' ).on( 'set:isEnabled', evt => { evt.return = false; evt.stop(); }, { priority: 'highest' } ); - editor.commands.get( 'imageResize' ).refresh(); + editor.commands.get( 'resizeImage' ).refresh(); editor.model.change( writer => { editor.model.insertContent( writer.createElement( 'image', { src: IMAGE_SRC_FIXTURE } ) ); diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js b/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js index f71e070dd93..32ff164634a 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js +++ b/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js @@ -9,7 +9,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ImageUploadCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; import FileRepository from '@ckeditor/ckeditor5-upload/src/filerepository'; import { createNativeFileMock, UploadAdapterMock } from '@ckeditor/ckeditor5-upload/tests/_utils/mocks'; @@ -17,7 +17,7 @@ import { setData as setModelData, getData as getModelData } from '@ckeditor/cked import Image from '../../src/image/imageediting'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; -describe( 'ImageUploadCommand', () => { +describe( 'UploadImageCommand', () => { let editor, command, model, fileRepository; class UploadAdapterPluginMock extends Plugin { @@ -38,7 +38,7 @@ describe( 'ImageUploadCommand', () => { editor = newEditor; model = editor.model; - command = new ImageUploadCommand( editor ); + command = new UploadImageCommand( editor ); const schema = model.schema; schema.extend( 'image', { allowAttributes: 'uploadId' } ); diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js b/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js index 18c18f8ee87..47f16bb48c8 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js +++ b/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js @@ -11,7 +11,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import ImageEditing from '../../src/image/imageediting'; import ImageUploadEditing from '../../src/imageupload/imageuploadediting'; -import ImageUploadCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting'; import DataTransfer from '@ckeditor/ckeditor5-clipboard/src/datatransfer'; @@ -80,8 +80,12 @@ describe( 'ImageUploadEditing', () => { expect( model.schema.checkAttribute( [ '$root', 'image' ], 'uploadId' ) ).to.be.true; } ); - it( 'should register imageUpload command', () => { - expect( editor.commands.get( 'imageUpload' ) ).to.be.instanceOf( ImageUploadCommand ); + it( 'should register uploadImage command', () => { + expect( editor.commands.get( 'uploadImage' ) ).to.be.instanceOf( UploadImageCommand ); + } ); + + it( 'should register imageUpload command as an alias for uploadImage command', () => { + expect( editor.commands.get( 'imageUpload' ) ).to.equal( editor.commands.get( 'uploadImage' ) ); } ); it( 'should load Clipboard plugin', () => { @@ -149,13 +153,13 @@ describe( 'ImageUploadEditing', () => { ); } ); - it( 'should insert image when is pasted on allowed position when ImageUploadCommand is disabled', () => { + it( 'should insert image when is pasted on allowed position when UploadImageCommand is disabled', () => { setModelData( model, 'foo[]' ); const fileMock = createNativeFileMock(); const dataTransfer = new DataTransfer( { files: [ fileMock ], types: [ 'Files' ] } ); - const command = editor.commands.get( 'imageUpload' ); + const command = editor.commands.get( 'uploadImage' ); expect( command.isEnabled ).to.be.true; @@ -353,7 +357,7 @@ describe( 'ImageUploadEditing', () => { it( 'should not use read data once it is present', done => { const file = createNativeFileMock(); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); model.document.once( 'change', () => { tryExpect( done, () => { @@ -377,7 +381,7 @@ describe( 'ImageUploadEditing', () => { it( 'should replace read data with server response once it is present', done => { const file = createNativeFileMock(); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); model.document.once( 'change', () => { model.document.once( 'change', () => { @@ -408,7 +412,7 @@ describe( 'ImageUploadEditing', () => { }, { priority: 'high' } ); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); loader.file.then( () => nativeReaderMock.mockError( 'Reading error.' ) ); } ); @@ -424,7 +428,7 @@ describe( 'ImageUploadEditing', () => { }, { priority: 'high' } ); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); loader.file.then( () => { nativeReaderMock.abort(); @@ -451,7 +455,7 @@ describe( 'ImageUploadEditing', () => { } ); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); sinon.assert.calledOnce( loadSpy ); @@ -494,7 +498,7 @@ describe( 'ImageUploadEditing', () => { evt.stop(); }, { priority: 'high' } ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); model.document.once( 'change', () => { model.document.once( 'change', () => { @@ -511,7 +515,7 @@ describe( 'ImageUploadEditing', () => { it( 'should abort upload if image is removed', () => { const file = createNativeFileMock(); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); const abortSpy = sinon.spy( loader, 'abort' ); @@ -533,7 +537,7 @@ describe( 'ImageUploadEditing', () => { it( 'should not abort and not restart upload when image is moved', () => { const file = createNativeFileMock(); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); const abortSpy = sinon.spy( loader, 'abort' ); const loadSpy = sinon.spy( loader, 'read' ); @@ -558,7 +562,7 @@ describe( 'ImageUploadEditing', () => { evt.stop(); }, { priority: 'high' } ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); const stub = sinon.stub(); model.document.on( 'change', stub ); @@ -586,7 +590,7 @@ describe( 'ImageUploadEditing', () => { it( 'should create responsive image if server return multiple images', done => { const file = createNativeFileMock(); setModelData( model, '{}foo bar' ); - editor.execute( 'imageUpload', { file } ); + editor.execute( 'uploadImage', { file } ); model.document.once( 'change', () => { model.document.once( 'change', () => { diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadprogress.js b/packages/ckeditor5-image/tests/imageupload/imageuploadprogress.js index 7e479f869a1..ffc969c58d6 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadprogress.js +++ b/packages/ckeditor5-image/tests/imageupload/imageuploadprogress.js @@ -71,7 +71,7 @@ describe( 'ImageUploadProgress', () => { it( 'should convert image\'s "reading" uploadStatus attribute', () => { setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); expect( getViewData( view ) ).to.equal( '[
' + @@ -83,7 +83,7 @@ describe( 'ImageUploadProgress', () => { it( 'should convert image\'s "uploading" uploadStatus attribute', done => { setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); model.document.once( 'change', () => { try { @@ -133,7 +133,7 @@ describe( 'ImageUploadProgress', () => { setModelData( model, '[]' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); model.document.once( 'change', () => { try { @@ -222,7 +222,7 @@ describe( 'ImageUploadProgress', () => { it( 'should update progressbar width on progress', done => { setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); model.document.once( 'change', () => { adapterMock.mockProgress( 40, 100 ); @@ -248,7 +248,7 @@ describe( 'ImageUploadProgress', () => { const clock = testUtils.sinon.useFakeTimers(); setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); model.document.once( 'change', () => { model.document.once( 'change', () => { @@ -285,7 +285,7 @@ describe( 'ImageUploadProgress', () => { uploadProgress.placeholder = base64Sample; setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); expect( getViewData( view ) ).to.equal( '[
' + @@ -301,7 +301,7 @@ describe( 'ImageUploadProgress', () => { }, { priority: 'highest' } ); setModelData( model, '[]foo' ); - editor.execute( 'imageUpload', { file: createNativeFileMock() } ); + editor.execute( 'uploadImage', { file: createNativeFileMock() } ); expect( getViewData( view ) ).to.equal( '[
]

foo

' diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadui.js b/packages/ckeditor5-image/tests/imageupload/imageuploadui.js index 15c090e5c31..127841a8959 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadui.js +++ b/packages/ckeditor5-image/tests/imageupload/imageuploadui.js @@ -56,23 +56,30 @@ describe( 'ImageUploadUI', () => { return editor.destroy(); } ); - it( 'should register imageUpload button', () => { - const button = editor.ui.componentFactory.create( 'imageUpload' ); + it( 'should register uploadImage button', () => { + const button = editor.ui.componentFactory.create( 'uploadImage' ); expect( button ).to.be.instanceOf( FileDialogButtonView ); } ); - it( 'should set proper accepted mime-types for imageUpload button as defined in configuration', () => { + it( 'should register imageUpload button as an alias for uploadImage button', () => { + const buttonCreator = editor.ui.componentFactory._components.get( 'uploadImage'.toLowerCase() ); + const buttonAliasCreator = editor.ui.componentFactory._components.get( 'imageUpload'.toLowerCase() ); + + expect( buttonCreator.callback ).to.equal( buttonAliasCreator.callback ); + } ); + + it( 'should set proper accepted mime-types for uploadImage button as defined in configuration', () => { editor.config.set( 'image.upload.types', [ 'svg+xml', 'jpeg', 'vnd.microsoft.icon', 'x-xbitmap' ] ); - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); expect( button.acceptedType ).to.equal( 'image/svg+xml,image/jpeg,image/vnd.microsoft.icon,image/x-xbitmap' ); } ); - it( 'should be disabled while ImageUploadCommand is disabled', () => { - const button = editor.ui.componentFactory.create( 'imageUpload' ); - const command = editor.commands.get( 'imageUpload' ); + it( 'should be disabled while UploadImageCommand is disabled', () => { + const button = editor.ui.componentFactory.create( 'uploadImage' ); + const command = editor.commands.get( 'uploadImage' ); command.isEnabled = true; @@ -84,9 +91,9 @@ describe( 'ImageUploadUI', () => { } ); // ckeditor5-upload/#77 - it( 'should be properly bound with ImageUploadCommand', () => { - const button = editor.ui.componentFactory.create( 'imageUpload' ); - const command = editor.commands.get( 'imageUpload' ); + it( 'should be properly bound with UploadImageCommand', () => { + const button = editor.ui.componentFactory.create( 'uploadImage' ); + const command = editor.commands.get( 'uploadImage' ); const spy = sinon.spy(); button.render(); @@ -100,30 +107,30 @@ describe( 'ImageUploadUI', () => { sinon.assert.notCalled( spy ); } ); - it( 'should execute imageUpload command', () => { + it( 'should execute uploadImage command', () => { const executeStub = sinon.stub( editor, 'execute' ); - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const files = [ createNativeFileMock() ]; button.fire( 'done', files ); sinon.assert.calledOnce( executeStub ); - expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'imageUpload' ); + expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'uploadImage' ); expect( executeStub.firstCall.args[ 1 ].file ).to.deep.equal( files ); } ); - it( 'should execute imageUpload command with multiple files', () => { + it( 'should execute uploadImage command with multiple files', () => { const executeStub = sinon.stub( editor, 'execute' ); - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const files = [ createNativeFileMock(), createNativeFileMock(), createNativeFileMock() ]; button.fire( 'done', files ); sinon.assert.calledOnce( executeStub ); - expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'imageUpload' ); + expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'uploadImage' ); expect( executeStub.firstCall.args[ 1 ].file ).to.deep.equal( files ); } ); it( 'should optimize the insertion position', () => { - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const files = [ createNativeFileMock() ]; setModelData( model, 'f[]oo' ); @@ -139,7 +146,7 @@ describe( 'ImageUploadUI', () => { } ); it( 'should correctly insert multiple files', () => { - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const files = [ createNativeFileMock(), createNativeFileMock() ]; setModelData( model, 'foo[]bar' ); @@ -157,9 +164,9 @@ describe( 'ImageUploadUI', () => { ); } ); - it( 'should not execute imageUpload if the file is not an image', () => { + it( 'should not execute uploadImage if the file is not an image', () => { const executeStub = sinon.stub( editor, 'execute' ); - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const file = { type: 'media/mp3', size: 1024 @@ -171,7 +178,7 @@ describe( 'ImageUploadUI', () => { it( 'should work even if the FileList does not support iterators', () => { const executeStub = sinon.stub( editor, 'execute' ); - const button = editor.ui.componentFactory.create( 'imageUpload' ); + const button = editor.ui.componentFactory.create( 'uploadImage' ); const files = { 0: createNativeFileMock(), length: 1 @@ -179,7 +186,7 @@ describe( 'ImageUploadUI', () => { button.fire( 'done', files ); sinon.assert.calledOnce( executeStub ); - expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'imageUpload' ); + expect( executeStub.firstCall.args[ 0 ] ).to.equal( 'uploadImage' ); expect( executeStub.firstCall.args[ 1 ].file ).to.deep.equal( [ files[ 0 ] ] ); } ); } ); diff --git a/packages/ckeditor5-image/tests/manual/imageinsertviaurl.js b/packages/ckeditor5-image/tests/manual/imageinsertviaurl.js index 8332c1fa641..4493bcc9c7d 100644 --- a/packages/ckeditor5-image/tests/manual/imageinsertviaurl.js +++ b/packages/ckeditor5-image/tests/manual/imageinsertviaurl.js @@ -22,7 +22,7 @@ ClassicEditor 'bulletedList', 'numberedList', 'blockQuote', - 'imageInsert', + 'insertImage', 'insertTable', 'mediaEmbed', 'undo', diff --git a/packages/ckeditor5-image/tests/manual/imageinsertviaurl.md b/packages/ckeditor5-image/tests/manual/imageinsertviaurl.md index 6090d8f64d8..2d78c167185 100644 --- a/packages/ckeditor5-image/tests/manual/imageinsertviaurl.md +++ b/packages/ckeditor5-image/tests/manual/imageinsertviaurl.md @@ -1,18 +1,18 @@ ## Image insert via URL -1. Click on the arrow button in `imageInsert` plugin to reveal the image insert panel. +1. Click on the arrow button in `insertImage` plugin to reveal the image insert panel. 1. Paste the URL to the input (eg: `https://ckeditor.com/docs/ckeditor5/latest/assets/img/malta.jpg`). 1. Click `Insert` button. ## Image replace via URL 1. Click on the image in the editor. -1. Click on the arrow button in `imageInsert` plugin to reveal the image insert panel. +1. Click on the arrow button in `insertImage` plugin to reveal the image insert panel. 1. Edit the value of the input. 1. Click `Update` button. ## Image insert via integrations -1. In the **Editor 2** click on the arrow button in `imageInsert` plugin to reveal the image insert panel. +1. In the **Editor 2** click on the arrow button in `insertImage` plugin to reveal the image insert panel. 1. Click on the **CKFinder** button. 1. Choose image and confirm. diff --git a/packages/ckeditor5-image/tests/manual/imageresize.js b/packages/ckeditor5-image/tests/manual/imageresize.js index eaa6d40b62e..9058ab29974 100644 --- a/packages/ckeditor5-image/tests/manual/imageresize.js +++ b/packages/ckeditor5-image/tests/manual/imageresize.js @@ -25,7 +25,7 @@ const commonConfig = { toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', 'undo', 'redo', 'outdent', 'indent' ], image: { - toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'imageResize' ], + toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'resizeImage' ], styles: [ 'alignLeft', 'alignCenter', diff --git a/packages/ckeditor5-image/tests/manual/imageresizebuttons.js b/packages/ckeditor5-image/tests/manual/imageresizebuttons.js index 0bbdd589fba..62016381325 100644 --- a/packages/ckeditor5-image/tests/manual/imageresizebuttons.js +++ b/packages/ckeditor5-image/tests/manual/imageresizebuttons.js @@ -40,19 +40,19 @@ const imageConfig1 = { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75' } ], - toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'imageResize' ], + toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'resizeImage' ], styles: [ 'alignLeft', 'alignCenter', @@ -80,17 +80,17 @@ const imageConfig2 = { resizeUnit: '%', resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', value: null, icon: 'original' }, { - name: 'imageResize:50', + name: 'resizeImage:50', value: '50', icon: 'medium' }, { - name: 'imageResize:75', + name: 'resizeImage:75', value: '75', icon: 'large' } @@ -99,9 +99,9 @@ const imageConfig2 = { 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:side', '|', - 'imageResize:50', - 'imageResize:75', - 'imageResize:original' + 'resizeImage:50', + 'resizeImage:75', + 'resizeImage:original' ], styles: [ 'full', diff --git a/packages/ckeditor5-image/tests/manual/imageresizepx.js b/packages/ckeditor5-image/tests/manual/imageresizepx.js index 0ecd0d553bb..a6974d85da4 100644 --- a/packages/ckeditor5-image/tests/manual/imageresizepx.js +++ b/packages/ckeditor5-image/tests/manual/imageresizepx.js @@ -26,7 +26,7 @@ const commonConfig = { 'bulletedList', 'numberedList', 'blockQuote', 'insertTable', 'undo', 'redo', 'outdent', 'indent' ], image: { resizeUnit: 'px', - toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'imageResize' ], + toolbar: [ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', 'resizeImage' ], styles: [ 'alignLeft', 'alignCenter', diff --git a/packages/ckeditor5-image/tests/manual/imageupload.js b/packages/ckeditor5-image/tests/manual/imageupload.js index e318e4023de..c794e33a1c9 100644 --- a/packages/ckeditor5-image/tests/manual/imageupload.js +++ b/packages/ckeditor5-image/tests/manual/imageupload.js @@ -25,7 +25,7 @@ ClassicEditor 'bulletedList', 'numberedList', 'blockQuote', - 'imageUpload', + 'uploadImage', 'insertTable', 'mediaEmbed', 'undo', diff --git a/packages/ckeditor5-list/docs/_snippets/features/lists-basic.js b/packages/ckeditor5-list/docs/_snippets/features/lists-basic.js index 595bddef034..a634413d7c3 100644 --- a/packages/ckeditor5-list/docs/_snippets/features/lists-basic.js +++ b/packages/ckeditor5-list/docs/_snippets/features/lists-basic.js @@ -22,7 +22,7 @@ ClassicEditor 'indent', '|', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-list/docs/_snippets/features/lists-style.js b/packages/ckeditor5-list/docs/_snippets/features/lists-style.js index fe8b274ec72..ff6a2e88fc1 100644 --- a/packages/ckeditor5-list/docs/_snippets/features/lists-style.js +++ b/packages/ckeditor5-list/docs/_snippets/features/lists-style.js @@ -23,7 +23,7 @@ ClassicEditor 'indent', '|', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-list/src/todolistcheckcommand.js b/packages/ckeditor5-list/src/todolistcheckcommand.js index 9170748cf50..2232f340566 100644 --- a/packages/ckeditor5-list/src/todolistcheckcommand.js +++ b/packages/ckeditor5-list/src/todolistcheckcommand.js @@ -4,7 +4,7 @@ */ /** - * @module list/todolistcheckedcommand + * @module list/checktodolistcommand */ import Command from '@ckeditor/ckeditor5-core/src/command'; @@ -12,14 +12,14 @@ import Command from '@ckeditor/ckeditor5-core/src/command'; const attributeKey = 'todoListChecked'; /** - * The to-do check command. + * The check to-do command. * * The command is registered by the {@link module:list/todolistediting~TodoListEditing} as - * the `'todoListCheck'` editor command. + * the `'checkTodoList'` editor command and it is also available via aliased `todoListCheck` name. * * @extends module:core/command~Command */ -export default class TodoListCheckCommand extends Command { +export default class CheckTodoListCommand extends Command { /** * @inheritDoc */ diff --git a/packages/ckeditor5-list/src/todolistediting.js b/packages/ckeditor5-list/src/todolistediting.js index d470da2e686..781b7acb48d 100644 --- a/packages/ckeditor5-list/src/todolistediting.js +++ b/packages/ckeditor5-list/src/todolistediting.js @@ -9,7 +9,7 @@ import ListCommand from './listcommand'; import ListEditing from './listediting'; -import TodoListCheckCommand from './todolistcheckcommand'; +import CheckTodoListCommand from './todolistcheckcommand'; import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; @@ -30,7 +30,8 @@ import { getLocalizedArrowKeyCodeDirection } from '@ckeditor/ckeditor5-utils/src * it with the commands: * * - `'todoList'`, - * - `'todoListCheck'`. + * - `'checkTodoList'`, + * - `'todoListCheck'` as an alias for `checkTodoList` command. * * @extends module:core/plugin~Plugin */ @@ -70,9 +71,14 @@ export default class TodoListEditing extends Plugin { } } ); - // Register commands. + // Register `todoList` command. editor.commands.add( 'todoList', new ListCommand( editor, 'todo' ) ); - editor.commands.add( 'todoListCheck', new TodoListCheckCommand( editor ) ); + + const checkTodoListCommand = new CheckTodoListCommand( editor ); + + // Register `checkTodoList` command and add `todoListCheck` command as an alias for backward compatibility. + editor.commands.add( 'checkTodoList', checkTodoListCommand ); + editor.commands.add( 'todoListCheck', checkTodoListCommand ); // Define converters. data.downcastDispatcher.on( 'insert:listItem', dataModelViewInsertion( model ), { priority: 'high' } ); @@ -108,7 +114,7 @@ export default class TodoListEditing extends Plugin { this.listenTo( editing.view.document, 'keydown', jumpOverCheckmarkOnSideArrowKeyPress( model, editor.locale ) ); // Toggle check state of selected to-do list items on keystroke. - editor.keystrokes.set( 'Ctrl+space', () => editor.execute( 'todoListCheck' ) ); + editor.keystrokes.set( 'Ctrl+space', () => editor.execute( 'checkTodoList' ) ); // Remove `todoListChecked` attribute when a host element is no longer a to-do list item. const listItemsToFix = new Set(); @@ -163,7 +169,7 @@ export default class TodoListEditing extends Plugin { model.change( writer => { writer.setSelection( listItem, 'end' ); - editor.execute( 'todoListCheck' ); + editor.execute( 'checkTodoList' ); writer.setSelection( previousSelectionRanges ); } ); } diff --git a/packages/ckeditor5-list/tests/todolistcheckcommand.js b/packages/ckeditor5-list/tests/todolistcheckcommand.js index 136f382a8b0..ec76169f92b 100644 --- a/packages/ckeditor5-list/tests/todolistcheckcommand.js +++ b/packages/ckeditor5-list/tests/todolistcheckcommand.js @@ -4,12 +4,12 @@ */ import TodoListEditing from '../src/todolistediting'; -import TodoListCheckCommand from '../src/todolistcheckcommand'; +import CheckTodoListCommand from '../src/todolistcheckcommand'; import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; -describe( 'TodoListCheckCommand', () => { +describe( 'CheckTodoListCommand', () => { let editor, model, command; beforeEach( () => { @@ -20,7 +20,7 @@ describe( 'TodoListCheckCommand', () => { .then( newEditor => { editor = newEditor; model = editor.model; - command = new TodoListCheckCommand( editor ); + command = new CheckTodoListCommand( editor ); } ); } ); diff --git a/packages/ckeditor5-list/tests/todolistediting.js b/packages/ckeditor5-list/tests/todolistediting.js index 7e69d51bb1c..e6b862ae046 100644 --- a/packages/ckeditor5-list/tests/todolistediting.js +++ b/packages/ckeditor5-list/tests/todolistediting.js @@ -9,7 +9,7 @@ import BoldEditing from '@ckeditor/ckeditor5-basic-styles/src/bold/boldediting'; import BlockQuoteEditing from '@ckeditor/ckeditor5-block-quote/src/blockquoteediting'; import Typing from '@ckeditor/ckeditor5-typing/src/typing'; import ListCommand from '../src/listcommand'; -import TodoListCheckCommand from '../src/todolistcheckcommand'; +import CheckTodoListCommand from '../src/todolistcheckcommand'; import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview'; import LinkEditing from '@ckeditor/ckeditor5-link/src/linkediting'; @@ -123,8 +123,12 @@ describe( 'TodoListEditing', () => { assertEqualMarkup( getViewData( view ), '

ab{}

' ); } ); - it( 'should register todoListCheck command', () => { - expect( editor.commands.get( 'todoListCheck' ) ).to.be.instanceOf( TodoListCheckCommand ); + it( 'should register checkTodoList command', () => { + expect( editor.commands.get( 'checkTodoList' ) ).to.be.instanceOf( CheckTodoListCommand ); + } ); + + it( 'should register todoListCheck command as an alias for checkTodoList command', () => { + expect( editor.commands.get( 'todoListCheck' ) ).to.equal( editor.commands.get( 'checkTodoList' ) ); } ); } ); @@ -608,7 +612,7 @@ describe( 'TodoListEditing', () => { ); // CC. - editor.execute( 'todoListCheck' ); + editor.execute( 'checkTodoList' ); } ); it( 'should properly handle typing inside text node with attribute', () => { @@ -1164,8 +1168,8 @@ describe( 'TodoListEditing', () => { }; } ); - it( 'should execute TodoListCheckCommand', () => { - const command = editor.commands.get( 'todoListCheck' ); + it( 'should execute CheckTodoListCommand', () => { + const command = editor.commands.get( 'checkTodoList' ); sinon.spy( command, 'execute' ); @@ -1239,7 +1243,7 @@ describe( 'TodoListEditing - checkbox rendering', () => { 'b[a]r' ); - const command = editor.commands.get( 'todoListCheck' ); + const command = editor.commands.get( 'checkTodoList' ); sinon.spy( command, 'execute' ); @@ -1280,7 +1284,7 @@ describe( 'TodoListEditing - checkbox rendering', () => { setModelData( model, 'f[]oo' ); editor.execute( 'todoList' ); - const command = editor.commands.get( 'todoListCheck' ); + const command = editor.commands.get( 'checkTodoList' ); sinon.spy( command, 'execute' ); @@ -1313,7 +1317,7 @@ describe( 'TodoListEditing - checkbox rendering', () => { dynamicRootEditable.name = 'dynamicRoot'; view.attachDomRoot( dynamicRootElement, 'dynamicRoot' ); - const command = editor.commands.get( 'todoListCheck' ); + const command = editor.commands.get( 'checkTodoList' ); sinon.spy( command, 'execute' ); diff --git a/packages/ckeditor5-page-break/docs/_snippets/features/page-break.js b/packages/ckeditor5-page-break/docs/_snippets/features/page-break.js index eb9f82ea32e..659268ebcd4 100644 --- a/packages/ckeditor5-page-break/docs/_snippets/features/page-break.js +++ b/packages/ckeditor5-page-break/docs/_snippets/features/page-break.js @@ -32,7 +32,7 @@ ClassicEditor 'pageBreak', 'blockQuote', 'link', - 'imageUpload', + 'uploadImage', 'mediaEmbed', 'insertTable', '|', diff --git a/packages/ckeditor5-page-break/tests/manual/pagebreak.js b/packages/ckeditor5-page-break/tests/manual/pagebreak.js index 6d89a66e722..3d0710d50bc 100644 --- a/packages/ckeditor5-page-break/tests/manual/pagebreak.js +++ b/packages/ckeditor5-page-break/tests/manual/pagebreak.js @@ -21,7 +21,7 @@ ClassicEditor '|', 'bold', 'italic', 'numberedList', 'bulletedList', '|', - 'link', 'blockquote', 'imageUpload', 'insertTable', 'mediaEmbed', + 'link', 'blockquote', 'uploadImage', 'insertTable', 'mediaEmbed', '|', 'undo', 'redo', '|', diff --git a/packages/ckeditor5-page-break/tests/pagebreakediting.js b/packages/ckeditor5-page-break/tests/pagebreakediting.js index 138a2d40e7d..4df2676ff09 100644 --- a/packages/ckeditor5-page-break/tests/pagebreakediting.js +++ b/packages/ckeditor5-page-break/tests/pagebreakediting.js @@ -46,7 +46,7 @@ describe( 'PageBreakEditing', () => { expect( model.schema.checkChild( [ '$root', '$block' ], 'pageBreak' ) ).to.be.false; } ); - it( 'should register imageInsert command', () => { + it( 'should register pageBreak command', () => { expect( editor.commands.get( 'pageBreak' ) ).to.be.instanceOf( PageBreakCommand ); } ); diff --git a/packages/ckeditor5-paste-from-office/docs/_snippets/features/paste-from-office.js b/packages/ckeditor5-paste-from-office/docs/_snippets/features/paste-from-office.js index 74ea9d1490b..19cb0008fc2 100644 --- a/packages/ckeditor5-paste-from-office/docs/_snippets/features/paste-from-office.js +++ b/packages/ckeditor5-paste-from-office/docs/_snippets/features/paste-from-office.js @@ -32,7 +32,7 @@ ClassicEditor 'outdent', '|', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', 'horizontalLine', '|', diff --git a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-extended-category.js b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-extended-category.js index e762a18dd68..c7c23f638f9 100644 --- a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-extended-category.js +++ b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-extended-category.js @@ -36,7 +36,7 @@ ClassicEditor '|', 'specialCharacters', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-limited-categories.js b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-limited-categories.js index fea8f2682af..a2c4d3ac0ee 100644 --- a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-limited-categories.js +++ b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-limited-categories.js @@ -24,7 +24,7 @@ ClassicEditor '|', 'specialCharacters', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-new-category.js b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-new-category.js index 4a2d5d80045..73bc0562a30 100644 --- a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-new-category.js +++ b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters-new-category.js @@ -34,7 +34,7 @@ ClassicEditor '|', 'specialCharacters', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters.js b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters.js index a92d03ee869..62fda1d0ace 100644 --- a/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters.js +++ b/packages/ckeditor5-special-characters/docs/_snippets/features/special-characters.js @@ -24,7 +24,7 @@ ClassicEditor '|', 'specialCharacters', 'link', - 'imageUpload', + 'uploadImage', 'insertTable', '|', 'undo', diff --git a/packages/ckeditor5-special-characters/tests/manual/specialcharacters.js b/packages/ckeditor5-special-characters/tests/manual/specialcharacters.js index a35448fbd72..32e81e59d91 100644 --- a/packages/ckeditor5-special-characters/tests/manual/specialcharacters.js +++ b/packages/ckeditor5-special-characters/tests/manual/specialcharacters.js @@ -22,7 +22,7 @@ ClassicEditor '|', 'bold', 'italic', 'numberedList', 'bulletedList', '|', - 'link', 'blockquote', 'imageUpload', 'insertTable', 'mediaEmbed', + 'link', 'blockquote', 'uploadImage', 'insertTable', 'mediaEmbed', '|', 'undo', 'redo', '|', diff --git a/packages/ckeditor5-ui/docs/_snippets/features/blocktoolbar.js b/packages/ckeditor5-ui/docs/_snippets/features/blocktoolbar.js index 0e5c6a3e2b5..f9653040316 100644 --- a/packages/ckeditor5-ui/docs/_snippets/features/blocktoolbar.js +++ b/packages/ckeditor5-ui/docs/_snippets/features/blocktoolbar.js @@ -25,7 +25,7 @@ BalloonEditor '|', 'outdent', 'indent', '|', - 'blockQuote', 'imageUpload' + 'blockQuote', 'uploadImage' ], cloudServices: CS_CONFIG } ) diff --git a/packages/ckeditor5-ui/docs/features/blocktoolbar.md b/packages/ckeditor5-ui/docs/features/blocktoolbar.md index 7aeb9823c5d..971e0d53f2e 100644 --- a/packages/ckeditor5-ui/docs/features/blocktoolbar.md +++ b/packages/ckeditor5-ui/docs/features/blocktoolbar.md @@ -66,7 +66,7 @@ BalloonEditor '|', 'bulletedList', 'numberedList', '|', - 'blockQuote', 'imageUpload' + 'blockQuote', 'uploadImage' ], toolbar: [ ... ] } ) @@ -90,7 +90,7 @@ BalloonEditor '|', 'bulletedList', 'numberedList', '|', - 'blockQuote', 'imageUpload' + 'blockQuote', 'uploadImage' ], shouldNotGroupWhenFull: true }, diff --git a/packages/ckeditor5-upload/CHANGELOG.md b/packages/ckeditor5-upload/CHANGELOG.md index 4220f3ebc77..b65eb9afd15 100644 --- a/packages/ckeditor5-upload/CHANGELOG.md +++ b/packages/ckeditor5-upload/CHANGELOG.md @@ -164,7 +164,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* Fixed incorrect `ImageUploadButton` and `ImageUploadCommand` binding. Closes [#77](https://github.com/ckeditor/ckeditor5-upload/issues/77). Closes https://github.com/ckeditor/ckeditor5-ui/issues/357. ([d231ea6](https://github.com/ckeditor/ckeditor5-upload/commit/d231ea6)) +* Fixed incorrect `UploadImageButton` and `UploadImageCommand` binding. Closes [#77](https://github.com/ckeditor/ckeditor5-upload/issues/77). Closes https://github.com/ckeditor/ckeditor5-ui/issues/357. ([d231ea6](https://github.com/ckeditor/ckeditor5-upload/commit/d231ea6)) ### Other changes @@ -178,7 +178,7 @@ Internal changes only (updated dependencies, documentation, etc.). * Removed `ImageUpload` plugin. It can be no found in ckeditor5-image repository. * Removed `ImageUploadEngine` plugin. It can be no found in ckeditor5-image repository. * Removed `ImageUploadProgress` plugin. It can be no found in ckeditor5-image repository. -* Removed `ImageUploadButton` plugin. It can be no found in ckeditor5-image repository. +* Removed `UploadImageButton` plugin. It can be no found in ckeditor5-image repository. * Renamed `FileRepository#createAdapter()` to `FileRepository#createUploadAdapter()`. * Renamed `filerepository-no-adapter` error to `filerepository-no-upload-adapter`. @@ -219,7 +219,7 @@ Internal changes only (updated dependencies, documentation, etc.). * [Safari, Edge] The image upload (button) feature will not throw an error anymore when trying to access picked files. The feature should not use `for...of` loop on native `FileList` because Safari and Edge do not support `Symbol.iterator` for it yet. Closes [#35](https://github.com/ckeditor/ckeditor5-upload/issues/35). ([f4efd9b](https://github.com/ckeditor/ckeditor5-upload/commit/f4efd9b)) * An image dropped on another image will not redirect the browser to the file's path. Closes [#32](https://github.com/ckeditor/ckeditor5-upload/issues/32). ([4f533be](https://github.com/ckeditor/ckeditor5-upload/commit/4f533be)) -* Bound `ImageUploadButton#isEnabled` to `ImageUploadCommand#isEnabled`. Closes [#43](https://github.com/ckeditor/ckeditor5-upload/issues/43). ([ba6de66](https://github.com/ckeditor/ckeditor5-upload/commit/ba6de66)) +* Bound `UploadImageButton#isEnabled` to `UploadImageCommand#isEnabled`. Closes [#43](https://github.com/ckeditor/ckeditor5-upload/issues/43). ([ba6de66](https://github.com/ckeditor/ckeditor5-upload/commit/ba6de66)) * Fixed two issues related to dropping images. First, when dropping a file into an empty paragraph, that paragraph should be replaced with that image. Second, drop position should be read correctly when the editor is focused upon drop. Closes [#42](https://github.com/ckeditor/ckeditor5-upload/issues/42). Closes [#29](https://github.com/ckeditor/ckeditor5-upload/issues/29). ([fec452d](https://github.com/ckeditor/ckeditor5-upload/commit/fec452d)) * Image will be inserted after the block if the selection is placed at the block's end. Closes [#7](https://github.com/ckeditor/ckeditor5-upload/issues/7). ([70742f9](https://github.com/ckeditor/ckeditor5-upload/commit/70742f9)) * When image upload is aborted, now the "image placeholder" element is permanently removed so it is not reinserted on undo. Closes [#38](https://github.com/ckeditor/ckeditor5-upload/issues/38). ([aff6382](https://github.com/ckeditor/ckeditor5-upload/commit/aff6382)) @@ -227,7 +227,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Features * Responsive images support in image upload. Closes [#34](https://github.com/ckeditor/ckeditor5-upload/issues/34). ([9a022a2](https://github.com/ckeditor/ckeditor5-upload/commit/9a022a2)) -* The `ImageUploadCommand` now accepts `insertAt` position which allows customizing where the image will be inserted. Closes [#45](https://github.com/ckeditor/ckeditor5-upload/issues/45). ([b90c8d7](https://github.com/ckeditor/ckeditor5-upload/commit/b90c8d7)) +* The `UploadImageCommand` now accepts `insertAt` position which allows customizing where the image will be inserted. Closes [#45](https://github.com/ckeditor/ckeditor5-upload/issues/45). ([b90c8d7](https://github.com/ckeditor/ckeditor5-upload/commit/b90c8d7)) ### Other changes diff --git a/packages/ckeditor5-widget/src/widgetresize.js b/packages/ckeditor5-widget/src/widgetresize.js index 4e9b4e9fd1e..eaecb65e135 100644 --- a/packages/ckeditor5-widget/src/widgetresize.js +++ b/packages/ckeditor5-widget/src/widgetresize.js @@ -262,7 +262,7 @@ mix( WidgetResize, ObservableMixin ); * viewElement: widget, * * onCommit( newValue ) { - * editor.execute( 'imageResize', { width: newValue } ); + * editor.execute( 'resizeImage', { width: newValue } ); * } * }; * ``` diff --git a/tests/manual/all-features.js b/tests/manual/all-features.js index be84e2243ad..fc87c363a9c 100644 --- a/tests/manual/all-features.js +++ b/tests/manual/all-features.js @@ -57,7 +57,7 @@ ClassicEditor '|', 'bulletedList', 'numberedList', 'todoList', '|', - 'blockQuote', 'imageUpload', 'insertTable', 'mediaEmbed', 'codeBlock', + 'blockQuote', 'uploadImage', 'insertTable', 'mediaEmbed', 'codeBlock', '|', 'alignment', 'outdent', 'indent', '|', @@ -77,17 +77,17 @@ ClassicEditor ], resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original size', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } @@ -95,7 +95,7 @@ ClassicEditor toolbar: [ 'imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize' + 'resizeImage' ], insert: { integrations: [ diff --git a/tests/manual/mathtype.js b/tests/manual/mathtype.js index 0a42d1f0fc2..18e0ecf684b 100644 --- a/tests/manual/mathtype.js +++ b/tests/manual/mathtype.js @@ -48,7 +48,7 @@ ClassicEditor 'MathType', 'ChemType', '|', 'heading', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor', 'highlight', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', 'code', 'subscript', 'superscript', 'removeFormat', '|', 'bulletedList', 'numberedList', 'indent', 'outdent', '|', 'link', - 'blockQuote', 'imageUpload', 'mediaEmbed', 'insertTable', '|', 'undo', 'redo' + 'blockQuote', 'uploadImage', 'mediaEmbed', 'insertTable', '|', 'undo', 'redo' ], image: { toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ] diff --git a/tests/manual/memory/memory.js b/tests/manual/memory/memory.js index 3756e96d45d..c32c0e75f56 100644 --- a/tests/manual/memory/memory.js +++ b/tests/manual/memory/memory.js @@ -61,7 +61,7 @@ function initEditor() { '|', 'bulletedList', 'numberedList', 'todoList', '|', - 'blockQuote', 'imageUpload', 'insertTable', 'mediaEmbed', 'codeBlock', + 'blockQuote', 'uploadImage', 'insertTable', 'mediaEmbed', 'codeBlock', '|', 'alignment', 'outdent', 'indent', '|', diff --git a/tests/manual/wproofreader.js b/tests/manual/wproofreader.js index d010e15b390..ad6dcfc2bea 100644 --- a/tests/manual/wproofreader.js +++ b/tests/manual/wproofreader.js @@ -45,7 +45,7 @@ ClassicEditor toolbar: [ 'heading', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor', 'highlight', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', 'code', 'subscript', 'superscript', 'removeFormat', '|', - 'link', 'blockQuote', 'imageUpload', 'mediaEmbed', 'insertTable', '|', + 'link', 'blockQuote', 'uploadImage', 'mediaEmbed', 'insertTable', '|', 'bulletedList', 'numberedList', 'indent', 'outdent', '|', 'undo', 'redo', '|' ], From ffa073c0e462575eb105ba797dd0c1498a6c7d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Mon, 2 Nov 2020 10:39:49 +0100 Subject: [PATCH 2/9] Replaced forwardDelete with deleteForward --- .../guides/contributing/code-style.md | 52 ++++++++++++++++++- .../tests/model/operation/transform/undo.js | 2 +- .../ckeditor5-image/src/image/imageediting.js | 2 +- ...insertcommand.js => insertimagecommand.js} | 2 +- .../src/imageresize/imageresizeediting.js | 2 +- ...resizecommand.js => resizeimagecommand.js} | 2 +- .../src/imageupload/imageuploadediting.js | 2 +- ...uploadcommand.js => uploadimagecommand.js} | 4 +- .../tests/image/imageediting.js | 2 +- ...insertcommand.js => insertimagecommand.js} | 2 +- .../tests/imageresize/imageresizeediting.js | 2 +- ...resizecommand.js => resizeimagecommand.js} | 4 +- .../tests/imageupload/imageuploadediting.js | 2 +- ...uploadcommand.js => uploadimagecommand.js} | 2 +- ...heckcommand.js => checktodolistcommand.js} | 2 +- .../ckeditor5-list/src/todolistediting.js | 2 +- ...heckcommand.js => checktodolistcommand.js} | 2 +- .../ckeditor5-list/tests/todolistediting.js | 2 +- .../src/restrictededitingmode.js | 2 +- .../src/restrictededitingmodeediting.js | 10 ++-- .../restrictededitingmodeediting-commands.js | 26 +++++----- .../tests/tableselection-integration.js | 2 +- .../ckeditor5-table/tests/tableselection.js | 4 +- packages/ckeditor5-typing/src/delete.js | 9 +++- packages/ckeditor5-typing/tests/delete.js | 8 ++- .../ckeditor5-typing/tests/deletecommand.js | 4 +- .../tests/undoediting-integration.js | 2 +- packages/ckeditor5-widget/src/widgetresize.js | 2 +- .../src/widgettypearound/widgettypearound.js | 10 ++-- packages/ckeditor5-widget/tests/widget.js | 8 +-- .../widgettypearound/widgettypearound.js | 2 +- 31 files changed, 119 insertions(+), 60 deletions(-) rename packages/ckeditor5-image/src/image/{imageinsertcommand.js => insertimagecommand.js} (97%) rename packages/ckeditor5-image/src/imageresize/{imageresizecommand.js => resizeimagecommand.js} (95%) rename packages/ckeditor5-image/src/imageupload/{imageuploadcommand.js => uploadimagecommand.js} (96%) rename packages/ckeditor5-image/tests/image/{imageinsertcommand.js => insertimagecommand.js} (98%) rename packages/ckeditor5-image/tests/imageresize/{imageresizecommand.js => resizeimagecommand.js} (96%) rename packages/ckeditor5-image/tests/imageupload/{imageuploadcommand.js => uploadimagecommand.js} (98%) rename packages/ckeditor5-list/src/{todolistcheckcommand.js => checktodolistcommand.js} (97%) rename packages/ckeditor5-list/tests/{todolistcheckcommand.js => checktodolistcommand.js} (99%) diff --git a/docs/framework/guides/contributing/code-style.md b/docs/framework/guides/contributing/code-style.md index 5708112972c..7b462643f4b 100644 --- a/docs/framework/guides/contributing/code-style.md +++ b/docs/framework/guides/contributing/code-style.md @@ -520,7 +520,7 @@ There are some special rules and tips for tests. * Use [sinon-chai assertions](https://www.chaijs.com/plugins/sinon-chai/) ```js - expect( myMethodSpy ).to.be.calledOnce + expect( myMethodSpy ).to.be.calledOnce // expected myMethod to be called once but was called twice ``` @@ -604,6 +604,56 @@ this.canObserve; this.mustRefresh; ``` +### Buttons, Commands and Plugins + +#### Buttons + +All buttons should follow the **verb + noun** or the **noun** convention. Examples: +- The **verb + noun** convention: + - `insertTable` + - `selectAll` + - `uploadImage` +- The **noun** convention: + - `bold` + - `mediaEmbed` + - `restrictedEditing` + +#### Commands + +As for commands it is trickier, because there are many more possible combinations of their names than there are for buttons. Examples: +- The **feature-related** convention: + - **noun-based** case: + - `codeBlock` + - `fontColor` + - `shiftEnter` + - **verb-based** case: + - `indent` + - `removeFormat` + - `selectAll` +- The **feature + sub-feature** convention: + - `imageStyle` + - `imageTextAlternative` + - `tableAlignment` + +For commands, the **noun + verb** (or the **feature + action**) naming conventions **should not be used**, because it does not sound natural (_what do_ vs. _do what_). In most cases the proper name should start with the **action** followed by the **feature** name: +- `checkTodoList` +- `insertTable` +- `uploadImage` + +#### Plugins + +Plugins should follow the **feature** or the **feature + sub-feature** convention. Examples: +- The **feature** convention: + - `Bold` + - `Paragraph` + - `SpecialCharacters` +- The **feature + sub-feature** convention: + - `ImageResize` + - `ListStyle` + - `TableClipboard` + +Plugins must be named in [UpperCamelCase](http://en.wikipedia.org/wiki/CamelCase). + ### Shortcuts For local variables **commonly accepted short versions** for long names are fine: diff --git a/packages/ckeditor5-engine/tests/model/operation/transform/undo.js b/packages/ckeditor5-engine/tests/model/operation/transform/undo.js index c75d8eaf868..e14ef0dfc21 100644 --- a/packages/ckeditor5-engine/tests/model/operation/transform/undo.js +++ b/packages/ckeditor5-engine/tests/model/operation/transform/undo.js @@ -325,7 +325,7 @@ describe( 'transform', () => { john.split(); john.setSelection( [ 1, 0 ] ); john._processExecute( 'bold' ); - john._processExecute( 'forwardDelete' ); + john._processExecute( 'deleteForward' ); expectClients( 'FooBar' ); diff --git a/packages/ckeditor5-image/src/image/imageediting.js b/packages/ckeditor5-image/src/image/imageediting.js index 5b7a2b8dcb9..77ec4f9f01a 100644 --- a/packages/ckeditor5-image/src/image/imageediting.js +++ b/packages/ckeditor5-image/src/image/imageediting.js @@ -18,7 +18,7 @@ import { import { toImageWidget } from './utils'; -import InsertImageCommand from './imageinsertcommand'; +import InsertImageCommand from './insertimagecommand'; /** * The image engine plugin. diff --git a/packages/ckeditor5-image/src/image/imageinsertcommand.js b/packages/ckeditor5-image/src/image/insertimagecommand.js similarity index 97% rename from packages/ckeditor5-image/src/image/imageinsertcommand.js rename to packages/ckeditor5-image/src/image/insertimagecommand.js index fd5c0e68342..38cf7635706 100644 --- a/packages/ckeditor5-image/src/image/imageinsertcommand.js +++ b/packages/ckeditor5-image/src/image/insertimagecommand.js @@ -13,7 +13,7 @@ import { insertImage, isImageAllowed } from './utils'; /** * Insert image command. * - * The command is registered by the {@link module:image/image/imageediting~ImageEditing} plugin as `'insertImage'` + * The command is registered by the {@link module:image/image/imageediting~ImageEditing} plugin as `insertImage` * and it is also available via aliased `imageInsert` name. * * In order to insert an image at the current selection position diff --git a/packages/ckeditor5-image/src/imageresize/imageresizeediting.js b/packages/ckeditor5-image/src/imageresize/imageresizeediting.js index 4a958840da2..98171db92a1 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizeediting.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizeediting.js @@ -8,7 +8,7 @@ */ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import ResizeImageCommand from './imageresizecommand'; +import ResizeImageCommand from './resizeimagecommand'; /** * The image resize editing feature. diff --git a/packages/ckeditor5-image/src/imageresize/imageresizecommand.js b/packages/ckeditor5-image/src/imageresize/resizeimagecommand.js similarity index 95% rename from packages/ckeditor5-image/src/imageresize/imageresizecommand.js rename to packages/ckeditor5-image/src/imageresize/resizeimagecommand.js index 971886ea6f3..e6c8dddc4c6 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizecommand.js +++ b/packages/ckeditor5-image/src/imageresize/resizeimagecommand.js @@ -11,7 +11,7 @@ import Command from '@ckeditor/ckeditor5-core/src/command'; import { isImage } from '../image/utils'; /** - * The image resize command. Currently, it only supports the width attribute. + * The resize image command. Currently, it only supports the width attribute. * * @extends module:core/command~Command */ diff --git a/packages/ckeditor5-image/src/imageupload/imageuploadediting.js b/packages/ckeditor5-image/src/imageupload/imageuploadediting.js index 24f232416aa..a4bf89265ce 100644 --- a/packages/ckeditor5-image/src/imageupload/imageuploadediting.js +++ b/packages/ckeditor5-image/src/imageupload/imageuploadediting.js @@ -14,7 +14,7 @@ import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import UpcastWriter from '@ckeditor/ckeditor5-engine/src/view/upcastwriter'; import env from '@ckeditor/ckeditor5-utils/src/env'; -import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from './uploadimagecommand'; import { fetchLocalImage, isLocalImage } from '../../src/imageupload/utils'; import { createImageTypeRegExp } from './utils'; import { getViewImgFromWidget } from '../image/utils'; diff --git a/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js b/packages/ckeditor5-image/src/imageupload/uploadimagecommand.js similarity index 96% rename from packages/ckeditor5-image/src/imageupload/imageuploadcommand.js rename to packages/ckeditor5-image/src/imageupload/uploadimagecommand.js index 4be12fb20d1..5008b11d12c 100644 --- a/packages/ckeditor5-image/src/imageupload/imageuploadcommand.js +++ b/packages/ckeditor5-image/src/imageupload/uploadimagecommand.js @@ -12,9 +12,9 @@ import { insertImage, isImageAllowed } from '../image/utils'; */ /** - * The image upload command. + * The upload image command. * - * The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `'uploadImage'` + * The command is registered by the {@link module:image/imageupload/imageuploadediting~ImageUploadEditing} plugin as `uploadImage` * and it is also available via aliased `imageUpload` name. * * In order to upload an image at the current selection position diff --git a/packages/ckeditor5-image/tests/image/imageediting.js b/packages/ckeditor5-image/tests/image/imageediting.js index 081eb35dd58..2fe8a994af4 100644 --- a/packages/ckeditor5-image/tests/image/imageediting.js +++ b/packages/ckeditor5-image/tests/image/imageediting.js @@ -9,7 +9,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import ImageEditing from '../../src/image/imageediting'; import ImageLoadObserver from '../../src/image/imageloadobserver'; -import InsertImageCommand from '../../src/image/imageinsertcommand'; +import InsertImageCommand from '../../src/image/insertimagecommand'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view'; import { isImageWidget } from '../../src/image/utils'; diff --git a/packages/ckeditor5-image/tests/image/imageinsertcommand.js b/packages/ckeditor5-image/tests/image/insertimagecommand.js similarity index 98% rename from packages/ckeditor5-image/tests/image/imageinsertcommand.js rename to packages/ckeditor5-image/tests/image/insertimagecommand.js index 87d8f49be42..277722893d4 100644 --- a/packages/ckeditor5-image/tests/image/imageinsertcommand.js +++ b/packages/ckeditor5-image/tests/image/insertimagecommand.js @@ -5,7 +5,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor'; -import InsertImageCommand from '../../src/image/imageinsertcommand'; +import InsertImageCommand from '../../src/image/insertimagecommand'; import Image from '../../src/image/imageediting'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js b/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js index 5ac9e9f3207..b1220280881 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizeediting.js @@ -12,7 +12,7 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import Image from '../../src/image'; import ImageResizeEditing from '../../src/imageresize/imageresizeediting'; -import ResizeImageCommand from '../../src/imageresize/imageresizecommand'; +import ResizeImageCommand from '../../src/imageresize/resizeimagecommand'; import ImageStyle from '../../src/imagestyle'; import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js b/packages/ckeditor5-image/tests/imageresize/resizeimagecommand.js similarity index 96% rename from packages/ckeditor5-image/tests/imageresize/imageresizecommand.js rename to packages/ckeditor5-image/tests/imageresize/resizeimagecommand.js index 3c5b28e8755..2285e979c0b 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizecommand.js +++ b/packages/ckeditor5-image/tests/imageresize/resizeimagecommand.js @@ -4,10 +4,10 @@ */ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; -import ResizeImageCommand from '../../src/imageresize/imageresizecommand'; +import ResizeImageCommand from '../../src/imageresize/resizeimagecommand'; import { setData, getData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; -describe( 'ImageStyleCommand', () => { +describe( 'ResizeImageCommand', () => { let model, command; beforeEach( () => { diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js b/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js index 47f16bb48c8..fa9b9cbc9a4 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js +++ b/packages/ckeditor5-image/tests/imageupload/imageuploadediting.js @@ -11,7 +11,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard'; import ImageEditing from '../../src/image/imageediting'; import ImageUploadEditing from '../../src/imageupload/imageuploadediting'; -import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from '../../src/imageupload/uploadimagecommand'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting'; import DataTransfer from '@ckeditor/ckeditor5-clipboard/src/datatransfer'; diff --git a/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js b/packages/ckeditor5-image/tests/imageupload/uploadimagecommand.js similarity index 98% rename from packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js rename to packages/ckeditor5-image/tests/imageupload/uploadimagecommand.js index 32ff164634a..4d15f94398c 100644 --- a/packages/ckeditor5-image/tests/imageupload/imageuploadcommand.js +++ b/packages/ckeditor5-image/tests/imageupload/uploadimagecommand.js @@ -9,7 +9,7 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; -import UploadImageCommand from '../../src/imageupload/imageuploadcommand'; +import UploadImageCommand from '../../src/imageupload/uploadimagecommand'; import FileRepository from '@ckeditor/ckeditor5-upload/src/filerepository'; import { createNativeFileMock, UploadAdapterMock } from '@ckeditor/ckeditor5-upload/tests/_utils/mocks'; diff --git a/packages/ckeditor5-list/src/todolistcheckcommand.js b/packages/ckeditor5-list/src/checktodolistcommand.js similarity index 97% rename from packages/ckeditor5-list/src/todolistcheckcommand.js rename to packages/ckeditor5-list/src/checktodolistcommand.js index 2232f340566..9e523aa587f 100644 --- a/packages/ckeditor5-list/src/todolistcheckcommand.js +++ b/packages/ckeditor5-list/src/checktodolistcommand.js @@ -15,7 +15,7 @@ const attributeKey = 'todoListChecked'; * The check to-do command. * * The command is registered by the {@link module:list/todolistediting~TodoListEditing} as - * the `'checkTodoList'` editor command and it is also available via aliased `todoListCheck` name. + * the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name. * * @extends module:core/command~Command */ diff --git a/packages/ckeditor5-list/src/todolistediting.js b/packages/ckeditor5-list/src/todolistediting.js index 781b7acb48d..1c9653b44c3 100644 --- a/packages/ckeditor5-list/src/todolistediting.js +++ b/packages/ckeditor5-list/src/todolistediting.js @@ -9,7 +9,7 @@ import ListCommand from './listcommand'; import ListEditing from './listediting'; -import CheckTodoListCommand from './todolistcheckcommand'; +import CheckTodoListCommand from './checktodolistcommand'; import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; diff --git a/packages/ckeditor5-list/tests/todolistcheckcommand.js b/packages/ckeditor5-list/tests/checktodolistcommand.js similarity index 99% rename from packages/ckeditor5-list/tests/todolistcheckcommand.js rename to packages/ckeditor5-list/tests/checktodolistcommand.js index ec76169f92b..955bbc9dcc4 100644 --- a/packages/ckeditor5-list/tests/todolistcheckcommand.js +++ b/packages/ckeditor5-list/tests/checktodolistcommand.js @@ -4,7 +4,7 @@ */ import TodoListEditing from '../src/todolistediting'; -import CheckTodoListCommand from '../src/todolistcheckcommand'; +import CheckTodoListCommand from '../src/checktodolistcommand'; import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; diff --git a/packages/ckeditor5-list/tests/todolistediting.js b/packages/ckeditor5-list/tests/todolistediting.js index e6b862ae046..3bed64d85dc 100644 --- a/packages/ckeditor5-list/tests/todolistediting.js +++ b/packages/ckeditor5-list/tests/todolistediting.js @@ -9,7 +9,7 @@ import BoldEditing from '@ckeditor/ckeditor5-basic-styles/src/bold/boldediting'; import BlockQuoteEditing from '@ckeditor/ckeditor5-block-quote/src/blockquoteediting'; import Typing from '@ckeditor/ckeditor5-typing/src/typing'; import ListCommand from '../src/listcommand'; -import CheckTodoListCommand from '../src/todolistcheckcommand'; +import CheckTodoListCommand from '../src/checktodolistcommand'; import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element'; import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview'; import LinkEditing from '@ckeditor/ckeditor5-link/src/linkediting'; diff --git a/packages/ckeditor5-restricted-editing/src/restrictededitingmode.js b/packages/ckeditor5-restricted-editing/src/restrictededitingmode.js index 6377bd5e9f1..33b7098a836 100644 --- a/packages/ckeditor5-restricted-editing/src/restrictededitingmode.js +++ b/packages/ckeditor5-restricted-editing/src/restrictededitingmode.js @@ -72,7 +72,7 @@ export default class RestrictedEditingMode extends Plugin { * The command names allowed in non-restricted areas of the content. * * Defines which feature commands should be enabled in the restricted editing mode. The commands used for typing and deleting text - * (`'input'`, `'delete'` and `'forwardDelete'`) are allowed by the feature inside non-restricted regions and do not need to be defined. + * (`'input'`, `'delete'` and `'deleteForward'`) are allowed by the feature inside non-restricted regions and do not need to be defined. * * **Note**: The restricted editing mode always allows to use the restricted mode navigation commands as well as `'undo'` and `'redo'` * commands. diff --git a/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js b/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js index e1746a1067d..250213a508e 100644 --- a/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js +++ b/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js @@ -58,13 +58,13 @@ export default class RestrictedEditingModeEditing extends Plugin { /** * Commands allowed in non-restricted areas. * - * Commands always enabled combine typing feature commands: `'typing'`, `'delete'` and `'forwardDelete'` with commands defined + * Commands always enabled combine typing feature commands: `'typing'`, `'delete'` and `'deleteForward'` with commands defined * in the feature configuration. * * @type {Set} * @private */ - this._allowedInException = new Set( [ 'input', 'delete', 'forwardDelete' ] ); + this._allowedInException = new Set( [ 'input', 'delete', 'deleteForward' ] ); } /** @@ -355,11 +355,11 @@ function getSelectAllHandler( editor ) { }; } -// Additional filtering rule for enabling "delete" and "forwardDelete" commands if selection is on range boundaries: +// Additional filtering rule for enabling "delete" and "deleteForward" commands if selection is on range boundaries: // // Does not allow to enable command when selection focus is: // - is on marker start - "delete" - to prevent removing content before marker -// - is on marker end - "forwardDelete" - to prevent removing content after marker +// - is on marker end - "deleteForward" - to prevent removing content after marker function filterDeleteCommandsOnMarkerBoundaries( selection, markerRange ) { return name => { if ( name == 'delete' && markerRange.start.isEqual( selection.focus ) ) { @@ -367,7 +367,7 @@ function filterDeleteCommandsOnMarkerBoundaries( selection, markerRange ) { } // Only for collapsed selection - non-collapsed selection that extends over a marker is handled elsewhere. - if ( name == 'forwardDelete' && selection.isCollapsed && markerRange.end.isEqual( selection.focus ) ) { + if ( name == 'deleteForward' && selection.isCollapsed && markerRange.end.isEqual( selection.focus ) ) { return false; } diff --git a/packages/ckeditor5-restricted-editing/tests/restrictededitingmodeediting-commands.js b/packages/ckeditor5-restricted-editing/tests/restrictededitingmodeediting-commands.js index c7c94ffe976..cf56a2be4f6 100644 --- a/packages/ckeditor5-restricted-editing/tests/restrictededitingmodeediting-commands.js +++ b/packages/ckeditor5-restricted-editing/tests/restrictededitingmodeediting-commands.js @@ -346,9 +346,9 @@ describe( 'RestrictedEditingEditing - commands', () => { } ); } ); - describe( 'forwardDelete', () => { + describe( 'deleteForward', () => { beforeEach( () => { - editor.commands.add( 'forwardDelete', buildFakeCommand( editor ) ); + editor.commands.add( 'deleteForward', buildFakeCommand( editor ) ); model.change( writer => { writer.setSelection( firstParagraph, 'end' ); @@ -360,7 +360,7 @@ describe( 'RestrictedEditingEditing - commands', () => { writer.setSelection( firstParagraph, 1 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.false; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.false; } ); it( 'should be enabled when caret is inside exception marker (not touching boundaries)', () => { @@ -368,7 +368,7 @@ describe( 'RestrictedEditingEditing - commands', () => { writer.setSelection( firstParagraph, 5 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); it( 'should be enabled when caret is inside exception marker (start boundary)', () => { @@ -376,7 +376,7 @@ describe( 'RestrictedEditingEditing - commands', () => { writer.setSelection( firstParagraph, 4 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); it( 'should be disabled when caret is inside exception marker (end boundary)', () => { @@ -384,7 +384,7 @@ describe( 'RestrictedEditingEditing - commands', () => { writer.setSelection( firstParagraph, 7 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.false; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.false; } ); it( 'should be disabled when caret moves to end boundary and it was enabled previously', () => { @@ -392,13 +392,13 @@ describe( 'RestrictedEditingEditing - commands', () => { writer.setSelection( firstParagraph, 5 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; model.change( writer => { writer.setSelection( firstParagraph, 7 ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.false; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.false; } ); it( 'should be disabled for non-collapsed selection that expands over exception marker', () => { @@ -409,7 +409,7 @@ describe( 'RestrictedEditingEditing - commands', () => { ) ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.false; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.false; } ); it( 'should be enabled for non-collapsed selection that is fully contained inside exception marker', () => { @@ -420,7 +420,7 @@ describe( 'RestrictedEditingEditing - commands', () => { ) ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); it( 'should be enabled for non-collapsed selection inside exception marker (start position on marker boundary)', () => { @@ -431,7 +431,7 @@ describe( 'RestrictedEditingEditing - commands', () => { ) ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); it( 'should be enabled for non-collapsed selection inside exception marker (end position on marker boundary)', () => { @@ -442,7 +442,7 @@ describe( 'RestrictedEditingEditing - commands', () => { ) ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); it( 'should be enabled for non-collapsed selection is equal to exception marker', () => { @@ -453,7 +453,7 @@ describe( 'RestrictedEditingEditing - commands', () => { ) ); } ); - expect( editor.commands.get( 'forwardDelete' ).isEnabled ).to.be.true; + expect( editor.commands.get( 'deleteForward' ).isEnabled ).to.be.true; } ); } ); } ); diff --git a/packages/ckeditor5-table/tests/tableselection-integration.js b/packages/ckeditor5-table/tests/tableselection-integration.js index d98449ee692..028cb073654 100644 --- a/packages/ckeditor5-table/tests/tableselection-integration.js +++ b/packages/ckeditor5-table/tests/tableselection-integration.js @@ -61,7 +61,7 @@ describe( 'TableSelection - integration', () => { ] ) ); } ); - it( 'should clear contents of the selected table cells and put selection in last cell on forward delete', () => { + it( 'should clear contents of the selected table cells and put selection in last cell on delete forward', () => { tableSelection.setCellSelection( modelRoot.getNodeByPath( [ 0, 0, 0 ] ), modelRoot.getNodeByPath( [ 0, 1, 1 ] ) diff --git a/packages/ckeditor5-table/tests/tableselection.js b/packages/ckeditor5-table/tests/tableselection.js index d4161424a37..95924d504c0 100644 --- a/packages/ckeditor5-table/tests/tableselection.js +++ b/packages/ckeditor5-table/tests/tableselection.js @@ -360,7 +360,7 @@ describe( 'TableSelection', () => { ] ) ); } ); - it( 'should put selection in the last selected cell after removing content (forward delete)', () => { + it( 'should put selection in the last selected cell after removing content (delete forward)', () => { tableSelection.setCellSelection( modelRoot.getChild( 0 ).getChild( 0 ).getChild( 0 ), modelRoot.getChild( 0 ).getChild( 1 ).getChild( 1 ) @@ -381,7 +381,7 @@ describe( 'TableSelection', () => { modelRoot.getChild( 0 ).getChild( 0 ).getChild( 0 ) ); - editor.execute( 'forwardDelete' ); + editor.execute( 'deleteForward' ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '[]', '12', '13' ], diff --git a/packages/ckeditor5-typing/src/delete.js b/packages/ckeditor5-typing/src/delete.js index ea2cf629663..22265d89983 100644 --- a/packages/ckeditor5-typing/src/delete.js +++ b/packages/ckeditor5-typing/src/delete.js @@ -32,7 +32,12 @@ export default class Delete extends Plugin { view.addObserver( DeleteObserver ); - editor.commands.add( 'forwardDelete', new DeleteCommand( editor, 'forward' ) ); + const deleteForwardCommand = new DeleteCommand( editor, 'forward' ); + + // Register `deleteForward` command and add `forwardDelete` command as an alias for backward compatibility. + editor.commands.add( 'deleteForward', deleteForwardCommand ); + editor.commands.add( 'forwardDelete', deleteForwardCommand ); + editor.commands.add( 'delete', new DeleteCommand( editor, 'backward' ) ); this.listenTo( viewDocument, 'delete', ( evt, data ) => { @@ -52,7 +57,7 @@ export default class Delete extends Plugin { deleteCommandParams.selection = modelSelection; } - editor.execute( data.direction == 'forward' ? 'forwardDelete' : 'delete', deleteCommandParams ); + editor.execute( data.direction == 'forward' ? 'deleteForward' : 'delete', deleteCommandParams ); data.preventDefault(); diff --git a/packages/ckeditor5-typing/tests/delete.js b/packages/ckeditor5-typing/tests/delete.js index 30df289e8e2..491e028d17d 100644 --- a/packages/ckeditor5-typing/tests/delete.js +++ b/packages/ckeditor5-typing/tests/delete.js @@ -34,7 +34,11 @@ describe( 'Delete feature', () => { it( 'creates two commands', () => { expect( editor.commands.get( 'delete' ) ).to.have.property( 'direction', 'backward' ); - expect( editor.commands.get( 'forwardDelete' ) ).to.have.property( 'direction', 'forward' ); + expect( editor.commands.get( 'deleteForward' ) ).to.have.property( 'direction', 'forward' ); + } ); + + it( 'should register forwardDelete command as an alias for deleteForward command', () => { + expect( editor.commands.get( 'forwardDelete' ) ).to.equal( editor.commands.get( 'deleteForward' ) ); } ); it( 'listens to the editing view document delete event', () => { @@ -49,7 +53,7 @@ describe( 'Delete feature', () => { } ) ); expect( spy.calledOnce ).to.be.true; - expect( spy.calledWithMatch( 'forwardDelete', { unit: 'character', sequence: 1 } ) ).to.be.true; + expect( spy.calledWithMatch( 'deleteForward', { unit: 'character', sequence: 1 } ) ).to.be.true; expect( domEvt.preventDefault.calledOnce ).to.be.true; diff --git a/packages/ckeditor5-typing/tests/deletecommand.js b/packages/ckeditor5-typing/tests/deletecommand.js index c6866f8087c..559cfc00d5b 100644 --- a/packages/ckeditor5-typing/tests/deletecommand.js +++ b/packages/ckeditor5-typing/tests/deletecommand.js @@ -187,7 +187,7 @@ describe( 'DeleteCommand', () => { it( 'should pass the "direction" option to Model#deleteContent method', () => { const spy = sinon.spy(); const forwardCommand = new DeleteCommand( editor, 'forward' ); - editor.commands.add( 'forwardDelete', forwardCommand ); + editor.commands.add( 'deleteForward', forwardCommand ); editor.model.on( 'deleteContent', spy ); setData( model, 'foo[]bar' ); @@ -199,7 +199,7 @@ describe( 'DeleteCommand', () => { let deleteOpts = spy.args[ 0 ][ 1 ][ 1 ]; expect( deleteOpts ).to.have.property( 'direction', 'backward' ); - editor.execute( 'forwardDelete' ); + editor.execute( 'deleteForward' ); expect( spy.callCount ).to.equal( 2 ); diff --git a/packages/ckeditor5-undo/tests/undoediting-integration.js b/packages/ckeditor5-undo/tests/undoediting-integration.js index daca6b5338c..2912c4e821e 100644 --- a/packages/ckeditor5-undo/tests/undoediting-integration.js +++ b/packages/ckeditor5-undo/tests/undoediting-integration.js @@ -888,7 +888,7 @@ describe( 'UndoEditing integration', () => { 'Bar' ); - editor.execute( 'forwardDelete' ); + editor.execute( 'deleteForward' ); output( 'Foo[]Bar' ); editor.execute( 'undo' ); diff --git a/packages/ckeditor5-widget/src/widgetresize.js b/packages/ckeditor5-widget/src/widgetresize.js index eaecb65e135..eacdfb0029b 100644 --- a/packages/ckeditor5-widget/src/widgetresize.js +++ b/packages/ckeditor5-widget/src/widgetresize.js @@ -252,7 +252,7 @@ mix( WidgetResize, ObservableMixin ); * * It receives a `Number` (`newValue`) as a parameter. * - * For example, {@link module:image/imageresize~ImageResize} uses it to execute the image resize command + * For example, {@link module:image/imageresize~ImageResize} uses it to execute the resize image command * which puts the new value into the model. * * ```js diff --git a/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js b/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js index a58a46408a1..562ac559b37 100644 --- a/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js +++ b/packages/ckeditor5-widget/src/widgettypearound/widgettypearound.js @@ -626,8 +626,8 @@ export default class WidgetTypeAround extends Plugin { const selectedModelWidget = model.document.selection.getSelectedElement(); const isFakeCaretBefore = typeAroundFakeCaretPosition === 'before'; - const isForwardDelete = direction == 'forward'; - const shouldDeleteEntireWidget = isFakeCaretBefore === isForwardDelete; + const isDeleteForward = direction == 'forward'; + const shouldDeleteEntireWidget = isFakeCaretBefore === isDeleteForward; if ( shouldDeleteEntireWidget ) { editor.execute( 'delete', { @@ -645,7 +645,7 @@ export default class WidgetTypeAround extends Plugin { if ( !range.isCollapsed ) { model.change( writer => { writer.setSelection( range ); - editor.execute( isForwardDelete ? 'forwardDelete' : 'delete' ); + editor.execute( isDeleteForward ? 'deleteForward' : 'delete' ); } ); } else { const probe = model.createSelection( range.start ); @@ -656,11 +656,11 @@ export default class WidgetTypeAround extends Plugin { if ( !probe.focus.isEqual( range.start ) ) { model.change( writer => { writer.setSelection( range ); - editor.execute( isForwardDelete ? 'forwardDelete' : 'delete' ); + editor.execute( isDeleteForward ? 'deleteForward' : 'delete' ); } ); } // If there is no non-collapsed range to be deleted then we are sure that there is an empty element - // next to a widget that should be removed. "delete" and "forwardDelete" commands cannot get rid of it + // next to a widget that should be removed. "delete" and "deleteForward" commands cannot get rid of it // so calling Model#deleteContent here manually. else { const deepestEmptyRangeAncestor = getDeepestEmptyElementAncestor( schema, range.start.parent ); diff --git a/packages/ckeditor5-widget/tests/widget.js b/packages/ckeditor5-widget/tests/widget.js index dc2ad1a6026..b432b8ca35b 100644 --- a/packages/ckeditor5-widget/tests/widget.js +++ b/packages/ckeditor5-widget/tests/widget.js @@ -918,7 +918,7 @@ describe( 'Widget', () => { ); test( - 'should not modify forward delete default behaviour in single paragraph boundaries', + 'should not modify delete forward default behaviour in single paragraph boundaries', 'foo[]', 'forward', 'foo[]' @@ -1098,7 +1098,7 @@ describe( 'Widget', () => { ); test( - 'should remove the entire empty element (deeper structure) if it is next to a widget (forward delete)', + 'should remove the entire empty element (deeper structure) if it is next to a widget (delete forward)', 'foo' + '
[]
' + @@ -1129,7 +1129,7 @@ describe( 'Widget', () => { ); test( - 'should not remove the entire element which is not empty and the element is next to a widget (forward delete)', + 'should not remove the entire element which is not empty and the element is next to a widget (delete forward)', 'foo' + '
Foo[]
' + @@ -1225,7 +1225,7 @@ describe( 'Widget', () => { scrollStub.restore(); } ); - it( 'does nothing when editor when read only mode is enabled (forward delete)', () => { + it( 'does nothing when editor when read only mode is enabled (delete forward)', () => { const scrollStub = sinon.stub( view, 'scrollToTheSelection' ); setModelData( model, 'foo' + diff --git a/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js b/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js index 41aa6ad03ad..47b67c326fb 100644 --- a/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js +++ b/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js @@ -1211,7 +1211,7 @@ describe( 'WidgetTypeAround', () => { } ); } ); - describe( 'forward delete', () => { + describe( 'delete forward', () => { it( 'should delete content after a widget if the "fake caret" is also after the widget', () => { setModelData( editor.model, '[]foo' ); From 7d46eb6bfddac8fe79100dbdb766ac68f5089042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Thu, 19 Nov 2020 11:56:21 +0100 Subject: [PATCH 3/9] Reverted changes from all CHANGELOG.md and fixed list style in docs --- CHANGELOG.md | 4 +- .../guides/contributing/code-style.md | 66 +++++++++---------- packages/ckeditor5-ckfinder/CHANGELOG.md | 2 +- packages/ckeditor5-image/CHANGELOG.md | 12 ++-- packages/ckeditor5-upload/CHANGELOG.md | 8 +-- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f488a5c3dde..8dd0aa18bc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -165,7 +165,7 @@ The CKEditor 5 Collaboration features changelog can be found here: https://ckedi ### MAJOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes) -* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: In order to use the "insert image via URL" feature you now need to load the `ImageInsert` plugin and use the `insertImage` button instead of the `uploadImage` button that implemented this functionality previously. +* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: In order to use the "insert image via URL" feature you now need to load the `ImageInsert` plugin and use the `imageInsert` button instead of the `imageUpload` button that implemented this functionality previously. ### MINOR BREAKING CHANGES [ℹ️](https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html#major-and-minor-breaking-changes) @@ -196,7 +196,7 @@ The CKEditor 5 Collaboration features changelog can be found here: https://ckedi ### Other changes * **[cloud-services-core](https://www.npmjs.com/package/@ckeditor/ckeditor-cloud-services-core)**: Change the token refreshing mechanism to depend on the token expiration time. ([commit](https://github.com/ckeditor/ckeditor5/commit/501490a5729c413ee00311fe3c9a965fab2bb2ad)) -* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `config.image.upload.panel.items` option does not need to be set anymore in order to show the "insert image via URL form". It is enough to load the new `ImageInsert` plugin and use the new `insertImage` button. See [#8034](https://github.com/ckeditor/ckeditor5/issues/8034). ([commit](https://github.com/ckeditor/ckeditor5/commit/48a9e943122e4cdd0e2647f03ebc7b17c402710e)) +* **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `config.image.upload.panel.items` option does not need to be set anymore in order to show the "insert image via URL form". It is enough to load the new `ImageInsert` plugin and use the new `imageInsert` button. See [#8034](https://github.com/ckeditor/ckeditor5/issues/8034). ([commit](https://github.com/ckeditor/ckeditor5/commit/48a9e943122e4cdd0e2647f03ebc7b17c402710e)) * **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: Introduced `ImageInsert` as a standalone plugin that contains the `ImageUpload` functionality. Closes [#7890](https://github.com/ckeditor/ckeditor5/issues/7890). ([commit](https://github.com/ckeditor/ckeditor5/commit/4671ed10a4af4c507abd594414771b714ff31cf7)) * **[image](https://www.npmjs.com/package/@ckeditor/ckeditor5-image)**: The `ImageUploadPanelView` form label should change depending on whether the image is selected or not. Closes [#7878](https://github.com/ckeditor/ckeditor5/issues/7878). ([commit](https://github.com/ckeditor/ckeditor5/commit/288fb97e00181a130dd2833d6e3aa74bdab5b7cc)) * **[link](https://www.npmjs.com/package/@ckeditor/ckeditor5-link)**: The link plugin now comes with the autolink feature enabled by default. Closes [#7682](https://github.com/ckeditor/ckeditor5/issues/7682). ([commit](https://github.com/ckeditor/ckeditor5/commit/c9533f1752057fd833998a356282f8a625f4e39c)) diff --git a/docs/framework/guides/contributing/code-style.md b/docs/framework/guides/contributing/code-style.md index 7b462643f4b..5cd1a123c40 100644 --- a/docs/framework/guides/contributing/code-style.md +++ b/docs/framework/guides/contributing/code-style.md @@ -447,7 +447,7 @@ You can use ES6 getters to simplify class API: class Position { // ... get offset() { - return this.path[ this.path.length - 1 ]; + return this.path[ this.path.length * 1 ]; } } ``` @@ -609,48 +609,48 @@ this.mustRefresh; #### Buttons All buttons should follow the **verb + noun** or the **noun** convention. Examples: -- The **verb + noun** convention: - - `insertTable` - - `selectAll` - - `uploadImage` -- The **noun** convention: - - `bold` - - `mediaEmbed` - - `restrictedEditing` +* The **verb + noun** convention: + * `insertTable` + * `selectAll` + * `uploadImage` +* The **noun** convention: + * `bold` + * `mediaEmbed` + * `restrictedEditing` #### Commands As for commands it is trickier, because there are many more possible combinations of their names than there are for buttons. Examples: -- The **feature-related** convention: - - **noun-based** case: - - `codeBlock` - - `fontColor` - - `shiftEnter` - - **verb-based** case: - - `indent` - - `removeFormat` - - `selectAll` -- The **feature + sub-feature** convention: - - `imageStyle` - - `imageTextAlternative` - - `tableAlignment` +* The **feature-related** convention: + * **noun-based** case: + * `codeBlock` + * `fontColor` + * `shiftEnter` + * **verb-based** case: + * `indent` + * `removeFormat` + * `selectAll` +* The **feature + sub-feature** convention: + * `imageStyle` + * `imageTextAlternative` + * `tableAlignment` For commands, the **noun + verb** (or the **feature + action**) naming conventions **should not be used**, because it does not sound natural (_what do_ vs. _do what_). In most cases the proper name should start with the **action** followed by the **feature** name: -- `checkTodoList` -- `insertTable` -- `uploadImage` +* `checkTodoList` +* `insertTable` +* `uploadImage` #### Plugins Plugins should follow the **feature** or the **feature + sub-feature** convention. Examples: -- The **feature** convention: - - `Bold` - - `Paragraph` - - `SpecialCharacters` -- The **feature + sub-feature** convention: - - `ImageResize` - - `ListStyle` - - `TableClipboard` +* The **feature** convention: + * `Bold` + * `Paragraph` + * `SpecialCharacters` +* The **feature + sub-feature** convention: + * `ImageResize` + * `ListStyle` + * `TableClipboard` Plugins must be named in [UpperCamelCase](http://en.wikipedia.org/wiki/CamelCase). diff --git a/packages/ckeditor5-ckfinder/CHANGELOG.md b/packages/ckeditor5-ckfinder/CHANGELOG.md index 09314bb4563..940eb729491 100644 --- a/packages/ckeditor5-ckfinder/CHANGELOG.md +++ b/packages/ckeditor5-ckfinder/CHANGELOG.md @@ -33,7 +33,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* CKFinderCommand should work when either `'link'` or `'insertImage'` command is enabled. Closes [#48](https://github.com/ckeditor/ckeditor5-ckfinder/issues/48). ([d82a762](https://github.com/ckeditor/ckeditor5-ckfinder/commit/d82a762)) +* CKFinderCommand should work when either `'link'` or `'imageInsert'` command is enabled. Closes [#48](https://github.com/ckeditor/ckeditor5-ckfinder/issues/48). ([d82a762](https://github.com/ckeditor/ckeditor5-ckfinder/commit/d82a762)) ### Other changes diff --git a/packages/ckeditor5-image/CHANGELOG.md b/packages/ckeditor5-image/CHANGELOG.md index 86cf765ff73..39c89121927 100644 --- a/packages/ckeditor5-image/CHANGELOG.md +++ b/packages/ckeditor5-image/CHANGELOG.md @@ -159,7 +159,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Features * Improved responsiveness of the text alternative view in narrow viewports (see [ckeditor/ckeditor5#416](https://github.com/ckeditor/ckeditor5/issues/416)). ([ff5394a](https://github.com/ckeditor/ckeditor5-image/commit/ff5394a)) -* Introduced the `'insertImage'` command. Closes [#245](https://github.com/ckeditor/ckeditor5-image/issues/245). Closes [#251](https://github.com/ckeditor/ckeditor5-image/issues/251). ([cc1e7a3](https://github.com/ckeditor/ckeditor5-image/commit/cc1e7a3)) +* Introduced the `'imageInsert'` command. Closes [#245](https://github.com/ckeditor/ckeditor5-image/issues/245). Closes [#251](https://github.com/ckeditor/ckeditor5-image/issues/251). ([cc1e7a3](https://github.com/ckeditor/ckeditor5-image/commit/cc1e7a3)) * Support for uploading images pasted with a base64 source. Closes [#246](https://github.com/ckeditor/ckeditor5-image/issues/246). Closes [ckeditor/ckeditor5-paste-from-office#24](https://github.com/ckeditor/ckeditor5-paste-from-office/issues/24). ([89ab27e](https://github.com/ckeditor/ckeditor5-image/commit/89ab27e)) ### Bug fixes @@ -176,7 +176,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### BREAKING CHANGES -* The `UploadImageCommand#execute()`'s `files` parameter was renamed to `file`. It can still accept an array of files. +* The `ImageUploadCommand#execute()`'s `files` parameter was renamed to `file`. It can still accept an array of files. ## [11.0.0](https://github.com/ckeditor/ckeditor5-image/compare/v10.2.0...v11.0.0) (2018-10-08) @@ -185,13 +185,13 @@ Internal changes only (updated dependencies, documentation, etc.). * Aligned `ImageToolbar` to use the new widget toolbar repository. ([980681d](https://github.com/ckeditor/ckeditor5-image/commit/980681d)) * Image feature should insert image the same way as other widget features do. ([26638f5](https://github.com/ckeditor/ckeditor5-image/commit/26638f5)) -* The `UploadImageCommand` should check whether it can be executed in the context of the current document selection. Closes [#225](https://github.com/ckeditor/ckeditor5-image/issues/225). Closes [#227](https://github.com/ckeditor/ckeditor5-image/issues/227). Closes [#235](https://github.com/ckeditor/ckeditor5-image/issues/235). ([4c1f27f](https://github.com/ckeditor/ckeditor5-image/commit/4c1f27f)) +* The `ImageUploadCommand` should check whether it can be executed in the context of the current document selection. Closes [#225](https://github.com/ckeditor/ckeditor5-image/issues/225). Closes [#227](https://github.com/ckeditor/ckeditor5-image/issues/227). Closes [#235](https://github.com/ckeditor/ckeditor5-image/issues/235). ([4c1f27f](https://github.com/ckeditor/ckeditor5-image/commit/4c1f27f)) * Updated translations. ([59f3604](https://github.com/ckeditor/ckeditor5-image/commit/59f3604)) ### BREAKING CHANGES -* The `options.file` property was renamed to `options.files` in `UploadImageCommand#execute()`. -* The `options.insertAt` property of `UploadImageCommand#execute()` was removed. The command will now use model's selection. +* The `options.file` property was renamed to `options.files` in `ImageUploadCommand#execute()`. +* The `options.insertAt` property of `ImageUploadCommand#execute()` was removed. The command will now use model's selection. * Removed `findOptimalInsertionPosition()` from utils. This method can now be found in the `@ckeditor/ckeditor5-widget/src/utils` module. @@ -222,7 +222,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* Made image upload by drag&drop work when the `UploadImageCommand` is disabled. Closes [#208](https://github.com/ckeditor/ckeditor5-image/issues/208). ([6908ec6](https://github.com/ckeditor/ckeditor5-image/commit/6908ec6)) +* Made image upload by drag&drop work when the `ImageUploadCommand` is disabled. Closes [#208](https://github.com/ckeditor/ckeditor5-image/issues/208). ([6908ec6](https://github.com/ckeditor/ckeditor5-image/commit/6908ec6)) ### Other changes diff --git a/packages/ckeditor5-upload/CHANGELOG.md b/packages/ckeditor5-upload/CHANGELOG.md index b65eb9afd15..4220f3ebc77 100644 --- a/packages/ckeditor5-upload/CHANGELOG.md +++ b/packages/ckeditor5-upload/CHANGELOG.md @@ -164,7 +164,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Bug fixes -* Fixed incorrect `UploadImageButton` and `UploadImageCommand` binding. Closes [#77](https://github.com/ckeditor/ckeditor5-upload/issues/77). Closes https://github.com/ckeditor/ckeditor5-ui/issues/357. ([d231ea6](https://github.com/ckeditor/ckeditor5-upload/commit/d231ea6)) +* Fixed incorrect `ImageUploadButton` and `ImageUploadCommand` binding. Closes [#77](https://github.com/ckeditor/ckeditor5-upload/issues/77). Closes https://github.com/ckeditor/ckeditor5-ui/issues/357. ([d231ea6](https://github.com/ckeditor/ckeditor5-upload/commit/d231ea6)) ### Other changes @@ -178,7 +178,7 @@ Internal changes only (updated dependencies, documentation, etc.). * Removed `ImageUpload` plugin. It can be no found in ckeditor5-image repository. * Removed `ImageUploadEngine` plugin. It can be no found in ckeditor5-image repository. * Removed `ImageUploadProgress` plugin. It can be no found in ckeditor5-image repository. -* Removed `UploadImageButton` plugin. It can be no found in ckeditor5-image repository. +* Removed `ImageUploadButton` plugin. It can be no found in ckeditor5-image repository. * Renamed `FileRepository#createAdapter()` to `FileRepository#createUploadAdapter()`. * Renamed `filerepository-no-adapter` error to `filerepository-no-upload-adapter`. @@ -219,7 +219,7 @@ Internal changes only (updated dependencies, documentation, etc.). * [Safari, Edge] The image upload (button) feature will not throw an error anymore when trying to access picked files. The feature should not use `for...of` loop on native `FileList` because Safari and Edge do not support `Symbol.iterator` for it yet. Closes [#35](https://github.com/ckeditor/ckeditor5-upload/issues/35). ([f4efd9b](https://github.com/ckeditor/ckeditor5-upload/commit/f4efd9b)) * An image dropped on another image will not redirect the browser to the file's path. Closes [#32](https://github.com/ckeditor/ckeditor5-upload/issues/32). ([4f533be](https://github.com/ckeditor/ckeditor5-upload/commit/4f533be)) -* Bound `UploadImageButton#isEnabled` to `UploadImageCommand#isEnabled`. Closes [#43](https://github.com/ckeditor/ckeditor5-upload/issues/43). ([ba6de66](https://github.com/ckeditor/ckeditor5-upload/commit/ba6de66)) +* Bound `ImageUploadButton#isEnabled` to `ImageUploadCommand#isEnabled`. Closes [#43](https://github.com/ckeditor/ckeditor5-upload/issues/43). ([ba6de66](https://github.com/ckeditor/ckeditor5-upload/commit/ba6de66)) * Fixed two issues related to dropping images. First, when dropping a file into an empty paragraph, that paragraph should be replaced with that image. Second, drop position should be read correctly when the editor is focused upon drop. Closes [#42](https://github.com/ckeditor/ckeditor5-upload/issues/42). Closes [#29](https://github.com/ckeditor/ckeditor5-upload/issues/29). ([fec452d](https://github.com/ckeditor/ckeditor5-upload/commit/fec452d)) * Image will be inserted after the block if the selection is placed at the block's end. Closes [#7](https://github.com/ckeditor/ckeditor5-upload/issues/7). ([70742f9](https://github.com/ckeditor/ckeditor5-upload/commit/70742f9)) * When image upload is aborted, now the "image placeholder" element is permanently removed so it is not reinserted on undo. Closes [#38](https://github.com/ckeditor/ckeditor5-upload/issues/38). ([aff6382](https://github.com/ckeditor/ckeditor5-upload/commit/aff6382)) @@ -227,7 +227,7 @@ Internal changes only (updated dependencies, documentation, etc.). ### Features * Responsive images support in image upload. Closes [#34](https://github.com/ckeditor/ckeditor5-upload/issues/34). ([9a022a2](https://github.com/ckeditor/ckeditor5-upload/commit/9a022a2)) -* The `UploadImageCommand` now accepts `insertAt` position which allows customizing where the image will be inserted. Closes [#45](https://github.com/ckeditor/ckeditor5-upload/issues/45). ([b90c8d7](https://github.com/ckeditor/ckeditor5-upload/commit/b90c8d7)) +* The `ImageUploadCommand` now accepts `insertAt` position which allows customizing where the image will be inserted. Closes [#45](https://github.com/ckeditor/ckeditor5-upload/issues/45). ([b90c8d7](https://github.com/ckeditor/ckeditor5-upload/commit/b90c8d7)) ### Other changes From 5abeb78c37a8fe608c2bf955e23e0ba9bb0da04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Thu, 4 Feb 2021 13:12:36 +0100 Subject: [PATCH 4/9] Fixes after master merge --- packages/ckeditor5-list/src/todolistediting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-list/src/todolistediting.js b/packages/ckeditor5-list/src/todolistediting.js index 7b67bd2d55a..ccc6fb1dbad 100644 --- a/packages/ckeditor5-list/src/todolistediting.js +++ b/packages/ckeditor5-list/src/todolistediting.js @@ -12,7 +12,7 @@ import { getLocalizedArrowKeyCodeDirection } from 'ckeditor5/src/utils'; import ListCommand from './listcommand'; import ListEditing from './listediting'; -import CheckTodoListCommand from './todolistcheckcommand'; +import CheckTodoListCommand from './checktodolistcommand'; import { dataModelViewInsertion, dataViewModelCheckmarkInsertion, From 092430c2e56e2343c82be96515786b9edc53c79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Thu, 4 Feb 2021 14:47:01 +0100 Subject: [PATCH 5/9] Updated leftovers introduced since last time --- docs/_snippets/features/toolbar-breakpoint.js | 2 +- docs/_snippets/features/toolbar-grouping.js | 2 +- docs/_snippets/features/toolbar-wrapping.js | 2 +- docs/builds/guides/development/dll-builds.md | 2 +- docs/features/toolbar.md | 4 ++-- packages/ckeditor5-image/src/autoimage.js | 2 +- .../ckeditor5-image/src/imageresize/imageresizehandles.js | 2 +- packages/ckeditor5-image/tests/manual/tickets/8433/1.js | 2 +- .../docs/_snippets/features/markdown.js | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/_snippets/features/toolbar-breakpoint.js b/docs/_snippets/features/toolbar-breakpoint.js index 16ea423dd2b..f49a59843b0 100644 --- a/docs/_snippets/features/toolbar-breakpoint.js +++ b/docs/_snippets/features/toolbar-breakpoint.js @@ -20,7 +20,7 @@ ClassicEditor 'code', 'codeBlock', '|', 'insertTable', '|', 'outdent', 'indent', '|', - 'imageUpload', 'blockQuote', '|', + 'uploadImage', 'blockQuote', '|', 'undo', 'redo' ], shouldNotGroupWhenFull: true, diff --git a/docs/_snippets/features/toolbar-grouping.js b/docs/_snippets/features/toolbar-grouping.js index 116589a286b..27a98fdd125 100644 --- a/docs/_snippets/features/toolbar-grouping.js +++ b/docs/_snippets/features/toolbar-grouping.js @@ -17,7 +17,7 @@ ClassicEditor 'bulletedList', 'numberedList', 'todoList', '|', 'code', 'codeBlock', '|', 'outdent', 'indent', '|', - 'imageUpload', 'blockQuote', '|', + 'uploadImage', 'blockQuote', '|', 'undo', 'redo' ], viewportTopOffset: window.getViewportTopOffsetConfig() diff --git a/docs/_snippets/features/toolbar-wrapping.js b/docs/_snippets/features/toolbar-wrapping.js index b298e4cc234..1387a45dcbf 100644 --- a/docs/_snippets/features/toolbar-wrapping.js +++ b/docs/_snippets/features/toolbar-wrapping.js @@ -21,7 +21,7 @@ ClassicEditor 'bulletedList', 'numberedList', 'todoList', '|', 'code', 'codeBlock', '|', 'insertTable', '|', - 'imageUpload', 'blockQuote', '|', + 'uploadImage', 'blockQuote', '|', 'undo', 'redo' ], shouldNotGroupWhenFull: true, diff --git a/docs/builds/guides/development/dll-builds.md b/docs/builds/guides/development/dll-builds.md index 27b5e053441..ce348b5b7e8 100644 --- a/docs/builds/guides/development/dll-builds.md +++ b/docs/builds/guides/development/dll-builds.md @@ -179,7 +179,7 @@ An example classic editor build configuration using dll bundles: 'indent', 'outdent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'insertTable', 'mediaEmbed', diff --git a/docs/features/toolbar.md b/docs/features/toolbar.md index da0cd78d568..6c702c028f2 100644 --- a/docs/features/toolbar.md +++ b/docs/features/toolbar.md @@ -112,7 +112,7 @@ toolbar: { 'bulletedList', 'numberedList', 'todoList', '|', 'code', 'codeBlock', '|', 'insertTable', '|', - 'imageUpload', 'blockQuote', '|', + 'uploadImage', 'blockQuote', '|', 'undo', 'redo' ], shouldNotGroupWhenFull: true @@ -140,7 +140,7 @@ toolbar: { 'code', 'codeBlock', '|', 'insertTable', '|', 'outdent', 'indent', '|', - 'imageUpload', 'blockQuote', '|', + 'uploadImage', 'blockQuote', '|', 'undo', 'redo' ], shouldNotGroupWhenFull: true diff --git a/packages/ckeditor5-image/src/autoimage.js b/packages/ckeditor5-image/src/autoimage.js index 1eb0c7da274..8a9e7bf3d6f 100644 --- a/packages/ckeditor5-image/src/autoimage.js +++ b/packages/ckeditor5-image/src/autoimage.js @@ -142,7 +142,7 @@ export default class AutoImage extends Plugin { // Do nothing if image element cannot be inserted at the current position. // See https://github.com/ckeditor/ckeditor5/issues/2763. // Condition must be checked after timeout - pasting may take place on an element, replacing it. The final position matters. - const imageCommand = editor.commands.get( 'imageInsert' ); + const imageCommand = editor.commands.get( 'insertImage' ); if ( !imageCommand.isEnabled ) { urlRange.detach(); diff --git a/packages/ckeditor5-image/src/imageresize/imageresizehandles.js b/packages/ckeditor5-image/src/imageresize/imageresizehandles.js index 1a350a80621..1e4cce83551 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizehandles.js +++ b/packages/ckeditor5-image/src/imageresize/imageresizehandles.js @@ -39,7 +39,7 @@ export default class ImageResizeHandles extends Plugin { * @inheritDoc */ init() { - const command = this.editor.commands.get( 'imageResize' ); + const command = this.editor.commands.get( 'resizeImage' ); this.bind( 'isEnabled' ).to( command ); this._setupResizerCreator(); diff --git a/packages/ckeditor5-image/tests/manual/tickets/8433/1.js b/packages/ckeditor5-image/tests/manual/tickets/8433/1.js index fdd7fd0f428..83382876d65 100644 --- a/packages/ckeditor5-image/tests/manual/tickets/8433/1.js +++ b/packages/ckeditor5-image/tests/manual/tickets/8433/1.js @@ -16,7 +16,7 @@ import { UploadAdapterMock } from '@ckeditor/ckeditor5-upload/tests/_utils/mocks ClassicEditor .create( document.querySelector( '#editor' ), { plugins: [ ArticlePluginSet, HtmlEmbed, ImageInsert, ImageResize ], - toolbar: [ 'imageInsert', '|', 'htmlEmbed' ], + toolbar: [ 'insertImage', '|', 'htmlEmbed' ], htmlEmbed: { showPreviews: true } diff --git a/packages/ckeditor5-markdown-gfm/docs/_snippets/features/markdown.js b/packages/ckeditor5-markdown-gfm/docs/_snippets/features/markdown.js index 5e2b89630ad..7d1e6294780 100644 --- a/packages/ckeditor5-markdown-gfm/docs/_snippets/features/markdown.js +++ b/packages/ckeditor5-markdown-gfm/docs/_snippets/features/markdown.js @@ -42,7 +42,7 @@ ClassicEditor 'outdent', 'indent', '|', - 'imageUpload', + 'uploadImage', 'blockQuote', 'horizontalLine', '|', From e73aa1d3b01ee2008c074ce3c39cf70fb58c197c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Fri, 12 Feb 2021 08:43:12 +0100 Subject: [PATCH 6/9] Fixed code style --- docs/framework/guides/contributing/code-style.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/code-style.md b/docs/framework/guides/contributing/code-style.md index 5cd1a123c40..0fe1c0d793f 100644 --- a/docs/framework/guides/contributing/code-style.md +++ b/docs/framework/guides/contributing/code-style.md @@ -447,7 +447,7 @@ You can use ES6 getters to simplify class API: class Position { // ... get offset() { - return this.path[ this.path.length * 1 ]; + return this.path[ this.path.length - 1 ]; } } ``` From 4685623beda7be9d17ca37757ccb7a0d0cb3df0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Fri, 12 Feb 2021 10:30:53 +0100 Subject: [PATCH 7/9] Fixed naming convention in all-features-dll manual test --- tests/manual/all-features-dll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/manual/all-features-dll.js b/tests/manual/all-features-dll.js index 2baf06e2776..b009f30d3b6 100644 --- a/tests/manual/all-features-dll.js +++ b/tests/manual/all-features-dll.js @@ -127,17 +127,17 @@ const config = { ], resizeOptions: [ { - name: 'imageResize:original', + name: 'resizeImage:original', label: 'Original size', value: null }, { - name: 'imageResize:50', + name: 'resizeImage:50', label: '50%', value: '50' }, { - name: 'imageResize:75', + name: 'resizeImage:75', label: '75%', value: '75' } From da525092d1e651227fa2d2ca9c189a2f83d00215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Smyrek?= Date: Fri, 12 Feb 2021 11:15:39 +0100 Subject: [PATCH 8/9] Unified name in all-features-dll manual test --- tests/manual/all-features-dll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/manual/all-features-dll.js b/tests/manual/all-features-dll.js index b009f30d3b6..78d2402fa68 100644 --- a/tests/manual/all-features-dll.js +++ b/tests/manual/all-features-dll.js @@ -145,7 +145,7 @@ const config = { toolbar: [ 'imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight', '|', - 'imageResize' + 'resizeImage' ], insert: { integrations: [ From 9f70aa6bc002bd0bb21cb921c9e8ee8e47697b95 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Fri, 12 Feb 2021 11:14:38 +0100 Subject: [PATCH 9/9] Docs: Spacing. --- docs/framework/guides/contributing/code-style.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/framework/guides/contributing/code-style.md b/docs/framework/guides/contributing/code-style.md index 0fe1c0d793f..2ad86aeaeea 100644 --- a/docs/framework/guides/contributing/code-style.md +++ b/docs/framework/guides/contributing/code-style.md @@ -609,6 +609,7 @@ this.mustRefresh; #### Buttons All buttons should follow the **verb + noun** or the **noun** convention. Examples: + * The **verb + noun** convention: * `insertTable` * `selectAll` @@ -621,6 +622,7 @@ All buttons should follow the **verb + noun** or the **noun** convention. Exampl #### Commands As for commands it is trickier, because there are many more possible combinations of their names than there are for buttons. Examples: + * The **feature-related** convention: * **noun-based** case: * `codeBlock` @@ -636,6 +638,7 @@ As for commands it is trickier, because there are many more possible combination * `tableAlignment` For commands, the **noun + verb** (or the **feature + action**) naming conventions **should not be used**, because it does not sound natural (_what do_ vs. _do what_). In most cases the proper name should start with the **action** followed by the **feature** name: + * `checkTodoList` * `insertTable` * `uploadImage`