|
| 1 | +# VS Code Draw.io Integration - plugins |
| 2 | + |
| 3 | +The plugins feature lets you load Draw.io plugins, just as you can by opening |
| 4 | +the online version of Draw.io with the `?p=svgdata` query parameter: |
| 5 | +<https://www.draw.io/?p=svgdata>. |
| 6 | + |
| 7 | +Draw.io has a list of [sample plugins](https://www.drawio.com/doc/faq/plugins) |
| 8 | +which can be copied, or you may create your own. |
| 9 | + |
| 10 | +## Enabling a plugin in the Draw.io Integration |
| 11 | + |
| 12 | +Plugins currently needs to be loaded from an absolute path in the Draw.io |
| 13 | +Integration extension. Thus for compatibility reasons (e.g., in a repository |
| 14 | +shared between multiple people), the plugin likely needs to be added to the |
| 15 | +workspace folder where your diagrams are located as well. To facilitate this, |
| 16 | +the path can be specified using the `${workspaceFolder}` variable, effectively |
| 17 | +allowing you to specify a relative path within your workspace. |
| 18 | + |
| 19 | +Plugins are added using the `hediet.vscode-drawio.plugins` configuration |
| 20 | +property. Adding this to the workspace settings makes sure that the plugin is |
| 21 | +automatically loaded for anyone that edits Draw.io files inside this workspace. |
| 22 | + |
| 23 | +Example: |
| 24 | + |
| 25 | +1. Download the Draw.io sample plugin `svgdata.js`, and place it in the root of |
| 26 | + the workspace. |
| 27 | + |
| 28 | +1. Add the following to the workspace settings: |
| 29 | + |
| 30 | + ```json |
| 31 | + "hediet.vscode-drawio.plugins": [ |
| 32 | + { |
| 33 | + "file": "${workspaceFolder}/svgdata.js" |
| 34 | + } |
| 35 | + ], |
| 36 | + ``` |
| 37 | + |
| 38 | +1. Open any Draw.io file |
| 39 | + |
| 40 | +1. Accept or deny loading of the plugin |
| 41 | + |
| 42 | + If this is the first time after adding the plugin definition, or if the |
| 43 | + plugin was changed, then the Draw.io Integration will show you a dialogue |
| 44 | + box, asking you to allow or disallow loading of the given plugin. |
| 45 | + |
| 46 | + What ever action you choose, is written to the |
| 47 | + `hediet.vscode-drawio.knownPlugins` property, in the user settings (scope) |
| 48 | + by the Draw.io Integration extension. |
| 49 | + |
| 50 | + Your decision is explicitly only read and written to the user scope, to |
| 51 | + ensure that a redistributed workspace can't load a plugin without you |
| 52 | + previously having accepted the specific version of a plugin (determined |
| 53 | + through the hash of the file). |
| 54 | + |
| 55 | + Example: |
| 56 | + |
| 57 | + ```json |
| 58 | + "hediet.vscode-drawio.knownPlugins": [ |
| 59 | + { |
| 60 | + "pluginId": "file:///full/path/to/workspace/svgdata.js", |
| 61 | + "fingerprint": "<sha256>", |
| 62 | + "allowed": true // or false if you disallowed it |
| 63 | + } |
| 64 | + ], |
| 65 | + ``` |
0 commit comments