How to get current paragraph from highlighted text?

Good day,

Is there’s a way to get the current paragraph from highlighted text?
sample paragraph : Powerful document functionality → and I highlighted the document, I would like to get the Powerful document functionality paragraph. Sample code is for selected/highlighted text only:

const textItems = instance.UI.textPopup.getItems();
instance.UI.textPopup.add({
type: ‘actionButton’,
label: ‘AddTag’,
dataElement: ‘addTag’,
//img: “”, icon
title: “Add Tag”,
onClick: () => {
const selectedText = instance.Core.documentViewer.getSelectedText();
console.log(selectedText);
},
},
textItems[0].dataElement);

image

Thanks.

Hi there,

Thanks for contacting pdf.js express forums,

This is not possible to do in pdf.js express. There is no way to know the entire line of text from just a selection of a word.

Best regards,
Kevin Kim

Noted, thanks for the quick reply.