Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I/7559: Update ImageResizeUI plugin #7616

Merged
merged 27 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0fd6e0b
Add icons.
panr Jul 10, 2020
75dfc30
Update manual test.
panr Jul 10, 2020
ba29358
Update unit tests.
panr Jul 10, 2020
b93c435
Fix styles.
panr Jul 10, 2020
5376350
Change plugin behavior and refactor existing code.
panr Jul 10, 2020
06f6cf8
Update API docs.
panr Jul 13, 2020
edabdcd
Update module path for `image/imageresize/imageresizeediting`.
panr Jul 13, 2020
66f6d04
Update the `ImageResizeUI` plugin and tests.
panr Jul 13, 2020
5256591
Clean plugin icons.
panr Jul 13, 2020
567ce7e
Update manual test description.
panr Jul 13, 2020
1d803c6
Fix comment formatting.
panr Jul 13, 2020
5a0f4ea
Update unit tests.
panr Jul 13, 2020
0584d97
Merge branch 'master' into i/7559
panr Jul 13, 2020
8440968
Move icons to the `ckeditor5-core` package.
panr Jul 15, 2020
def39ba
Refactor plugin.
panr Jul 15, 2020
a7d8714
Fix unit tests.
panr Jul 15, 2020
4f53ee1
Update plugin styling.
panr Jul 15, 2020
78a2e8e
Remove icons from the plugin.
panr Jul 15, 2020
41ad1ea
Replace width/height with viewBox in svgs.
panr Jul 16, 2020
24c6e28
Refactor the plugin options API docs.
panr Jul 16, 2020
1d45d2c
Refactor plugin code.
panr Jul 16, 2020
166ef08
Merge branch 'master' into i/7559
oleq Jul 16, 2020
71dbcb3
Tests: Improved the ImageResizeUI manual test instructions.
oleq Jul 16, 2020
27fee04
Docs and code refactoring.
oleq Jul 16, 2020
e3661dd
Docs: Minor corrections in image resize docs.
oleq Jul 16, 2020
21cc867
Fix image resize snippets configuration.
panr Jul 16, 2020
7f2b25e
Update translations.
panr Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 48 additions & 16 deletions packages/ckeditor5-image/src/imageresize.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ export default class ImageResize extends Plugin {
/**
* The resize options.
*
* Each option should have its `name`, which is a component name definition that will be
* used in the {@link module:image/imageresize/imageresizeui~ImageResizeUI} plugin.
* Other properties like `label` and `value` define the following:
* a text label for the option button and the value that will be applied to the image's width.
* Each option should have its own `name`, which is a component name definition that will be
panr marked this conversation as resolved.
Show resolved Hide resolved
* used in the {@link module:image/imageresize/imageresizeui~ImageResizeUI} plugin and `value` which will
* be applied to the image's width during the {@link module:image/imageresize/imageresizecommand~ImageResizeCommand} execution.
*
* The value property is combined with the `resizeUnit` (`%` by default), eg: `value: '50'` and `resizeUnit: '%'` is `50%`.
*
* **NOTE:** If you want to set an option that will reset image to its original size, you need to pass a `null` value
* **NOTE:** There is additional mandatory property — `icon`, but it's necessary only for setting the standalone buttons configuration.
panr marked this conversation as resolved.
Show resolved Hide resolved
*
* **Reset size option:** If you want to set an option that will reset image to its original size, you need to pass a `null` value
* to one of the options. The `:original` token is not mandatory, you can call it anything you wish, but it must reflect
* in the standalone buttons configuration for the image toolbar.
*
Expand All @@ -77,18 +78,18 @@ export default class ImageResize extends Plugin {
* resizeUnit: "%",
* resizeOptions: [ {
* name: 'imageResize:original',
* label: 'Original size',
* value: null
* // you should add `icon` property if you're configuring the standalone buttons.
panr marked this conversation as resolved.
Show resolved Hide resolved
* },
* {
* name: 'imageResize:50',
* label: '50%',
* value: '50'
* // you should add `icon` property if you're configuring the standalone buttons.
* },
* {
* name: 'imageResize:75',
* label: '75%',
* value: '75'
* // you should add `icon` property if you're configuring the standalone buttons.
* } ]
* }
* } )
Expand All @@ -105,17 +106,14 @@ export default class ImageResize extends Plugin {
* resizeUnit: "%",
* resizeOptions: [ {
* name: 'imageResize:original',
* label: 'Original size',
* value: null
* },
* {
* name: 'imageResize:50',
* label: '50%',
* value: '50'
* },
* {
* name: 'imageResize:75',
* label: '75%',
* value: '75'
* } ],
* toolbar: [ 'imageResize', ... ],
Expand All @@ -124,28 +122,62 @@ export default class ImageResize extends Plugin {
* .then( ... )
* .catch( ... );
*
* If you want to have separate buttons for each option, pass their names instead:
* If you want to have separate buttons for each option, pass their names to the `image.toolbar` instead. Please keep in
panr marked this conversation as resolved.
Show resolved Hide resolved
* mind that this time **you should define additional `icon` property**:
*
* ClassicEditor
* .create( editorElement, {
* image: {
* resizeUnit: "%",
* resizeOptions: [ {
* name: 'imageResize:original',
* label: 'Original size',
* value: null
* icon: 'original'
* },
* {
* name: 'imageResize:25',
* value: '25'
* icon: 'small'
* },
* {
* name: 'imageResize:50',
* label: '50%',
* value: '50'
* icon: 'medium'
* },
* {
* name: 'imageResize:75',
* label: '75%',
* value: '75'
* icon: 'large'
* } ],
* toolbar: [ 'imageResize:original', 'imageResize:50', 'imageResize:75', ... ],
* toolbar: [ 'imageResize:25', 'imageResize:50', 'imageResize:75', 'imageResize:original', ... ],
* }
* } )
* .then( ... )
* .catch( ... );
*
* **User-defined labels**: You can also set your own labels for each option. To do that, please add `label` property like
* in the example below. With the **dropdown**, the labels will be shown on the list of all options when you open the dropdown.
* With the **standalone buttons**, the labels will be shown only in tooltips when you hover over the icons.
*
* ClassicEditor
* .create( editorElement, {
* image: {
* resizeUnit: "%",
* resizeOptions: [ {
* name: 'imageResize:original',
* value: null,
* label: 'Original size'
* },
* {
* name: 'imageResize:50',
* value: '50',
* label: 'Medium size'
* },
* {
* name: 'imageResize:75',
* value: '75',
* label: 'Large size'
* } ]
* }
* } )
* .then( ... )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/**
* @module image/imageresizeediting
* @module image/imageresize/imageresizeediting
*/

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
Expand Down
Loading