[Libreoffice-commits] online.git: loleaflet/reference.html
Pranav Kant
pranavk at collabora.co.uk
Thu Nov 10 17:08:08 UTC 2016
loleaflet/reference.html | 105 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 82 insertions(+), 23 deletions(-)
New commits:
commit d060b242e8274d194b1a2ccf15d3a9ee39525704
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Nov 10 22:25:31 2016 +0530
More documentation about post message API
Change-Id: I362e159c32d2ea93139be58ca647a2f4c5678dee
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 11ccb80..529728a 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -70,6 +70,7 @@
<h4 style="color:red;">PostMessage API</h4>
<ul>
<li><a href="#loleaflet-postmessage-initialization">Initialization</a></li>
+ <li><a href="#loleaflet-postmessage-query">Query API</a></li>
<li><a href="#loleaflet-postmessage-sessions">Session Management</a></li>
<li><a href="#loleaflet-postmessage-actions">Actions</a></li>
</ul>
@@ -2733,13 +2734,13 @@ The <code>id</code> property of ErrorEvent can have the following values:
<h2 id="loleaflet-postmessage">PostMessage API</h2>
-<p>PostMessage API is used to post messages to outer frame when loleaflet is
- enclosed in a parent frame. This is useful for hosts wanting to
- integrate LibreOffice Online in it.</p>
+<p>PostMessage API is used to interact with parent frame when loleaflet is
+ enclosed in one. This is useful for hosts wanting to
+ integrate LibreOffice Online in them.</p>
<p>This API is mostly based
on <a href="https://wopi.readthedocs.io/en/latest/scenarios/postmessage.html">WOPI
- specification</a> with few additions/modifications. All messages sent are
+ specification</a> with few extensions/modifications. All messages sent are
in this form</p>
<pre><code class="javascript">
@@ -2754,9 +2755,12 @@ The <code>id</code> property of ErrorEvent can have the following values:
SendTime is the timestamp returned by browsers' Date.now()
+<br/><br/>
+Similarly, message received should be in same form.
+
<h3 id="loleaflet-postmessage-initialization">Initialization</h3>
Editor to WOPI host
-<table data-id='postmessage-initialization'>
+<table data-id='postmessage-initialization-from-editor'>
<tr>
<th>MessageId</th>
<th>Values</th>
@@ -2773,10 +2777,30 @@ Editor to WOPI host
ready/loaded.</td>
</tr>
</table>
+WOPI host to editor
+<table data-id='postmessage-initialization-to-editor'>
+ <tr>
+ <th>MessageId</th>
+ <th>Values</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code><b>Host_PostMessageReady</b></code></td>
+ <td><code>
+ </code></td>
+ <td>
+ See WOPI docs for detail.
+ </td>
+ </tr>
+</table>
-<h3 id="loleaflet-postmessage-sessions">Session Management</h3>
+<h3 id="loleaflet-postmessage-query">Query</h3>
+You can query data from the editor using post message API. All responses are
+returned with query's MessageId suffixed with '_Resp' as shown below
+<br/><br/>
+Getters<br/>
WOPI Host to Editor
-<table data-id='postmessage-sessions'>
+<table data-id='postmessage-query-getters'>
<tr>
<th>MessageId</th>
<th>Values</th>
@@ -2790,8 +2814,52 @@ WOPI Host to Editor
Queries the editor for currently active views of the document. Response is returned in form of <code>Get_Views_Resp</code>
</td>
</tr>
+ <tr>
+ <td><code><b>Get_Export_Formats</b></code></td>
+ <td><code>
+ </code></td>
+ <td>
+ Queries the editor for all the supported export formats for currently opened document.
+ </td>
+ </tr>
+
+</table>
+Getters response<br/>
+Editor to WOPI host
+<table data-id='postmessage-query-getters-resp'>
+ <tr>
+ <th>MessageId</th>
+ <th>Values</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td><code><b>Get_Views_Resp</b></code></td>
+ <td><code>
+ <nobr>ViewId: <Number></nobr>
+ <nobr>UserId: <String></nobr>
+ <nobr>UserName: <String></nobr>
+ <nobr>Color: <Number></nobr>
+ </code></td>
+ <td>Give details of all current views when queried using <code>Get_Views</code>
+ </td>
+ </tr>
+ <tr>
+ <td><code><b>Get_Export_Formats_Resp</b></code></td>
+ <td><code>
+ <nobr>Label: <String></nobr>
+ <nobr>Format: <String></nobr>
+ </code></td>
+ <td>
+ Response to query <code>Get_Export_Formats</code>.
+ Label would contain a localised string explaining about the format.
+ Format is the file extension of the format which is required while requesting
+ export of the document.
+ </td>
+ </tr>
+
</table>
+<h3 id="loleaflet-postmessage-sessions">Session Management</h3>
Editor to WOPI Host
<table data-id='postmessage-sessions'>
<tr>
@@ -2821,18 +2889,7 @@ Editor to WOPI Host
<td>View with <code>ViewId</code> has closed the document.
</td>
</tr>
- <tr>
- <td><code><b>Get_Views_Resp</b></code></td>
- <td><code>
- <nobr>ViewId: <Number></nobr>
- <nobr>UserId: <String></nobr>
- <nobr>UserName: <String></nobr>
- <nobr>Color: <Number></nobr>
- </code></td>
- <td>Give details of all current views when queried using <code>Get_Views</code>
- </td>
- </tr>
-</table>
+ </table>
<h3 id="loleaflet-postmessage-actions">Actions</h3>
WOPI host to editor
@@ -2848,11 +2905,12 @@ WOPI host to editor
<nobr>DontTerminateEdit: <boolean></nobr>
<nobr>DontSaveIfUnmodified: <boolean></nobr>
</code></td>
- <td>Saves the document. DontTerminateEdit is relevant for spreadsheets where saving
+ <td>Saves the document.<br/>
+ <code>DontTerminateEdit</code> is relevant for spreadsheets where saving
a document can terminate the edit mode (text cursor dissappearing). Setting this to
true won't terminate the edit mode and can be used to save document without disrupting
- user's editing session in spreadsheets.
- DontSaveIfUnmodified prevents loolwsd to save the file back to storage if document is
+ user's editing session in spreadsheets.<br/>
+ <code>DontSaveIfUnmodified</code> prevents loolwsd to save the file back to storage if document is
unmodified (only cursor position changed etc.) but still saved. This can be helpful
to prevent creating unnecessary file revisions.
</td>
@@ -2871,7 +2929,8 @@ WOPI host to editor
<nobr>Format: <String></nobr>
</code></td>
<td>
- Downloads the document in format specified by <code>Format</code>.
+ Downloads the document in format specified by <code>Format</code>. Format must be from the list returned
+ in <code>Get_Export_Formats</code>
</td>
</tr>
</table>
More information about the Libreoffice-commits
mailing list