react-pdf-viewer v3.5.0 Release Notes

  • ๐Ÿ†• New feature

    • Be able to customize the highlight elements when searching for a keyword:
    const searchPluginInstance = searchPlugin({
        renderHighlights: (highlightPositions: HighlightPosition[]) => (
            // Your custom highlight elements
        ),
    });
    

    ๐Ÿ‘Œ Improvements

    • ๐Ÿ”Œ The highlight plugin supports double click. Users can double click to select the entire text of a given element

    • ๐Ÿ”Œ The page navigation plugin allows to jump to the previous and next pages with shortcuts.

    Shortcut Action
    PageUp or Alt + ArrowUp Go to the previous page
    PageDown or Alt + ArrowDown Go to the next page

    0๏ธโƒฃ The shortcuts are enabled by default. It's possible to disable them, for example:

    // Use the standalone page navigation plugin
    const pageNavigationPluginInstance = pageNavigationPlugin({
        enableShortcuts: false,
    });
    
    // Use the default layout plugin
    const defaultLayoutPluginInstance = defaultLayoutPlugin({
        toolbarPlugin: {
            pageNavigationPlugin: {
                enableShortcuts: false,
            },
        },
    });
    

    ๐Ÿ› Bug fixes

    • Don't highlight the entire page when selecting multiple lines
    • 0๏ธโƒฃ The default layout plugin throws an exception if the setInitialTabFromPageMode function returns a Promise which resolves an invalid tab index
    • ๐Ÿ”Œ The highlight plugin throws an exception when double click a page without selecting any text
    • ๐Ÿ”Œ The search plugin can't set the initial keyword when using with the highlight plugins