From 99b667da6c9841532386cac98de87f66ab3ada4f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 7 Mar 2023 14:50:09 +0100 Subject: [PATCH] Fix broken dock/undocking mail preview on 3pane views --- mail/js/app.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 6de75efcf0..e0f80dac91 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1019,6 +1019,16 @@ app.classes.mail = AppJS.extend( var splitter = this.et2.getWidgetById('mailSplitter'); // return if there's no splitter we maybe in mobile mode 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()) { this.mail_previewAreaActive = false; @@ -1027,15 +1037,15 @@ app.classes.mail = AppJS.extend( //Dock the splitter always if we are browsing with mobile if (_value==true) { - if (this.mail_previewAreaActive) splitter.dock(); + if (this.mail_previewAreaActive) dock(); this.mail_previewAreaActive = false; } else { if (!this.mail_previewAreaActive) { - splitter.undock(); - window.setTimeout(function(){splitter.left.trigger('resize.et2_split.mailSplitter');},200); + undock(); + //window.setTimeout(function(){splitter.left.trigger('resize.et2_split.mailSplitter');},200); } 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 if (attachmentsBlock) { - attachmentsBlock.set_value({content:[]}); - attachmentsBlock.set_class('previewAttachmentArea noContent mail_DisplayNone'); + // check if the widget is attached before setting its content + if (attachmentsBlock.parentNode) + { + attachmentsBlock.set_value({content:[]}); + attachmentsBlock.set_class('previewAttachmentArea noContent mail_DisplayNone'); + } var IframeHandle = this.et2.getWidgetById('messageIFRAME'); - IframeHandle.set_src('about:blank'); + if(IframeHandle) IframeHandle.set_src('about:blank'); this.mail_disablePreviewArea(true); } if (!egwIsMobile())return;