Change position a button textpopup

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version
8.7.4

Detailed description of issue
Hi, i use code below to add a button in textpopup, is there anyway to change this button position in pdf viewer

Expected behaviour
{Provide a screenshot or description of the expected behaviour}

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet

this.webViewerInstance.textPopup.add({
                type: 'actionButton',
                onClick: () => {
                    this.onClickHandler()
                },
                img: '/img/mrc/table-file.svg'
            })

Hello there,

You change the order of the text popup buttons using the following code:

  let textPopupItems = instance.UI.textPopup.getItems()

  const printButton =
  {
    type: 'actionButton',
    onClick: () => {
      this.onClickHandler()
    },
    img: 'icon-header-print-line'
  }

  textPopupItems.splice(2, 0, printButton);
  instance.UI.textPopup.update(textPopupItems);

Note I am using a printButton as an example. I inserted the new button at index 2 of the array.

Let me know if this helps.

Best Regards,
Darian Chen

Hi darian.chen, i mean change the location of button textpopup in viewer by a specific coordinate not the order

Hello there,

Could you clarify where you want the button to be with a screenshot?

Best Regards,
Darian Chen

current, the position of textpopup is center and below textselected, i want to position is right after textselected

Hello,

Unfortunately, there are no settings/APIs to change the textPopup position in PDF.js Express. In order to do this, you would have to fork our public repo and then make any customizations you want directly in the source.

Here is a guide on that.

From there, the changes would likely have to be made in the getPopupPosition helper file here:

Best Regards,
Darian Chen