fix pdf display problems in chrome
This commit is contained in:
parent
bed7d95bf3
commit
a4dbf39c4a
File diff suppressed because one or more lines are too long
@ -343,8 +343,8 @@ function isDataSchema(url) {
|
|||||||
function getPDFFileNameFromURL(url) {
|
function getPDFFileNameFromURL(url) {
|
||||||
var query;
|
var query;
|
||||||
var title;
|
var title;
|
||||||
if (/\?/.test(url)) {
|
if (/\#/.test(url)) {
|
||||||
url.replace(/\?(.*)$/, function (all, t) {
|
url.replace(/\#(.*)$/, function (all, t) {
|
||||||
title = t;
|
title = t;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,14 @@ define([
|
|||||||
Title.updateTitle(title || Title.defaultTitle);
|
Title.updateTitle(title || Title.defaultTitle);
|
||||||
toolbar.addElement(['pageTitle'], {pageTitle: title});
|
toolbar.addElement(['pageTitle'], {pageTitle: title});
|
||||||
|
|
||||||
var displayFile = function (ev, sizeMb) {
|
var displayFile = function (ev, sizeMb, CB) {
|
||||||
|
var called_back;
|
||||||
|
var cb = function (e) {
|
||||||
|
if (called_back) { return; }
|
||||||
|
called_back = true;
|
||||||
|
if (CB) { CB(e); }
|
||||||
|
};
|
||||||
|
|
||||||
var $mt = $dlview.find('media-tag');
|
var $mt = $dlview.find('media-tag');
|
||||||
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
var cryptKey = secret.keys && secret.keys.fileKeyStr;
|
||||||
var hexFileName = Cryptpad.base64ToHex(secret.channel);
|
var hexFileName = Cryptpad.base64ToHex(secret.channel);
|
||||||
@ -127,7 +134,7 @@ define([
|
|||||||
|
|
||||||
// make pdfs big
|
// make pdfs big
|
||||||
var toolbarHeight = $iframe.find('#toolbar').height();
|
var toolbarHeight = $iframe.find('#toolbar').height();
|
||||||
$iframe.find('media-tag iframe').css({
|
var $another_iframe = $iframe.find('media-tag iframe').css({
|
||||||
'height': 'calc(100vh - ' + toolbarHeight + 'px)',
|
'height': 'calc(100vh - ' + toolbarHeight + 'px)',
|
||||||
'width': '100vw',
|
'width': '100vw',
|
||||||
'position': 'absolute',
|
'position': 'absolute',
|
||||||
@ -135,10 +142,19 @@ define([
|
|||||||
'left': 0,
|
'left': 0,
|
||||||
'border': 0
|
'border': 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($another_iframe.length) {
|
||||||
|
$another_iframe.load(function () {
|
||||||
|
cb();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.on('decryptionError', function (e) {
|
.on('decryptionError', function (e) {
|
||||||
var error = e.originalEvent;
|
var error = e.originalEvent;
|
||||||
Cryptpad.alert(error.message);
|
//Cryptpad.alert(error.message);
|
||||||
|
cb(error.message);
|
||||||
})
|
})
|
||||||
.on('decryptionProgress', function (e) {
|
.on('decryptionProgress', function (e) {
|
||||||
var progress = e.originalEvent;
|
var progress = e.originalEvent;
|
||||||
@ -188,7 +204,9 @@ define([
|
|||||||
var onClick = function (ev) {
|
var onClick = function (ev) {
|
||||||
if (decrypting) { return; }
|
if (decrypting) { return; }
|
||||||
decrypting = true;
|
decrypting = true;
|
||||||
displayFile(ev, sizeMb);
|
displayFile(ev, sizeMb, function (err) {
|
||||||
|
if (err) { Cryptpad.alert(err); }
|
||||||
|
});
|
||||||
};
|
};
|
||||||
if (typeof(sizeMb) === 'number' && sizeMb < 5) { return void onClick(); }
|
if (typeof(sizeMb) === 'number' && sizeMb < 5) { return void onClick(); }
|
||||||
$dlform.find('#dl, #progress').click(onClick);
|
$dlform.find('#dl, #progress').click(onClick);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user