New features
- Add new
onSwitchTheme
option that allows to track if users switch theme. The following snippet demonstrates an example that the current theme is stored in the local storage, and is loaded back in the next user's visit:
const handleSwitchTheme = (theme: string) => {
localStorage.setItem('theme', theme);
};
const theme = localStorage.getItem('theme') || 'light';
<Viewer theme={theme} onSwitchTheme={handleSwitchTheme} />;
Improve the search plugin
-
Add new
jumpToMatch
function which jumps to the given match -
The
highlight
function now returns aPromise
that holds the results. Each result also contains the matching text -
The
core
package providesisMac
function
Improvements
Accessibility
- Add ARIA attributes to
Icon
,Menu
,MenuDivider
,MenuItem
,MinimalButton
,Modal
,Popover
,TextBox
,Tooltip
components - Add ARIA attributes to pages and thumbnails
- Add ARIA attributes to internal links of the document
- When the shortcuts are enabled, the associal buttons will have the
aria-keyshortcuts
attributes - Use the keyboard to navigate between components:
Component | Press key | Action |
---|---|---|
Attachments
| ArrowDown
| Focus on the next attachment |
ArrowUp
| Focus on the previous attachment | |
End
| Focus on the last attachment | |
Enter
| Download the current focused attachment | |
Home
| Focus on the first attachment | |
Bookmark
| ArrowDown
| Focus on the next bookmark |
ArrowLeft
| Collapse the current bookmark | |
ArrowRight
| Expand the current bookmark | |
ArrowUp
| Focus on the previous bookmark | |
End
| Focus on the last bookmark | |
Enter
| Click the current focused bookmark | |
Home
| Focus on the first bookmark | |
Space
| Click the current focused bookmark | |
Menu
| ArrowDown
| Focus on the next menu item |
ArrowUp
| Focus on the previous menu item | |
Enter
| Click the current focused item | |
Thumbnails
| ArrowDown
| Focus on the thumbnail of next page |
ArrowUp
| Focus on the thumbnail of the previous page | |
Enter
| Jump to the associate page | |
Tooltip
| Escape
| Close |
Tab
| Show when being focused | |
Close when being blured |
- Add a background color to the current search highlight
- Show a loading indicator while searching for a keyword
- The
Spinner
component adds newsize
property
Bug fixes
- Custom search control isn't rendered
- Pressing shortcuts effects all viewer instances in the same page. The shortcuts should be enabled when the viewer gets focused.
- Remove
br
elements generated by the recent versions of pdf.js before rendering the text layer - Remove
keyCode
usages because it's deprecated - The print progress container loses the border
- The search popover isn't shown until the document is loaded