espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of pdfium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
60 stars 36 forks source link

Can I customize the box when I finish selecting the text? Are there any callbacks for table/picture clicks? #120

Closed MRYIN123 closed 4 weeks ago

MRYIN123 commented 1 month ago

Is there a selectArea for selecting text on macos? Can you open the callback after selecting the text, so that you can customize the pop-up box when selecting the text. Are there any callbacks for table/picture clicks?

espresso3389 commented 1 month ago

1.0.54 introduces `PdfViewerParams.perPageSelectionAreaInjector to customize text selection behavior:

perPageSelectionAreaInjector: (page, child) {
  return SelectionArea(
    contextMenuBuilder: (context, selectableRegionState) {
      return AdaptiveTextSelectionToolbar.selectableRegion(
         selectableRegionState: selectableRegionState,
      );
    },
    child: child,
  );
},
MRYIN123 commented 1 month ago

Thanks!

espresso3389 commented 1 month ago

You can inject any widget other than SelectionArea so that do some special trick.

But I understand that it is just the first step and could not customize everything (I don't know what should be customizable) so far.

espresso3389 commented 1 month ago

At least, currently we can not do "selecting picture". It's very difficult to implement. I have no idea for that.