loleaflet: Prevent sidebar from opening when file is on read only mode.

This patch is for preventing sidebar from being launched when:
   * Document is on read only mode (No need for an editor bar when doc is read-only).
   * Also the main reason for this patch was to hide Sidebar when revision history is open (NC).

Change-Id: I4d78c65a7e8f39b0827b9e23ecc24fcd9520fef8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100601
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
gokaysatir 2020-08-12 17:20:54 +03:00 committed by Henry Castro
parent a3da55a28d
commit eb8e075ce0

View file

@ -991,6 +991,11 @@ L.Control.LokDialog = L.Control.extend({
},
_launchSidebar: function(id, width, height) {
// In read-only mode, we don't need to show sidebar. This if clause prevents sidebar from opening also when revision history is open.
if (this._map.isPermissionReadOnly()) {
return;
}
console.log('_launchSidebar: start: id: ' + id + ', width: ' + width + ', height: ' + height);
if ((window.mode.isMobile() || window.mode.isTablet())
&& !this._map.isPermissionEdit())