diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-06-15 20:58:49 -0400 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-09-03 01:53:12 -0400 |
commit | 0852f62f5650f6c07e6fbd90040bf5b9176e6cb3 (patch) | |
tree | cb5db678504c87183c0fae2ef60d743857ec9a72 | |
parent | 89ae4278e849cd950f7df984e69715649dc724fb (diff) |
leaflet: support Action_Close
This allows for clients to issue a document
close programmatically, which is useful when they
have custom buttons or commands, or external
events/triggers, that might result in cleanly
closing the document.
A demo of how to use it is included in framed.doc.html.
Change-Id: Ib889bb01bbcaaa91fd0f341c989aeb1a6fceec28
Reviewed-on: https://gerrit.libreoffice.org/74131
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r-- | loleaflet/html/framed.doc.html | 9 | ||||
-rw-r--r-- | loleaflet/reference.html | 8 | ||||
-rw-r--r-- | loleaflet/src/map/handler/Map.WOPI.js | 3 |
3 files changed, 19 insertions, 1 deletions
diff --git a/loleaflet/html/framed.doc.html b/loleaflet/html/framed.doc.html index 93c606cdc..5501d5df6 100644 --- a/loleaflet/html/framed.doc.html +++ b/loleaflet/html/framed.doc.html @@ -52,6 +52,12 @@ }); } + function closeDocument() { + post({'MessageId': 'Action_Close', + 'Values': null + }); + } + function hide_commands(id) { post({'MessageId': 'Hide_Menu_Item', 'Values': { 'id': id, } @@ -97,7 +103,8 @@ <form id="insert-text-form"> Click <button onclick="capitalize(); return false;">here</button> to capitalize selected text in the document.</br></br> - <button onclick="save(); return false;">Save</button></br></br> + <button onclick="save(); return false;">Save</button> + <button onclick="closeDocument(); return false;">Close</button></br></br> <button onclick="hide_commands('save'); return false;">Hide Save Commands</button> <button onclick="show_commands('save'); return false;">Show Save Commands</button></br> <button onclick="hide_commands('print'); return false;">Hide Print Commands</button> diff --git a/loleaflet/reference.html b/loleaflet/reference.html index 686c2854b..e6a0b448f 100644 --- a/loleaflet/reference.html +++ b/loleaflet/reference.html @@ -2973,6 +2973,14 @@ Editor to WOPI host </td> </tr> <tr> + <td><code><b>Action_Close</b></code></td> + <td><code> + </code></td> + <td> + Closes the document. + </td> + </tr> + <tr> <td><code><b>Action_Print</b></code></td> <td><code> </code></td> diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js index e8c591b9f..7cc9f7241 100644 --- a/loleaflet/src/map/handler/Map.WOPI.js +++ b/loleaflet/src/map/handler/Map.WOPI.js @@ -313,6 +313,9 @@ L.Map.WOPI = L.Handler.extend({ this._map.save(dontTerminateEdit, dontSaveIfUnmodified); } + else if (msg.MessageId === 'Action_Close') { + this._map.remove(); + } else if (msg.MessageId === 'Action_Print') { this._map.print(); } |