Preview multiple mediatags

This commit is contained in:
yflory
2020-04-01 12:04:31 +02:00
parent 81b460abd8
commit 572db00987
4 changed files with 185 additions and 58 deletions

View File

@@ -289,7 +289,7 @@ define([
};
DiffMd.apply = function (newHtml, $content, common) {
var contextMenu = common.importMediaTagMenu();
var contextMenu = common.importMediaTagMenu($content);
var id = $content.attr('id');
if (!id) { throw new Error("The element must have a valid id"); }
var pattern = /(<media-tag src="([^"]*)" data-crypto-key="([^"]*)">)<\/media-tag>/g;
@@ -375,10 +375,19 @@ define([
$mt.off('dblclick');
if ($mt.find('img').length) {
$mt.on('dblclick', function () {
common.getMediaTagPreview({
var mts = [{
src: $mt.attr('src'),
key: $mt.attr('data-crypto-key')
}];
$content.find('media-tag').each(function (i, el) {
var $el = $(el);
if ($el.attr('src') === $mt.attr('src')) { return; }
mts.push({
src: $el.attr('src'),
key: $el.attr('data-crypto-key')
});
});
common.getMediaTagPreview(mts);
});
}
});