window.Asc.plugin object

Description

Defines the object created when the plugin is launched. It has several methods some of which are optional and must be used only if and when needed.

Methods and properties
Name Description Type Presence
button Defines the buttons used with the plugin and the plugin behavior when they are clicked. This method is called when any of the plugin buttons is clicked. function required
callCommand/executeCommand Defines the window.Asc.plugin.callCommand method that is used to send the data back to the editor. It replaces the window.Asc.plugin.executeCommand method when working with texts in order to simplify the syntax of the script that is necessary to pass to the editors. The window.Asc.plugin.executeCommand method is now primarily used to work with OLE objects. function required
executeMethod Used to execute certain editor methods with the help of the plugin. function optional
info Stores all the information about the editor that uses the plugin. object optional
init The data sent to the plugin and what is to be done with it and how. This method is called when the plugin is started. function required
onExternalMouseUp Specify the action that is to be performed when the mouse button is released outside the plugin iframe. function optional
onMethodReturn - function optional
Example
(function(window, undefined){
    var text = "Hello world!";
    window.Asc.plugin.init = function() {
        Asc.scope.text = text;
        this.callCommand(function() {
            var oDocument = Api.GetDocument();
            var oParagraph = Api.CreateParagraph();
            oParagraph.AddText(Asc.scope.text);
            oDocument.InsertContent([oParagraph]);
        }, true);
    };
    window.Asc.plugin.button = function(id)
    {
    };
})(window, undefined);