[IMP] mail: introduce AttachmentViewer/close

Task-2579306

Part-of: odoo/odoo#88152
This commit is contained in:
Alexandre Kühn
2022-04-07 14:20:55 +02:00
parent b88e7aba8a
commit 591f3da27e
2 changed files with 10 additions and 13 deletions
@@ -86,15 +86,6 @@ export class AttachmentViewer extends Component {
// Private
//--------------------------------------------------------------------------
/**
* Close the dialog with this attachment viewer.
*
* @private
*/
_close() {
this.attachmentViewer.delete();
}
/**
* Determine whether the current image is rendered for the 1st time, and if
* that's the case, display a spinner until loaded.
@@ -290,7 +281,7 @@ export class AttachmentViewer extends Component {
}
// TODO: clicking on the background should probably be handled by the dialog?
// task-2092965
this._close();
this.attachmentViewer.close();
}
/**
@@ -300,7 +291,7 @@ export class AttachmentViewer extends Component {
* @param {MouseEvent} ev
*/
_onClickClose(ev) {
this._close();
this.attachmentViewer.close();
}
/**
@@ -455,10 +446,10 @@ export class AttachmentViewer extends Component {
this._previous();
break;
case 'Escape':
this._close();
this.attachmentViewer.close();
break;
case 'q':
this._close();
this.attachmentViewer.close();
break;
case 'r':
this._rotate();
@@ -7,6 +7,12 @@ registerModel({
name: 'AttachmentViewer',
identifyingFields: ['dialogOwner'],
recordMethods: {
/**
* Close the dialog with this attachment viewer.
*/
close() {
this.delete();
},
/**
* Returns whether the given html element is inside this attachment viewer.
*