Get Started
Documentation
Macros
More information
|
Plugin exampleTo understand how the plugins work and how they can be written and added to document editors, please see the example of the helloworld.js plugin below: (function(window, undefined){ var text = "Hello world!"; window.Asc.plugin.init = function() { Asc.scope.text = text; // export variable to plugin scope this.callCommand(function() { var oDocument = Api.GetDocument(); var oParagraph = Api.CreateParagraph(); oParagraph.AddText(Asc.scope.text); // or oParagraph.AddText(scope.text); oDocument.InsertContent([oParagraph]); }, true); }; window.Asc.plugin.button = function(id) { }; })(window, undefined); It is the easiest plugin that will insert the 'Hello world!' phrase into your document whenever you press the plugin button. This plugin and all the other currently existing open source plugin examples are available here: https://github.com/ONLYOFFICE/sdkjs-plugins. Feel free to fork them, use them with your editors and create your own plugins. SupportIf you have any questions, you can ask our developers at dev.onlyoffice.org (registration required). |
© Ascensio System SIA 2021. All rights reserved
|