[Libreoffice-commits] online.git: 4 commits - loleaflet/html loleaflet/js loleaflet/reference.html loleaflet/src wsd/FileServer.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 29 08:35:27 UTC 2018
loleaflet/html/framed.html | 2 +-
loleaflet/js/toolbar.js | 6 +++---
loleaflet/reference.html | 24 ++++++++++++++++++++++++
loleaflet/src/map/handler/Map.WOPI.js | 23 +++++++++++++++++++++++
wsd/FileServer.cpp | 2 ++
5 files changed, 53 insertions(+), 4 deletions(-)
New commits:
commit c0d0ad736839260667c98aa0cf08feb5630e0b87
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Nov 29 09:32:56 2018 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Nov 29 09:34:37 2018 +0100
Add postMessage methods to show/hide toolbar buttons
Change-Id: Ib5ecde5a53aa0aae2346e360423e72025edade3a
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 75433f9a2..817789373 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -3074,6 +3074,30 @@ WOPI host to editor
is used as text of the menubar item.
</td>
</tr>
+ <tr>
+ <td><code><b>Hide_Button</b></code></td>
+ <td>
+ <code><nobr>id: <string></nobr></code>
+ </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>.
+ </td>
+ </tr>
+ <tr>
+ <td><code><b>Show_Button</b></code></td>
+ <td>
+ <code><nobr>id: <string></nobr></code>
+ </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>.
+ </td>
+ </tr>
</table>
Editor to WOPI host
<table data-id='postmessage-misc-to-host'>
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index 18e86c7c6..b9644fde7 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -183,6 +183,29 @@ L.Map.WOPI = L.Handler.extend({
}
}
}
+ if (msg.MessageId === 'Show_Button' || msg.MessageId === 'Hide_Button') {
+ if (!msg.Values) {
+ console.error('Property "Values" not set');
+ return;
+ }
+ if (!msg.Values.id) {
+ console.error('Property "Values.id" not set');
+ return;
+ }
+ if (this._map._permission !== 'edit') {
+ console.log('No toolbar in readonly mode - ignoring Remove_Button request.');
+ return;
+ }
+ if (!w2ui['toolbar-up'].get(msg.Values.id)) {
+ console.error('Toolbar button with id "' + msg.Values.id + '" not found.');
+ return;
+ }
+ if (msg.MessageId === 'Show_Button') {
+ w2ui['toolbar-up'].show(msg.Values.id);
+ } else {
+ w2ui['toolbar-up'].hide(msg.Values.id);
+ }
+ }
else if (msg.MessageId === 'Set_Settings') {
if (msg.Values) {
var alwaysActive = msg.Values.AlwaysActive;
commit 1d9a9e834abb612bbf7b6828802db64e53036723
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Nov 29 09:16:47 2018 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Nov 29 09:34:37 2018 +0100
Always allow frame embedding in debug mode
Change-Id: I81c434cfd75c0732e8b6aaaba1392059b0637182
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 87f90e556..318a9ff98 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -681,6 +681,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
<< "font-src 'self' data:; "
<< "object-src blob:; ";
+#if !ENABLE_DEBUG // always allow iframe embedding in debug mode
// Frame ancestors: Allow loolwsd host, wopi host and anything configured.
std::string configFrameAncestor = config.getString("net.frame_ancestors", "");
std::string frameAncestors = configFrameAncestor;
@@ -722,6 +723,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
cspOss << "\r\n";
// Append CSP to response headers too
oss << cspOss.str();
+#endif
// Setup HTTP Public key pinning
if ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) && config.getBool("ssl.hpkp[@enable]", false))
commit 40f80ea149189f569d8f07d8b9c56205331f2344
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Nov 29 09:15:39 2018 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Nov 29 09:34:37 2018 +0100
Change url to work in any version
Change-Id: Ie11c91d36d39b3a3ecc8eda01f556d25d3ef847a
diff --git a/loleaflet/html/framed.html b/loleaflet/html/framed.html
index 8b4f324c6..c3f46f39b 100644
--- a/loleaflet/html/framed.html
+++ b/loleaflet/html/framed.html
@@ -204,6 +204,6 @@
the hex string needs to be changed of course, to the right one as
shown by 'make run'. -->
- <iframe src="http://localhost:9980/loleaflet/b766728b5/loleaflet.html?file_path=file:///libreoffice/online/test/data/hello-world.ods&NotWOPIButIframe=true" height="1000" width="1000"></iframe>
+ <iframe src="http://localhost:9980/loleaflet/dist/loleaflet.html?file_path=file:///libreoffice/online/test/data/hello-world.ods&NotWOPIButIframe=true" height="1000" width="1000"></iframe>
</body>
</html>
commit 2e7f67f33b44ccf53096351299ff9fc043f924ef
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Thu Nov 29 08:40:15 2018 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Thu Nov 29 09:34:37 2018 +0100
Show "Insert footnote" toolbar button only in Writer
Change-Id: I542a43b27f8d3beddad4c932a79812b404da63b8
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index eb4be1346..5802f42fa 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -1402,7 +1402,7 @@ function onDocLayerInit() {
switch (docType) {
case 'spreadsheet':
- toolbarUp.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering');
+ toolbarUp.remove('inserttable', 'styles', 'justifypara', 'defaultbullet', 'defaultnumbering', 'break-numbering', 'insertfootnote');
if (!_useSimpleUI()) {
statusbar.insert('left', [
{type: 'break', id:'break1'},
@@ -1474,7 +1474,7 @@ function onDocLayerInit() {
if (!map['wopi'].HideExportOption) {
presentationToolbar.show('presentation', 'presentationbreak');
}
- toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending', 'setborderstyle', 'conditionalformaticonset');
+ toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending', 'setborderstyle', 'conditionalformaticonset', 'insertfootnote');
if (!_useSimpleUI()) {
statusbar.insert('left', [
{type: 'break', id: 'break1'},
@@ -1496,7 +1496,7 @@ function onDocLayerInit() {
break;
case 'drawing':
- toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending', 'setborderstyle', 'conditionalformaticonset');
+ toolbarUp.remove('insertannotation', 'wraptextseparator', 'wraptext', 'togglemergecells', 'break-toggle', 'numberformatcurrency', 'numberformatpercent', 'numberformatdecimal', 'numberformatdate', 'numberformatincdecimals', 'numberformatdecdecimals', 'break-number', 'sortascending', 'sortdescending', 'setborderstyle', 'conditionalformaticonset', 'insertfootnote');
// Remove irrelevant toolbars
$('#formulabar').hide();
More information about the Libreoffice-commits
mailing list