You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Update website
This commit is contained in:
@@ -67,21 +67,25 @@
|
||||
<section class="tsd-panel tsd-comment">
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>This class allows executing or registering new Joplin commands. Commands can be executed or associated with
|
||||
<a href="joplinviewstoolbarbuttons.html">toolbar buttons</a> or <a href="joplinviewsmenuitems.html">menu items</a>.</p>
|
||||
<p>This class allows executing or registering new Joplin commands. Commands
|
||||
can be executed or associated with
|
||||
<a href="joplinviewstoolbarbuttons.html">toolbar buttons</a> or
|
||||
<a href="joplinviewsmenuitems.html">menu items</a>.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
<a href="#executing-joplin39s-internal-commands" id="executing-joplin39s-internal-commands" style="color: inherit; text-decoration: none;">
|
||||
<h2>Executing Joplin's internal commands</h2>
|
||||
</a>
|
||||
<p>It is also possible to execute internal Joplin's commands which, as of now, are not well documented.
|
||||
You can find the list directly on GitHub though at the following locations:</p>
|
||||
<p>It is also possible to execute internal Joplin's commands which, as of
|
||||
now, are not well documented. You can find the list directly on GitHub
|
||||
though at the following locations:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/MainScreen/commands">Main screen commands</a></li>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/ElectronClient/commands">Global commands</a></li>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.ts">Editor commands</a></li>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands">Main screen commands</a></li>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands">Global commands</a></li>
|
||||
<li><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts">Editor commands</a></li>
|
||||
</ul>
|
||||
<p>To view what arguments are supported, you can open any of these files and look at the <code>execute()</code> command.</p>
|
||||
<p>To view what arguments are supported, you can open any of these files
|
||||
and look at the <code>execute()</code> command.</p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
@@ -124,9 +128,14 @@
|
||||
</aside>
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p><span class="platform-desktop">desktop</span> Executes the given command.
|
||||
The <code>props</code> are the arguments passed to the command, and they vary based on the command</p>
|
||||
<p><span class="platform-desktop">desktop</span> Executes the given
|
||||
command.</p>
|
||||
</div>
|
||||
<p>The command can take any number of arguments, and the supported
|
||||
arguments will vary based on the command. For custom commands, this
|
||||
is the <code>args</code> passed to the <code>execute()</code> function. For built-in
|
||||
commands, you can find the supported arguments by checking the links
|
||||
above.</p>
|
||||
<pre><code class="language-typescript"><span class="hljs-comment">// Create a new note in the current notebook:</span>
|
||||
<span class="hljs-keyword">await</span> joplin.commands.execute(<span class="hljs-string">'newNote'</span>);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
or to update them or delete them.</p>
|
||||
</div>
|
||||
<p>This is also what you would use to search notes, via the <code>search</code> endpoint.</p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/simple">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/simple">View the demo plugin</a></p>
|
||||
<p>In general you would use the methods in this class as if you were using a REST API. There are four methods that map to GET, POST, PUT and DELETE calls.
|
||||
And each method takes these parameters:</p>
|
||||
<ul>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="lead">
|
||||
<p>Provides a way to create modules to import external data into Joplin or to export notes into any arbitrary format.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export">View the demo plugin</a></p>
|
||||
<p>To implement an import or export module, you would simply define an object with various event handlers that are called
|
||||
by the application during the import/export process.</p>
|
||||
<p>See the documentation of the <a href="../interfaces/exportmodule.html">ExportModule</a> and <a href="../interfaces/importmodule.html">ImportModule</a> for more information.</p>
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
</div>
|
||||
<p>Note that registering a content script in itself will do nothing - it will only be loaded in specific cases by the relevant app modules
|
||||
(eg. the Markdown renderer or the code editor). So it is not a way to inject and run arbitrary code in the app, which for safety and performance reasons is not supported.</p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/content_script">View the demo plugin</a></p>
|
||||
</div>
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
<p>Settings are essentially key/value pairs.</p>
|
||||
<p>Note: Currently this API does <strong>not</strong> provide access to Joplin's built-in settings. This is by design as plugins that modify user settings could give unexpected results</p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/settings">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/settings">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
@@ -124,7 +124,7 @@
|
||||
<p>Gets a global setting value, including app-specific settings and those set by other plugins.</p>
|
||||
</div>
|
||||
<p>The list of available settings is not documented yet, but can be found by looking at the source code:</p>
|
||||
<p><a href="https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/ReactNativeClient/lib/models/Setting.ts#L142">https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/ReactNativeClient/lib/models/Setting.ts#L142</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/packages/app-mobile/lib/models/Setting.ts#L142">https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/packages/app-mobile/lib/models/Setting.ts#L142</a></p>
|
||||
</div>
|
||||
<h4 class="tsd-parameters-title">Parameters</h4>
|
||||
<ul class="tsd-parameters">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
Dialogs are hidden by default and you need to call <code>open()</code> to open them. Once the user clicks on a button, the <code>open</code> call will return and provide the button ID that was
|
||||
clicked on. There is currently no "close" method since the dialog should be thought as a modal one and thus can only be closed by clicking on one of the buttons.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/dialog">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/dialog">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="lead">
|
||||
<p>Allows creating and managing menu items.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="lead">
|
||||
<p>Allows creating menus.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/menu">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/menu">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<p>Allows creating and managing view panels. View panels currently are displayed at the right of the sidebar and allows displaying any HTML content (within a webview) and update it in real-time. For example
|
||||
it could be used to display a table of content for the active note, or display various metadata or graph.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<div class="lead">
|
||||
<p>Allows creating and managing toolbar buttons.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<p>The workspace service provides access to all the parts of Joplin that are being worked on - i.e. the currently selected notes or notebooks as well
|
||||
as various related events, such as when a new note is selected, or when the note content changes.</p>
|
||||
</div>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins">View the demo plugin</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins">View the demo plugin</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
@@ -112,9 +112,9 @@
|
||||
<ul>
|
||||
<li><p>The <code>context</code> argument is currently unused but could be used later on to provide access to your own plugin so that the content script and plugin can communicate.</p>
|
||||
</li>
|
||||
<li><p>The <strong>required</strong> <code>plugin</code> key is the actual Markdown-It plugin - check the <a href="https://github.com/markdown-it/markdown-it">official doc</a> for more information. The <code>options</code> parameter is of type <a href="https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts">RuleOptions</a>, which contains a number of options, mostly useful for Joplin's internal code.</p>
|
||||
<li><p>The <strong>required</strong> <code>plugin</code> key is the actual Markdown-It plugin - check the <a href="https://github.com/markdown-it/markdown-it">official doc</a> for more information. The <code>options</code> parameter is of type <a href="https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml.ts">RuleOptions</a>, which contains a number of options, mostly useful for Joplin's internal code.</p>
|
||||
</li>
|
||||
<li><p>Using the <strong>optional</strong> <code>assets</code> key you may specify assets such as JS or CSS that should be loaded in the rendered HTML document. Check for example the Joplin <a href="https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts">Mermaid plugin</a> to see how the data should be structured.</p>
|
||||
<li><p>Using the <strong>optional</strong> <code>assets</code> key you may specify assets such as JS or CSS that should be loaded in the rendered HTML document. Check for example the Joplin <a href="https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml/rules/mermaid.ts">Mermaid plugin</a> to see how the data should be structured.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>To include a regular Markdown-It plugin, that doesn't make use of any Joplin-specific features, you would simply create a file such as this:</p>
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
<td>"oneNoteSelected && !inConflictFolder"</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<p>Currently the supported context variables aren't documented, but you can <a href="https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/services/commands/stateToWhenClauseContext.ts">find the list here</a>.</p>
|
||||
<p>Currently the supported context variables aren't documented, but you can <a href="https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/services/commands/stateToWhenClauseContext.ts">find the list here</a>.</p>
|
||||
<p>Note: Commands are enabled by default unless you use this property.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<section class="tsd-panel tsd-comment">
|
||||
<div class="tsd-comment tsd-typography">
|
||||
<div class="lead">
|
||||
<p>Used to implement a module to export data from Joplin. <a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export">View the demo plugin</a> for an example.</p>
|
||||
<p>Used to implement a module to export data from Joplin. <a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export">View the demo plugin</a> for an example.</p>
|
||||
</div>
|
||||
<p>In general, all the event handlers you'll need to implement take a <code>context</code> object as a first argument. This object will contain the export or import path as well as various optional properties, such as which notes or notebooks need to be exported.</p>
|
||||
<p>To get a better sense of what it will contain it can be useful to print it using <code>console.info(context)</code>.</p>
|
||||
|
||||
@@ -663,7 +663,7 @@ document.addEventListener('click', event => {
|
||||
// ...
|
||||
</code></pre>
|
||||
<p>And that's it! If you run this code you should now have a fully functional TOC. The full source code is available there:</p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc/">https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc/</a></p>
|
||||
<p><a href="https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc/">https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc/</a></p>
|
||||
<p>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 <a href="https://joplinapp.org/api/references/plugin_api/classes/joplin.html">plugin API</a> for further information or head to the <a href="https://discourse.joplinapp.org/c/development/6">development forum</a> for support.</p>
|
||||
|
||||
<div class="bottom-links">
|
||||
|
||||
Reference in New Issue
Block a user