@onlyoffice/docspace-plugin-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ONLYOFFICE DocSpace Plugins SDK

Overview

ONLYOFFICE DocSpace Plugins SDK is an npm package based on TypeScript engines which provides interfaces to create your own plugins for embedding in the DocSpace portal.

To install the @onlyoffice/docspace-plugin-sdk npm package globally, run the following command in the terminal:

npm i -g @onlyoffice/docspace-plugin-sdk

Functionality

  • Creating base plugins with the npx command.
  • Embedding plugins in context menu, info panel, profile menu, main button using the corresponding interfaces.
  • Configuring plugin UI using the DocSpace plugins components.

npx

After installing the npm package, the npx create-docspace-plugin command becomes available and allows you to create a plugin template with the pre-installed plugin types and the implementation of basic methods.

This command displays a dialog which allows you to configure the plugin settings and select the required scopes.

You can find a list of all the dialog questions here.

Developing a plugin

  • Write code for each plugin type using the corresponding variables, methods and items. Put the scripts into the src folder. Specify the required Plugin interface for each plugin to be embedded in the portal.
  • Specify plugin messages that will be returned by the items. Use the appropriate events that will be processed on the portal side.
  • Configure the plugin UI using the plugin components.

Code samples are available at https://github.com/ONLYOFFICE/docspace-plugins.

Building a plugin

To build a plugin, you need the yarn package manager to be installed. After that, follow the instructions below:

  1. Open the terminal and go to the plugin root folder:
cd PDF-Converter
  1. Install all the necessary dependencies (if this was not done previously when creating the plugin template):
yarn install
  1. Collect an archive for uploading to the portal:
yarn build

This command generates the obfuscated code from the entire project and collects it into the plugin.js file using the webpack npm package. After that the plugin builder from the createZip.js file generates the config.json file from the package.json data and creates an archive that contains the assets folder, the plugin.js file, and the config.json file.

The dist folder will be created in the root plugin folder and the plugin archive will be placed in it. This archive is the completed plugin that can be uploaded to the DocSpace portal.

Package Sidebar

Install

npm i @onlyoffice/docspace-plugin-sdk

Weekly Downloads

436

Version

1.0.0

License

Apache-2.0

Unpacked Size

151 kB

Total Files

121

Last publish

Collaborators

  • onlyoffice