[Libreoffice-commits] online.git: loleaflet/src
mert (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 7 18:29:02 UTC 2020
loleaflet/src/control/Control.Menubar.js | 8 ++++++++
loleaflet/src/control/Control.Toolbar.js | 8 +++++---
loleaflet/src/main.js | 2 +-
3 files changed, 14 insertions(+), 4 deletions(-)
New commits:
commit f634264d89896be25f2853952241afe4e9d4c45c
Author: mert <mert.tumer at collabora.com>
AuthorDate: Wed Mar 25 23:15:10 2020 +0300
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Apr 7 20:28:40 2020 +0200
mobile: Add search in the readonly mode
Change-Id: I059b0337096f9eed21031724dbec22f29807a979
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91072
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index e2396faf5..f7aa69111 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -489,6 +489,7 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Paste'},
{uno: '.uno:SelectAll'}
]},
+ {name: _('Search'), id: 'searchdialog', type: 'action'},
{name: _UNO('.uno:ChangesMenu', 'text'), id: 'changesmenu', type: 'menu', menu: [
{uno: '.uno:TrackChanges'},
{uno: '.uno:ShowTrackedChanges'},
@@ -535,6 +536,7 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Paste'},
{uno: '.uno:SelectAll'}
]},
+ {name: _('Search'), id: 'searchdialog', type: 'action'},
{name: _UNO('.uno:TableMenu', 'text'/*HACK should be 'presentation', but not in xcu*/), id: 'tablemenu', type: 'menu', menu: [
{uno: '.uno:InsertRowsBefore'},
{uno: '.uno:InsertRowsAfter'},
@@ -580,6 +582,7 @@ L.Control.Menubar = L.Control.extend({
{uno: '.uno:Paste'},
{uno: '.uno:SelectAll'}
]},
+ {name: _('Search'), id: 'searchdialog', type: 'action'},
{name: _UNO('.uno:SheetMenu', 'spreadsheet'), id: 'sheetmenu', type: 'menu', menu: [
{name: _UNO('.uno:InsertRowsMenu', 'spreadsheet'), id: 'insertrowsmenu', type: 'menu', menu: [
{uno: '.uno:InsertRowsBefore'},
@@ -1194,6 +1197,11 @@ L.Control.Menubar = L.Control.extend({
}
} else if (id === 'repair') {
this._map._socket.sendMessage('commandvalues command=.uno:DocumentRepair');
+ } else if (id === 'searchdialog') {
+ $('#toolbar-down').hide();
+ $('#toolbar-search').show();
+ $('#mobile-edit-button').hide();
+ L.DomUtil.get('search-input').focus();
}
// Inform the host if asked
if (postmessage)
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 6a61894df..21a434d56 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -186,7 +186,11 @@ function onClick(e, id, item, subItem) {
}
else if (id === 'hidesearchbar') {
$('#toolbar-search').hide();
- $('#toolbar-down').show();
+ if (map._permission === 'edit')
+ $('#toolbar-down').show();
+ /** show edit button if only we are able to edit but in readonly mode */
+ if (window.docPermission === 'edit' && map._permission === 'readonly')
+ $('#mobile-edit-button').show();
}
else if (id === 'searchprev') {
map.search(L.DomUtil.get('search-input').value, true);
@@ -2304,7 +2308,6 @@ function onUpdatePermission(e) {
toolbar.enable(id);
});
}
- $('#search-input').prop('disabled', false);
if (window.mode.isMobile()) {
$('#toolbar-down').show();
@@ -2347,7 +2350,6 @@ function onUpdatePermission(e) {
toolbar.disable(id);
});
}
- $('#search-input').prop('disabled', true);
if (window.mode.isMobile()) {
$('#toolbar-down').hide();
diff --git a/loleaflet/src/main.js b/loleaflet/src/main.js
index 7fdbee43d..5b2799df6 100644
--- a/loleaflet/src/main.js
+++ b/loleaflet/src/main.js
@@ -49,7 +49,6 @@ if (wopiSrc != '') {
}
var notWopiButIframe = getParameterByName('NotWOPIButIframe') != '';
-
var map = L.map('map', {
server: host,
doc: docURL,
@@ -90,6 +89,7 @@ window.addEventListener('beforeunload', function () {
}
});
+window.docPermission = permission;
window.bundlejsLoaded = true;
}(window));
More information about the Libreoffice-commits
mailing list