aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/editor.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor.mjs')
-rw-r--r--src/editor.mjs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/editor.mjs b/src/editor.mjs
index e2d3d6d..c258c3d 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -2,7 +2,7 @@
2import { markdown2HTML, generateMaps } from './dumbymap' 2import { markdown2HTML, generateMaps } from './dumbymap'
3import { defaultAliases, parseConfigsFromYaml } from 'mapclay' 3import { defaultAliases, parseConfigsFromYaml } from 'mapclay'
4import * as menuItem from './MenuItem' 4import * as menuItem from './MenuItem'
5import { addAnchorByPoint } from './dumbyUtils.mjs' 5import { addMarkerByPoint } from './dumbyUtils.mjs'
6import { shiftByWindow } from './utils.mjs' 6import { shiftByWindow } from './utils.mjs'
7import * as tutorial from './tutorial' 7import * as tutorial from './tutorial'
8 8
@@ -463,8 +463,18 @@ const menuForEditor = (event, menu) => {
463 if (map) { 463 if (map) {
464 const item = new menuItem.Item({ 464 const item = new menuItem.Item({
465 text: 'Add Anchor', 465 text: 'Add Anchor',
466 onclick: (event) => { 466 onclick: () => {
467 const refLink = addAnchorByPoint({ point: event, map, validateAnchorName }) 467 let anchorName
468 do {
469 anchorName = window.prompt(anchorName ? 'Name exists' : 'Name of Anchor')
470 } while (refLinks.find(ref => ref === anchorName))
471 if (anchorName === null) return
472
473 const marker = addMarkerByPoint({ point: [event.clientX, event.clientY], map })
474 const refLink = {
475 ref: anchorName,
476 link: `geo:${marker.dataset.xy.split(',').reverse()}`,
477 }
468 appendRefLink(cm, refLink) 478 appendRefLink(cm, refLink)
469 }, 479 },
470 }) 480 })