-
-
Notifications
You must be signed in to change notification settings - Fork 901
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
Add prop for custom text rendering #163
Conversation
hey @wojtekmaj! just want to add a little more context here - essentially I have implemented a search function (using js-worker-search) and want to use this added code as a way to indicate to the renderer which text items should be highlighted to indicate they match. So essentially I would implement a function to pass to |
Thanks for all the information! I'm busy at the moment, but quickly approaching the moment in which I'll be able to focus on open source stuff :) I'll review it today! |
Sweet! Thank you :) |
Played with it a little bit... This is really super cool 😀 |
awesome! glad you like it :). Very cool library. |
hey @wojtekmaj when do you expect to next release? |
@juliakieserman, I'm preparing to release v3.0.0 sometime this month. The first feature complete beta was just released. I'm monitoring the opinions in #143 and if nothing super horrible appears after a short while of beta program, I think we'll be ready to go :) |
got it, thanks! also @wojtekmaj - it looks like you made some changes that removed the index being passed back along with the text layer props...would you mind putting that back in? This allows a custom renderer function to do a check on an index in the text layer to decide what to do with it. |
3.0.1 is out! Sorry! |
thanks for the quick response! looks like itemIndex is still coming back as undefined though... |
ah - nevermind, I see you grouped it with the rest of the content. Thanks! |
hey @wojtekmaj - sorry to keep bugging you with this, but I'm starting to wonder if passing back a page index would also be super helpful. That way you could say things like "for page 4, I want to edit the 8th index in the text content". Any chance we could throw that in there? |
There will be no passing back like this for sure as this breaks the nice flow React makes. But! <Document file={...} >
<Page
pageNumber={pageNumber}
customTextRenderer={({ str, itemIndex }) =>
(
pageIndex === 4 && itemIndex === 8
? 'I am 8th string on page 4'
: str
)
}
/>
</Document> |
Added optional prop
customTextRenderer
that allows user to pass in a function that will modify how text div is rendered within text layer. Possible use case includes the ability to highlight words.(potentially addresses #160 as well)