Duplicate object tag when updating the content of Document widget

Some browser does not refresh properly the content when updating the data
attribute.

Closes #12808
This commit is contained in:
Cédric Krier
2023-12-07 22:50:42 +01:00
parent b3d31f1b60
commit ce5afab66e
+6 -2
View File
@@ -4538,12 +4538,16 @@ function eval_pyson(value){
});
url = window.URL.createObjectURL(blob);
}
// duplicate object to force refresh on buggy browsers
const object = this.object.clone();
// set onload before data to be always called
this.object.get(0).onload = function() {
object.get(0).onload = function() {
this.onload = null;
window.URL.revokeObjectURL(url);
};
this.object.attr('data', url);
object.attr('data', url);
this.object.replaceWith(object);
this.object = object;
});
},
});