yarn @react-pdf-viewer/core 2.11.0
v2.11.0

latest releases: 3.12.0, 3.11.0, 3.10.0...
2 years ago

New features

  • The Button component has new testId property that is identical with the data-testid attribute
  • The Scroll Mode plugin provides new function to switch mode programmatically:
const scrollModePluginInstance = scrollModePlugin();
const { switchScrollMode } = scrollModePluginInstance;

// Switch to Wrapped mode
switchScrollMode(ScrollMode.Wrapped);

You might find it useful when using with the full screen plugin. The following sample code switches the scroll mode after entering the full screen mode:

const defaultLayoutPluginInstance = defaultLayoutPlugin({
    toolbarPlugin: {
        fullScreenPlugin: {
            onEnterFullScreen: (zoom) => {
                zoom(SpecialZoomLevel.PageFit);
                defaultLayoutPluginInstance.toolbarPluginInstance.scrollModePluginInstance.switchScrollMode(
                    ScrollMode.Wrapped
                );
            },
            onExitFullScreen: (zoom) => {
                zoom(SpecialZoomLevel.PageWidth);
                defaultLayoutPluginInstance.toolbarPluginInstance.scrollModePluginInstance.switchScrollMode(
                    ScrollMode.Horizontal
                );
            },
        },
    },
});

Improvements

  • Cache pages' labels. So we won't see blink in the current page label when navigating between pages
  • Keep the file name when downloading a file opened from local
  • It's possible to remove the sidebar created by the default layout plugin:
const defaultLayoutPluginInstance = defaultLayoutPlugin({
    sidebarTabs: () => [],
});

Bug fixes

  • Can't use special characters such as (, ), [, ], * in the keyword
  • Downloading document doesn't work on iOS Safari and iOS Chrome
  • The Get File plugin doesn't work with a file which is opened with credentials
  • The highlight area aren't displayed
  • The selectedText prop of RenderHighlightContentProps isn't correct

Don't miss a new core release

NewReleases is sending notifications on new releases.