Skip to content

Commit

Permalink
Check onRequestRefreshFile event
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Oct 2, 2024
1 parent e53deb9 commit 7da70f0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
4 changes: 3 additions & 1 deletion apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
'onError': <error callback>,
'onWarning': <warning callback>,
'onInfo': <document open callback>,// send view or edit mode
'onOutdatedVersion': <outdated version callback>,// send when previous version is opened
'onOutdatedVersion': <outdated version callback>,// send when previous version is opened, deprecated: use onRequestRefreshFile/refreshFile instead
'onDownloadAs': <download as callback>,// send url of downloaded file as a response for downloadAs method
'onRequestSaveAs': <try to save copy of the document>,
'onCollaborativeChanges': <co-editing changes callback>,// send when other user co-edit document
Expand All @@ -305,6 +305,7 @@
'onSaveDocument': 'save document from binary',
'onRequestStartFilling': <try to start filling forms> // used in pdf-form edit mode. must call startFilling method
'onSubmit': <filled form is submitted> // send when filled form is submitted successfully
'onRequestRefreshFile': <request new file version> // send when file version is updated. use instead of onOutdatedVersion
}
}
Expand Down Expand Up @@ -375,6 +376,7 @@
_config.editorConfig.canRequestReferenceSource = _config.events && !!_config.events.onRequestReferenceSource;
_config.editorConfig.canSaveDocumentToBinary = _config.events && !!_config.events.onSaveDocument;
_config.editorConfig.canStartFilling = _config.events && !!_config.events.onRequestStartFilling;
_config.editorConfig.canRequestRefreshFile = _config.events && !!_config.events.onRequestRefreshFile;
_config.frameEditorId = placeholderId;
_config.parentOrigin = window.location.origin;

Expand Down
8 changes: 5 additions & 3 deletions apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ define([
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
Common.NotificationCenter.on('doc:mode-apply', _.bind(this.onDocModeApply, this));

Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));

this.isShowOpenDialog = false;

// Initialize api gateway
Expand Down Expand Up @@ -516,6 +513,11 @@ define([
this.appOptions.wopi = this.editorConfig.wopi;
appHeader.setWopi(this.appOptions.wopi);

if (this.editorConfig.canRequestRefreshFile) {
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
}

Common.Controllers.Desktop.init(this.appOptions);
Common.UI.HintManager.setMode(this.appOptions);
},
Expand Down
8 changes: 5 additions & 3 deletions apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ define([
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
Common.NotificationCenter.on('pdf:mode-apply', _.bind(this.onPdfModeApply, this));

Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));

this.isShowOpenDialog = false;

// Initialize api gateway
Expand Down Expand Up @@ -437,6 +434,11 @@ define([
this.appOptions.wopi = this.editorConfig.wopi;
appHeader.setWopi(this.appOptions.wopi);

if (this.editorConfig.canRequestRefreshFile) {
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
}

Common.Controllers.Desktop.init(this.appOptions);
Common.UI.HintManager.setMode(this.appOptions);
},
Expand Down
7 changes: 5 additions & 2 deletions apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@ define([
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));

this.isShowOpenDialog = false;

Expand Down Expand Up @@ -482,6 +480,11 @@ define([
this.appOptions.wopi = this.editorConfig.wopi;
appHeader.setWopi(this.appOptions.wopi);

if (this.editorConfig.canRequestRefreshFile) {
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
}

Common.Controllers.Desktop.init(this.appOptions);
Common.UI.HintManager.setMode(this.appOptions);
},
Expand Down
7 changes: 5 additions & 2 deletions apps/spreadsheeteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ define([
Common.NotificationCenter.on('protect:check', _.bind(this.checkProtectedRange, this));
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));

this.stackLongActions = new Common.IrregularStack({
strongCompare : this._compareActionStrong,
Expand Down Expand Up @@ -551,6 +549,11 @@ define([
this.appOptions.wopi = this.editorConfig.wopi;
this.headerView.setWopi(this.appOptions.wopi);

if (this.editorConfig.canRequestRefreshFile) {
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
}

this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge || this.appOptions.isEditOle);
Common.Controllers.Desktop.init(this.appOptions);

Expand Down

0 comments on commit 7da70f0

Please sign in to comment.