From f83179cb62e13d06d6288fd4e185106f0dab0ba9 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 15 Apr 2020 16:07:18 +0200 Subject: [PATCH] Fix mediatag cache preventing preview modal --- www/common/diffMarked.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index f53828e17..45d426124 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -418,7 +418,7 @@ define([ throw new Error(patch); } else { DD.apply($content[0], patch); - var $mts = $content.find('media-tag:not(:has(*))'); + var $mts = $content.find('media-tag'); $mts.each(function (i, el) { var $mt = $(el).contextmenu(function (e) { e.preventDefault(); @@ -426,6 +426,16 @@ define([ $(contextMenu.menu).find('li').show(); contextMenu.show(e); }); + if ($mt.children().length) { + $mt.off('dblclick preview'); + $mt.on('preview', onPreview($mt)); + if ($mt.find('img').length) { + $mt.on('dblclick', function () { + $mt.trigger('preview'); + }); + } + return; + } MediaTag(el); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) {