Which product are you using?
PDF.js Express
PDF.js Express Version
8.1.0
Detailed description of issue
when i click selectTextButton, the viewer turns to text selection mode, but when i click the button again, text selection mode can’t be toggle, so when i touch the mobile screen, the pdf text will be selected.
Expected behaviour
text selection mode should be toggle when i click selectionTextButton
Does your issue happen with every document, or just one?
it happens anyway when in mobile
Link to document
Code snippet
WebViewer(
{
licenseKey: 'zSbyd7VXHHiO0AP6DxNO',
path: '/webviewer/lib',
initialDoc: pdfUri,
css: '/pdf.css',
disabledElements: [
'leftPanelTabs',
'menuButton',
'panToolButton',
'viewControlsButton',
'selectToolButton',
],
},
viewerRef.current
).then((instance: any) => {
// now you can access APIs through the WebViewer instance
const { Core, UI } = instance
console.log('instance', instance)
// adding an event listener for when a document is loaded
Core.documentViewer.addEventListener('documentLoaded', () => {
UI.setSideWindowVisibility(!isMobile)
})
// adding an event listener for when the page number has changed
// Core.documentViewer.addEventListener(
// 'pageNumberUpdated',
// (pageNumber: number) => {
// console.log(`Page number is: ${pageNumber}`)
// }
// )
Core.documentViewer.addEventListener('mouseLeftUp', (e: any) => {
// !!selectTxt.length && instance.UI.openElements([modalOptions.dataElement])
instance.UI.textPopup.update(textPopupButtons)
})
Core.documentViewer.addEventListener(
'textSelected',
(quads: any, selectedStr: string, pageNumber: number) => {
selectedText = selectedStr
}
)
// adds a button to the header that on click sets the page to the next page
if (showCupture && !isMobile) {
UI.setHeaderItems((header: any) => {
header.get('searchButton')
header.insertBefore({
type: 'actionButton',
img: iconFullSize,
onClick: () => {
onCupture()
},
})
})
}
})