Fix mediatag flickering
This commit is contained in:
parent
ce50dbf3ca
commit
159ccc2866
@ -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 = $('<div>', {id: id}).append(newHtml);
|
||||
var pattern = /(<media-tag src="([^"]*)" data-crypto-key="([^"]*)">)<\/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 + '</media-tag>';
|
||||
});
|
||||
var $div = $('<div>', {id: id}).append(newHtmlFixed);
|
||||
var Dom = domFromHTML($('<div>').append($div).html());
|
||||
var oldDom = domFromHTML($content[0].outerHTML);
|
||||
var patch = makeDiff(oldDom, Dom, id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user