Getting started
To create an extension, you need the following elements:
JavaScript/TypeScript IDE like Visual Studio Code
PowerDocs installed
Your first extension
Start by creating a folder in the
%USERPROFILE%\AppData\Local\PowerDocs\extensions\
existing folder, for example MyExtensionCreate a file in this folder, called
manifest.xml
Create a file in this folder, called
main.js
Open the
main.js
file in your favorite IDE and start typing code
You must import the PowerDocsExtension class from the PowerDocs.Lib module like this:
import {PowerDocsExtension} from 'PowerDocs.Lib';
...
Then you can instantiate your extension like this:
...
// instanciates the extension object
var myExtensionInstance = PowerDocsExtension.create();
...
Then, depending on your extension purpose, you can listen to some events, like that:
...
// listen to the "documentLoaded" event, which happens every time the editor loads a file
myExtensionInstance.addListener("documentLoaded", (d) => { ... });
...
Last modified: 08 avril 2024