aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-10 01:39:00 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-10 01:39:00 +0800
commitaaead2d60e4956c3ff7ff7c1401dd58e663ab0ce (patch)
tree8cd6805820bd755add2521cd4f47cb7f692b94ba /src
parente2ae7ac64df88f85fa99947280d156582a986612 (diff)
fix: set config id with snake_case
Diffstat (limited to 'src')
-rw-r--r--src/dumbymap.mjs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 0c7ff02..8203818 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -316,7 +316,7 @@ export const generateMaps = (container, { layouts = [], delay, renderCallback }
316 // Set unique ID for map container 316 // Set unique ID for map container
317 const mapIdList = [] 317 const mapIdList = []
318 const assignMapId = config => { 318 const assignMapId = config => {
319 let mapId = config.id 319 let mapId = config.id.replaceAll('\x20', '_')
320 if (!mapId) { 320 if (!mapId) {
321 mapId = config.use?.split('/')?.at(-1) 321 mapId = config.use?.split('/')?.at(-1)
322 let counter = 1 322 let counter = 1
@@ -324,8 +324,9 @@ export const generateMaps = (container, { layouts = [], delay, renderCallback }
324 mapId = `${config.use ?? 'unnamed'}-${counter}` 324 mapId = `${config.use ?? 'unnamed'}-${counter}`
325 counter++ 325 counter++
326 } 326 }
327 config.id = mapId
328 } 327 }
328
329 config.id = mapId
329 mapIdList.push(mapId) 330 mapIdList.push(mapId)
330 return config 331 return config
331 } 332 }