[Libreoffice-commits] online.git: loleaflet/js

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 11:11:04 UTC 2018


 loleaflet/js/toolbar.js |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 300b883dc04b46bbb4a692ce7145892349318d54
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Dec 19 13:06:16 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Dec 19 13:10:19 2018 +0200

    Make the 'closemobile' button (at left, looks like '<') work in the mobile app
    
    We now have two places, the handler for the 'closemobile' button and
    the handler for the 'closedocument' menu entry, where we have an if
    statement that checks window.ThisIsAMobileApp and if so posts the "BYE"
    message to the webkit message handler in the app. Possibly we could
    move that conditional code into just one place, down into the 'close'
    function in L.Socket instead?
    
    Change-Id: Ib8c6adf621945b266fa4ea5f6d66b0022c2ca373

diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 82fd2eaa1..f20e88ec5 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -290,8 +290,12 @@ function onClick(e, id, item, subItem) {
 		L.toggleFullScreen();
 	}
 	else if (id === 'close' || id === 'closemobile') {
-		map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}});
-		map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
+		if (window.ThisIsAMobileApp) {
+			window.webkit.messageHandlers.lool.postMessage('BYE', '*');
+		} else {
+			map.fire('postMessage', {msgId: 'close', args: {EverModified: map._everModified, Deprecated: true}});
+			map.fire('postMessage', {msgId: 'UI_Close', args: {EverModified: map._everModified}});
+		}
 		map.remove();
 	}
 	else {


More information about the Libreoffice-commits mailing list