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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed May 22 13:55:02 UTC 2019


 loleaflet/reference.html              |   13 +++++++++----
 loleaflet/src/map/handler/Map.WOPI.js |    4 +++-
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 575eb438711fd9527d53d95abb1e4439313df46e
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed May 22 13:12:39 2019 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed May 22 15:54:44 2019 +0200

    Insert_Button: Add parameter to specify a uno command
    
    Change-Id: Ibdb1ad1b25df38c12ab71386a5ab8fb92d3076d0
    Reviewed-on: https://gerrit.libreoffice.org/72758
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index d6d7732f7..b7a4941a7 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -3096,12 +3096,14 @@ Editor to WOPI host
 		    <nobr>mobile: <boolean></nobr><br/>
 		    <nobr>label: <string></nobr><br/>
 		    <nobr>insertBefore: <string></nobr><br/>
+		    <nobr>unoCommand: <string></nobr><br/>
 		</code></td>
 		<td>
-		  Inserts the button to the left of the top toolbar. Only thing
-		  that it does is response to click events based on which hosts
-		  can act accordingly. It responds
-		  with <code>Clicked_Button</code> post message event.<br/>
+		  Inserts a button to the top toolbar.
+
+		  It responds with <code>Clicked_Button</code> post message event
+		  on which hosts can react accordingly
+		  (except when the <code>unoCommand</code> property is set).<br/>
 		  <code>id</code> parameter is a unique id of the toolbar
 		  button. It is recommended to prefix such ids given here with
 		  some host namespace so that it doesn't conflict with existing
@@ -3121,6 +3123,9 @@ Editor to WOPI host
 		  <code>insertBefore</code> Specify the position where the button
 		  should be inserted.
 		  <code>insertBefore</code> is the button ID (see <a href="#toolbar-button-ids">Finding toolbar button IDs</a>).
+		  <code>unoCommand</code> UNO Command to be executed on button click
+		  (<a href="https://wiki.documentfoundation.org/Development/DispatchCommands">Reference</a>). When this property
+		  is set, no 'Clicked_Button' response is sent. The button click will be handled by LibreOffice.
 		</td>
 	</tr>
 	<tr>
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index a09087d5b..4975fb691 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -175,10 +175,12 @@ L.Map.WOPI = L.Handler.extend({
 						w2ui['editbar'].insert(insertBefore, [
 							{
 								type: 'button',
+								uno: msg.Values.unoCommand,
 								id: msg.Values.id,
 								img: msg.Values.id,
 								hint: _(msg.Values.hint), /* "Try" to localize ! */
-								postmessage: true /* Notify the host back when button is clicked */
+								/* Notify the host back when button is clicked (only when unoCommand is not set) */
+								postmessage: !msg.Values.hasOwnProperty('unoCommand')
 							}
 						]);
 						if (msg.Values.mobile)


More information about the Libreoffice-commits mailing list