Skip to content

The selection-mode plugin provides buttons to apply two different selection modes:

MODETYPEDESCRIPTION
SelectionMode.HandSelectionModeUse the mouse to drag the pages. Users cannot select the text of document.
SelectionMode.TextSelectionModeThe normal selection mode. Users can select the text of document.

SelectionMode is an enum provided by the selection-mode plugin. You will know more about it in the next section.

Install

> npm install @sse-ui/pdf-selection-mode;

OR

> yarn add @sse-ui/pdf-selection-mode;

The selection-mode plugin is included in the toolbar and default-layout plugins

Usage

1. Import the plugin

javascript
import { selectionModePlugin } from "@sse-ui/pdf-selection-mode";

// Import styles
import "@sse-ui/pdf-selection-mode/lib/styles/index.css";

2. Create the plugin instance

javascript
const selectionModePluginInstance = selectionModePlugin(
    props?: SelectionModePluginProps
);

The optional parameter SelectionModePluginProps represents an object of the property: (? denotes an optional property)

PROPERTYTYPEDESCRIPTIONFROM
selectionMode?SelectionModeThe initial selection mode. By default, it is set to SelectionMode.Text1.0.0

The plugin instance selectionModePluginInstance provides the following properties:

PROPERTYTYPEDESCRIPTIONFROM
SwitchSelectionModeReactElementCustomizable button to switch the selection mode1.0.0
SwitchSelectionModeButtonReactElementThe default button to switch the selection mode1.0.0
SwitchSelectionModeMenuItemReactElementThe default menu item to switch the selection mode1.0.0

3. Register the plugin

Register the selection-mode plugin instance:

javascript
<Viewer plugins={[selectionModePluginInstance]} />

Properties

The selection-mode plugin provides other useful properties as following:

javascript
import {
  HandToolIcon,
  TextSelectionIcon,
} from "@sse-ui/pdf-selection-mode";
PROPERTYTYPEDESCRIPTIONFROM
HandToolIconReactElementThe hand icon represents the hand selection mode1.0.0
TextSelectionIconReactElementThe icon represents the text selection mode1.0.0

Released under the MIT License.