diff --git a/includes/AnnotationHooks.php b/includes/AnnotationHooks.php index a695c31..b554383 100644 --- a/includes/AnnotationHooks.php +++ b/includes/AnnotationHooks.php @@ -45,11 +45,6 @@ class AnnotationHooks { [view] direction = "L" - - # [annotation.1] - # position = - # leader.1 = - # light = true NEWAN; } return true; diff --git a/modules/annot-prev.js b/modules/annot-prev.js index cc3c500..4143b1d 100644 --- a/modules/annot-prev.js +++ b/modules/annot-prev.js @@ -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() + } }) \ No newline at end of file