Getting getSelectedText() value
I am trying to retrieve the getSelectedText() value from a PREVIEW_SELECTED_END callback to populate the prompt for a Highlight comment entry as follows... trying to set var [selectedText]
var selectedText;
const eventOptions = {
enableFilePreviewEvents: true
}
adobeDCView.registerCallback(
AdobeDC.View.Enum.CallbackType.EVENT_LISTENER,
function(event) {
console.log("Event: " + event.type);
if (event.type === "PREVIEW_SELECTION_END") {
previewFilePromise.then(adobeViewer => {
adobeViewer.getAPIs().then(apis => {
apis.getSelectedContent()
.then(result => selectedText = result.data)
.catch(error => console.log(error));
});
});
console.log("selectedText = " + selectedText);
}
}, eventOptions
);...which does work, but not always. For instance, the first selection of text appears to block the Tool popover, clear and select again and it works, but then only randomly thereafter. What am I missing?
Any help greatly appretiated, Nick Gates
