[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - kit/ChildSession.cpp loleaflet/css loleaflet/src

gokaysatir (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 28 10:43:51 UTC 2020


 kit/ChildSession.cpp                  |    3 +++
 loleaflet/css/leaflet.css             |   22 ++++++++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js |   31 +++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)

New commits:
commit 2dcaf64c454644b2294711df588d4498123a8fc0
Author:     gokaysatir <gokaysatir at collabora.com>
AuthorDate: Tue Sep 15 17:10:15 2020 +0300
Commit:     Gökay ŞATIR <gokaysatir at collabora.com>
CommitDate: Mon Sep 28 12:43:31 2020 +0200

    Online: Show input help on Online / Online part.
    
    Change-Id: Ida8c5e8baccf87dae68c1c6d8f5302b1288741e7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102747
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103522
    Reviewed-by: Gökay ŞATIR <gokaysatir at collabora.com>

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 5c7df7272..359fe4644 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2598,6 +2598,9 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
     case LOK_CALLBACK_VALIDITY_LIST_BUTTON:
         sendTextFrame("validitylistbutton: " + payload);
         break;
+    case LOK_CALLBACK_VALIDITY_INPUT_HELP:
+        sendTextFrame("validityinputhelp: " + payload);
+        break;
     case LOK_CALLBACK_CLIPBOARD_CHANGED:
     {
         std::string selection;
diff --git a/loleaflet/css/leaflet.css b/loleaflet/css/leaflet.css
index 55f47bc1c..3a754d86f 100644
--- a/loleaflet/css/leaflet.css
+++ b/loleaflet/css/leaflet.css
@@ -993,3 +993,25 @@ input.clipboard {
 	top: 24px;
 	color: white;
 	}
+
+.input-help {
+	border-radius: 15px;
+	padding: 5px;
+	box-sizing: content-box;
+	border: 1px solid black;
+	color: black;
+	background-color: wheat;
+	min-width: 200px;
+	text-align: center;
+	}
+
+.input-help > h4 {
+	display: block;
+	font-weight: 900;
+}
+
+.input-help > p {
+	display: block;
+	text-indent: 20px;
+	text-align: justify;
+}
\ No newline at end of file
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index c178bdb34..7f7d33c1b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -712,6 +712,9 @@ L.TileLayer = L.GridLayer.extend({
 		else if (textMsg.startsWith('validitylistbutton:')) {
 			this._onValidityListButtonMsg(textMsg);
 		}
+		else if (textMsg.startsWith('validityinputhelp:')) {
+			this._onValidityInputHelpMsg(textMsg);
+		}
 		else if (textMsg.startsWith('signaturestatus:')) {
 			var signstatus = textMsg.substring('signaturestatus:'.length + 1);
 			this._map.onChangeSignStatus(signstatus);
@@ -1188,6 +1191,16 @@ L.TileLayer = L.GridLayer.extend({
 		}
 
 		this._onUpdateCellCursor(horizontalDirection, verticalDirection, onPgUpDn);
+
+		// Remove input help if there is any:
+		this._removeInputHelpMarker();
+	},
+
+	_removeInputHelpMarker: function() {
+		if (this._inputHelpPopUp) {
+			this._map.removeLayer(this._inputHelpPopUp);
+			this._inputHelpPopUp = null;
+		}
 	},
 
 	_onDocumentRepair: function (textMsg) {
@@ -3095,6 +3108,24 @@ L.TileLayer = L.GridLayer.extend({
 		}
 	},
 
+	_onValidityInputHelpMsg: function(textMsg) {
+		var message = textMsg.replace('validityinputhelp: ', '');
+		message = JSON.parse(message);
+
+		var icon = L.divIcon({
+			html: '<div class="input-help"><h4 id="input-help-title"></h4><p id="input-help-content"></p></div>',
+			iconSize: [0, 0],
+			iconAnchor: [0, 0]
+		});
+
+		this._removeInputHelpMarker();
+		var inputHelpMarker = L.marker(this._cellCursor.getNorthEast(), { icon: icon });
+		inputHelpMarker.addTo(this._map);
+		document.getElementById('input-help-title').innerText = message.title;
+		document.getElementById('input-help-content').innerText = message.content;
+		this._inputHelpPopUp = inputHelpMarker;
+	},
+
 	_addDropDownMarker: function () {
 		if (this._validatedCellXY && this._cellCursorXY && this._validatedCellXY.equals(this._cellCursorXY)) {
 			var pos = this._cellCursor.getNorthEast();


More information about the Libreoffice-commits mailing list