From 1df72089568080ee46cde1f9a86a3c31752a2f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Tue, 4 Dec 2018 16:46:45 +0100 Subject: [PATCH] Enable undo & redo after enterEditMode Change-Id: I275f16613eafe74539a8ddd939a8db9979174e6d --- loleaflet/js/toolbar.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js index 7f1d6feac..29dc2491e 100644 --- a/loleaflet/js/toolbar.js +++ b/loleaflet/js/toolbar.js @@ -2095,22 +2095,22 @@ function onUpdatePermission(e) { var toolbar = w2ui['editbar']; // always enabled items - var enabledButtons = ['closemobile']; + var enabledButtons = ['closemobile', 'undo', 'redo']; // copy the first array var items = toolbar.items.slice(); for (var idx in items) { + var found = enabledButtons.filter(function(id) { return id === items[idx].id }); + var alwaysEnable = found.length !== 0; + var unoCmd = map.getDocType() === 'spreadsheet' ? items[idx].unosheet : items[idx].uno; var keepDisabled = map['stateChangeHandler'].getItemValue(unoCmd) === 'disabled'; if (e.perm === 'edit') { - if (!keepDisabled) { + if (!keepDisabled || alwaysEnable) { toolbar.enable(items[idx].id); } - } else { - var item = enabledButtons.filter(function(id) { return id === items[idx].id }); - if (item.length === 0) { - toolbar.disable(items[idx].id); - } + } else if (!alwaysEnable) { + toolbar.disable(items[idx].id); } }