diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index a1add1497..fa0e28755 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -356,10 +356,32 @@ define([ } }; + Messages.oo_cantMigrate = "This sheet exceeds the maximum upload size and is too large to be migrated."; // XXX var onUploaded = function (ev, data, err) { content.saveLock = undefined; if (err) { console.error(err); + if (content.saveLock === myOOId) { delete content.saveLock; } // Unlock checkpoints + if (APP.migrateModal) { + try { getEditor().asc_setRestriction(true); } catch (e) {} + setEditable(true); + delete content.migration; + APP.migrateModal.closeModal(); + APP.onLocal(); + } + if (isLockedModal.modal && err === "TOO_LARGE") { + if (APP.migrate) { + UI.warn(Messages.oo_cantMigrate); + } + APP.cantCheckpoint = true; + isLockedModal.modal.closeModal(); + delete isLockedModal.modal; + if (content.saveLock === myOOId) { + delete content.saveLock; + } + APP.onLocal(); + return; + } return void UI.alert(Messages.oo_saveError); } // Get the last cp idx @@ -453,6 +475,7 @@ define([ }; var saveToServer = function () { + if (APP.cantCheckpoint) { return; } // TOO_LARGE var text = getContent(); if (!text) { setEditable(false, true); @@ -490,6 +513,8 @@ define([ var noLogin = false; var makeCheckpoint = function (force) { + if (APP.cantCheckpoint) { return; } // TOO_LARGE + var locked = content.saveLock; var lastCp = getLastCp(); @@ -1385,7 +1410,7 @@ define([ h('span.fa.fa-spin.fa-spinner'), h('span', Messages.oo_sheetMigration_loading) ]); - UI.openCustomModal(UI.dialog.customModal(div, {buttons: []})); + APP.migrateModal = UI.openCustomModal(UI.dialog.customModal(div, {buttons: []})); makeCheckpoint(true); }); // DEPRECATED: from version 3, the queue is sent again during init diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index c7a66adb9..2a6f4fea3 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -133,6 +133,7 @@ define([ $pv.text(Messages.error); queue.inProgress = false; queue.next(); + if (config.onError) { config.onError("TOO_LARGE"); } return void UI.alert(Messages._getKey('upload_tooLargeBrief', [maxSizeStr])); }