Add annotation block with hotkey

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2026-07-21 09:16:54 -07:00
parent 5d0b6371e1
commit e0ea16c714
2 changed files with 14 additions and 7 deletions

View File

@@ -45,11 +45,6 @@ class AnnotationHooks {
[view]
direction = "L"
# [annotation.1]
# position =
# leader.1 =
# light = true
NEWAN;
}
return true;

View File

@@ -13,8 +13,8 @@ elSvgCont.addEventListener('click', (e) => {
console.log(e)
if (!e.ctrlKey) {
elInput = document.getElementById('wpTextbox1')
elInput.setRangeText(`[${elCoordBox.textContent}]`)
elInput.selectionStart += elCoordBox.textContent.length + 2
elInput.setRangeText(`[${elCoordBox.textContent}]`, elInput.selectionStart, elInput.selectionEnd, 'end')
elInput.focus({ preventScroll: true })
} else {
navigator.clipboard.writeText(`[${elCoordBox.textContent}]`)
}
@@ -53,4 +53,16 @@ document.addEventListener('keydown',(e) => {
elInput.setRangeText(`${oldCoord[1]}${calcX}${oldCoord[3]}${calcY}${oldCoord[5]}`)
}
}
if (!e.altKey && e.shiftKey && e.ctrlKey && e.key == "{") {
console.log('Add new annotation')
const anTemp = `
[annotation.#]
position =
leader.1 =
light = true
`
elInput = document.getElementById('wpTextbox1')
elInput.setRangeText(anTemp, elInput.value.length, elInput.value.length, 'start')
elInput.focus()
}
})