diff options
| author | Samuel Degueldre <sad@odoo.com> | 2020-03-31 07:10:34 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-06-05 18:11:42 +0000 |
| commit | c2de755bc690987f59cda27bd83a7429278955fc (patch) | |
| tree | 8da996cffc724c2b2e5564a760d99b484ca42e1c /addons/web_editor/static/src/xml/wysiwyg.xml | |
| parent | 59cd23a4dfde62a9986373e232b14f22a34d90c2 (diff) | |
[IMP] web_editor, *: change image cropping from modal to inline widget
*: base
Previously, cropping an image was done inside of a modal window, turning
it into an inline widget makes the editor feel more integrated and
allows you to better see the result of cropping directly in the page,
it's also less intrusive to the user's edition workflow.
At the same time, the way cropped images are saved was refactored to use
the new original_id field on ir_attachment, as the old system was
creating problems.
Part of https://github.com/odoo/odoo/pull/51517
task-2192755
Diffstat (limited to 'addons/web_editor/static/src/xml/wysiwyg.xml')
| -rw-r--r-- | addons/web_editor/static/src/xml/wysiwyg.xml | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/addons/web_editor/static/src/xml/wysiwyg.xml b/addons/web_editor/static/src/xml/wysiwyg.xml index f23165e8959..a5f4ddb0f74 100644 --- a/addons/web_editor/static/src/xml/wysiwyg.xml +++ b/addons/web_editor/static/src/xml/wysiwyg.xml @@ -520,46 +520,40 @@ </div> </div> - <!-- Crop Image Dialog (allows to crop image on the page) --> - <div t-name="wysiwyg.widgets.crop_image" class="o_crop_image_dialog"> - <div t-if="widget.imageData.isExternalImage" class="alert alert-warning text-center" role="alert"> - <i class="fa fa-exclamation-triangle fa-2x"/> - <h4>This image is an external image</h4> - <p> - This type of image is not supported for cropping.<br/> - If you want to crop it, please first download it from the original source and upload it in Odoo. - </p> + <!-- ImageCropWidget controls (allows to crop images on the page) --> + <div t-name="wysiwyg.widgets.crop" class="o_we_crop_widget" contenteditable="false"> + <div class="o_we_cropper_wrapper"> + <img class="o_we_cropper_img"/> + <div class="o_we_crop_buttons text-center mt16 position-absolute o_we_no_overlay" contenteditable="false"> + <div class="btn-group btn-group-toggle" title="Aspect Ratio" data-toggle="buttons"> + <t t-foreach="widget.aspectRatios" t-as="ratio"> + <t t-set="is_active" t-value="ratio.value === widget.aspectRatio"/> + <label t-attf-class="{is_active and 'active' or ''}" data-action="ratio" t-att-data-value="ratio"> + <input type="radio" /><t t-esc="ratio_value.label"/> + </label> + </t> + </div> + <div class="btn-group" role="group"> + <button type="button" title="Zoom In" data-action="zoom" data-value="0.1"><i class="fa fa-fw fa-search-plus"/></button> + <button type="button" title="Zoom Out" data-action="zoom" data-value="-0.1"><i class="fa fa-fw fa-search-minus"/></button> + </div> + <div class="btn-group" role="group"> + <button type="button" title="Rotate Left" data-action="rotate" data-value="-90"><i class="fa fa-fw fa-rotate-left"/></button> + <button type="button" title="Rotate Right" data-action="rotate" data-value="90"><i class="fa fa-fw fa-rotate-right"/></button> + </div> + <div class="btn-group" role="group"> + <button type="button" title="Flip Horizontal" data-action="flip" data-scale-direction="scaleX"><i class="fa fa-fw fa-arrows-h"/></button> + <button type="button" title="Flip Vertical" data-action="flip" data-scale-direction="scaleY"><i class="fa fa-fw fa-arrows-v"/></button> + </div> + <div class="btn-group" role="group"> + <button type="button" title="Reset Image" data-action="reset"><i class="fa fa-refresh"/> Reset Image</button> + </div> + <div class="btn-group" role="group"> + <button type="button" title="Apply" data-action="apply" class="btn btn-primary"><i class="fa fa-check"/> Apply</button> + <button type="button" title="Discard" data-action="discard" class="btn btn-danger"><i class="fa fa-times"/> Discard</button> + </div> + </div> </div> - <t t-else=""> - <div class="o_crop_area"> - <img class="img img-fluid o_cropper_image" t-att-src="widget.imageData.originalSrc"/> - </div> - <div class="o_crop_options text-center mt16"> - <div class="btn-group btn-group-toggle" title="Aspect Ratio" data-toggle="buttons"> - <t t-foreach="widget.aspectRatioList" t-as="ratio"> - <t t-set="is_active" t-value="ratio[1] === widget.imageData.aspectRatio"/> - <label t-attf-class="btn btn-secondary#{is_active and ' active' or ''}" data-event="ratio" t-att-data-label="ratio[1]" t-att-data-value="ratio[2]"> - <input type="radio" /><t t-esc="ratio[0]"/> - </label> - </t> - </div> - <div class="btn-group" role="group"> - <button type="button" class="btn btn-secondary" title="Zoom In" data-event="zoom" data-value="0.1"><i class="fa fa-search-plus"/></button> - <button type="button" class="btn btn-secondary" title="Zoom Out" data-event="zoom" data-value="-0.1"><i class="fa fa-search-minus"/></button> - </div> - <div class="btn-group" role="group"> - <button type="button" class="btn btn-secondary" title="Rotate Left" data-event="rotate" data-value="-45"><i class="fa fa-rotate-left"/></button> - <button type="button" class="btn btn-secondary" title="Rotate Right" data-event="rotate" data-value="45"><i class="fa fa-rotate-right"/></button> - </div> - <div class="btn-group" role="group"> - <button type="button" class="btn btn-secondary" title="Flip Horizontal" data-event="flip" data-value="horizontal" data-x="1"><i class="fa fa-arrows-h"/></button> - <button type="button" class="btn btn-secondary" title="Flip Vertical" data-event="flip" data-value="vertical" data-y="1"><i class="fa fa-arrows-v"/></button> - </div> - <div class="btn-group" role="group"> - <button type="button" class="btn btn-secondary" title="Reset Image" data-event="reset"><i class="fa fa-refresh"/> Reset Image</button> - </div> - </div> - </t> </div> </templates> |
