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

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 11:59:17 UTC 2019


 loleaflet/src/control/Control.Menubar.js |    6 +++++-
 loleaflet/src/control/Toolbar.js         |   10 ++++++++++
 loleaflet/src/map/Clipboard.js           |    3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 10b8f77099e3c0331d4f3469dd39c6579c070b36
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Wed Nov 27 12:58:50 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Nov 27 12:58:50 2019 +0100

    Use special Mac key names on Mac clients
    
    Change-Id: I6f1431cce44dd95c716cee6a3e01e71c491ac74b

diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 3745141c1..1d87d77c1 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -1129,8 +1129,12 @@ L.Control.Menubar = L.Control.extend({
 			this._map._socket.sendMessage('commandvalues command=.uno:DocumentRepair');
 		} else if (!window.ThisIsAMobileApp && id === 'warn-copy-paste') {
 			var self = this;
+			var msg = _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>');
+			if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) {
+				msg = msg.replace(/Ctrl/g, '⌘');
+			}
 			vex.dialog.alert({
-				unsafeMessage: _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>'),
+				unsafeMessage: msg,
 				callback: function () {
 					self._map.focus();
 				}
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 45770d65e..be8e8dbcf 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -309,6 +309,16 @@ L.Map.include({
 						}
 					}
 
+					// Special Mac key names
+					if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) {
+						if (id === 'keyboard-shortcuts') {
+							document.getElementById('keyboard-shortcuts').innerHTML = document.getElementById('keyboard-shortcuts').innerHTML.replace(/Ctrl/g, '⌘').replace(/Alt/g, '⌥');
+						}
+						if (id === 'online-help') {
+							document.getElementById('online-help').innerHTML = document.getElementById('online-help').innerHTML.replace(/Ctrl/g, '⌘').replace(/Alt/g, '⌥');
+						}
+					}
+
 					$vexContent.attr('tabindex', -1);
 					$vexContent.focus();
 					// workaround for https://github.com/HubSpot/vex/issues/43
diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index 9dad436ba..1acfff606 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -749,6 +749,9 @@ L.Clipboard = L.Class.extend({
 			msg = _('<p>Please use the copy/paste buttons on your on-screen keyboard.</p>');
 		} else {
 			msg = _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>');
+			if (navigator.appVersion.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Mac') != -1) {
+				msg = msg.replace(/Ctrl/g, '⌘');
+			}
 		}
 		vex.dialog.alert({
 			unsafeMessage: msg,


More information about the Libreoffice-commits mailing list