Properly cleanup an image when it is removed
This commit is contained in:
parent
6295d9b177
commit
03f992811d
@ -31,11 +31,11 @@ async function loadImageFromBlob(doc, evt, node, vm) {
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup(id, evt) {
|
||||
const { src } = evt.target;
|
||||
function cleanup(node) {
|
||||
const src = node.el.src;
|
||||
if (src.startsWith('blob:')) {
|
||||
URL.revokeObjectURL(s);
|
||||
srcMap.remove(id);
|
||||
URL.revokeObjectURL(src);
|
||||
srcMap.delete(node.key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ export function AttachmentImageView(doc, props) {
|
||||
onerror: [loadImageFromBlob, doc],
|
||||
_key: _id,
|
||||
_hooks: {
|
||||
didRemove: [cleanup, _id]
|
||||
willRemove: cleanup
|
||||
}
|
||||
},
|
||||
props || {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user