- ExtensionDocs update

master
Brett Zamir 2018-05-31 17:09:53 +08:00
parent a27a5d5637
commit bbded75c54
1 changed files with 4 additions and 1 deletions

View File

@ -44,6 +44,10 @@ svgEditor.addExtension('Hello World', function () {
Note how the returned properties include information on the buttons, as well as the functions that should be run when certain events take place.
An object can be provided in place of a function in which case, `callback` will be bound with the same arguments supplied to the callback.
The callback is invoked upon addition of the extension, or, if svgicons are set, then after the icons are ready.
## Creating buttons
Buttons can appear either in the mode panel (left panel) or the context panel (top panel, changes depending on selection). Their icons can either consist of SVG icons (recommended) or just raster images.
@ -113,7 +117,6 @@ Most plugins will want to run functions when certain events are triggered. This
| `langChanged` | The language was changed | Two-letter code of the new language | None |
| `langReady` | Invoked as soon as the locale is ready | An object with properties "lang" containing the two-letter language code and "uiStrings" as an alias for svgEditor.uiStrings | None |
| `addlangData` | Means for an extension to add locale data | The two-letter language code | Object with "data" property set to an object containing two-letter language codes keyed to an array of objects with "id" and "title" or "textContent" properties |
| `callback` | Invoked upon addition of the extension, or, if svgicons are set, then after the icons are ready | None | None (IS THIS STILL PRESENT?) |
| `canvasUpdated` | Invoked upon updates to the canvas | Object with properties: new_x, new_y, old_x, old_y, d_x, d_y | None |
| `IDsUpdated` | When `pasteElements` called from paste action (context menu or key) | An object with `elems` array and `changes` object (mapping past ID (on attribute) to current ID) Object with `remove` array containing string IDs (used by `ext-connector.js`)
| `onNewDocument` | Called when new image is created | None | None |