diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index b0f764913..f0c50b062 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1356,7 +1356,7 @@ define([ varĀ unsaved = APP.unsavedChanges; delete APP.unsavedChanges; rtChannel.sendMsg(unsaved, null, function (err, hash) { - if (err) { return; } + if (err) { return void UI.warn(Messages.error); } // XXX Better error message? // This is supposed to be a "send" function to tell our OO // to unlock the cell. We use this to know that the patch was // correctly sent so that we can apply it to our OO too. @@ -2042,6 +2042,28 @@ define([ } }; + var setStrictEditing = function () { + if (APP.isFast) { return; } + var editor = getEditor(); + var editing = editor.asc_isDocumentModified(); + if (editing) { + evOnPatch.fire(); + } else { + evOnSync.fire(); + } + }; + APP.onFastChange = function (isFast) { + APP.isFast = isFast; + if (isFast) { + if (APP.hasChangedInterval) { + window.clearInterval(APP.hasChangedInterval) + } + return; + } + setStrictEditing(); + APP.hasChangedInterval = window.setInterval(setStrictEditing, 500); + }; + APP.getContent = function () { return content; }; APP.onLocal = config.onLocal = function () { diff --git a/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js b/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js index 6aac2e139..c360e7352 100644 --- a/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js +++ b/www/common/onlyoffice/v2b/sdkjs/cell/sdk-all-min.js @@ -1689,17 +1689,17 @@ function(){var t=this;if(this.openingEnd.xlsxStart)return;this.openingEnd.xlsxSt function(actionType,options,oAdditionalData,dataContainer){var fileType=options.fileType;if(c_oAscFileType.PDF===fileType||c_oAscFileType.PDFA===fileType){var printPagesData=this.wb.calcPagesPrint(options.advancedOptions);var pdfPrinterMemory=this.wb.printSheets(printPagesData).DocumentRenderer.Memory;dataContainer.data=oAdditionalData["nobase64"]?pdfPrinterMemory.GetData():pdfPrinterMemory.GetBase64Memory()}else{var oBinaryFileWriter=new AscCommonExcel.BinaryFileWriter(this.wbModel);if(c_oAscFileType.CSV=== fileType)if(options.advancedOptions instanceof asc.asc_CTextOptions){oAdditionalData["codepage"]=options.advancedOptions.asc_getCodePage();oAdditionalData["delimiter"]=options.advancedOptions.asc_getDelimiter();oAdditionalData["delimiterChar"]=options.advancedOptions.asc_getDelimiterChar()}dataContainer.data=oBinaryFileWriter.Write(oAdditionalData["nobase64"])}if(window.isCloudCryptoDownloadAs){var sParamXml=""+oAdditionalData["codepage"]+"";sParamXml+=""+ oAdditionalData["delimiter"]+"";window["AscDesktopEditor"]["CryptoDownloadAs"](dataContainer.data,fileType,sParamXml);return true}};spreadsheet_api.prototype.asc_isDocumentModified=function(){if(!this.canSave||this.asc_getCellEditMode())return true;else if(History&&History.Have_Changes)return History.Have_Changes();return false};spreadsheet_api.prototype.asc_registerCallback=function(name,callback,replaceOldCallback){this.handlers.add(name,callback,replaceOldCallback)};spreadsheet_api.prototype.asc_unregisterCallback= -function(name,callback){this.handlers.remove(name,callback)};spreadsheet_api.prototype.asc_SetDocumentPlaceChangedEnabled=function(val){this.wb.setDocumentPlaceChangedEnabled(val)};spreadsheet_api.prototype.asc_SetFastCollaborative=function(bFast){if(this.collaborativeEditing){AscCommon.CollaborativeEditing.Set_Fast(bFast);this.collaborativeEditing.setFast(bFast)}};spreadsheet_api.prototype.asc_setThumbnailStylesSizes=function(width,height){this.styleThumbnailWidth=width;this.styleThumbnailHeight= -height};spreadsheet_api.prototype.sheetsChanged=function(){this.handlers.trigger("asc_onSheetsChanged")};spreadsheet_api.prototype.asyncFontsDocumentStartLoaded=function(){this.OpenDocumentProgress.Type=c_oAscAsyncAction.LoadDocumentFonts;this.OpenDocumentProgress.FontsCount=this.FontLoader.fonts_loading.length;this.OpenDocumentProgress.CurrentFont=0;this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadDocumentFonts)};spreadsheet_api.prototype.asyncFontsDocumentEndLoaded= -function(){this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction,c_oAscAsyncAction.LoadDocumentFonts);if(this.asyncMethodCallback!==undefined){this.asyncMethodCallback();this.asyncMethodCallback=undefined}else{this.FontLoadWaitComplete=true;this._openDocumentEndCallback()}};spreadsheet_api.prototype.asyncFontEndLoaded=function(font){this.sync_EndAction(c_oAscAsyncActionType.Information,c_oAscAsyncAction.LoadFont)};spreadsheet_api.prototype._loadFonts=function(fonts,callback){if(window["NATIVE_EDITOR_ENJINE"])return callback(); -this.asyncMethodCallback=callback;var arrLoadFonts=[];for(var i in fonts)arrLoadFonts.push(new AscFonts.CFont(i,0,"",0));AscFonts.FontPickerByCharacter.extendFonts(arrLoadFonts);this.FontLoader.LoadDocumentFonts2(arrLoadFonts)};spreadsheet_api.prototype.openDocument=function(file){this._openDocument(file.data);this._openOnClient()};spreadsheet_api.prototype.openDocumentFromZip=function(wb,data){var t=this;return new Promise(function(resolve,reject){var openXml=AscCommon.openXml;if(t.isChartEditor){resolve(); -return}var nextPromise;if(data){var doc=new openXml.OpenXmlPackage;var wbPart=null;var wbXml=null;var pivotCaches={};var jsZipWrapper=new AscCommon.JSZipWrapper;nextPromise=jsZipWrapper.loadAsync(data).then(function(zip){return doc.openFromZip(zip)}).then(function(){wbPart=doc.getPartByRelationshipType(openXml.relationshipTypes.workbook);return wbPart.getDocumentContent()}).then(function(contentWorkbook){wbXml=new AscCommonExcel.CT_Workbook;(new openXml.SaxParserBase).parse(contentWorkbook,wbXml); -if(wbXml.pivotCaches)return wbXml.pivotCaches.reduce(function(prevVal,wbPivotCacheXml){var pivotTableCacheDefinitionPart;var pivotTableCacheDefinition;return prevVal.then(function(){if(null!==wbPivotCacheXml.cacheId&&null!==wbPivotCacheXml.id){pivotTableCacheDefinitionPart=wbPart.getPartById(wbPivotCacheXml.id);return pivotTableCacheDefinitionPart.getDocumentContent()}}).then(function(content){if(content){pivotTableCacheDefinition=new Asc.CT_PivotCacheDefinition;(new openXml.SaxParserBase).parse(content, -pivotTableCacheDefinition);if(pivotTableCacheDefinition.isValidCacheSource()){pivotCaches[wbPivotCacheXml.cacheId]=pivotTableCacheDefinition;if(pivotTableCacheDefinition.id){var partPivotTableCacheRecords=pivotTableCacheDefinitionPart.getPartById(pivotTableCacheDefinition.id);return partPivotTableCacheRecords.getDocumentContent()}}}}).then(function(content){if(content){var pivotTableCacheRecords=new Asc.CT_PivotCacheRecords;(new openXml.SaxParserBase).parse(content,pivotTableCacheRecords);pivotTableCacheDefinition.cacheRecords= -pivotTableCacheRecords}})},Promise.resolve())}).then(function(){if(wbXml.sheets){var wsIndex=0;return wbXml.sheets.reduce(function(prevVal,wbSheetXml){var wsPart;return prevVal.then(function(){if(null!==wbSheetXml.id){var actions=[];wsPart=wbPart.getPartById(wbSheetXml.id);var pivotParts=wsPart.getPartsByRelationshipType(openXml.relationshipTypes.pivotTable);for(var i=0;i