diff options
Diffstat (limited to 'src/editor.mjs')
-rw-r--r-- | src/editor.mjs | 16 |
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 @@ | |||
2 | import { markdown2HTML, generateMaps } from './dumbymap' | 2 | import { markdown2HTML, generateMaps } from './dumbymap' |
3 | import { defaultAliases, parseConfigsFromYaml } from 'mapclay' | 3 | import { defaultAliases, parseConfigsFromYaml } from 'mapclay' |
4 | import * as menuItem from './MenuItem' | 4 | import * as menuItem from './MenuItem' |
5 | import { addAnchorByPoint } from './dumbyUtils.mjs' | 5 | import { addMarkerByPoint } from './dumbyUtils.mjs' |
6 | import { shiftByWindow } from './utils.mjs' | 6 | import { shiftByWindow } from './utils.mjs' |
7 | import * as tutorial from './tutorial' | 7 | import * 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 | }) |