aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/editor.mjs
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-07 17:43:16 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-08 10:28:47 +0800
commit31106909f6075a139e481df5d929fee3dedfbabf (patch)
treeabcdcc13a8183237e6a7fe164bc0e6f64873d9d4 /src/editor.mjs
parentbd7791bbe69dda2bb6bfb7f5a1207fa7f14f550e (diff)
feat: patch 6d1d37d
also add marker on map
Diffstat (limited to 'src/editor.mjs')
-rw-r--r--src/editor.mjs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/editor.mjs b/src/editor.mjs
index 64d5cf6..eb9b5c1 100644
--- a/src/editor.mjs
+++ b/src/editor.mjs
@@ -438,6 +438,8 @@ const menuForEditor = (event, menu) => {
438 `${lastLineIsRefLink ? '' : '\n'}\n[${anchorName}]: ${link}`, 438 `${lastLineIsRefLink ? '' : '\n'}\n[${anchorName}]: ${link}`,
439 { line: Infinity } 439 { line: Infinity }
440 ) 440 )
441 refLinks = getRefLinks()
442 map.renderer.addMarker({xy: [Number(x), Number(y)], title: `${map.id}@${x},${y}`, type: 'circle'})
441 } 443 }
442 }) 444 })
443 menu.insertBefore(item, menu.firstChild) 445 menu.insertBefore(item, menu.firstChild)
@@ -981,9 +983,10 @@ const addMapRandomlyByPreset = () => {
981 yamlText.sort((a, b) => 983 yamlText.sort((a, b) =>
982 order.indexOf(a.split(':')[0]) > order.indexOf(b.split(':')[0]) 984 order.indexOf(a.split(':')[0]) > order.indexOf(b.split(':')[0])
983 ) 985 )
986 const anchor = cm.getCursor()
984 cm.replaceRange( 987 cm.replaceRange(
985 '\n```map\n' + yamlText.join('\n') + '\n```\n', 988 '\n```map\n' + yamlText.join('\n') + '\n```\n',
986 cm.getCursor() 989 anchor
987 ) 990 )
988} 991}
989 992