From 7b4a89be92b7c8fbe41cc212c86bf6eb74304209 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 3 Dec 2020 15:36:29 +0100 Subject: [PATCH] Handle cached mediatags in preview modal --- customize.dist/src/less2/include/markdown.less | 3 +++ www/common/inner/common-mediatag.js | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/customize.dist/src/less2/include/markdown.less b/customize.dist/src/less2/include/markdown.less index f88d8ca7c..677ec13a3 100644 --- a/customize.dist/src/less2/include/markdown.less +++ b/customize.dist/src/less2/include/markdown.less @@ -66,6 +66,9 @@ .mediatag_cryptpad() { media-tag { + &:empty { + display: none !important; + } cursor: pointer; * { max-width: 100%; diff --git a/www/common/inner/common-mediatag.js b/www/common/inner/common-mediatag.js index eaf640b0d..bbc149d5b 100644 --- a/www/common/inner/common-mediatag.js +++ b/www/common/inner/common-mediatag.js @@ -249,7 +249,6 @@ define([ var locked = false; var show = function (_i) { if (locked) { return; } - locked = true; if (_i < 0) { i = 0; } else if (_i > tags.length -1) { i = tags.length - 1; } else { i = _i; } @@ -293,7 +292,6 @@ define([ if (_key) { key = 'cryptpad:' + Nacl.util.encodeBase64(_key); } } if (!src || !key) { - locked = false; $spinner.hide(); return void UI.log(Messages.error); } @@ -307,13 +305,18 @@ define([ locked = false; $spinner.hide(); UI.log(Messages.error); + }).on('progress', function () { + $spinner.hide(); + locked = true; + }).on('complete', function () { + locked = false; + $spinner.hide(); }); }); } var observer = new MutationObserver(function(mutations) { mutations.forEach(function() { - locked = false; $spinner.hide(); }); });