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
executeCommand Used to send the data back to the editor. function required
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
Example
(function (window, undefined) {
    window.Asc.plugin.init = function () {
        var sScript = 'var oDocument = Api.GetDocument();';
        sScript += 'oDocument.CreateNewHistoryPoint();';
        sScript += 'oParagraph = Api.CreateParagraph();';
        sScript += 'oParagraph.AddText(\'Hello world!\');';
        sScript += 'oDocument.InsertContent([oParagraph]);';
        window.Asc.plugin.info.recalculate = true;
        this.executeCommand("close", sScript);
    };
    window.Asc.plugin.button = function (id) {
    };
})(window, undefined);