-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature requests #5
Comments
Very true. I'm not too fond of adding additional accepted types to functions and components since I feel that confuses expected behaviour, but since Currently
Not too sure what you mean? This sounds like an example app request though, which would be of low priority.
PDF.js actually already exposes this functionality via the PDF Viewer, which you can access yourself. Note: // Using usePdfHighlighterContext hook inside of any child of PdfHighlighter. For example, inside a tip
const { getViewer } = usePdfHighlighterContext();
getViewer()?.scrollPageIntoView({pageNumber: 2});
// Using utils ref outside of the PdfHighlighter component (taken from example app)
const highlighterUtilsRef = useRef<PdfHighlighterUtils>();
highlighterUtilsRef.current?.getViewer()?.scrollPageIntoView({ pageNumber: 2); You can even add in a scrollPageIntoView({ pageNumber: 2, destArray: [null, { name: "XYZ" }, 10, 10, "page-fit"] });
There's a lot of variability here in how a developer might want to implement this (how should highlights be separated, what data should be stored with highlights, etc.). In general though, you could implement this crudely by simply adding creating a highlight on every selection event. This is much simpler with the new selection event in #15 , and I've added this functionality to the example app.
The text layer of each PDF is currently loaded in, so you should be able to Ctrl + F as usual. Exposing the PDFFindService from PDF.js could have its perks though. I'll keep considering it. |
woah, too good! thanks a fuckton <3 |
sweet, works great! is there a way to use smooth scrolling? |
easiest way would be to create a patch passing
at
|
is there anyway i can do:
|
v8 is awesome! Thanks a ton for putting time into this.
Few feature requests:
expose content, position,etc in selectionTip as props.
i have this use case where i have a text copy button inside the selectionTip, so having access to those values would be nice.
the highlights prop takes value of type "Highlight[]", this isnt ideal imo, cause content type is often expensive to store in db, and not preferred imo. would be cool if youd make it "Omit<Highlight,"content"> [] | Highlight[]> , or something similar.
same goes for the
scrollToHighlight
fnFor deleting a highlight itd be better for the popup to appear once the user clicks on the highlight instead of hover.
also maybe a fn to Scroll to specific page no . someone else raised this issue in the other lib
and maybe a toggle button which if turned on, then if any text is selected it gets highlighted. (instead of having to click the popover everytime). => some helper fn to implement this would be cool.
feature to search text
The text was updated successfully, but these errors were encountered: