[Libreoffice-commits] online.git: 2 commits - loleaflet/reference.html loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon May 20 07:59:33 UTC 2019
loleaflet/reference.html | 28 +++++++++++++++++-----------
loleaflet/src/map/handler/Map.WOPI.js | 6 ++++--
2 files changed, 21 insertions(+), 13 deletions(-)
New commits:
commit 433f66ca8be87c18e08d1e5f91193b79c3a62d4b
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri May 17 09:11:30 2019 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon May 20 09:59:23 2019 +0200
Improve formatting: Add some linebreaks
Change-Id: I1e7fde64d84690cf8cb3e16d4ddd0baba3917151
Reviewed-on: https://gerrit.libreoffice.org/72447
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 ac7eb14cf..48aa18ca8 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -3091,11 +3091,11 @@ WOPI host to editor
<td><code><b>Insert_Button</b></code></td>
<td><code>
<nobr>id: <string></nobr><br/>
- <nobr>imgurl: <string></nobr>
- <nobr>hint: <string></nobr>
- <nobr>mobile: <boolean></nobr>
- <nobr>label: <string></nobr>
- <nobr>insertBefore: <string></nobr>
+ <nobr>imgurl: <string></nobr><br/>
+ <nobr>hint: <string></nobr><br/>
+ <nobr>mobile: <boolean></nobr><br/>
+ <nobr>label: <string></nobr><br/>
+ <nobr>insertBefore: <string></nobr><br/>
</code></td>
<td>
Inserts the button to the left of the top toolbar. Only thing
commit e45f7998dcf642a2139991ae42053ffc38225b2e
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri May 17 09:08:38 2019 +0200
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon May 20 09:59:13 2019 +0200
Insert_Button: Add parameter to specify insert position
Change-Id: I362f4c67506c1e98c47d7bd55127ded63758c334
Reviewed-on: https://gerrit.libreoffice.org/72446
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 e08bfa453..ac7eb14cf 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -3095,6 +3095,7 @@ WOPI host to editor
<nobr>hint: <string></nobr>
<nobr>mobile: <boolean></nobr>
<nobr>label: <string></nobr>
+ <nobr>insertBefore: <string></nobr>
</code></td>
<td>
Inserts the button to the left of the top toolbar. Only thing
@@ -3116,7 +3117,10 @@ WOPI host to editor
<code>label</code> When a readonly document is opened, we
don't have the toolbar at all. In this case, this newly added
button is present in file menubar. The text against this label
- is used as text of the menubar item.
+ is used as text of the menubar item.<br/>
+ <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>).
</td>
</tr>
<tr>
@@ -3126,9 +3130,7 @@ WOPI host to editor
</td>
<td>
Hides a button from the toolbar.<br/>
- <code>id</code> is the button ID as defined in the
- <a href="https://opengrok.libreoffice.org/search?project=online&q=&defs=createToolbar">createToolbar</a>
- function in <a href="https://opengrok.libreoffice.org/xref/online/loleaflet/js/toolbar.js">loleaflet/js/toolbar.js</a>.
+ <code>id</code> is the button ID (see <a href="#toolbar-button-ids">Finding toolbar button IDs</a>).
</td>
</tr>
<tr>
@@ -3138,9 +3140,7 @@ WOPI host to editor
</td>
<td>
Hides a button from the toolbar.<br/>
- <code>id</code> is the button ID as defined in the
- <a href="https://opengrok.libreoffice.org/search?project=online&q=&defs=createToolbar">createToolbar</a>
- function in <a href="https://opengrok.libreoffice.org/xref/online/loleaflet/js/toolbar.js">loleaflet/js/toolbar.js</a>.
+ <code>id</code> is the button ID (see <a href="#toolbar-button-ids">Finding toolbar button IDs</a>).
</td>
</tr>
<tr>
@@ -3158,6 +3158,12 @@ WOPI host to editor
</td>
</tr>
</table>
+
+<h5><a name="toolbar-button-ids">Finding toolbar button IDs</a></h5>
+<p>Toolbar button IDs are defined in the <a href="https://opengrok.libreoffice.org/search?project=online&q=&defs=createToolbar">createToolbar</a>
+function in <a href="https://opengrok.libreoffice.org/xref/online/loleaflet/js/toolbar.js">loleaflet/js/toolbar.js</a>.
+Note that they usually don't change but there is no guarantee that they are stable.</p>
+
Editor to WOPI host
<table data-id='postmessage-misc-to-host'>
<tr>
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index 57f41b31f..a09087d5b 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -169,8 +169,10 @@ L.Map.WOPI = L.Handler.extend({
$('html > head').append('<style/>');
$('html > head > style').append('.w2ui-icon.' + msg.Values.id + '{background: url(' + msg.Values.imgurl + ') no-repeat center !important; }');
+ // Position: Either specified by the caller, or defaulting to first position (before save)
+ var insertBefore = msg.Values.insertBefore || 'save';
// add the item to the toolbar
- w2ui['editbar'].insert('save', [
+ w2ui['editbar'].insert(insertBefore, [
{
type: 'button',
id: msg.Values.id,
@@ -184,7 +186,7 @@ L.Map.WOPI = L.Handler.extend({
// Add to our list of items to preserve when in mobile mode
// FIXME: Wrap the toolbar in a class so that we don't make use
// global variables and functions like this
- var idx = toolbarUpMobileItems.indexOf('save');
+ var idx = toolbarUpMobileItems.indexOf(insertBefore);
toolbarUpMobileItems.splice(idx, 0, msg.Values.id);
}
}
More information about the Libreoffice-commits
mailing list