-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7482 from ckeditor/i/5201
Feature (image): Introduced the UI for a manual image resizing via a dropdown or standalone buttons. Closes #5201. Feature (image): Introduced the UI for restoring original image size. Closes #5197.
- Loading branch information
Showing
16 changed files
with
1,095 additions
and
123 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/ckeditor5-image/docs/_snippets/features/image-resizeui.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div id="snippet-image-resizeui"> | ||
<h3>Resize me using image toolbar buttons!</h3> | ||
|
||
<figure class="image"> | ||
<img src="%BASE_PATH%/assets/img/fields.jpg" alt="Autumn fields"> | ||
<figcaption>Autumn fields by Aleksander Nowodziński</figcaption> | ||
</figure> | ||
|
||
<h3>Resized image (width: 75%):</h3> | ||
|
||
<figure class="image image_resized" style="width:75%;"> | ||
<img src="%BASE_PATH%/assets/img/fields.jpg" alt="Autumn fields"> | ||
</figure> | ||
</div> |
49 changes: 49 additions & 0 deletions
49
packages/ckeditor5-image/docs/_snippets/features/image-resizeui.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* globals ClassicEditor, console, window, document */ | ||
|
||
import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config.js'; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#snippet-image-resizeui' ), { | ||
removePlugins: [ 'LinkImage' ], | ||
toolbar: { | ||
viewportTopOffset: window.getViewportTopOffsetConfig() | ||
}, | ||
image: { | ||
resizeOptions: [ | ||
{ | ||
name: 'imageResize:original', | ||
label: 'Original size', | ||
value: null | ||
}, | ||
{ | ||
name: 'imageResize:50', | ||
label: '50%', | ||
value: '50' | ||
}, | ||
{ | ||
name: 'imageResize:75', | ||
label: '75%', | ||
value: '75' | ||
} | ||
], | ||
toolbar: [ | ||
'imageStyle:full', | ||
'imageStyle:side', '|', | ||
'imageResize:original', | ||
'imageResize:50', | ||
'imageResize:75' | ||
] | ||
}, | ||
cloudServices: CS_CONFIG | ||
} ) | ||
.then( editor => { | ||
window.editorResizeUI = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err ); | ||
} ); |
14 changes: 14 additions & 0 deletions
14
packages/ckeditor5-image/docs/_snippets/features/image-resizeuidropdown.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div id="snippet-image-resizeui-dropdown"> | ||
<h3>Resize me using the dropdown!</h3> | ||
|
||
<figure class="image"> | ||
<img src="%BASE_PATH%/assets/img/fields.jpg" alt="Autumn fields"> | ||
<figcaption>Autumn fields by Aleksander Nowodziński</figcaption> | ||
</figure> | ||
|
||
<h3>Resized image (width: 75%):</h3> | ||
|
||
<figure class="image image_resized" style="width:75%;"> | ||
<img src="%BASE_PATH%/assets/img/fields.jpg" alt="Autumn fields"> | ||
</figure> | ||
</div> |
43 changes: 43 additions & 0 deletions
43
packages/ckeditor5-image/docs/_snippets/features/image-resizeuidropdown.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* globals ClassicEditor, console, window, document */ | ||
|
||
import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config.js'; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#snippet-image-resizeui-dropdown' ), { | ||
removePlugins: [ 'LinkImage' ], | ||
toolbar: { | ||
viewportTopOffset: window.getViewportTopOffsetConfig() | ||
}, | ||
image: { | ||
resizeOptions: [ | ||
{ | ||
name: 'imageResize:original', | ||
label: 'Original size', | ||
value: null | ||
}, | ||
{ | ||
name: 'imageResize:50', | ||
label: '50%', | ||
value: '50' | ||
}, | ||
{ | ||
name: 'imageResize:75', | ||
label: '75%', | ||
value: '75' | ||
} | ||
], | ||
toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageResize' ] | ||
}, | ||
cloudServices: CS_CONFIG | ||
} ) | ||
.then( editor => { | ||
window.editorResizeUIDropdown = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.