summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2024-05-03 12:44:51 +0200
committerSzymon Kłos <eszkadev@gmail.com>2024-05-05 21:22:55 +0200
commit58e5208027ee58a1ac6c071eb81ac78db4183649 (patch)
treec506fe9718967ea306bd25065a908f5867f0f48f
parentcypress: fix assertion in jsdialog test (diff)
downloadonline-58e5208027ee58a1ac6c071eb81ac78db4183649.tar.gz
online-58e5208027ee58a1ac6c071eb81ac78db4183649.zip
Fix buttons visibility in formulabar on cancelformula
Make code more deterministic by removing old hacks with timeout and cursor detection from: - 6037d52 - b62320c Bug was that on desktop when we were in formula edit mode and we clicked cancel button - it was not showing again the regular buttons but instead it was showing the accept/cancel buttons. Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I1a51920e99f4902c1dbb62b0eab6e4f2edc932ce
-rw-r--r--browser/src/control/Toolbar.js43
1 files changed, 17 insertions, 26 deletions
diff --git a/browser/src/control/Toolbar.js b/browser/src/control/Toolbar.js
index f0438e4484..1aad0f48f0 100644
--- a/browser/src/control/Toolbar.js
+++ b/browser/src/control/Toolbar.js
@@ -1081,36 +1081,27 @@ L.Map.include({
},
onFormulaBarBlur: function() {
- // The timeout is needed because we want 'click' event on 'cancel',
- // 'accept' button to act before we hide these buttons because
- // once hidden, click event won't be processed.
- // TODO: Some better way to do it ?
var map = this;
- setTimeout(() => {
- if ($('.leaflet-cursor').is(':visible'))
- return;
-
- if (window.mode.isMobile() && this.isEditMode()) {
- var mobileTopBar = map.mobileTopBar;
- mobileTopBar.showItem('cancelformula', false);
- mobileTopBar.showItem('acceptformula', false);
- mobileTopBar.showItem('undo', true);
- mobileTopBar.showItem('redo', true);
- } else {
- var jsdialogFormulabar = map.formulabar;
- jsdialogFormulabar.hide('cancelformula');
- jsdialogFormulabar.hide('acceptformula');
- jsdialogFormulabar.show('startformula');
- jsdialogFormulabar.show('AutoSumMenu');
- }
+ if (window.mode.isMobile() && this.isEditMode()) {
+ var mobileTopBar = map.mobileTopBar;
+ mobileTopBar.showItem('cancelformula', false);
+ mobileTopBar.showItem('acceptformula', false);
+ mobileTopBar.showItem('undo', true);
+ mobileTopBar.showItem('redo', true);
+ } else {
+ var jsdialogFormulabar = map.formulabar;
+ jsdialogFormulabar.hide('cancelformula');
+ jsdialogFormulabar.hide('acceptformula');
+ jsdialogFormulabar.show('startformula');
+ jsdialogFormulabar.show('AutoSumMenu');
+ }
- $('#AutoSumMenu-button').css('margin-inline', '0');
- $('#AutoSumMenu .unoarrow').css('margin', '0');
+ $('#AutoSumMenu-button').css('margin-inline', '0');
+ $('#AutoSumMenu .unoarrow').css('margin', '0');
- // clear reference marks
- map._docLayer._clearReferences();
- }, 250);
+ // clear reference marks
+ map._docLayer._clearReferences();
map.formulabar.blurField();
$('#addressInput-input').blur();