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