jsdialog: when we enter readonly mode close dialogs

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I01aaf1b4bf0e0071db439e6ebf65eae49e3b29bb
pull/7195/head
Szymon Kłos 2023-08-29 12:41:39 +02:00 committed by Szymon Kłos
parent 049f8b16cc
commit 2593713fe6
2 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,7 @@ L.Control.JSDialog = L.Control.extend({
this.map.on('jsdialogupdate', this.onJSUpdate, this);
this.map.on('jsdialogaction', this.onJSAction, this);
this.map.on('zoomend', this.onZoomEnd, this);
this.map.on('closealldialogs', this.onCloseAll, this);
},
onRemove: function() {
@ -25,6 +26,7 @@ L.Control.JSDialog = L.Control.extend({
this.map.off('jsdialogupdate', this.onJSUpdate, this);
this.map.off('jsdialogaction', this.onJSAction, this);
this.map.off('zoomend', this.onZoomEnd, this);
this.map.off('closealldialogs', this.onCloseAll, this);
},
hasDialogOpened: function() {
@ -58,10 +60,14 @@ L.Control.JSDialog = L.Control.extend({
}
},
closeAll: function() {
closeAll: function(leaveSnackbar) {
var dialogs = Object.keys(this.dialogs);
for (var i = 0; i < dialogs.length; i++)
for (var i = 0; i < dialogs.length; i++) {
if (leaveSnackbar && dialogs[i] && dialogs[i].isSnackbar)
continue;
this.close(dialogs[i], true);
}
},
closeDialog: function(id, sendCloseEvent) {
@ -112,6 +118,10 @@ L.Control.JSDialog = L.Control.extend({
this.focusToLastElement(id);
},
onCloseAll: function() {
this.closeAll(/*leaveSnackbar*/ true);
},
focusToLastElement: function(id) {
try {
this.dialogs[id].lastFocusedElement.focus();

View File

@ -227,6 +227,7 @@ L.Map.include({
}
this.fire('updatepermission', {perm : perm});
this.fire('closemobilewizard');
this.fire('closealldialogs');
if (window.ThisIsTheAndroidApp)
window.postMobileMessage('EDITMODE off');