1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Fixing doc

This commit is contained in:
Laurent Cozic
2020-10-09 19:04:18 +01:00
parent b706217d41
commit 7cb55ffdc4
71 changed files with 140 additions and 2027 deletions

View File

@@ -25,7 +25,7 @@ The `src/` directory also contains a [manifest.json](https://github.com/laurent2
## Building the plugin
The file `src/index.ts` already contain some basic code meant for testing the plugin. In particular it contains a call to [joplin.plugins.register](https://joplinapp.org/plugins/api/classes/joplinplugins.html), which all plugins should call to register the plugin. And an `onStart()` event handler, which will be executed by Joplin when the plugin starts.
The file `src/index.ts` already contain some basic code meant for testing the plugin. In particular it contains a call to [joplin.plugins.register](https://joplinapp.org/plugin/api/classes/joplinplugins.html), which all plugins should call to register the plugin. And an `onStart()` event handler, which will be executed by Joplin when the plugin starts.
To try this basic plugin, compile the app by running the following from the root of the project:
@@ -44,4 +44,4 @@ Restart the app, and Joplin should load the plugin and execute its `onStart` han
# Next steps
- You might want to check the [plugin tutorial](https://github.com/laurent22/joplin/blob/dev/readme/api/tutorials/toc_plugin/) to get a good overview of how to create a complete plugin and how to use the plugin API.
- For more information about the plugin API, check the [Plugin API reference](https://joplinapp.org/plugins/api/classes/joplin.html).
- For more information about the plugin API, check the [Plugin API reference](https://joplinapp.org/plugin/api/classes/joplin.html).

View File

@@ -6,7 +6,7 @@ The two main extension points are:
- The [data API](https://github.com/laurent22/joplin/blob/dev/readme/api/references/rest_api.md), which is a server that provides access to Joplin data to external applications. It is possible, using standard HTTP calls, to create, modify or delete notes, notebooks, tags, etc. as well as attach files to notes and retrieve these files. This is for example how the web clipper communicates with Joplin.
- The [plugin API](https://joplinapp.org/plugins/api/classes/joplin.html), which allows directly modifying Joplin by adding new features to the application. Using this API, you can:
- The [plugin API](https://joplinapp.org/plugin/api/classes/joplin.html), which allows directly modifying Joplin by adding new features to the application. Using this API, you can:
- Access notes, folders, etc. via the data API
- Add a view to display custom data using HTML/CSS/JS
- Create a dialog to display information and get input from the user

View File

@@ -14,7 +14,7 @@ Before getting any further, make sure your environment is setup correctly as des
## Registering the plugin
All plugins must [register themselves](https://joplinapp.org/plugins/api/classes/joplinplugins.html) and declare what events they can handle. To do so, open `src/index.ts` and register the plugin as below. We'll also need to run some initialisation code when the plugin starts, so add the `onStart()` event handler too:
All plugins must [register themselves](https://joplinapp.org/plugin/api/classes/joplinplugins.html) and declare what events they can handle. To do so, open `src/index.ts` and register the plugin as below. We'll also need to run some initialisation code when the plugin starts, so add the `onStart()` event handler too:
```typescript
// Import the Joplin API
@@ -37,7 +37,7 @@ If you now build the plugin and try to run it in Joplin, you should see the mess
## Getting the current note
In order to create the table of content, you will need to access the content of the currently selected note, and you will need to refresh the TOC every time the note changes. All this can be done using the [workspace API](https://joplinapp.org/plugins/api/classes/joplinworkspace.html), which provides information about the active content being edited.
In order to create the table of content, you will need to access the content of the currently selected note, and you will need to refresh the TOC every time the note changes. All this can be done using the [workspace API](https://joplinapp.org/plugin/api/classes/joplinworkspace.html), which provides information about the active content being edited.
So within the `onStart()` event handler, add the following:
@@ -162,7 +162,7 @@ Again try to run the plugin and if you select a note with multiple headers, you
## Creating a webview
In order to display the TOC in Joplin, you will need a [webview panel](https://joplinapp.org/plugins/api/classes/joplinviewspanels.html). Panels are a simple way to add custom content to the UI using HTML/CSS and JavaScript. First you would create the panel object and get back a view handler. Using this handler, you can set various properties such as the HTML content.
In order to display the TOC in Joplin, you will need a [webview panel](https://joplinapp.org/plugin/api/classes/joplinviewspanels.html). Panels are a simple way to add custom content to the UI using HTML/CSS and JavaScript. First you would create the panel object and get back a view handler. Using this handler, you can set various properties such as the HTML content.
Here's how it could be done:
@@ -338,4 +338,4 @@ And that's it! If you run this code you should now have a fully functional TOC.
https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc/
Various improvements can be made such as improving the styling, making the header collapsible, etc. but that tutorial should provide the basic building blocks to do so. You might also want to check the [plugin API](https://joplinapp.org/plugins/api/classes/joplin.html) for further information or head to the [development forum](https://discourse.joplinapp.org/c/development/6) for support.
Various improvements can be made such as improving the styling, making the header collapsible, etc. but that tutorial should provide the basic building blocks to do so. You might also want to check the [plugin API](https://joplinapp.org/plugin/api/classes/joplin.html) for further information or head to the [development forum](https://discourse.joplinapp.org/c/development/6) for support.