chore: deactivate contextmenu and shortcuts in map preview (#2199)

Contextmenu and keyboard shortcuts open controls, which are not fully
initiated when in mode `noControl`, which is the case for preview.
This commit is contained in:
Yohan Boniface 2024-10-07 22:28:30 +02:00 committed by GitHub
commit b7ee50980f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -191,15 +191,17 @@ U.Map = L.Map.extend({
this.renderEditToolbar()
}
this.initShortcuts()
if (!this.options.noControl) this.initCaptionBar()
this.onceDataLoaded(this.setViewFromQueryString)
if (!this.options.noControl) {
this.initShortcuts()
this.initCaptionBar()
this.on('contextmenu', this.onContextMenu)
this.onceDataLoaded(this.setViewFromQueryString)
this.on('click', this.closeInplaceToolbar)
this.propagate()
}
window.onbeforeunload = () => (this.editEnabled && this.isDirty) || null
this.backup()
this.on('click', this.closeInplaceToolbar)
this.on('contextmenu', this.onContextMenu)
this.propagate()
},
initSyncEngine: async function () {
@ -1752,7 +1754,7 @@ U.Map = L.Map.extend({
},
{
label: this.help.displayLabel('SEARCH'),
action: () => this.search(event),
action: () => this.search(),
}
)
if (this.options.urls.routing) {