window.Asc.plugin object

Description

The object created at the plugin startup. It has several methods, some of them are optional and are to be used only if and when needed.

Methods and properties
Name Description Type Presence
button The buttons used with the plugin and the plugin behavior when these buttons are clicked. The method is called when any of the plugin buttons is clicked. function required
callCommand/executeCommand The window.Asc.plugin.callCommand method is used to send the data back to the editor. Replaced the window.Asc.plugin.executeCommand method when working with texts so that to simplify the syntax of the script you want 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 using the plugin. function optional
info It stores all the information about the editor where the plugin is used. 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 Used to return the result of the previously executed method. 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);