mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-16 12:12:57 -06:00
Merge b13d72e5e8
into baa5e3bed4
This commit is contained in:
commit
fbeea792c2
@ -1,16 +1,16 @@
|
|||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
/* eslint-disable no-undef */
|
||||||
import AttachmentPreviewWidget from "../../attachmentPreviewWidget.esm";
|
import AttachmentPreviewWidget from "../../attachmentPreviewWidget.esm";
|
||||||
import FormRenderer from "web.FormRenderer";
|
import FormRenderer from "web.FormRenderer";
|
||||||
import {registerInstancePatchModel} from "@mail/model/model_core";
|
import {registerInstancePatchModel} from "@mail/model/model_core";
|
||||||
|
|
||||||
odoo.define("attachment_preview.attachment_card", function (require) {
|
var rpc = require("web.rpc");
|
||||||
var rpc = require("web.rpc");
|
|
||||||
|
|
||||||
var chatterpreviewableAttachments = [];
|
var chatterpreviewableAttachments = [];
|
||||||
var active_attachment_id = 0;
|
var active_attachment_id = 0;
|
||||||
var first_click = true;
|
var first_click = true;
|
||||||
|
|
||||||
FormRenderer.include({
|
FormRenderer.include({
|
||||||
custom_events: _.extend({}, FormRenderer.prototype.custom_events, {
|
custom_events: _.extend({}, FormRenderer.prototype.custom_events, {
|
||||||
onAttachmentPreview: "_onAttachmentPreview",
|
onAttachmentPreview: "_onAttachmentPreview",
|
||||||
}),
|
}),
|
||||||
@ -58,9 +58,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
|
|||||||
first_click = true;
|
first_click = true;
|
||||||
this.showAttachmentPreviewWidget(first_click);
|
this.showAttachmentPreviewWidget(first_click);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function canPreview(extension) {
|
function canPreview(extension) {
|
||||||
return (
|
return (
|
||||||
$.inArray(extension, [
|
$.inArray(extension, [
|
||||||
"odt",
|
"odt",
|
||||||
@ -75,14 +75,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
|
|||||||
"ots",
|
"ots",
|
||||||
]) > -1
|
]) > -1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUrl(
|
function getUrl(attachment_id, attachment_url, attachment_extension, attachment_title) {
|
||||||
attachment_id,
|
|
||||||
attachment_url,
|
|
||||||
attachment_extension,
|
|
||||||
attachment_title
|
|
||||||
) {
|
|
||||||
var url = "";
|
var url = "";
|
||||||
if (attachment_url) {
|
if (attachment_url) {
|
||||||
if (attachment_url.slice(0, 21) === "/web/static/lib/pdfjs") {
|
if (attachment_url.slice(0, 21) === "/web/static/lib/pdfjs") {
|
||||||
@ -115,9 +110,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
|
|||||||
"?model%3Dir.attachment";
|
"?model%3Dir.attachment";
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerInstancePatchModel(
|
registerInstancePatchModel(
|
||||||
"mail.attachment_card",
|
"mail.attachment_card",
|
||||||
"attachment_preview/static/src/js/models/attachment_card/attachment_card.js",
|
"attachment_preview/static/src/js/models/attachment_card/attachment_card.js",
|
||||||
{
|
{
|
||||||
@ -261,5 +256,4 @@ odoo.define("attachment_preview.attachment_card", function (require) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
Loading…
Reference in New Issue
Block a user