close AutoFill popup on tab change

close AutoFill popup when
- sheet tab is clicked
- new sheet is inserted
- sheet tab is switched using Ctrl+Alt+PageUp/PageDown
keyboard shortcuts

Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com>
Change-Id: I03711d202b47813d101bd066db1a3e8e106430e3
pull/9039/head
Bayram Çiçek 2024-05-14 13:49:29 +03:00
parent 91f080976f
commit 8529063378
7 changed files with 17 additions and 7 deletions

View File

@ -21,7 +21,6 @@ class AutoFillOptions extends L.Control.AutoCompletePopup {
users: any;
itemList: Array<any>;
data: MessageEvent<any>;
autoFillPopupPoint: Point;
constructor(map: ReturnType<typeof L.map>) {
super('autoFillPopup', map);
@ -30,7 +29,7 @@ class AutoFillOptions extends L.Control.AutoCompletePopup {
onAdd() {
this.newPopupData.isAutoCompletePopup = true;
this.map.on('openautofillpopup', this.openAutoFillPopup, this);
this.map.on('closementionpopup', this.closeMentionPopup, this);
this.map.on('closeautofillpopup', this.closeMentionPopup, this);
this.map.on('sendautofilllocation', this.sendAutoFillLocation, this);
this.firstChar = null;
this.users = null;
@ -76,20 +75,20 @@ class AutoFillOptions extends L.Control.AutoCompletePopup {
data.posx = framePos.x;
data.posy = framePos.y;
this.sendJSON(data);
this.map._docLayer.isAutoFillPopupOpen = true;
}
closeMentionPopup(ev: CloseMessageEvent) {
// console.error('close closeMentionPopup');
super.closePopup();
if (!ev.typingMention) {
this.map._docLayer._typingMention = false;
this.map._docLayer._mentionText = [];
}
this.map._docLayer.isAutoFillPopupOpen = false;
}
callback(objectType: any, eventType: any, object: any, index: number) {
// console.error("eventType: " + eventType);
if (eventType === 'close') {
// console.error('close callback');
this.closeMentionPopup({ typingMention: false } as CloseMessageEvent);

View File

@ -602,7 +602,8 @@ L.Control.JSDialog = L.Control.extend({
var dialog = this.dialogs[autoFilterDialogId];
// Check if the current dialog has the isAutofilter property set to true
if (dialog.isAutofilter) {
// and if it is not an autoFillPopup
if (dialog.isAutofilter && (autoFilterDialogId !== 'autoFillPopup')) {
// Call this.close(key, true) for the current dialog
this.close(autoFilterDialogId, true);
}

View File

@ -69,6 +69,9 @@ L.Control.SheetsBar = L.Control.extend({
}
if (id === 'insertsheet') {
if (this.map._docLayer.isAutoFillPopupOpen)
this._map.fire('closeautofillpopup');
var nPos = $('#spreadsheet-tab-scroll')[0].childElementCount;
this.map.insertPage(nPos);
this.map.insertPage.scrollToEnd = true;

View File

@ -334,6 +334,9 @@ L.Control.Tabs = L.Control.extend({
if (part !== this._map._docLayer._selectedPart) {
this._setPartIndex(part);
}
if (this._map._docLayer.isAutoFillPopupOpen)
this._map.fire('closeautofillpopup');
},
//selected sheet is moved to new index

View File

@ -208,7 +208,6 @@ class AutoFillMarkerSection extends CanvasSectionObject {
this.sectionProperties.docLayer._postMouseEvent('buttonup', pos.x, pos.y, 1, 1, 0);
}
// console.error("--- MOUSE UP");
this.map._docLayer.isFromAutoFill = true;
this.map.scrollingIsHandled = false;

View File

@ -93,6 +93,7 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({
this.insertMode = false;
this.isFromAutoFill = false;
this.isAutoFillPopupOpen = false;
this._resetInternalState();
this._sheetSwitch = new L.SheetSwitchViewRestore(map);
},

View File

@ -914,6 +914,10 @@ L.Map.Keyboard = L.Handler.extend({
else {
partToSelect = currentSelectedPart != 0 ? currentSelectedPart - 1 : parts - 1;
}
if (this._map._docLayer.isAutoFillPopupOpen)
this._map.fire('closeautofillpopup');
this._map.setPart(parseInt(partToSelect), /*external:*/ false, /*calledFromSetPartHandler:*/ true);
return;
}