Skip to content

Commit

Permalink
Merge pull request #2888 from ONLYOFFICE/fix/bugfix
Browse files Browse the repository at this point in the history
Fix/bugfix
  • Loading branch information
JuliaRadzhabova authored Mar 18, 2024
2 parents f5de71b + 8c8b632 commit a0ec143
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/documenteditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ DE.ApplicationController = new(function(){
if (config.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof config.customization.close === 'object')
if (config.customization.close && typeof config.customization.close === 'object')
config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp;
}
config.canBackToFolder = !!_canback;
Expand Down
24 changes: 24 additions & 0 deletions apps/documenteditor/forms/app/controller/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,22 @@ define([
this.appOptions.canPlugins = false;

Common.Controllers.Desktop.init(this.appOptions);

this.appOptions.canCloseEditor = false;
var _canback = false;
if (typeof this.appOptions.customization === 'object') {
if (typeof this.appOptions.customization.goback == 'object' && this.appOptions.canBackToFolder!==false) {
_canback = this.appOptions.customization.close===undefined ?
this.appOptions.customization.goback.url || this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose :
this.appOptions.customization.goback.url && !this.appOptions.customization.goback.requestClose;

if (this.appOptions.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object')
this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp;
}
this.appOptions.canBackToFolder = !!_canback;
},

onExternalMessage: function(msg) {
Expand Down Expand Up @@ -675,6 +691,14 @@ define([
this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None);
}

this.view.btnClose.setVisible(this.appOptions.canCloseEditor);
if (this.appOptions.canCloseEditor) {
this.view.btnClose.updateHint(this.appOptions.customization.close.text || this.view.textClose);
this.view.btnClose.on('click', function(){
Common.Gateway.requestClose();
});
}

this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
this.api.asc_LoadDocument();
this.api.Resize();
Expand Down
12 changes: 11 additions & 1 deletion apps/documenteditor/forms/app/view/ApplicationView.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ define([
maskExp: /[0-9]/
});

this.btnClose = new Common.UI.Button({
cls: 'btn-toolbar margin-left-small',
iconCls: 'svg-icon search-close',
hint: this.textClose,
visible: false,
scaling: false
});
this.btnClose.render($('#id-btn-close-editor'));

return this;
},

Expand Down Expand Up @@ -213,7 +222,8 @@ define([
txtSearch: 'Search',
tipUndo: 'Undo',
tipRedo: 'Redo',
textClearField: 'Clear field'
textClearField: 'Clear field',
textClose: 'Close file'

}, DE.Views.ApplicationView || {}));
});
1 change: 1 addition & 0 deletions apps/documenteditor/forms/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
<div id="id-submit-group" style="display: inline-block;"></div>
<div id="id-download-group" style="display: inline-block;"></div>
<span id="box-tools"></span>
<div id="id-btn-close-editor" style="display: inline-block;"></div>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions apps/documenteditor/forms/index.html.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
<div id="id-submit-group" style="display: inline-block;"></div>
<div id="id-download-group" style="display: inline-block;"></div>
<span id="box-tools"></span>
<div id="id-btn-close-editor" style="display: inline-block;"></div>
</div>
</div>
<script>
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/forms/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,6 @@
"DE.Views.ApplicationView.txtPrint": "Print",
"DE.Views.ApplicationView.txtSearch": "Search",
"DE.Views.ApplicationView.txtShare": "Share",
"DE.Views.ApplicationView.txtTheme": "Interface theme"
"DE.Views.ApplicationView.txtTheme": "Interface theme",
"DE.Views.ApplicationView.textClose": "Close file"
}
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ define([
if (this.appOptions.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof this.appOptions.customization.close === 'object')
if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') // if close=null - no close button
this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp;
}
this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback;
Expand Down
2 changes: 1 addition & 1 deletion apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ define([
if (this.appOptions.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof this.appOptions.customization.close === 'object')
if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object')
this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp;
}
this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback;
Expand Down
2 changes: 1 addition & 1 deletion apps/presentationeditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ PE.ApplicationController = new(function(){
if (config.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof config.customization.close === 'object')
if (config.customization.close && typeof config.customization.close === 'object')
config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp;
}
config.canBackToFolder = !!_canback;
Expand Down
2 changes: 1 addition & 1 deletion apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ define([
if (this.appOptions.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof this.appOptions.customization.close === 'object')
if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object')
this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp;
}
this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback;
Expand Down
2 changes: 1 addition & 1 deletion apps/spreadsheeteditor/embed/js/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SSE.ApplicationController = new(function(){
if (config.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof config.customization.close === 'object')
if (config.customization.close && typeof config.customization.close === 'object')
config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp;
}
config.canBackToFolder = !!_canback;
Expand Down
2 changes: 1 addition & 1 deletion apps/spreadsheeteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ define([
if (this.appOptions.customization.goback.requestClose)
console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead.");
}
if (typeof this.appOptions.customization.close === 'object')
if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object')
this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp;
}
this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback;
Expand Down

0 comments on commit a0ec143

Please sign in to comment.