Enable downloading OnlyOffice documents and slides from the drive

This commit is contained in:
yflory 2021-10-11 17:00:51 +02:00
parent a56cdfe38f
commit c24fa2bb30
2 changed files with 52 additions and 0 deletions

26
www/doc/export.js Normal file
View File

@ -0,0 +1,26 @@
define([], function () {
var module = {
ext: '.docx', // default
exts: ['.docx']
};
module.main = function (userDoc, cb, ext, sframeChan, padData) {
sframeChan.query('Q_OOIFRAME_OPEN', {
json: userDoc,
type: 'doc',
padData: padData
}, function (err, u8) {
if (!u8) { return void cb(''); }
var ext;
if (typeof(u8) === "string") { ext = '.bin'; } // x2t not supported
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob, ext);
}, {
timeout: 600000,
raw: true
});
};
return module;
});

View File

@ -0,0 +1,26 @@
define([], function () {
var module = {
ext: '.pptx', // default
exts: ['.pptx']
};
module.main = function (userDoc, cb, ext, sframeChan, padData) {
sframeChan.query('Q_OOIFRAME_OPEN', {
json: userDoc,
type: 'presentation',
padData: padData
}, function (err, u8) {
if (!u8) { return void cb(''); }
var ext;
if (typeof(u8) === "string") { ext = '.bin'; } // x2t not supported
var blob = new Blob([u8], {type: "application/bin;charset=utf-8"});
cb(blob, ext);
}, {
timeout: 600000,
raw: true
});
};
return module;
});