mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: fix help module not using umap module
This commit is contained in:
parent
55f04a2f10
commit
491d0515cd
4 changed files with 18 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
|||
import { DomEvent, DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
||||
import { translate } from './i18n.js'
|
||||
import * as Utils from './utils.js'
|
||||
|
||||
const SHORTCUTS = {
|
||||
DRAW_MARKER: {
|
||||
|
@ -163,9 +164,9 @@ const ENTRIES = {
|
|||
}
|
||||
|
||||
export default class Help {
|
||||
constructor(map) {
|
||||
this.map = map
|
||||
this.dialog = new U.Dialog()
|
||||
constructor(umap) {
|
||||
this.umap = umap
|
||||
this.dialog = new U.Dialog({ className: 'dark', accept: false, cancel: false })
|
||||
this.isMacOS = /mac/i.test(
|
||||
// eslint-disable-next-line compat/compat -- Fallback available.
|
||||
navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform
|
||||
|
@ -199,7 +200,7 @@ export default class Help {
|
|||
innerHTML: ENTRIES[name],
|
||||
})
|
||||
}
|
||||
this.dialog.open({ template: container, className: 'dark', cancel: false, accept: false })
|
||||
this.dialog.open({ template: container })
|
||||
}
|
||||
|
||||
// Special dynamic case. Do we still think this dialog is useful?
|
||||
|
@ -211,7 +212,7 @@ export default class Help {
|
|||
className: 'umap-help-entry',
|
||||
parent: container,
|
||||
}).appendChild(this._buildEditEntry())
|
||||
this.map.dialog.open({ content: container, className: 'dark' })
|
||||
this.dialog.open({ template: container })
|
||||
}
|
||||
|
||||
button(container, entries) {
|
||||
|
@ -247,9 +248,11 @@ export default class Help {
|
|||
DomEvent.on(actionContainer, 'click', action.addHooks, action)
|
||||
DomEvent.on(actionContainer, 'click', this.dialog.close, this.dialog)
|
||||
}
|
||||
for (const id in this.map.helpMenuActions) {
|
||||
addAction(this.map.helpMenuActions[id])
|
||||
for (const action of Object.values(Help.MENU_ACTIONS)) {
|
||||
addAction(action)
|
||||
}
|
||||
return container
|
||||
}
|
||||
}
|
||||
|
||||
Help.MENU_ACTIONS = {}
|
||||
|
|
|
@ -36,7 +36,6 @@ const ControlsMixin = {
|
|||
],
|
||||
|
||||
initControls: function () {
|
||||
this.helpMenuActions = {}
|
||||
this._controls = {}
|
||||
|
||||
if (this.umap.hasEditMode() && !this.options.noControl) {
|
||||
|
|
|
@ -523,7 +523,7 @@ export default class Umap extends ServerStored {
|
|||
this._leafletMap.importer.openFiles()
|
||||
break
|
||||
case 'h':
|
||||
this.help.show('edit')
|
||||
this.help.showGetStarted()
|
||||
break
|
||||
default:
|
||||
used = false
|
||||
|
@ -1203,7 +1203,7 @@ export default class Umap extends ServerStored {
|
|||
this.editPanel.close()
|
||||
this.fullPanel.close()
|
||||
this.sync.stop()
|
||||
this.closeInplaceToolbar()
|
||||
this._leafletMap.closeInplaceToolbar()
|
||||
}
|
||||
|
||||
askForReset(e) {
|
||||
|
|
|
@ -12,8 +12,8 @@ U.BaseAction = L.ToolbarAction.extend({
|
|||
tooltip: this.options.tooltip,
|
||||
}
|
||||
L.ToolbarAction.prototype.initialize.call(this)
|
||||
if (this.options.helpMenu && !this.map.helpMenuActions[this.options.className])
|
||||
this.map.helpMenuActions[this.options.className] = this
|
||||
if (this.options.helpMenu && !U.Help.MENU_ACTIONS[this.options.className])
|
||||
U.Help.MENU_ACTIONS[this.options.className] = this
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -675,7 +675,10 @@ U.TileLayerChooser = L.Control.extend({
|
|||
const el = L.DomUtil.create('li', selectedClass, this._tilelayers_container)
|
||||
const img = L.DomUtil.create('img', '', el)
|
||||
const name = L.DomUtil.create('div', '', el)
|
||||
img.src = U.Utils.template(tilelayer.options.url_template, this.map.options.demoTileInfos)
|
||||
img.src = U.Utils.template(
|
||||
tilelayer.options.url_template,
|
||||
this.map.options.demoTileInfos
|
||||
)
|
||||
img.loading = 'lazy'
|
||||
name.textContent = tilelayer.options.name
|
||||
L.DomEvent.on(
|
||||
|
|
Loading…
Reference in a new issue