Now ONLYOFFICE can do everything: add plugins to document editors
What if you could add to the editors of your documents any functions you want? Now you can: in the editors ONLYOFFICE the opportunity to connect plug-ins. We wrote a few examples ourselves - all of them can be viewed in our open repository on GitHub. Now your move - write what you lacked.
Details below.
Why did we do this?
So, we decided to give developers the opportunity to add the necessary (but not directly related to OOXML formats) functionality to ONLYOFFICE editors. ')
It all started with one company, in which they really wanted to write their own button to generate content and insert the resulting data into the editor. Okay, we thought, that makes sense. There is a functionality that only certain people need and no one else. We can not do everything for everyone, but we can give the opportunity to steal everything that is needed. Therefore, here is the API for working with the editor, the first version.
So there were plugins.
They can use the code that we ourselves can not take because of licensing restrictions. We make a commercial product and sell it, you can’t just take it and (* in this moment the author of the text is interrupted to brush off the ghost of Sean Bean from the depths of the subconscious) you cannot just take and use any code from the Internet. That is, we can not. And you can. Those things that we, for objective reasons, cannot, our users can.
Types of plugins
We divide them into three types:
Visuals When we use such an extension of the editor, a window opens and a certain interface is drawn. For example, Glavred, who asked our PR.
A visual plugin can change something in the document itself, or it can change nothing. Glavred does not change anything - he only highlights a certain part of the text (stamps, extra words, etc.).
You can write a plugin that searches on Google. Pictures and inserts your favorite into the text. This plugin changes the document.
Non-visual For example, a simple button, when clicked, performs manipulations with the document. The simplest example of such a plugin is an extension that, when a button is pressed, adds the words Hello World!
You can also add your own Bold button to your document, for example. Or a button, when clicked, a report is generated.
OLE objects . These are our favorite plugins. And the only way for a third-party developer to “get into” the format part of the document, i.e. write your information not only while the editor is working, but also directly into the file. This, for example, our chess.
What solution are plugins connected to and how is this done?
In fact, to anyone.
For server version
Plug-ins need to register in the configs of editors - they will automatically appear in all users of the portal.
For desktop
We archive plugins, change the file extension to .plugin and drop it on the main page. They immediately pick up, we promise. In addition, if you connect the application to the portal with plug-ins enabled, they will automatically work in the desktop.
For web version
In the near future, we will write down something like a store or gallery, where plug-ins from users will be added (after moderation).
While there is no “store”, plugins can be added via an extension in the browser. This path only works for Chrome for now. We on GitHub have a folder with a talking name chrome_extension_example: this is a sample, how to make an extension in Chrome on our plugins.
Here, by the way, is a short video about what our plugins can do and how to add them to an existing installation (desktop, server).
How to write your plugin?
Here we wanted to write detailed instructions on how to do this. But we remembered that we already have good and detailed documentation, where the structure of the plug-in is described in all the necessary details. So everything is here . You can also explore the device add-ons that we personally posted on GitHub .
On this, perhaps, everything. And yes - we hope over time to see the riot of plug-ins created by the community. In any case, it is very curious what functions our users will add.