From 72704e3f5d5f4cbe00640be875955d4649f30780 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sat, 12 Oct 2024 15:46:50 +0800 Subject: feat: use selection as default name of anchor --- src/dumbyUtils.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dumbyUtils.mjs') diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index 2f92c18..24699b3 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs @@ -267,6 +267,7 @@ const isAnchorVisible = anchor => { * @param {Function} options.validateAnchorName -- validate anchor name is OK to use */ export const addAnchorByPoint = ({ + defaultName, point, map, validateAnchorName = () => true, @@ -281,7 +282,7 @@ export const addAnchorByPoint = ({ do { prompt = prompt ? 'Anchor name exists' : 'Name this anchor' - anchorName = window.prompt(prompt, `${x},${y}`) + anchorName = window.prompt(prompt, defaultName ?? '') } while (anchorName !== null && !validateAnchorName(anchorName)) if (anchorName === null) return -- cgit v1.2.3-70-g09d2