[Libreoffice-commits] online.git: loleaflet/debug loleaflet/src

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 15 10:08:40 UTC 2019


 loleaflet/debug/document/loleaflet.html  |    2 +-
 loleaflet/src/control/Control.Menubar.js |    4 ++--
 loleaflet/src/control/Control.Toolbar.js |   31 ++++++++++++++++---------------
 loleaflet/src/main.js                    |    3 +--
 loleaflet/src/map/Map.js                 |    6 +++---
 5 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 05a6486f3635fd6926cd0d32cd2b31031117c382
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Oct 15 12:08:14 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Oct 15 12:08:14 2019 +0200

    Fix initial state of closebutton (show in integration)
    
    Change-Id: I7b1fa565098f32817674fbeff5676cafa6957f31

diff --git a/loleaflet/debug/document/loleaflet.html b/loleaflet/debug/document/loleaflet.html
index 89156fe20..f7d17966c 100644
--- a/loleaflet/debug/document/loleaflet.html
+++ b/loleaflet/debug/document/loleaflet.html
@@ -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);
     }
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index bdb66f948..f36a489f5 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -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;
 			}
 		}
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 19bdacc8a..d1a455151 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -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;
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index 965aa132e..1110b5365 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -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;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 20e948353..628227522 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -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();
 		}
 


More information about the Libreoffice-commits mailing list