Merge branch 'staging' into exportSheet

This commit is contained in:
yflory 2021-10-04 13:13:15 +02:00
commit 08d771a3df
3 changed files with 43 additions and 5 deletions

View File

@ -1912,6 +1912,17 @@ define([
var type = common.getMetadataMgr().getPrivateData().ooType;
var title = md.title || md.defaultTitle || type;
var blob = new Blob([xlsData], {type: "application/pdf"});
if (privateData.app !== "sheet") {
UI.removeModals();
var url = URL.createObjectURL(blob, { type: "application/pdf" });
cb({
"type":"save",
"status":"ok",
"data": url
});
saveAs(blob, title+'.pdf');
return;
}
saveAs(blob, title+'.pdf');
cb({
"type":"save",
@ -1922,10 +1933,10 @@ define([
var x2tSaveAndConvertData = function(data, filename, extension, finalFilename) {
var type = common.getMetadataMgr().getPrivateData().ooType;
var e = getEditor();
// PDF
if (type === "sheet" && extension === "pdf") {
var e = getEditor();
var d = e.asc_nativePrint(undefined, undefined, 0x101).ImData;
x2tConvertData({
buffer: d.data,
@ -1939,6 +1950,9 @@ define([
});
return;
}
if (extension === "pdf") {
return void e.asc_Print({});
}
x2tConvertData(data, filename, extension, function (xlsData) {
if (xlsData) {
var blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
@ -1959,9 +1973,9 @@ define([
var type = common.getMetadataMgr().getPrivateData().ooType;
var warning = '';
if (type==="presentation") {
ext = ['.pptx', /*'.odp',*/ '.bin'];
ext = ['.pptx', '.odp', '.bin', '.pdf'];
} else if (type==="doc") {
ext = ['.docx', /*'.odt',*/ '.bin'];
ext = ['.docx', '.odt', '.bin', '.pdf'];
}
if (!supportsXLSX()) {

View File

@ -142,6 +142,30 @@ define([
});
}
};
if (ext === 'bin') {
var reader2 = new FileReader();
reader2.onload = function (e) {
var str = e.target.result;
var type = str.slice(0,4);
var c = CONVERTERS['bin'] = {};
if (type === "XLSY") {
c.ods = x2tConverter('bin', 'ods');
c.xlsx = x2tConverter('bin', 'xlsx');
} else if (type === "PPTY") {
c.odp = x2tConverter('bin', 'odp');
c.pptx = x2tConverter('bin', 'pptx');
} else if (type === "DOCY") {
c.odt = x2tConverter('bin', 'odt');
c.docx = x2tConverter('bin', 'docx');
} else {
return void console.error('Unsupported');
}
reader.readAsArrayBuffer(file, 'application/octet-stream');
};
return void reader2.readAsText(file);
}
reader.readAsArrayBuffer(file, 'application/octet-stream');
});

View File

@ -3,8 +3,8 @@ This file is intended to be used as a log of what third-party source we have ven
* [turndown v7.1.1](https://github.com/mixmark-io/turndown/releases/tag/v7.1.1) built from unmodified source as per its build scripts.
* [less.min.js v3.11.1](https://github.com/less/less.js/releases/tag/v3.11.1) with a minor modification to produce slightly more compact CSS
* [textFit.min.js v2.4.0 ](https://github.com/STRML/textFit/releases/tag/v2.4.0) to ensure that app names fit inside their icon containers on the home page
* [highlightjs](https://github.com/highlightjs/highlight.js/) for syntax highlighting in our code editor
* [our fork of tippy.js](https://github.com/xwiki-labs/tippyjs) for adding tooltips.
* [highlightjs v10.2.0](https://github.com/highlightjs/highlight.js/) for syntax highlighting in our code editor
* [our fork of tippy.js v1.2.0](https://github.com/xwiki-labs/tippyjs) for adding tooltips.
* [jscolor v2.0.5](https://jscolor.com/) for providing a consistent color picker across all browsers
* [jquery.ui 1.12.1](https://jqueryui.com/) for its 'autocomplete' extension which is used for our tag picker
* [pdfjs](https://mozilla.github.io/pdf.js/) with some minor modifications to prevent CSP errors