I have tried to get selected text as in the documentation here. The problem I encountered is this that the event is triggered on selection of each letter or word. I need to get the selectedText at the time the selection is complete or when the user leaves the mouse hold. How can I do that?
Hello,
I need to get the selectedText at the time the selection is complete or when the user leaves the mouse hold.
I believe what you are looking for is documented here:
WebViewer.then(instance => {
const { docViewer } = instance;
docViewer.getTool(‘TextSelect’).on(‘selectionComplete’, (startQuad, allQuads) => {
/**
- If Quad information is needed, note the callback arguments
*/
const selectedText = docViewer.getSelectedText();
// selectedText contains the text that the user has selected on mouseLeftUp
console.log(selectedText);
});
});
Feel free to let me know if you have any additional questions about this logic.