Browse Source

Merge branch 'issue-69' of isundil/mimouchat into devel

isundil 6 years ago
parent
commit
3d19f40896
2 changed files with 7 additions and 4 deletions
  1. 1 0
      cli/dom.js
  2. 6 4
      cli/uiMessage.js

+ 1 - 0
cli/dom.js

@@ -244,6 +244,7 @@ function doCreateMessageDom(msg) {
     dom.authorName = document.createElement("span");
     dom.attachmentWrapper = document.createElement("details");
 
+    dom.attachmentWrapper.addEventListener("toggle", function() { this.toggled = true; });
     dom.className = R.klass.msg.item;
     dom.ts.className = R.klass.msg.ts;
     dom.textDom.className = R.klass.msg.msg;

+ 6 - 4
cli/uiMessage.js

@@ -173,10 +173,12 @@ var AbstractUiMessage = (function() {
         _this.dom.attachments.appendChild(attachmentFrag);
         if (hasAttachment) {
             _this.dom.attachmentWrapper.classList.remove(R.klass.hidden);
-            if (CONFIG.shouldExpandAttachment(containImages))
-                _this.dom.attachmentWrapper["open"] = true;
-            else
-                _this.dom.attachmentWrapper["open"] = false;
+            if (!_this.dom.attachmentWrapper.toggled) {
+                if (CONFIG.shouldExpandAttachment(containImages))
+                    _this.dom.attachmentWrapper["open"] = true;
+                else
+                    _this.dom.attachmentWrapper["open"] = false;
+            }
         } else {
             _this.dom.attachmentWrapper.classList.add(R.klass.hidden);
         }