跳到主要内容

React

Hooks and runtime types for plugin UI written as React components. A component is handed to DocSpace through one of the *Component props on an item, a modal dialog or the settings block, and reads the portal selection, user, API and actions through these hooks.

Import from the @onlyoffice/docspace-plugin-sdk/react subpath, and keep react and both SDK entry points external in the plugin bundle — DocSpace supplies its own copies, and a second React instance breaks every hook.

Overview​

The React API is split across these pages:

PageDescription
PluginActionsPortal-side actions available to a React plugin component.
ApiThe portal API as a plugin sees it: the client every request goes through, the options a request takes, and the error a failure arrives as.
HooksReact hooks for plugin components rendered inside the DocSpace application tree.
RuntimeWhat DocSpace hands a React plugin component: the current selection, the current user, and the clients the component reaches the portal with.
PluginSettingsClientClient for persisting and retrieving plugin-specific settings.