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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 23 07:23:38 UTC 2020


 loleaflet/css/notebookbar.css                       |    1 
 loleaflet/src/control/Control.JSDialogBuilder.js    |    8 ------
 loleaflet/src/control/Control.Notebookbar.js        |   16 +++++++++++-
 loleaflet/src/control/Control.NotebookbarBuilder.js |   25 +++++++++++++++++++
 loleaflet/src/control/Control.UIManager.js          |   26 ++++++++++++++++++++
 5 files changed, 67 insertions(+), 9 deletions(-)

New commits:
commit 70cef6aeda72e4cbe9d2511ea2c39665bfae7c7d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jul 22 11:08:02 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jul 23 09:23:27 2020 +0200

    notebookbar: avoid doubled switching tabs on context change
    
    Change-Id: Ic0fdd3eec0a254db930c42d1d11257a1462d1f7b
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99210
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.Notebookbar.js b/loleaflet/src/control/Control.Notebookbar.js
index 7f8dfffe5..41c6f55d9 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -214,7 +214,9 @@ L.Control.Notebookbar = L.Control.extend({
 				var contexts = tabs[tab].context.split('|');
 				for (var context in contexts) {
 					if (contexts[context] === event.context) {
-						$('#' + tabs[tab].name).click();
+						var tabElement = $('#' + tabs[tab].name);
+						if (!tabElement.hasClass('selected'))
+							tabElement.click();
 					}
 				}
 			}
commit bb9ee333bdb0f16ef8f414a37c5294607e4afee9
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jul 22 10:38:14 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jul 23 09:23:19 2020 +0200

    notebookbar: fix collapsing
    
    - don't hide formula bar in calc
    - move tab click handler to NotebookbarBuilder
      to avoid isses in mobile wizard
    - cleanup in the code
    
    Change-Id: Id13e969676bd32882c85394abf1febe2e943e9e7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99187
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/css/notebookbar.css b/loleaflet/css/notebookbar.css
index 5c4843424..410426a50 100644
--- a/loleaflet/css/notebookbar.css
+++ b/loleaflet/css/notebookbar.css
@@ -73,6 +73,7 @@
 	display: inline;
 	position: fixed;
 	right: 0px;
+	z-index: 1000;
 }
 
 /* root container */
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index 1519947b3..967e2bd7b 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -653,14 +653,6 @@ L.Control.JSDialogBuilder = L.Control.extend({
 	_createTabClick: function(builder, t, tabs, contentDivs, tabIds)
 	{
 		return function() {
-			if ($(tabs[t]).hasClass('selected') && !$('#document-container').hasClass('tabs-collapsed')) {
-				$('#document-container').css('top', '38px');
-				$('#document-container').addClass('tabs-collapsed');
-			}
-			else if ($(tabs[t]).hasClass('selected') && $('#document-container').hasClass('tabs-collapsed')) {
-				$('#document-container').css('top', '120px');
-				$('#document-container').removeClass('tabs-collapsed');
-			}
 			$(tabs[t]).addClass('selected');
 			for (var i = 0; i < tabs.length; i++) {
 				if (i !== t)
diff --git a/loleaflet/src/control/Control.Notebookbar.js b/loleaflet/src/control/Control.Notebookbar.js
index b2c4ac54e..7f8dfffe5 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -62,6 +62,18 @@ L.Control.Notebookbar = L.Control.extend({
 		$('.notebookbar-shortcuts-bar').hide();
 	},
 
+	collapse: function() {
+		this.map.uiManager.collapseNotebookbar();
+	},
+
+	extend: function() {
+		this.map.uiManager.extendNotebookbar();
+	},
+
+	isCollapsed: function() {
+		return this.map.uiManager.isNotebookbarCollapsed();
+	},
+
 	clearNotebookbar: function() {
 		$('.root-container.notebookbar').remove();
 		$('.ui-tabs.notebookbar').remove();
diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index 52b8ebc57..2dd18e5be 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -250,6 +250,31 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
 		return builder._comboboxControl(parentContainer, data, builder);
 	},
 
+	// overriden
+	_createTabClick: function(builder, t, tabs, contentDivs, tabIds)
+	{
+		return function() {
+			var tabIsSelected = $(tabs[t]).hasClass('selected');
+			var notebookbarIsCollapsed = builder.wizard.isCollapsed();
+
+			if (tabIsSelected && !notebookbarIsCollapsed) {
+				builder.wizard.collapse();
+			} else if (tabIsSelected && notebookbarIsCollapsed) {
+				builder.wizard.extend();
+			}
+
+			$(tabs[t]).addClass('selected');
+			for (var i = 0; i < tabs.length; i++) {
+				if (i !== t) {
+					$(tabs[i]).removeClass('selected');
+					$(contentDivs[i]).hide();
+				}
+			}
+			$(contentDivs[t]).show();
+			builder.wizard.selectedTab(tabIds[t]);
+		};
+	},
+
 	_overridenTabsControlHandler: function(parentContainer, data, builder) {
 		data.tabs = builder.wizard.getTabs();
 		return builder._tabsControlHandler(parentContainer, data, builder);
diff --git a/loleaflet/src/control/Control.UIManager.js b/loleaflet/src/control/Control.UIManager.js
index 534216d73..7f9d4eb55 100644
--- a/loleaflet/src/control/Control.UIManager.js
+++ b/loleaflet/src/control/Control.UIManager.js
@@ -214,6 +214,32 @@ L.Control.UIManager = L.Control.extend({
 		$('#map').addClass('notebookbar-opened');
 	},
 
+	collapseNotebookbar: function() {
+		this.moveObjectVertically($('#spreadsheet-row-column-frame'), -85);
+		this.moveObjectVertically($('#document-container'), -85);
+		this.moveObjectVertically($('#presentation-controls-wrapper'), -85);
+		this.moveObjectVertically($('#sidebar-dock-wrapper'), -85);
+		this.moveObjectVertically($('#formulabar'), -1);
+		$('#toolbar-up').css('display', 'none');
+
+		$('#document-container').addClass('tabs-collapsed');
+	},
+
+	extendNotebookbar: function() {
+		this.moveObjectVertically($('#spreadsheet-row-column-frame'), 85);
+		this.moveObjectVertically($('#document-container'), 85);
+		this.moveObjectVertically($('#presentation-controls-wrapper'), 85);
+		this.moveObjectVertically($('#sidebar-dock-wrapper'), 85);
+		this.moveObjectVertically($('#formulabar'), 1);
+		$('#toolbar-up').css('display', '');
+
+		$('#document-container').removeClass('tabs-collapsed');
+	},
+
+	isNotebookbarCollapsed: function() {
+		return $('#document-container').hasClass('tabs-collapsed');
+	},
+
 	// Event handlers
 
 	onUpdatePermission: function(e) {


More information about the Libreoffice-commits mailing list