[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd-4' - 2 commits - loleaflet/html loleaflet/reference.html loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 17 11:29:10 UTC 2019
loleaflet/html/framed.doc.html | 38 +++++++++++++++++++++++++++++++++-
loleaflet/reference.html | 8 +++++++
loleaflet/src/map/handler/Map.WOPI.js | 3 ++
3 files changed, 48 insertions(+), 1 deletion(-)
New commits:
commit 08d72efe37f36aad64eccff807972e49c9b13911
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jun 15 20:58:49 2019 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 17 13:29:00 2019 +0200
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 at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/html/framed.doc.html b/loleaflet/html/framed.doc.html
index 2b1cf3374..28fb465c8 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, }
@@ -103,7 +109,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 8350a9fe9..dc8e69480 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -2955,6 +2955,14 @@ WOPI host to editor
</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 42a84aa7d..b51d87c2d 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -272,6 +272,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();
}
commit 439eb0b98bbedaf8ea2cf016bd2c3bae5c56a2cd
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jun 15 20:56:28 2019 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 17 13:28:51 2019 +0200
leaflet: show/hide commands demo
This demonstrates the use of show and hide
functionality via Show/Hide_Button and
Show/Hide_Menu_Item postMessage events.
Save and Print buttons and menu items are
controlled in the demo.
Change-Id: I81dfea816765da50a1c20699b460765ae35f60a6
Reviewed-on: https://gerrit.libreoffice.org/74130
Reviewed-by: Andras Timar <andras.timar at collabora.com>
Tested-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/html/framed.doc.html b/loleaflet/html/framed.doc.html
index 894bc1c8f..2b1cf3374 100644
--- a/loleaflet/html/framed.doc.html
+++ b/loleaflet/html/framed.doc.html
@@ -46,6 +46,30 @@
});
}
+ function save() {
+ post({'MessageId': 'Action_Save',
+ 'Values': { 'Notify': true, }
+ });
+ }
+
+ function hide_commands(id) {
+ post({'MessageId': 'Hide_Menu_Item',
+ 'Values': { 'id': id, }
+ });
+ post({'MessageId': 'Hide_Button',
+ 'Values': { 'id': id, }
+ });
+ }
+
+ function show_commands(id) {
+ post({'MessageId': 'Show_Menu_Item',
+ 'Values': { 'id': id, }
+ });
+ post({'MessageId': 'Show_Button',
+ 'Values': { 'id': id, }
+ });
+ }
+
// This function is invoked when the iframe posts a message back.
function receiveMessage(event) {
@@ -78,7 +102,12 @@
</form>
<form id="insert-text-form">
- Click <button onclick="capitalize(); return false;">here</button> to capitalize selected text in the document:
+ 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="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>
+ <button onclick="show_commands('print'); return false;">Show Print Commands</button></br></br>
</form>
<!-- The hostname and pathnames below are obviously specific to my
More information about the Libreoffice-commits
mailing list