40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
|
|
<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
|
|
|
|
<script runat="server">
|
|
protected override void Init()
|
|
{
|
|
PageTitle = PageCaption = "Плагины";
|
|
MetaKeyWords = "";
|
|
MetaDescription = "Статьи документации по плагинам.";
|
|
|
|
}
|
|
</script>
|
|
|
|
<div class="MainHelpCenter">
|
|
<h1 class="subHeaderFeaturesCaption Guides_Video_Captions">Пример плагина</h1>
|
|
<p>Чтобы понять, как работают плагины, как их можно написать и как добавить в редакторы документов, рассмотрите следующий пример плагина <code>helloworld.js</code>:</p>
|
|
<pre>
|
|
<code>
|
|
(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);
|
|
</code>
|
|
</pre>
|
|
<p>Это самый простой плагин, который при нажатии на кнопку плагина вставляет в документ фразу 'Hello world!'.</p>
|
|
|
|
|
|
</div>
|