From c24fa2bb30728339d64ab7f8f4f353e0f0ae4df7 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 11 Oct 2021 17:00:51 +0200 Subject: [PATCH] Enable downloading OnlyOffice documents and slides from the drive --- www/doc/export.js | 26 ++++++++++++++++++++++++++ www/presentation/export.js | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 www/doc/export.js create mode 100644 www/presentation/export.js diff --git a/www/doc/export.js b/www/doc/export.js new file mode 100644 index 000000000..736778dbe --- /dev/null +++ b/www/doc/export.js @@ -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; +}); + diff --git a/www/presentation/export.js b/www/presentation/export.js new file mode 100644 index 000000000..b0bfbaacc --- /dev/null +++ b/www/presentation/export.js @@ -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; +}); +