raphael10-collab opened a new issue, #128: URL: https://github.com/apache/incubator-annotator/issues/128
The text is highlighted but I do not get the text position, needed for further annotating  This is the code I'm using: // https://annotator.apache.org/docs/getting-started/ import { describeTextQuote } from '@apache-annotator/dom' import { createTextQuoteSelectorMatcher, highlightText } from '@apache-annotator/dom'; async function describeCurrentSelection() { const userSelection = window.getSelection()?.getRangeAt(0); console.log("view-preload.ts-userSelection: ", userSelection) if (!userSelection || userSelection.isCollapsed) return; console.log("view-preloads-describeTextQuote(userSelection): ", describeTextQuote(userSelection)) return describeTextQuote(userSelection); } async function highlightSelectorTarget(textQuoteSelector) { const matches = createTextQuoteSelectorMatcher(textQuoteSelector)(document.body); console.log("view-preload.ts-highlighSelectorTarger-matches: ", matches) // Modifying the DOM while searching can mess up; see issue #112. // Therefore, we first collect all matches before highlighting them. const matchList = []; for await (const match of matches) matchList.push(match); for (const match of matchList) highlightText(match); } document.addEventListener('mouseup', async () => { const selector = await describeCurrentSelection(); const existingSelectors = JSON.parse(localStorage[document.URL] || '[]'); localStorage[document.URL] = JSON.stringify([...existingSelectors, selector]); await highlightSelectorTarget(selector); }) // Highlight the last selection that was stored, if any. async function highlightStoredSelectors() { if (localStorage[document.URL]) { const selectors = JSON.parse(localStorage[document.URL]); for (const selector of selectors) { console.log("view-preload.ts-highlightStoredSelectors-selector: ", selector) await highlightSelectorTarget(selector); } } } highlightStoredSelectors() -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@annotator.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org