Fixed PDF service
This commit is contained in:
parent
7726b46be2
commit
a037fb31a8
@ -39,7 +39,7 @@ var authorizedPageSizes = [
|
||||
'Letter'
|
||||
];
|
||||
|
||||
module.exports = function(req, res, next) {
|
||||
exports.export = function(req, res, next) {
|
||||
function onError(err) {
|
||||
next(err);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ define([
|
||||
'fileMgr',
|
||||
'editor',
|
||||
'diff_match_patch_uncompressed',
|
||||
'jsondiffpatch',
|
||||
'jsondiffpatch'
|
||||
], function(_, utils, settings, eventMgr, fileMgr, editor, diff_match_patch, jsondiffpatch) {
|
||||
|
||||
function Provider(providerId, providerName) {
|
||||
|
@ -23,10 +23,10 @@ define([], function() {
|
||||
constants.IMPORT_IMG_MAX_CONTENT_SIZE = 10000000;
|
||||
constants.TEMPORARY_FILE_INDEX = "file.tempIndex";
|
||||
constants.WELCOME_DOCUMENT_TITLE = "Welcome document";
|
||||
constants.DOWNLOAD_PROXY_URL = "https://stackedit-download-proxy.herokuapp.com/";
|
||||
constants.PICASA_PROXY_URL = "https://stackedit-picasa-proxy.herokuapp.com/";
|
||||
constants.SSH_PROXY_URL = "https://stackedit-ssh-proxy.herokuapp.com/";
|
||||
constants.HTMLTOPDF_URL = "/pdf";
|
||||
constants.DOWNLOAD_IMPORT_URL = "/downloadImport";
|
||||
constants.PICASA_IMPORT_IMG_URL = "/picasaImportImg";
|
||||
constants.SSH_PUBLISH_URL = '/sshPublish';
|
||||
constants.PDF_EXPORT_URL = "/pdfExport";
|
||||
|
||||
// Site dependent
|
||||
constants.BASE_URL = "http://localhost/";
|
||||
|
@ -364,7 +364,10 @@ define([
|
||||
return task.chain();
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', constants.HTMLTOPDF_URL + '?token=' + encodeURIComponent(token) + '&options=' + encodeURIComponent(settings.pdfOptions), true);
|
||||
xhr.open('POST', constants.PDF_EXPORT_URL + '?' + $.param({
|
||||
token: token,
|
||||
options: settings.pdfOptions
|
||||
}), true);
|
||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
xhr.responseType = 'blob';
|
||||
xhr.onreadystatechange = function() {
|
||||
@ -373,7 +376,7 @@ define([
|
||||
pdf = this.response;
|
||||
}
|
||||
else {
|
||||
eventMgr.onError("Error when trying to generate PDF: " + this.status);
|
||||
eventMgr.onError("Error when trying to generate PDF: " + this.statusText);
|
||||
}
|
||||
task.chain();
|
||||
}
|
||||
|
@ -246,9 +246,10 @@ define([
|
||||
localStorage.removeItem("welcomeTour");
|
||||
if(_.has(localStorage, 'settings')) {
|
||||
settings = JSON.parse(localStorage.settings);
|
||||
// Remove PDF settings as it's a new web service
|
||||
// New web services
|
||||
delete settings.pdfTemplate;
|
||||
delete settings.pdfPageSize;
|
||||
delete settings.sshProxy;
|
||||
localStorage.settings = JSON.stringify(settings);
|
||||
}
|
||||
version = "v20";
|
||||
|
Loading…
Reference in New Issue
Block a user