[IMP] mail: introduce AttachmentViewer/onClick

Task-2579306

Part-of: odoo/odoo#88152
This commit is contained in:
Alexandre Kühn
2022-04-07 14:20:56 +02:00
parent 591f3da27e
commit 2148d2d77d
3 changed files with 14 additions and 16 deletions
@@ -269,21 +269,6 @@ export class AttachmentViewer extends Component {
// Handlers
//--------------------------------------------------------------------------
/**
* Called when clicking on mask of attachment viewer.
*
* @private
* @param {MouseEvent} ev
*/
_onClick(ev) {
if (this.attachmentViewer.isDragging) {
return;
}
// TODO: clicking on the background should probably be handled by the dialog?
// task-2092965
this.attachmentViewer.close();
}
/**
* Called when clicking on cross icon.
*
@@ -3,7 +3,7 @@
<t t-name="mail.AttachmentViewer" owl="1">
<t t-if="attachmentViewer">
<div class="o_AttachmentViewer flex-column align-items-center d-flex w-100 h-100" t-attf-class="{{ className }}" t-on-click="_onClick" t-on-keydown="_onKeydown" tabindex="0" t-ref="root">
<div class="o_AttachmentViewer flex-column align-items-center d-flex w-100 h-100" t-attf-class="{{ className }}" t-on-click="attachmentViewer.onClick" t-on-keydown="_onKeydown" tabindex="0" t-ref="root">
<div class="o_AttachmentViewer_header d-flex w-100 bg-black-75 text-400" t-on-click="_onClickHeader">
<t t-if="attachmentViewer.attachment.isViewable">
<div class="o_AttachmentViewer_headerItem o_AttachmentViewer_icon d-flex align-items-center ms-4 me-2">
@@ -22,6 +22,19 @@ registerModel({
containsElement(element) {
return Boolean(this.component && this.component.root.el && this.component.root.el.contains(element));
},
/**
* Called when clicking on mask of attachment viewer.
*
* @param {MouseEvent} ev
*/
onClick(ev) {
if (this.isDragging) {
return;
}
// TODO: clicking on the background should probably be handled by the dialog?
// task-2092965
this.close();
},
/**
* @private
* @returns {string}