-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathweb-preview.get.js
47 lines (47 loc) · 1.38 KB
/
web-preview.get.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if (model.widgets)
{
for (var i = 0; i < model.widgets.length; i++)
{
var widget = model.widgets[i];
if (widget.id == "WebPreview")
{
var conditions = [];
// Insert new pluginCondition(s) at start of the chain
conditions.push({
attributes: {
mimeType: "application/pdf"
},
plugins: [{
name: "PdfJs",
attributes: {progressiveLoading: "true"}
},
{
name: "Embed",
attributes: {}
}]
});
conditions.push({
attributes: {
thumbnail: "pdf"
},
plugins: [{
name: "PdfJs",
attributes: { src: "pdf", progressiveLoading: "true" }
},
{
name: "Embed",
attributes: { src: "pdf" }
}]
});
var oldConditions = jsonUtils.toObject("{\"tmp\":" + widget.options.pluginConditions + "}").tmp;
// Add the other conditions back in
for (var j = 0; j < oldConditions.length; j++)
{
conditions.push(oldConditions[j]);
}
// Override the original conditions
model.pluginConditions = jsonUtils.toJSONString(conditions);
widget.options.pluginConditions = model.pluginConditions;
}
}
}