We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 77a7b0c + 5f8733e commit c582798Copy full SHA for c582798
1 file changed
spp_dms/static/src/js/preview_binary_field.esm.js
@@ -39,16 +39,16 @@ export class PreviewRecordWidget extends Component {
39
if (record.mimetype === "application/pdf") {
40
window.open(fileUrl, "_blank");
41
} else {
42
- const attachment = this.store.Attachment.insert({
43
- id: resId,
44
- filename: record.name || "",
45
- name: record.name || "",
46
- mimetype: record.mimetype,
47
- model_name: resModel,
48
- url: fileUrl,
49
- });
+ const fileModel = {
+ isImage: Boolean(record.mimetype.startsWith("image/")),
+ isVideo: Boolean(record.mimetype.startsWith("video/")),
+ isViewable: true,
+ displayName: record.name,
+ defaultSource: fileUrl,
+ downloadUrl: fileUrl,
+ };
50
51
- this.fileViewer.open(attachment);
+ this.fileViewer.open(fileModel);
52
}
53
54
0 commit comments