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

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 09:17:25 UTC 2020


 loleaflet/src/control/Control.Notebookbar.js |   20 ++++++++++++++++++--
 loleaflet/src/control/Ruler.js               |    3 +++
 2 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 91d2e967461f5bb4552c8332faa393ba97e59f11
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jun 18 14:27:27 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 19 11:17:14 2020 +0200

    Avoid usage of undefined when no margin set
    
    Change-Id: Ie922448e37e4414f054fa0404ea5787212c446dd
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96679
    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/Ruler.js b/loleaflet/src/control/Ruler.js
index 011b16488..e717d84e3 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -211,6 +211,9 @@ L.Control.Ruler = L.Control.extend({
 		var items = this._map['stateChangeHandler'];
 		var state = items.getItemValue('.uno:LeftRightParaMargin');
 
+		if (!state)
+			return;
+
 		this.options.firstLineIndent = parseFloat(state.firstline.replace(',', '.'));
 		this.options.leftParagraphIndent = parseFloat(state.left.replace(',', '.'));
 		this.options.rightParagraphIndent = parseFloat(state.right.replace(',', '.'));
commit c24b034f33a4dd5aeaf5e91e1f5968b2d9cf13e5
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jun 17 11:08:19 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 19 11:17:02 2020 +0200

    notebookbar: scroll to last position on refresh
    
    Change-Id: Iec0d6938f43231c6808dc14ca69c98be6f44012c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96680
    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 7b62e1123..b18dcf611 100644
--- a/loleaflet/src/control/Control.Notebookbar.js
+++ b/loleaflet/src/control/Control.Notebookbar.js
@@ -6,8 +6,11 @@
 /* global $ */
 L.Control.Notebookbar = L.Control.extend({
 
+	_currentScrollPosition: 0,
+
 	onAdd: function (map) {
 		this.map = map;
+		this._currentScrollPosition = 0;
 
 		this.loadTab(this.getHomeTab());
 
@@ -31,6 +34,8 @@ L.Control.Notebookbar = L.Control.extend({
 		var container = L.DomUtil.create('div', 'notebookbar-scroll-wrapper', parent);
 
 		builder.build(container, [tabJSON]);
+
+		this.scrollToLastPositionIfNeeded();
 	},
 
 	setTabs: function(tabs) {
@@ -81,8 +86,19 @@ L.Control.Notebookbar = L.Control.extend({
 		builder.build(shortcutsBar, this.getShortcutsBarData());
 	},
 
-	// required, called by builder, not needed in this container
-	setCurrentScrollPosition: function() {},
+	setCurrentScrollPosition: function() {
+		this._currentScrollPosition = $('.notebookbar-scroll-wrapper').scrollLeft();
+	},
+
+	scrollToLastPositionIfNeeded: function() {
+		var rootContainer = $('.notebookbar-scroll-wrapper table').get(0);
+
+		if (this._currentScrollPosition && $(rootContainer).outerWidth() > $(window).width()) {
+			$('.notebookbar-scroll-wrapper').animate({ scrollLeft: this._currentScrollPosition }, 0);
+		} else {
+			$(window).resize();
+		}
+	},
 
 	createScrollButtons: function() {
 		var parent = $('#toolbar-up').get(0);


More information about the Libreoffice-commits mailing list