Fix initial state of closebutton (show in integration)

Change-Id: I7b1fa565098f32817674fbeff5676cafa6957f31
This commit is contained in:
Szymon Kłos 2019-10-15 12:08:14 +02:00
parent 4b55e4ac0c
commit 05a6486f36
5 changed files with 23 additions and 23 deletions

View file

@ -106,7 +106,7 @@
var filePath = getParameterByName('file_path');
var permission = getParameterByName('permission') || 'edit';
var timestamp = getParameterByName('timestamp');
var closebutton = getParameterByName('closebutton');
window.closeButtonEnabled = getParameterByName('closebutton');
if (wopiSrc === '' && filePath === '') {
vex.dialog.alert(wrongwopisrc);
}

View file

@ -3,7 +3,7 @@
* Control.Menubar
*/
/* global $ _ _UNO vex revHistoryEnabled closebutton L */
/* global $ _ _UNO vex revHistoryEnabled L */
L.Control.Menubar = L.Control.extend({
// TODO: Some mechanism to stop the need to copy duplicate menus (eg. Help)
options: {
@ -1029,7 +1029,7 @@ L.Control.Menubar = L.Control.extend({
if (menuItem.type === 'action') {
if ((menuItem.id === 'rev-history' && !revHistoryEnabled) ||
(menuItem.id === 'closedocument' && !closebutton)) {
(menuItem.id === 'closedocument' && !window.closebutton)) {
return false;
}
}

View file

@ -3,7 +3,7 @@
* LibreOffice Online toolbar
*/
/* global $ closebutton w2ui w2utils vex _ _UNO */
/* global $ w2ui w2utils vex _ _UNO */
/*eslint indent: [error, "tab", { "outerIIFEBody": 0 }]*/
(function(global) {
@ -2374,20 +2374,6 @@ $(window).resize(function() {
});
$(document).ready(function() {
if (!closebutton) {
$('#closebuttonwrapper').hide();
} else if (closebutton && !L.Browser.mobile) {
$('.closebuttonimage').show();
}
$('#closebutton').click(function() {
map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}});
map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
if (!map._disableDefaultAction['UI_Close']) {
map.remove();
}
});
// Attach insert file action
$('#insertgraphic').on('change', onInsertFile);
});
@ -2493,6 +2479,21 @@ function setupToolbar(e) {
map.on('updateparts pagenumberchanged', onUpdateParts);
map.on('commandstatechanged', onCommandStateChanged);
map.on('commandvalues', onCommandValues, this);
if (!window.closeButtonEnabled) {
$('#closebuttonwrapper').hide();
} else if (window.closeButtonEnabled && !L.Browser.mobile) {
$('#closebuttonwrapper').show();
$('.closebuttonimage').show();
}
$('#closebutton').click(function() {
map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}});
map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
if (!map._disableDefaultAction['UI_Close']) {
map.remove();
}
});
}
global.setupToolbar = setupToolbar;

View file

@ -18,7 +18,7 @@ var filePath = getParameterByName('file_path');
var permission = getParameterByName('permission') || 'edit';
var timestamp = getParameterByName('timestamp');
// Shows close button if non-zero value provided
var closebutton = getParameterByName('closebutton');
window.closeButtonEnabled = getParameterByName('closebutton');
// Shows revision history file menu option
var revHistoryEnabled = getParameterByName('revisionhistory');
// Should the document go inactive or not
@ -38,7 +38,6 @@ global.isInternetExplorer = isInternetExplorer;
// loleaflet.js accesses these globals
// TODO: Get rid of these globals
global.closebutton = closebutton;
global.revHistoryEnabled = revHistoryEnabled;
var docURL, docParams;
var isWopi = false;

View file

@ -24,7 +24,7 @@ function isAnyVexDialogActive() {
return res;
}
/* global closebutton vex revHistoryEnabled $ _ */
/* global vex revHistoryEnabled $ _ */
L.Map = L.Evented.extend({
options: {
@ -1669,7 +1669,7 @@ L.Map = L.Evented.extend({
if (!this.isMenubarHidden())
return;
$('.main-nav').show();
if (closebutton && !window.mode.isTablet()) {
if (window.closeButtonEnabled && !window.mode.isTablet()) {
$('#closebuttonwrapper').show();
}
@ -1687,7 +1687,7 @@ L.Map = L.Evented.extend({
if (this.isMenubarHidden())
return;
$('.main-nav').hide();
if (closebutton) {
if (window.closeButtonEnabled) {
$('#closebuttonwrapper').hide();
}