[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd-4' - loleaflet/js loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 26 15:36:08 UTC 2019
loleaflet/js/toolbar.js | 9 ++++++---
loleaflet/src/control/Control.Menubar.js | 9 ++++++---
loleaflet/src/map/handler/Map.Keyboard.js | 11 +++++++----
3 files changed, 19 insertions(+), 10 deletions(-)
New commits:
commit fb9907d6ba9ef33fb58f60ac7a79fa0e9cacbd12
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Aug 17 11:13:57 2019 -0400
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Aug 26 17:35:50 2019 +0200
leaflet: save only when not read-only
Change-Id: I0cff68d2a2e8354b8c5a6888faa9fa823295c98e
Reviewed-on: https://gerrit.libreoffice.org/77959
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 2fe703d7e..f937d1498 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -137,9 +137,12 @@ function onClick(e, id, item, subItem) {
map.print();
}
else if (id === 'save') {
- map.fire('postMessage', {msgId: 'UI_Save'});
- if (!map._disableDefaultAction['UI_Save']) {
- map.save(false /* An explicit save should terminate cell edit */, false /* An explicit save should save it again */);
+ // Save only when not read-only.
+ if (map._permission !== 'readonly') {
+ map.fire('postMessage', {msgId: 'UI_Save'});
+ if (!map._disableDefaultAction['UI_Save']) {
+ map.save(false /* An explicit save should terminate cell edit */, false /* An explicit save should save it again */);
+ }
}
}
else if (id === 'repair') {
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 3d7dbee1e..0ead78ebe 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -726,9 +726,12 @@ L.Control.Menubar = L.Control.extend({
_executeAction: function(item) {
var id = $(item).data('id');
if (id === 'save') {
- this._map.fire('postMessage', {msgId: 'UI_Save'});
- if (!this._map._disableDefaultAction['UI_Save']) {
- this._map.save(true, true);
+ // Save only when not read-only.
+ if (this._map._permission !== 'readonly') {
+ this._map.fire('postMessage', {msgId: 'UI_Save'});
+ if (!this._map._disableDefaultAction['UI_Save']) {
+ this._map.save(true, true);
+ }
}
} else if (id === 'saveas') {
this._map.fire('postMessage', {msgId: 'UI_SaveAs'});
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 4b71a7605..ab0bec340 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -539,10 +539,13 @@ L.Map.Keyboard = L.Handler.extend({
this._map.print();
return true;
case 83: // s
- this._map.fire('postMessage', {msgId: 'UI_Save'});
- if (!this._map._disableDefaultAction['UI_Save']) {
- this._map.save(false /* An explicit save should terminate cell edit */,
- false /* An explicit save should save it again */);
+ // Save only when not read-only.
+ if (this._map._permission !== 'readonly') {
+ this._map.fire('postMessage', {msgId: 'UI_Save'});
+ if (!this._map._disableDefaultAction['UI_Save']) {
+ this._map.save(false /* An explicit save should terminate cell edit */,
+ false /* An explicit save should save it again */);
+ }
}
return true;
case 86: // v
More information about the Libreoffice-commits
mailing list