mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Fix cached mediatags in pads
This commit is contained in:
parent
5bbde5fec5
commit
20cecbcfa2
@ -188,7 +188,7 @@ var factory = function () {
|
||||
cfg.download.textDl + ' <b>(' + size + 'MB)</b>';
|
||||
btn.addEventListener('click', function () {
|
||||
makeProgressBar(cfg, mediaObject);
|
||||
var a = document.querySelectorAll('media-tag[src="'+mediaObject.tag.getAttribute('src')+'"] button[data-dl]');
|
||||
var a = (cfg.body || document).querySelectorAll('media-tag[src="'+mediaObject.tag.getAttribute('src')+'"] button[data-dl]');
|
||||
for(var i = 0; i < a.length; i++) {
|
||||
if (a[i] !== btn) { a[i].click(); }
|
||||
}
|
||||
|
||||
@ -87,5 +87,7 @@ define([
|
||||
cache.clear(cb);
|
||||
};
|
||||
|
||||
self.CryptPad_clearIndexedDB = S.clear;
|
||||
|
||||
return S;
|
||||
});
|
||||
|
||||
@ -463,7 +463,9 @@ define([
|
||||
setTimeout(function() { // Just in case
|
||||
var tags = dom.querySelectorAll('media-tag:empty');
|
||||
Array.prototype.slice.call(tags).forEach(function(el) {
|
||||
var mediaObject = MediaTag(el);
|
||||
var mediaObject = MediaTag(el, {
|
||||
body: dom
|
||||
});
|
||||
$(el).on('keydown', function(e) {
|
||||
if ([8, 46].indexOf(e.which) !== -1) {
|
||||
$(el).remove();
|
||||
@ -473,14 +475,17 @@ define([
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.type === 'childList') {
|
||||
var list_values = [].slice.call(el.children);
|
||||
mediaTagMap[el.getAttribute('src')] = list_values;
|
||||
var list_values = slice(el.children)
|
||||
.map(function (el) { return el.outerHTML; })
|
||||
.join('');
|
||||
mediaMap[el.getAttribute('src')] = list_values;
|
||||
if (mediaObject.complete) { observer.disconnect(); }
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(el, {
|
||||
attributes: false,
|
||||
subtree: true,
|
||||
childList: true,
|
||||
characterData: false
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user