diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js
index c151b5743..47acb1fba 100644
--- a/www/common/diffMarked.js
+++ b/www/common/diffMarked.js
@@ -143,7 +143,17 @@ define([
DiffMd.apply = function (newHtml, $content) {
var id = $content.attr('id');
if (!id) { throw new Error("The element must have a valid id"); }
- var $div = $('
', {id: id}).append(newHtml);
+ var pattern = /(
)<\/media-tag>/g;
+ var newHtmlFixed = newHtml.replace(pattern, function (all, tag, src, key) {
+ var mt = tag;
+ if (mediaMap[src]) {
+ mediaMap[src].forEach(function (n) {
+ mt += n.outerHTML;
+ });
+ }
+ return mt + '';
+ });
+ var $div = $('
', {id: id}).append(newHtmlFixed);
var Dom = domFromHTML($('
').append($div).html());
var oldDom = domFromHTML($content[0].outerHTML);
var patch = makeDiff(oldDom, Dom, id);