[IMP] mail: introduce AttachmentViewer/previous

Task-2579306

Part-of: odoo/odoo#88152
This commit is contained in:
Alexandre Kühn
2022-04-07 14:20:58 +02:00
parent d54ba604db
commit 3a7ad52857
2 changed files with 12 additions and 15 deletions
@@ -117,18 +117,6 @@ export class AttachmentViewer extends Component {
}
}
/**
* Display the previous attachment in the list of attachments.
*
* @private
*/
_previous() {
if (!this.attachmentViewer.dialogOwner || !this.attachmentViewer.dialogOwner.attachmentListOwnerAsAttachmentView) {
return;
}
this.attachmentViewer.dialogOwner.attachmentListOwnerAsAttachmentView.selectPreviousAttachment();
}
/**
* Prompt the browser print of this attachment.
*
@@ -291,7 +279,7 @@ export class AttachmentViewer extends Component {
*/
_onClickPrevious(ev) {
ev.stopPropagation();
this._previous();
this.attachmentViewer.previous();
}
/**
@@ -359,7 +347,7 @@ export class AttachmentViewer extends Component {
this.attachmentViewer.next();
break;
case 'ArrowLeft':
this._previous();
this.attachmentViewer.previous();
break;
case 'Escape':
this.attachmentViewer.close();
@@ -23,7 +23,7 @@ registerModel({
return Boolean(this.component && this.component.root.el && this.component.root.el.contains(element));
},
/**
* Display the previous attachment in the list of attachments.
* Display the next attachment in the list of attachments.
*/
next() {
if (!this.dialogOwner || !this.dialogOwner.attachmentListOwnerAsAttachmentView) {
@@ -103,6 +103,15 @@ registerModel({
ev.stopPropagation();
this.update({ isImageLoading: false });
},
/**
* Display the previous attachment in the list of attachments.
*/
previous() {
if (!this.dialogOwner || !this.dialogOwner.attachmentListOwnerAsAttachmentView) {
return;
}
this.dialogOwner.attachmentListOwnerAsAttachmentView.selectPreviousAttachment();
},
/**
* @private
* @returns {string}