Fix broken dock/undocking mail preview on 3pane views

This commit is contained in:
Hadi Nategh 2023-03-07 14:50:09 +01:00
parent 23dadd0559
commit 99b667da6c

View File

@ -1019,6 +1019,16 @@ app.classes.mail = AppJS.extend(
var splitter = this.et2.getWidgetById('mailSplitter'); var splitter = this.et2.getWidgetById('mailSplitter');
// return if there's no splitter we maybe in mobile mode // return if there's no splitter we maybe in mobile mode
if (typeof splitter == 'undefined' || splitter == null) return; if (typeof splitter == 'undefined' || splitter == null) return;
let dock = function(){
splitter.style.setProperty('--max','100%');
splitter.dock();
};
let undock = function ()
{
splitter.style.setProperty('--max','70%');
splitter.undock();
};
if(splitter.isDocked()) if(splitter.isDocked())
{ {
this.mail_previewAreaActive = false; this.mail_previewAreaActive = false;
@ -1027,15 +1037,15 @@ app.classes.mail = AppJS.extend(
//Dock the splitter always if we are browsing with mobile //Dock the splitter always if we are browsing with mobile
if (_value==true) if (_value==true)
{ {
if (this.mail_previewAreaActive) splitter.dock(); if (this.mail_previewAreaActive) dock();
this.mail_previewAreaActive = false; this.mail_previewAreaActive = false;
} }
else else
{ {
if (!this.mail_previewAreaActive) if (!this.mail_previewAreaActive)
{ {
splitter.undock(); undock();
window.setTimeout(function(){splitter.left.trigger('resize.et2_split.mailSplitter');},200); //window.setTimeout(function(){splitter.left.trigger('resize.et2_split.mailSplitter');},200);
} }
this.mail_previewAreaActive = true; this.mail_previewAreaActive = true;
} }
@ -1194,10 +1204,14 @@ app.classes.mail = AppJS.extend(
// Leave if we're here and there is nothing selected, too many, or no data // Leave if we're here and there is nothing selected, too many, or no data
if (attachmentsBlock) if (attachmentsBlock)
{ {
attachmentsBlock.set_value({content:[]}); // check if the widget is attached before setting its content
attachmentsBlock.set_class('previewAttachmentArea noContent mail_DisplayNone'); if (attachmentsBlock.parentNode)
{
attachmentsBlock.set_value({content:[]});
attachmentsBlock.set_class('previewAttachmentArea noContent mail_DisplayNone');
}
var IframeHandle = this.et2.getWidgetById('messageIFRAME'); var IframeHandle = this.et2.getWidgetById('messageIFRAME');
IframeHandle.set_src('about:blank'); if(IframeHandle) IframeHandle.set_src('about:blank');
this.mail_disablePreviewArea(true); this.mail_disablePreviewArea(true);
} }
if (!egwIsMobile())return; if (!egwIsMobile())return;