Plugin

new Plugin()

Methods

Name Description
attachContextMenuClickEvent

Defines the method to add an event listener, a function that will be called whenever the specified event is clicked in the context menu.

attachEvent

Defines the method to add an event listener, a function that will be called whenever the specified event is delivered to the target. The list of all the available events can be found here.

callCommand

Defines the method used to send the data back to the editor. It allows the plugin to send structured data that can be inserted to the resulting document file (formatted paragraphs, tables, text parts, and separate words, etc.).

The callback is the result that the command returns. It is an optional parameter. In case it is missing, the window.Asc.plugin.onCommandCallback function will be used to return the result of the command execution. ONLYOFFICE Document Builder commands can be only used to create content and insert it to the document editor (using the Api.GetDocument().InsertContent(...)). This limitation exists due to the co-editing feature in the online editors. If it is necessary to create a plugin for desktop editors to work with local files, no such limitation is applied.

This method is executed in its own context isolated from other JavaScript data. If some parameters or other data need to be passed to this method, use Asc.scope object.

callModule

Defines the method used to execute a remotely located script following a link.

createInputHelper

Defines the method used to create an input helper - a window that appears and disappears when you type text. Its location is tied to the cursor.

executeMethod

Defines the method used to execute certain editor methods using the plugin.

The callback is the result that the method returns. It is an optional parameter. In case it is missing, the window.Asc.plugin.onMethodReturn function will be used to return the result of the method execution.

getInputHelper

Defines the method used to get the InputHelper object.

loadModule

Defines the method used to load a remotely located text resource.

resizeWindow

Defines the method used to change the window size updating the minimum/maximum sizes. This method is used for visual modal plugins only.

sendToPlugin

Sends a message from the modal window to the plugin.