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

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 13:31:32 UTC 2019


 loleaflet/src/control/Control.LokDialog.js |   29 +++++++++++++++++++++++------
 loleaflet/src/map/Map.js                   |    1 -
 2 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit c90a2ad13ff226655166eb897ca53ab373a6e9f4
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Aug 21 11:17:26 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Oct 4 14:31:10 2019 +0100

    loleaflet: mobile: do not add extra space for the scrollbar
    
    Change-Id: I1b58611ed724e6cd7a0c6c0a93c02e283d0d1672

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 36c9bf708..0eef1dbf1 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -890,7 +890,7 @@ L.Control.LokDialog = L.Control.extend({
 
 	_resizeSidebar: function(strId, width) {
 		this._currentDeck.width = width;
-		if (width > 1) {
+		if (width > 1 && !window.mode.isMobile()) {
 			// Add extra space for scrollbar only when visible
 			width = width + 15;
 		}
commit 4c303f41dd86bbe6bd8484ee7520f740753370c8
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Aug 14 16:32:48 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Oct 4 14:31:10 2019 +0100

    Sidebar: controls without cursor should not pop-up keyboard...
    
    when selected on mobile
    
    In case of the sidebar we need to be careful about
    grabbing the focus from the main window, because the
    sidebar and the main document window are on the same
    screen and so the user can interact with both at the
    same time.
    However on mobile the sidebar takes the whole screen
    so we can grab the focus when the sidebar is visible
    and give back the focus to the main window when the
    sidebar becomes hidden again.
    
    Change-Id: I6a8975b66d77399f99b803c9931fb668c1fd59a7

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 6cc4934e1..36c9bf708 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -397,11 +397,22 @@ L.Control.LokDialog = L.Control.extend({
 		L.DomUtil.addClass(cursor, 'blinking-cursor');
 	},
 
-	focus: function(dlgId, force) {
-		if (!force && (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible))
-			return;
+	focus: function(dlgId) {
+		// In case of the sidebar we should be carefull about
+		// grabbing the focus from the main window.
+		if (this._dialogs[dlgId].isSidebar) {
+			// On mobile, grab the focus if the sidebar is visible.
+			if (window.mode.isMobile()) {
+				if (!this.mobileSidebarVisible)
+					return;
+			// On desktop, grab the focus only when there is a visible cursor on the sidebar.
+			} else if (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible) {
+				return;
+			}
+		}
+
 		this._map.setWinId(dlgId);
-		if (this._isOpen(dlgId) && this._dialogs[dlgId].cursorVisible) {
+		if (this._dialogs[dlgId].cursorVisible) {
 			this._map.getClipboardContainer().focus();
 		}
 		else {
@@ -838,7 +849,7 @@ L.Control.LokDialog = L.Control.extend({
 			var container = L.DomUtil.get(strId);
 			if (container)
 				$(container).parent().show();
-			that.focus(parentId, !isSidebar);
+			that.focus(parentId);
 		};
 		img.src = imgData;
 	},
commit 4e8a9a450e7faa19c066b28fdd561cf3a48fdfad
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Aug 13 14:46:58 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Oct 4 14:31:10 2019 +0100

    Dialogs: controls without cursor should not pop-up keyboard
    
    when selected on mobile
    
    Change-Id: Iee34ad4a878bacea1e11e754b41bf86734796b27

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index b00ff806d..6cc4934e1 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -400,7 +400,13 @@ L.Control.LokDialog = L.Control.extend({
 	focus: function(dlgId, force) {
 		if (!force && (!this._isOpen(dlgId) || !this._dialogs[dlgId].cursorVisible))
 			return;
-		this._dialogs[dlgId].input.focus();
+		this._map.setWinId(dlgId);
+		if (this._isOpen(dlgId) && this._dialogs[dlgId].cursorVisible) {
+			this._map.getClipboardContainer().focus();
+		}
+		else {
+			this._map.getClipboardContainer().blur();
+		}
 	},
 
 	_setCanvasWidthHeight: function(canvas, width, height) {
commit 7e0087882928a601f4eee5188387bd2772857910
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Oct 4 14:17:41 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Oct 4 14:31:10 2019 +0100

    Remove redundant dontBlur.
    
    Change-Id: I3ca8060f6e0ff4494b70b121b97c984aa681e65a

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 366c62453..1b5b78b68 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -895,7 +895,6 @@ L.Map = L.Evented.extend({
 	},
 
 	focus: function () {
-		this._clipboardContainer.dontBlur = true;
 		// Clicking or otherwise focusing the map should focus on the clipboard
 		// container in order for the user to input text (and on-screen keyboards
 		// to pop-up), unless the document is read only.


More information about the Libreoffice-commits mailing list