1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00
This commit is contained in:
Laurent Cozic 2020-11-14 00:21:16 +00:00
commit a3286a9896
308 changed files with 14709 additions and 2097 deletions

View File

@ -208,6 +208,15 @@ packages/app-cli/tests/support/plugins/dialog/api/types.js.map
packages/app-cli/tests/support/plugins/dialog/src/index.d.ts
packages/app-cli/tests/support/plugins/dialog/src/index.js
packages/app-cli/tests/support/plugins/dialog/src/index.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.js
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.js
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.js
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.js.map
packages/app-cli/tests/support/plugins/events/api/index.d.ts
packages/app-cli/tests/support/plugins/events/api/index.js
packages/app-cli/tests/support/plugins/events/api/index.js.map
@ -433,6 +442,9 @@ packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.js.map
packages/app-desktop/gui/MainScreen/commands/toggleEditors.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js.map
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js.map
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js.map
@ -496,9 +508,9 @@ packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js.map
@ -580,6 +592,9 @@ packages/app-desktop/gui/NoteListControls/commands/focusSearch.js.map
packages/app-desktop/gui/NoteListItem.d.ts
packages/app-desktop/gui/NoteListItem.js
packages/app-desktop/gui/NoteListItem.js.map
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.d.ts
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.js
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.js.map
packages/app-desktop/gui/NoteTextViewer.d.ts
packages/app-desktop/gui/NoteTextViewer.js
packages/app-desktop/gui/NoteTextViewer.js.map
@ -589,15 +604,60 @@ packages/app-desktop/gui/NoteToolbar/NoteToolbar.js.map
packages/app-desktop/gui/OneDriveLoginScreen.d.ts
packages/app-desktop/gui/OneDriveLoginScreen.js
packages/app-desktop/gui/OneDriveLoginScreen.js.map
packages/app-desktop/gui/ResizableLayout/MoveButtons.d.ts
packages/app-desktop/gui/ResizableLayout/MoveButtons.js
packages/app-desktop/gui/ResizableLayout/MoveButtons.js.map
packages/app-desktop/gui/ResizableLayout/ResizableLayout.d.ts
packages/app-desktop/gui/ResizableLayout/ResizableLayout.js
packages/app-desktop/gui/ResizableLayout/ResizableLayout.js.map
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.d.ts
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.js
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.js.map
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.d.ts
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.js
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.js.map
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.d.ts
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.js
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.js.map
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.d.ts
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.js
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.js.map
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.d.ts
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.js
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.js.map
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.d.ts
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.js
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.js.map
packages/app-desktop/gui/ResizableLayout/utils/movements.d.ts
packages/app-desktop/gui/ResizableLayout/utils/movements.js
packages/app-desktop/gui/ResizableLayout/utils/movements.js.map
packages/app-desktop/gui/ResizableLayout/utils/movements.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/movements.test.js
packages/app-desktop/gui/ResizableLayout/utils/movements.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/persist.d.ts
packages/app-desktop/gui/ResizableLayout/utils/persist.js
packages/app-desktop/gui/ResizableLayout/utils/persist.js.map
packages/app-desktop/gui/ResizableLayout/utils/persist.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/persist.test.js
packages/app-desktop/gui/ResizableLayout/utils/persist.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/removeItem.d.ts
packages/app-desktop/gui/ResizableLayout/utils/removeItem.js
packages/app-desktop/gui/ResizableLayout/utils/removeItem.js.map
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.d.ts
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.js
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.js.map
packages/app-desktop/gui/ResizableLayout/utils/style.d.ts
packages/app-desktop/gui/ResizableLayout/utils/style.js
packages/app-desktop/gui/ResizableLayout/utils/style.js.map
packages/app-desktop/gui/ResizableLayout/utils/types.d.ts
packages/app-desktop/gui/ResizableLayout/utils/types.js
packages/app-desktop/gui/ResizableLayout/utils/types.js.map
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.js
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.js.map
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.js
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.js
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.js.map
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.d.ts
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.js
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.js.map
packages/app-desktop/gui/ResourceScreen.d.ts
packages/app-desktop/gui/ResourceScreen.js
packages/app-desktop/gui/ResourceScreen.js.map
@ -676,6 +736,9 @@ packages/app-desktop/plugins/GotoAnything.js.map
packages/app-desktop/services/bridge.d.ts
packages/app-desktop/services/bridge.js
packages/app-desktop/services/bridge.js.map
packages/app-desktop/services/commands/stateToWhenClauseContext.d.ts
packages/app-desktop/services/commands/stateToWhenClauseContext.js
packages/app-desktop/services/commands/stateToWhenClauseContext.js.map
packages/app-desktop/services/commands/types.d.ts
packages/app-desktop/services/commands/types.js
packages/app-desktop/services/commands/types.js.map
@ -1144,9 +1207,6 @@ packages/lib/services/rest/utils/requestFields.js.map
packages/lib/services/rest/utils/requestPaginationOptions.d.ts
packages/lib/services/rest/utils/requestPaginationOptions.js
packages/lib/services/rest/utils/requestPaginationOptions.js.map
packages/lib/services/rest/utils/types.d.ts
packages/lib/services/rest/utils/types.js
packages/lib/services/rest/utils/types.js.map
packages/lib/services/searchengine/filterParser.d.ts
packages/lib/services/searchengine/filterParser.js
packages/lib/services/searchengine/filterParser.js.map

View File

@ -25,6 +25,9 @@ module.exports = {
'afterEach': 'readonly',
'jasmine': 'readonly',
// Jest variables
'test': 'readonly',
// React Native variables
'__DEV__': 'readonly',

84
.gitignore vendored
View File

@ -200,6 +200,15 @@ packages/app-cli/tests/support/plugins/dialog/api/types.js.map
packages/app-cli/tests/support/plugins/dialog/src/index.d.ts
packages/app-cli/tests/support/plugins/dialog/src/index.js
packages/app-cli/tests/support/plugins/dialog/src/index.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.js
packages/app-cli/tests/support/plugins/editor_context_menu/api/index.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.js
packages/app-cli/tests/support/plugins/editor_context_menu/api/types.js.map
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.d.ts
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.js
packages/app-cli/tests/support/plugins/editor_context_menu/src/index.js.map
packages/app-cli/tests/support/plugins/events/api/index.d.ts
packages/app-cli/tests/support/plugins/events/api/index.js
packages/app-cli/tests/support/plugins/events/api/index.js.map
@ -425,6 +434,9 @@ packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.js.map
packages/app-desktop/gui/MainScreen/commands/toggleEditors.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js.map
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js.map
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.d.ts
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js.map
@ -488,9 +500,9 @@ packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupContextMenu.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js.map
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.d.ts
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js.map
@ -572,6 +584,9 @@ packages/app-desktop/gui/NoteListControls/commands/focusSearch.js.map
packages/app-desktop/gui/NoteListItem.d.ts
packages/app-desktop/gui/NoteListItem.js
packages/app-desktop/gui/NoteListItem.js.map
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.d.ts
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.js
packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.js.map
packages/app-desktop/gui/NoteTextViewer.d.ts
packages/app-desktop/gui/NoteTextViewer.js
packages/app-desktop/gui/NoteTextViewer.js.map
@ -581,15 +596,60 @@ packages/app-desktop/gui/NoteToolbar/NoteToolbar.js.map
packages/app-desktop/gui/OneDriveLoginScreen.d.ts
packages/app-desktop/gui/OneDriveLoginScreen.js
packages/app-desktop/gui/OneDriveLoginScreen.js.map
packages/app-desktop/gui/ResizableLayout/MoveButtons.d.ts
packages/app-desktop/gui/ResizableLayout/MoveButtons.js
packages/app-desktop/gui/ResizableLayout/MoveButtons.js.map
packages/app-desktop/gui/ResizableLayout/ResizableLayout.d.ts
packages/app-desktop/gui/ResizableLayout/ResizableLayout.js
packages/app-desktop/gui/ResizableLayout/ResizableLayout.js.map
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.d.ts
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.js
packages/app-desktop/gui/ResizableLayout/hooks/useLayoutItemSizes.js.map
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.d.ts
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.js
packages/app-desktop/gui/ResizableLayout/hooks/useWindowResizeEvent.js.map
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.d.ts
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.js
packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.js.map
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.d.ts
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.js
packages/app-desktop/gui/ResizableLayout/utils/isTempContainer.js.map
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.d.ts
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.js
packages/app-desktop/gui/ResizableLayout/utils/iterateItems.js.map
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.d.ts
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.js
packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.js.map
packages/app-desktop/gui/ResizableLayout/utils/movements.d.ts
packages/app-desktop/gui/ResizableLayout/utils/movements.js
packages/app-desktop/gui/ResizableLayout/utils/movements.js.map
packages/app-desktop/gui/ResizableLayout/utils/movements.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/movements.test.js
packages/app-desktop/gui/ResizableLayout/utils/movements.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/persist.d.ts
packages/app-desktop/gui/ResizableLayout/utils/persist.js
packages/app-desktop/gui/ResizableLayout/utils/persist.js.map
packages/app-desktop/gui/ResizableLayout/utils/persist.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/persist.test.js
packages/app-desktop/gui/ResizableLayout/utils/persist.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/removeItem.d.ts
packages/app-desktop/gui/ResizableLayout/utils/removeItem.js
packages/app-desktop/gui/ResizableLayout/utils/removeItem.js.map
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.d.ts
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.js
packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.js.map
packages/app-desktop/gui/ResizableLayout/utils/style.d.ts
packages/app-desktop/gui/ResizableLayout/utils/style.js
packages/app-desktop/gui/ResizableLayout/utils/style.js.map
packages/app-desktop/gui/ResizableLayout/utils/types.d.ts
packages/app-desktop/gui/ResizableLayout/utils/types.js
packages/app-desktop/gui/ResizableLayout/utils/types.js.map
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.js
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.js.map
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.js
packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.test.js.map
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.d.ts
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.js
packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.js.map
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.d.ts
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.js
packages/app-desktop/gui/ResizableLayout/utils/validateLayout.js.map
packages/app-desktop/gui/ResourceScreen.d.ts
packages/app-desktop/gui/ResourceScreen.js
packages/app-desktop/gui/ResourceScreen.js.map
@ -668,6 +728,9 @@ packages/app-desktop/plugins/GotoAnything.js.map
packages/app-desktop/services/bridge.d.ts
packages/app-desktop/services/bridge.js
packages/app-desktop/services/bridge.js.map
packages/app-desktop/services/commands/stateToWhenClauseContext.d.ts
packages/app-desktop/services/commands/stateToWhenClauseContext.js
packages/app-desktop/services/commands/stateToWhenClauseContext.js.map
packages/app-desktop/services/commands/types.d.ts
packages/app-desktop/services/commands/types.js
packages/app-desktop/services/commands/types.js.map
@ -1136,9 +1199,6 @@ packages/lib/services/rest/utils/requestFields.js.map
packages/lib/services/rest/utils/requestPaginationOptions.d.ts
packages/lib/services/rest/utils/requestPaginationOptions.js
packages/lib/services/rest/utils/requestPaginationOptions.js.map
packages/lib/services/rest/utils/types.d.ts
packages/lib/services/rest/utils/types.js
packages/lib/services/rest/utils/types.js.map
packages/lib/services/searchengine/filterParser.d.ts
packages/lib/services/searchengine/filterParser.js
packages/lib/services/searchengine/filterParser.js.map

View File

@ -415,7 +415,7 @@ https://github.com/laurent22/joplin/blob/dev/readme/api/get_started/plugins.md
</code></pre>
<p>Doing so should compile all the files into the <code>dist/</code> directory. This is from here that Joplin will load the plugin.</p>
<h2>Testing the plugin<a name="testing-the-plugin" href="#testing-the-plugin" class="heading-anchor">🔗</a></h2>
<p>In order to test the plugin, you might want to run Joplin in <a href="https://github.com/laurent22/joplin/blob/dev/readme/api/references/development_mode/">Development Mode</a>. Doing so means that Joplin will run using a different profile, so you can experiment with the plugin without risking to accidentally change or delete your data.</p>
<p>In order to test the plugin, you might want to run Joplin in <a href="https://joplinapp.org/api/references/development_mode/">Development Mode</a>. Doing so means that Joplin will run using a different profile, so you can experiment with the plugin without risking to accidentally change or delete your data.</p>
<p>Finally, in order to test the plugin, open the Setting screen, then navigate the the <strong>Plugins</strong> section, and add the plugin path in the <strong>Development plugins</strong> text field. For example, if your plugin project path is <code>/home/user/src/joplin-plugin</code>, add this in the text field.</p>
<p>Restart the app, and Joplin should load the plugin and execute its <code>onStart</code> handler. If all went well you should see the test message in the plugin console: &quot;Test plugin started!&quot;.</p>
<h1>Next steps<a name="next-steps" href="#next-steps" class="heading-anchor">🔗</a></h1>

File diff suppressed because one or more lines are too long

View File

@ -69,6 +69,15 @@
<div class="lead">
<p>This is the main entry point to the Joplin API. You can access various services using the provided accessors.</p>
</div>
<p><strong>This is a beta API</strong></p>
<p>Please note that the plugin API is relatively new and should be considered Beta state. Besides possible bugs, what it means is that there might be necessary breaking changes from one version to the next. Whenever such change is needed, best effort will be done to:</p>
<ul>
<li>Maintain backward compatibility;</li>
<li>When possible, deprecate features instead of removing them;</li>
<li>Document breaking changes in the changelog;</li>
</ul>
<p>So if you are developing a plugin, please keep an eye on the changelog as everything will be in there with information about how to update your code. There won&#39;t be any major API rewrite or architecture changes, but possibly small tweaks like function signature change, type change, etc.</p>
<p>Eventually, the plugin API will be versioned to make this process smoother.</p>
</div>
</section>
<!--
@ -344,6 +353,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -291,6 +291,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -345,6 +345,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -244,6 +244,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -281,6 +281,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -372,6 +372,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -302,6 +302,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -68,8 +68,9 @@
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>Allows creating and managing dialogs. A dialog is modal window that contains a webview and a row of buttons. You can update the update the webview using the <code>setHtml</code> method.
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 &quot;close&quot; 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>
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 an object indicating what button was clicked
on. If your HTML content included one or more form, a <code>formData</code> object will also be included with the key/value for each form.
There is currently no &quot;close&quot; 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/packages/app-cli/tests/support/plugins/dialog">View the demo plugin</a></p>
</div>
@ -136,7 +137,7 @@
<a name="open" class="tsd-anchor"></a>
<h3>open</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">open<span class="tsd-signature-symbol">(</span>handle<span class="tsd-signature-symbol">: </span><a href="../globals.html#viewhandle" class="tsd-signature-type">ViewHandle</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../globals.html#buttonid" class="tsd-signature-type">ButtonId</a><span class="tsd-signature-symbol">&gt;</span></li>
<li class="tsd-signature tsd-kind-icon">open<span class="tsd-signature-symbol">(</span>handle<span class="tsd-signature-symbol">: </span><a href="../globals.html#viewhandle" class="tsd-signature-type">ViewHandle</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/dialogresult.html" class="tsd-signature-type">DialogResult</a><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
@ -154,7 +155,7 @@
</li>
</ul>
<!-- JOPLINCHANGE
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../globals.html#buttonid" class="tsd-signature-type">ButtonId</a><span class="tsd-signature-symbol">&gt;</span></h4>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/dialogresult.html" class="tsd-signature-type">DialogResult</a><span class="tsd-signature-symbol">&gt;</span></h4>
-->
@ -358,6 +359,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -230,6 +230,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -231,6 +231,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -327,6 +327,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -227,6 +227,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -378,6 +378,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -219,6 +219,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -186,6 +186,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -186,6 +186,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -241,6 +241,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -230,6 +230,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -196,6 +196,9 @@
<li class=" tsd-kind-interface">
<a href="../interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="../interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -100,6 +100,7 @@
<li class="tsd-kind-interface"><a href="interfaces/buttonspec.html" class="tsd-kind-icon">Button<wbr>Spec</a></li>
<li class="tsd-kind-interface"><a href="interfaces/command.html" class="tsd-kind-icon">Command</a></li>
<li class="tsd-kind-interface"><a href="interfaces/createmenuitemoptions.html" class="tsd-kind-icon">Create<wbr>Menu<wbr>Item<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/dialogresult.html" class="tsd-kind-icon">Dialog<wbr>Result</a></li>
<li class="tsd-kind-interface"><a href="interfaces/editorcommand.html" class="tsd-kind-icon">Editor<wbr>Command</a></li>
<li class="tsd-kind-interface"><a href="interfaces/exportcontext.html" class="tsd-kind-icon">Export<wbr>Context</a></li>
<li class="tsd-kind-interface"><a href="interfaces/exportmodule.html" class="tsd-kind-icon">Export<wbr>Module</a></li>
@ -234,6 +235,9 @@
<li class=" tsd-kind-interface">
<a href="interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -146,6 +146,9 @@
<li class=" tsd-kind-interface">
<a href="interfaces/createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -228,6 +228,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -318,6 +318,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -187,6 +187,9 @@
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -0,0 +1,272 @@
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>DialogResult | Joplin Plugin API Documentation</title>
<meta name="description" content="Documentation for Joplin Plugin API Documentation">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../classes/joplin.html" class="title">Joplin Plugin API Documentation</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<!--
<li>
<a href="../globals.html">Globals</a>
</li>
-->
<li>
<a href="dialogresult.html">DialogResult</a>
</li>
</ul>
<h1><!-- Interface -->DialogResult</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<!--
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">DialogResult</span>
</li>
</ul>
</section>
-->
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="dialogresult.html#formdata" class="tsd-kind-icon">form<wbr>Data</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="dialogresult.html#id" class="tsd-kind-icon">id</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="formdata" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> form<wbr>Data</h3>
<div class="tsd-signature tsd-kind-icon">form<wbr>Data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="id" class="tsd-anchor"></a>
<h3>id</h3>
<div class="tsd-signature tsd-kind-icon">id<span class="tsd-signature-symbol">:</span> <a href="../globals.html#buttonid" class="tsd-signature-type">ButtonId</a></div>
<aside class="tsd-sources">
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<!--
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
-->
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-enum">
<a href="../enums/contentscripttype.html" class="tsd-kind-icon">ContentScriptType</a>
</li>
<li class=" tsd-kind-enum">
<a href="../enums/filesystemitem.html" class="tsd-kind-icon">FileSystemItem</a>
</li>
<li class=" tsd-kind-enum">
<a href="../enums/importmoduleoutputformat.html" class="tsd-kind-icon">ImportModuleOutputFormat</a>
</li>
<li class=" tsd-kind-enum">
<a href="../enums/menuitemlocation.html" class="tsd-kind-icon">MenuItemLocation</a>
</li>
<li class=" tsd-kind-enum">
<a href="../enums/settingitemtype.html" class="tsd-kind-icon">SettingItemType</a>
</li>
<li class=" tsd-kind-enum">
<a href="../enums/toolbarbuttonlocation.html" class="tsd-kind-icon">ToolbarButtonLocation</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplin.html" class="tsd-kind-icon">joplin</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplincommands.html" class="tsd-kind-icon">joplin.commands</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplindata.html" class="tsd-kind-icon">joplin.data</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplininterop.html" class="tsd-kind-icon">joplin.interop</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinplugins.html" class="tsd-kind-icon">joplin.plugins</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinsettings.html" class="tsd-kind-icon">joplin.settings</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviews.html" class="tsd-kind-icon">joplin.views</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviewsdialogs.html" class="tsd-kind-icon">joplin.views.dialogs</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviewsmenuitems.html" class="tsd-kind-icon">joplin.views.menuItems</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviewsmenus.html" class="tsd-kind-icon">joplin.views.menus</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviewspanels.html" class="tsd-kind-icon">joplin.views.panels</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinviewstoolbarbuttons.html" class="tsd-kind-icon">joplin.views.toolbarButtons</a>
</li>
<li class=" tsd-kind-class">
<a href="../classes/joplinworkspace.html" class="tsd-kind-icon">joplin.workspace</a>
</li>
<li class=" tsd-kind-interface">
<a href="buttonspec.html" class="tsd-kind-icon">ButtonSpec</a>
</li>
<li class=" tsd-kind-interface">
<a href="command.html" class="tsd-kind-icon">Command</a>
</li>
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="dialogresult.html#formdata" class="tsd-kind-icon">form<wbr>Data</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="dialogresult.html#id" class="tsd-kind-icon">id</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>
<li class=" tsd-kind-interface">
<a href="exportcontext.html" class="tsd-kind-icon">ExportContext</a>
</li>
<li class=" tsd-kind-interface">
<a href="exportmodule.html" class="tsd-kind-icon">ExportModule</a>
</li>
<li class=" tsd-kind-interface">
<a href="exportoptions.html" class="tsd-kind-icon">ExportOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="importcontext.html" class="tsd-kind-icon">ImportContext</a>
</li>
<li class=" tsd-kind-interface">
<a href="importmodule.html" class="tsd-kind-icon">ImportModule</a>
</li>
<li class=" tsd-kind-interface">
<a href="menuitem.html" class="tsd-kind-icon">MenuItem</a>
</li>
<li class=" tsd-kind-interface">
<a href="script.html" class="tsd-kind-icon">Script</a>
</li>
<li class=" tsd-kind-interface">
<a href="settingitem.html" class="tsd-kind-icon">SettingItem</a>
</li>
<li class=" tsd-kind-interface">
<a href="settingsection.html" class="tsd-kind-icon">SettingSection</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../globals.html#buttonid" class="tsd-kind-icon">ButtonId</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../globals.html#path" class="tsd-kind-icon">Path</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="../globals.html#viewhandle" class="tsd-kind-icon">ViewHandle</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<!-- JOPLINCHANGE
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
-->
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>

View File

@ -186,6 +186,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface">

View File

@ -199,6 +199,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -386,6 +386,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -218,6 +218,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -194,6 +194,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -288,6 +288,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -223,6 +223,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -195,6 +195,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -282,6 +282,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -202,6 +202,9 @@
<li class=" tsd-kind-interface">
<a href="createmenuitemoptions.html" class="tsd-kind-icon">CreateMenuItemOptions</a>
</li>
<li class=" tsd-kind-interface">
<a href="dialogresult.html" class="tsd-kind-icon">DialogResult</a>
</li>
<li class=" tsd-kind-interface">
<a href="editorcommand.html" class="tsd-kind-icon">EditorCommand</a>
</li>

View File

@ -682,6 +682,16 @@ Details:
<td>Current date and/or time formatted based on a supplied string (using <a href="https://momentjs.com/">moment.js</a> formatting)</td>
<td><code>{{#custom_datetime}}M d{{/custom_datetime}}</code></td>
</tr>
<tr>
<td><code>{{bowm}}</code></td>
<td>Date of the beginning of the week (when week starts on Monday) based on the settings format</td>
<td></td>
</tr>
<tr>
<td><code>{{bows}}</code></td>
<td>Date of the beginning of the week (when week starts on Sunday) based on the settings format</td>
<td></td>
</tr>
</tbody>
</table>
<h1>Searching<a name="searching" href="#searching" class="heading-anchor">🔗</a></h1>

View File

@ -402,15 +402,15 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tbody>
<tr>
<td>Total Windows downloads</td>
<td>1,090,167</td>
<td>1,093,355</td>
</tr>
<tr>
<td>Total macOs downloads</td>
<td>422,857</td>
<td>424,314</td>
</tr>
<tr>
<td>Total Linux downloads</td>
<td>307,611</td>
<td>308,866</td>
</tr>
<tr>
<td>Windows %</td>
@ -441,114 +441,114 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.3.18">v1.3.18</a></td>
<td>2020-11-06T12:07:02Z</td>
<td>8,566</td>
<td>3,609</td>
<td>2,837</td>
<td>15,012</td>
<td>11,553</td>
<td>5,028</td>
<td>4,072</td>
<td>20,653</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.3.15">v1.3.15</a></td>
<td>2020-11-04T12:22:50Z</td>
<td>2,121</td>
<td>1,251</td>
<td>820</td>
<td>4,192</td>
<td>2,130</td>
<td>1,257</td>
<td>822</td>
<td>4,209</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.2.6">v1.2.6</a></td>
<td>2020-10-09T13:56:59Z</td>
<td>43,259</td>
<td>17,626</td>
<td>13,986</td>
<td>74,871</td>
<td>43,344</td>
<td>17,636</td>
<td>13,990</td>
<td>74,970</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.1.4">v1.1.4</a></td>
<td>2020-09-21T11:20:09Z</td>
<td>27,391</td>
<td>13,455</td>
<td>7,691</td>
<td>48,537</td>
<td>27,401</td>
<td>13,457</td>
<td>7,692</td>
<td>48,550</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.245">v1.0.245</a></td>
<td>2020-09-09T12:56:10Z</td>
<td>20,762</td>
<td>9,957</td>
<td>20,766</td>
<td>9,959</td>
<td>5,617</td>
<td>36,336</td>
<td>36,342</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.242">v1.0.242</a></td>
<td>2020-09-04T22:00:34Z</td>
<td>12,299</td>
<td>6,393</td>
<td>3,003</td>
<td>21,695</td>
<td>3,004</td>
<td>21,696</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.241">v1.0.241</a></td>
<td>2020-09-04T18:06:00Z</td>
<td>23,064</td>
<td>23,066</td>
<td>5,684</td>
<td>4,959</td>
<td>33,707</td>
<td>33,709</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.233">v1.0.233</a></td>
<td>2020-08-01T14:51:15Z</td>
<td>42,160</td>
<td>18,145</td>
<td>42,177</td>
<td>18,149</td>
<td>12,344</td>
<td>72,649</td>
<td>72,670</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.227">v1.0.227</a></td>
<td>2020-07-07T20:44:54Z</td>
<td>40,128</td>
<td>15,234</td>
<td>40,132</td>
<td>15,235</td>
<td>9,610</td>
<td>64,972</td>
<td>64,977</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.224">v1.0.224</a></td>
<td>2020-06-20T22:26:08Z</td>
<td>24,702</td>
<td>10,975</td>
<td>24,705</td>
<td>10,976</td>
<td>5,999</td>
<td>41,676</td>
<td>41,680</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.220">v1.0.220</a></td>
<td>2020-06-13T18:26:22Z</td>
<td>31,505</td>
<td>31,507</td>
<td>9,887</td>
<td>6,407</td>
<td>47,799</td>
<td>47,801</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.218">v1.0.218</a></td>
<td>2020-06-07T10:43:34Z</td>
<td>14,480</td>
<td>14,485</td>
<td>6,946</td>
<td>2,950</td>
<td>24,376</td>
<td>24,381</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.216">v1.0.216</a></td>
<td>2020-05-24T14:21:01Z</td>
<td>36,322</td>
<td>14,233</td>
<td>36,341</td>
<td>14,235</td>
<td>10,169</td>
<td>60,724</td>
<td>60,745</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.201">v1.0.201</a></td>
<td>2020-04-15T22:55:13Z</td>
<td>52,335</td>
<td>52,351</td>
<td>20,032</td>
<td>18,167</td>
<td>90,534</td>
<td>90,550</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.200">v1.0.200</a></td>
@ -561,34 +561,34 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.199">v1.0.199</a></td>
<td>2020-04-10T18:41:58Z</td>
<td>19,236</td>
<td>19,237</td>
<td>5,878</td>
<td>3,783</td>
<td>28,897</td>
<td>28,898</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.197">v1.0.197</a></td>
<td>2020-03-30T17:21:22Z</td>
<td>22,059</td>
<td>22,061</td>
<td>9,506</td>
<td>5,608</td>
<td>37,173</td>
<td>5,610</td>
<td>37,177</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.195">v1.0.195</a></td>
<td>2020-03-22T19:56:12Z</td>
<td>18,860</td>
<td>7,941</td>
<td>7,942</td>
<td>4,502</td>
<td>31,303</td>
<td>31,304</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.193">v1.0.193</a></td>
<td>2020-03-08T08:58:53Z</td>
<td>28,593</td>
<td>10,894</td>
<td>28,594</td>
<td>10,895</td>
<td>7,356</td>
<td>46,843</td>
<td>46,845</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.179">v1.0.179</a></td>
@ -609,58 +609,58 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.175">v1.0.175</a></td>
<td>2019-12-08T11:48:47Z</td>
<td>71,972</td>
<td>71,976</td>
<td>16,855</td>
<td>16,475</td>
<td>105,302</td>
<td>16,476</td>
<td>105,307</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.174">v1.0.174</a></td>
<td>2019-11-12T18:20:58Z</td>
<td>30,387</td>
<td>11,687</td>
<td>30,388</td>
<td>11,688</td>
<td>8,216</td>
<td>50,290</td>
<td>50,292</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.173">v1.0.173</a></td>
<td>2019-11-11T08:33:35Z</td>
<td>5,057</td>
<td>5,058</td>
<td>2,071</td>
<td>739</td>
<td>7,867</td>
<td>7,868</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.170">v1.0.170</a></td>
<td>2019-10-13T22:13:04Z</td>
<td>27,369</td>
<td>27,372</td>
<td>8,737</td>
<td>7,668</td>
<td>43,774</td>
<td>43,777</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.169">v1.0.169</a></td>
<td>2019-09-27T18:35:13Z</td>
<td>17,080</td>
<td>17,081</td>
<td>5,915</td>
<td>3,750</td>
<td>26,745</td>
<td>26,746</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.168">v1.0.168</a></td>
<td>2019-09-25T21:21:38Z</td>
<td>5,322</td>
<td>5,323</td>
<td>2,265</td>
<td>714</td>
<td>8,301</td>
<td>8,302</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.167">v1.0.167</a></td>
<td>2019-09-10T08:48:37Z</td>
<td>16,778</td>
<td>5,698</td>
<td>16,779</td>
<td>5,699</td>
<td>3,700</td>
<td>26,176</td>
<td>26,178</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.166">v1.0.166</a></td>
@ -683,16 +683,16 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td>2019-07-13T18:30:00Z</td>
<td>19,272</td>
<td>6,348</td>
<td>4,132</td>
<td>29,752</td>
<td>4,133</td>
<td>29,753</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.160">v1.0.160</a></td>
<td>2019-06-15T00:21:40Z</td>
<td>30,455</td>
<td>7,741</td>
<td>30,457</td>
<td>7,742</td>
<td>8,098</td>
<td>46,294</td>
<td>46,297</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.159">v1.0.159</a></td>
@ -730,25 +730,25 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.151">v1.0.151</a></td>
<td>2019-05-12T15:14:32Z</td>
<td>1,948</td>
<td>529</td>
<td>530</td>
<td>955</td>
<td>3,432</td>
<td>3,433</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.150">v1.0.150</a></td>
<td>2019-05-12T11:27:48Z</td>
<td>417</td>
<td>128</td>
<td>418</td>
<td>129</td>
<td>66</td>
<td>611</td>
<td>613</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.145">v1.0.145</a></td>
<td>2019-05-03T09:16:53Z</td>
<td>6,998</td>
<td>7,000</td>
<td>2,857</td>
<td>1,434</td>
<td>11,289</td>
<td>11,291</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.143">v1.0.143</a></td>
@ -777,18 +777,18 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.135">v1.0.135</a></td>
<td>2019-02-27T23:36:57Z</td>
<td>12,483</td>
<td>12,484</td>
<td>3,953</td>
<td>4,072</td>
<td>20,508</td>
<td>20,509</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.134">v1.0.134</a></td>
<td>2019-02-27T10:21:44Z</td>
<td>1,462</td>
<td>1,463</td>
<td>563</td>
<td>217</td>
<td>2,242</td>
<td>2,243</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.132">v1.0.132</a></td>
@ -803,8 +803,8 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td>2019-02-14T23:12:48Z</td>
<td>9,734</td>
<td>3,164</td>
<td>2,927</td>
<td>15,825</td>
<td>2,928</td>
<td>15,826</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.125">v1.0.125</a></td>
@ -825,10 +825,10 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.119">v1.0.119</a></td>
<td>2018-12-18T12:40:22Z</td>
<td>8,901</td>
<td>8,902</td>
<td>3,257</td>
<td>2,013</td>
<td>14,171</td>
<td>14,172</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.118">v1.0.118</a></td>
@ -874,9 +874,9 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.111">v1.0.111</a></td>
<td>2018-09-30T20:15:09Z</td>
<td>12,007</td>
<td>3,285</td>
<td>3,286</td>
<td>3,663</td>
<td>18,955</td>
<td>18,956</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.110">v1.0.110</a></td>
@ -915,8 +915,8 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td>2018-09-05T11:29:36Z</td>
<td>4,652</td>
<td>1,585</td>
<td>1,452</td>
<td>7,689</td>
<td>1,453</td>
<td>7,690</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.104">v1.0.104</a></td>
@ -938,9 +938,9 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.101">v1.0.101</a></td>
<td>2018-06-17T18:35:11Z</td>
<td>1,304</td>
<td>603</td>
<td>604</td>
<td>407</td>
<td>2,314</td>
<td>2,315</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.100">v1.0.100</a></td>
@ -971,8 +971,8 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td>2018-05-26T16:36:39Z</td>
<td>2,715</td>
<td>1,221</td>
<td>1,602</td>
<td>5,538</td>
<td>1,606</td>
<td>5,542</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v1.0.95">v1.0.95</a></td>
@ -1179,8 +1179,8 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<td>2018-01-23T11:19:51Z</td>
<td>1,964</td>
<td>1,750</td>
<td>29</td>
<td>3,743</td>
<td>30</td>
<td>3,744</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v0.10.47">v0.10.47</a></td>
@ -1217,10 +1217,10 @@ https://github.com/laurent22/joplin/blob/dev/readme/stats.md
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v0.10.39">v0.10.39</a></td>
<td>2017-12-11T21:19:44Z</td>
<td>5,783</td>
<td>4,256</td>
<td>3,158</td>
<td>13,197</td>
<td>5,784</td>
<td>4,257</td>
<td>3,159</td>
<td>13,200</td>
</tr>
<tr>
<td><a href="https://github.com/laurent22/joplin/releases/tag/v0.10.38">v0.10.38</a></td>

View File

@ -8,6 +8,7 @@
"files.exclude": {
"lerna-debug.log": true,
"_mydocs/mdtest/": true,
"./packages/lib/plugin_types": true,
"_releases/": true,
"_vieux/": true,
".gitignore": true,

View File

@ -14,7 +14,6 @@
"buildWebsite": "npm run buildApiDoc && node ./packages/tools/build-website.js && npm run buildPluginDoc",
"clean": "lerna clean -y && lerna run clean",
"generateDatabaseTypes": "node packages/tools/generate-database-types",
"generatePluginTypes": "rm -rf ./plugin_types && node node_modules/typescript/bin/tsc --declaration --declarationDir ./plugin_types --project tsconfig.json",
"linkChecker": "linkchecker https://joplinapp.org",
"linter-ci": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-precommit": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --fix --ext .js --ext .jsx --ext .ts --ext .tsx",

View File

@ -9,7 +9,8 @@ module.exports = {
],
testPathIgnorePatterns: [
'/node_modules/',
'tests/support/',
'/tests\\/support/',
'/build/',
'test-utils.js',
'file_api_driver.js',
],

View File

@ -1,6 +1,7 @@
import MenuUtils from '@joplin/lib/services/commands/MenuUtils';
import ToolbarButtonUtils from '@joplin/lib/services/commands/ToolbarButtonUtils';
import CommandService, { CommandDeclaration, CommandRuntime } from '@joplin/lib/services/CommandService';
import stateToWhenClauseContext from '@joplin/lib/services/commands/stateToWhenClauseContext';
import KeymapService from '@joplin/lib/services/KeymapService';
const { asyncTest, setupDatabaseAndSynchronizer, switchClient, expectThrow, expectNotThrow } = require('./test-utils.js');
@ -17,7 +18,7 @@ function newService(): CommandService {
return {};
},
};
service.initialize(mockStore, true);
service.initialize(mockStore, true, stateToWhenClauseContext);
return service;
}

View File

@ -44,6 +44,8 @@ describe('services_PluginService', function() {
const service = newPluginService();
await service.loadAndRunPlugins([`${testPluginDir}/simple`]);
expect(() => service.pluginById('simple')).not.toThrowError();
const allFolders = await Folder.all();
expect(allFolders.length).toBe(1);
expect(allFolders[0].title).toBe('my plugin folder');
@ -54,6 +56,12 @@ describe('services_PluginService', function() {
expect(allNotes[0].parent_id).toBe(allFolders[0].id);
}));
it('should load and run a simple plugin and handle trailing slash', asyncTest(async () => {
const service = newPluginService();
await service.loadAndRunPlugins([`${testPluginDir}/simple/`]);
expect(() => service.pluginById('simple')).not.toThrowError();
}));
it('should load and run a plugin that uses external packages', asyncTest(async () => {
const service = newPluginService();
await service.loadAndRunPlugins([`${testPluginDir}/withExternalModules`]);

View File

@ -696,7 +696,18 @@ describe('services_rest_Api', function() {
const r = await api.route(RequestMethod.GET, `resources/${resource.id}/notes`);
expect(r.items.length).toBe(1);
expect(r.items[0]).toBe(note.id);
expect(r.items[0].id).toBe(note.id);
}));
it('should return the resources associated with a note', asyncTest(async () => {
const note = await Note.save({});
await shim.attachFileToNote(note, `${__dirname}/../tests/support/photo.jpg`);
const resource = (await Resource.all())[0];
const r = await api.route(RequestMethod.GET, `notes/${note.id}/resources`);
expect(r.items.length).toBe(1);
expect(r.items[0].id).toBe(resource.id);
}));
it('should return search results', asyncTest(async () => {

View File

@ -1,6 +1,6 @@
import Plugin from '../Plugin';
import Joplin from './Joplin';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
/**
* @ignore
*/

View File

@ -7,9 +7,21 @@ import JoplinCommands from './JoplinCommands';
import JoplinViews from './JoplinViews';
import JoplinInterop from './JoplinInterop';
import JoplinSettings from './JoplinSettings';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
*
* **This is a beta API**
*
* Please note that the plugin API is relatively new and should be considered Beta state. Besides possible bugs, what it means is that there might be necessary breaking changes from one version to the next. Whenever such change is needed, best effort will be done to:
*
* - Maintain backward compatibility;
* - When possible, deprecate features instead of removing them;
* - Document breaking changes in the changelog;
*
* So if you are developing a plugin, please keep an eye on the changelog as everything will be in there with information about how to update your code. There won't be any major API rewrite or architecture changes, but possibly small tweaks like function signature change, type change, etc.
*
* Eventually, the plugin API will be versioned to make this process smoother.
*/
export default class Joplin {
private data_;

View File

@ -1,25 +1,35 @@
import { Command } from './types';
/**
* This class allows executing or registering new Joplin commands. Commands can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or {@link JoplinViewsMenuItems | menu items}.
* This class allows executing or registering new Joplin commands. Commands
* can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or
* {@link JoplinViewsMenuItems | menu items}.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*
* ## Executing Joplin's internal commands
*
* 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:
* 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:
*
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/MainScreen/commands
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/commands
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.ts
* * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands)
* * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands)
* * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts)
*
* To view what arguments are supported, you can open any of these files and look at the `execute()` command.
* To view what arguments are supported, you can open any of these files
* and look at the `execute()` command.
*/
export default class JoplinCommands {
/**
* <span class="platform-desktop">desktop</span> Executes the given command.
* The `props` are the arguments passed to the command, and they vary based on the command
* <span class="platform-desktop">desktop</span> Executes the given
* command.
*
* The command can take any number of arguments, and the supported
* arguments will vary based on the command. For custom commands, this
* is the `args` passed to the `execute()` function. For built-in
* commands, you can find the supported arguments by checking the links
* above.
*
* ```typescript
* // Create a new note in the current notebook:

View File

@ -6,7 +6,7 @@ import { Path } from './types';
*
* This is also what you would use to search notes, via the `search` endpoint.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/simple)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/simple)
*
* 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:

View File

@ -2,7 +2,7 @@ import { ExportModule, ImportModule } from './types';
/**
* Provides a way to create modules to import external data into Joplin or to export notes into any arbitrary format.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export)
*
* 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.

View File

@ -1,5 +1,5 @@
import Plugin from '../Plugin';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
import { ContentScriptType, Script } from './types';
/**
* This class provides access to plugin-related features.
@ -28,7 +28,7 @@ export default class JoplinPlugins {
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/content_script)
*
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.

View File

@ -7,7 +7,7 @@ import { SettingItem, SettingSection } from './types';
*
* Note: Currently this API does **not** provide access to Joplin's built-in settings. This is by design as plugins that modify user settings could give unexpected results
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/settings)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/settings)
*/
export default class JoplinSettings {
private plugin_;
@ -37,7 +37,7 @@ export default class JoplinSettings {
*
* The list of available settings is not documented yet, but can be found by looking at the source code:
*
* https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/ReactNativeClient/lib/models/Setting.ts#L142
* https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/packages/app-mobile/lib/models/Setting.ts#L142
*/
globalValue(key: string): Promise<any>;
}

View File

@ -1,11 +1,12 @@
import Plugin from '../Plugin';
import { ButtonSpec, ViewHandle, ButtonId } from './types';
import { ButtonSpec, ViewHandle, DialogResult } from './types';
/**
* Allows creating and managing dialogs. A dialog is modal window that contains a webview and a row of buttons. You can update the update the webview using the `setHtml` method.
* Dialogs are hidden by default and you need to call `open()` to open them. Once the user clicks on a button, the `open` 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.
* Dialogs are hidden by default and you need to call `open()` to open them. Once the user clicks on a button, the `open` call will return an object indicating what button was clicked
* on. If your HTML content included one or more form, a `formData` object will also be included with the key/value for each form.
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/dialog)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/dialog)
*/
export default class JoplinViewsDialogs {
private store;
@ -16,7 +17,7 @@ export default class JoplinViewsDialogs {
/**
* Creates a new dialog
*/
create(): Promise<ViewHandle>;
create(id: string): Promise<ViewHandle>;
/**
* Displays a message box with OK/Cancel buttons. Returns the button index that was clicked - "0" for OK and "1" for "Cancel"
*/
@ -32,5 +33,5 @@ export default class JoplinViewsDialogs {
/**
* Opens the dialog
*/
open(handle: ViewHandle): Promise<ButtonId>;
open(handle: ViewHandle): Promise<DialogResult>;
}

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating and managing menu items.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsMenuItems {
private store;
@ -12,5 +12,5 @@ export default class JoplinViewsMenuItems {
/**
* Creates a new menu item and associate it with the given command. You can specify under which menu the item should appear using the `location` parameter.
*/
create(commandName: string, location?: MenuItemLocation, options?: CreateMenuItemOptions): Promise<void>;
create(id: string, commandName: string, location?: MenuItemLocation, options?: CreateMenuItemOptions): Promise<void>;
}

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating menus.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/menu)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/menu)
*/
export default class JoplinViewsMenus {
private store;
@ -14,5 +14,5 @@ export default class JoplinViewsMenus {
* Creates a new menu from the provided menu items and place it at the given location. As of now, it is only possible to place the
* menu as a sub-menu of the application build-in menus.
*/
create(label: string, menuItems: MenuItem[], location?: MenuItemLocation): Promise<void>;
create(id: string, label: string, menuItems: MenuItem[], location?: MenuItemLocation): Promise<void>;
}

View File

@ -1,10 +1,13 @@
import Plugin from '../Plugin';
import { ViewHandle } from './types';
/**
* 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.
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc)
*/
export default class JoplinViewsPanels {
private store;
@ -14,7 +17,7 @@ export default class JoplinViewsPanels {
/**
* Creates a new panel
*/
create(): Promise<ViewHandle>;
create(id: string): Promise<ViewHandle>;
/**
* Sets the panel webview HTML
*/

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating and managing toolbar buttons.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsToolbarButtons {
private store;
@ -12,5 +12,5 @@ export default class JoplinViewsToolbarButtons {
/**
* Creates a new toolbar button and associate it with the given command.
*/
create(commandName: string, location: ToolbarButtonLocation): Promise<void>;
create(id: string, commandName: string, location: ToolbarButtonLocation): Promise<void>;
}

View File

@ -2,7 +2,7 @@
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins)
*/
export default class JoplinWorkspace {
private store;

View File

@ -6,7 +6,7 @@ export interface Command {
/**
* Name of command - must be globally unique
*/
name: string
name: string;
/**
* Label to be displayed on menu items or keyboard shortcut editor for example.
@ -14,17 +14,17 @@ export interface Command {
* In that case the command will not appear in the shortcut editor or command panel, and logically
* should not be used as a menu item.
*/
label?: string
label?: string;
/**
* Icon to be used on toolbar buttons for example
*/
iconName?: string,
iconName?: string;
/**
* Code to be ran when the command is executed. It may return a result.
*/
execute(...args:any[]):Promise<any | void>
execute(...args: any[]): Promise<any | void>;
/**
* Defines whether the command should be enabled or disabled, which in turns affects
@ -40,13 +40,11 @@ export interface Command {
* Or | \|\| | "noteIsTodo \|\| noteTodoCompleted"
* And | && | "oneNoteSelected && !inConflictFolder"
*
* Currently the supported context variables aren't documented, but you can find the list there:
*
* https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/services/commands/stateToWhenClauseContext.ts
* Currently the supported context variables aren't documented, but you can [find the list here](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/services/commands/stateToWhenClauseContext.ts).
*
* Note: Commands are enabled by default unless you use this property.
*/
enabledCondition?: string
enabledCondition?: string;
}
// =================================================================
@ -64,7 +62,7 @@ export enum ImportModuleOutputFormat {
}
/**
* Used to implement a module to export data from Joplin. [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export) for an example.
* Used to implement a module to export data from Joplin. [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export) for an example.
*
* In general, all the event handlers you'll need to implement take a `context` 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.
*
@ -74,113 +72,113 @@ export interface ExportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string,
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string,
description: string;
/**
* Whether the module will export a single file or multiple files in a directory. It affects the open dialog that will be presented to the user when using your exporter.
*/
target: FileSystemItem,
target: FileSystemItem;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean,
isNoteArchive: boolean;
/**
* The extensions of the files exported by your module. For example, it is `["htm", "html"]` for the HTML module, and just `["jex"]` for the JEX module.
*/
fileExtensions?: string[],
fileExtensions?: string[];
/**
* Called when the export process starts.
*/
onInit(context:ExportContext): Promise<void>;
onInit(context: ExportContext): Promise<void>;
/**
* Called when an item needs to be processed. An "item" can be any Joplin object, such as a note, a folder, a notebook, etc.
*/
onProcessItem(context:ExportContext, itemType:number, item:any):Promise<void>;
onProcessItem(context: ExportContext, itemType: number, item: any): Promise<void>;
/**
* Called when a resource file needs to be exported.
*/
onProcessResource(context:ExportContext, resource:any, filePath:string):Promise<void>;
onProcessResource(context: ExportContext, resource: any, filePath: string): Promise<void>;
/**
* Called when the export process is done.
*/
onClose(context:ExportContext):Promise<void>;
onClose(context: ExportContext): Promise<void>;
}
export interface ImportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string,
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string,
description: string;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean,
isNoteArchive: boolean;
/**
* The type of sources that are supported by the module. Tells whether the module can import files or directories or both.
*/
sources: FileSystemItem[],
sources: FileSystemItem[];
/**
* Tells the file extensions of the exported files.
*/
fileExtensions?: string[],
fileExtensions?: string[];
/**
* Tells the type of notes that will be generated, either HTML or Markdown (default).
*/
outputFormat?: ImportModuleOutputFormat,
outputFormat?: ImportModuleOutputFormat;
/**
* Called when the import process starts. There is only one event handler within which you should import the complete data.
*/
onExec(context:ImportContext): Promise<void>;
onExec(context: ImportContext): Promise<void>;
}
export interface ExportOptions {
format?: string,
path?:string,
sourceFolderIds?: string[],
sourceNoteIds?: string[],
modulePath?:string,
target?:FileSystemItem,
format?: string;
path?: string;
sourceFolderIds?: string[];
sourceNoteIds?: string[];
modulePath?: string;
target?: FileSystemItem;
}
export interface ExportContext {
destPath: string,
options: ExportOptions,
destPath: string;
options: ExportOptions;
/**
* You can attach your own custom data using this propery - it will then be passed to each event handler, allowing you to keep state from one event to the next.
*/
userData?: any,
userData?: any;
}
export interface ImportContext {
sourcePath: string,
options: any,
warnings: string[],
sourcePath: string;
options: any;
warnings: string[];
}
// =================================================================
@ -188,7 +186,7 @@ export interface ImportContext {
// =================================================================
export interface Script {
onStart?(event:any):Promise<void>,
onStart?(event: any): Promise<void>;
}
// =================================================================
@ -196,7 +194,7 @@ export interface Script {
// =================================================================
export interface CreateMenuItemOptions {
accelerator: string,
accelerator: string;
}
export enum MenuItemLocation {
@ -206,7 +204,12 @@ export enum MenuItemLocation {
Note = 'note',
Tools = 'tools',
Help = 'help',
/*
* Deprecated - do not use - same as NoteListContext
*/
Context = 'context',
NoteListContextMenu = 'noteListContextMenu',
EditorContextMenu = 'editorContextMenu',
}
export interface MenuItem {
@ -214,22 +217,22 @@ export interface MenuItem {
* Command that should be associated with the menu item. All menu item should
* have a command associated with them unless they are a sub-menu.
*/
commandName?: string,
commandName?: string;
/**
* Accelerator associated with the menu item
*/
accelerator?: string,
accelerator?: string;
/**
* Menu items that should appear below this menu item. Allows creating a menu tree.
*/
submenu?: MenuItem[],
submenu?: MenuItem[];
/**
* Menu item label. If not specified, the command label will be used instead.
*/
label?: string,
label?: string;
}
// =================================================================
@ -237,9 +240,9 @@ export interface MenuItem {
// =================================================================
export interface ButtonSpec {
id: ButtonId,
title?: string,
onClick?():void,
id: ButtonId;
title?: string;
onClick?(): void;
}
export type ButtonId = string;
@ -263,6 +266,11 @@ export interface EditorCommand {
value?: any;
}
export interface DialogResult {
id: ButtonId;
formData?: any;
}
// =================================================================
// Settings types
// =================================================================
@ -279,28 +287,28 @@ export enum SettingItemType {
// Redefine a simplified interface to mask internal details
// and to remove function calls as they would have to be async.
export interface SettingItem {
value: any,
type: SettingItemType,
public: boolean,
label:string,
value: any;
type: SettingItemType;
public: boolean;
label: string;
description?:string,
isEnum?: boolean,
section?: string,
options?:any,
appTypes?:string[],
secure?: boolean,
advanced?: boolean,
minimum?: number,
maximum?: number,
step?: number,
description?: string;
isEnum?: boolean;
section?: string;
options?: any;
appTypes?: string[];
secure?: boolean;
advanced?: boolean;
minimum?: number;
maximum?: number;
step?: number;
}
export interface SettingSection {
label: string,
iconName?: string,
description?: string,
name?: string,
label: string;
iconName?: string;
description?: string;
name?: string;
}
// =================================================================
@ -322,36 +330,30 @@ export type Path = string[];
export enum ContentScriptType {
/**
* Registers a new Markdown-It plugin, which should follow this template:
* Registers a new Markdown-It plugin, which should follow the template below.
*
* ```javascript
* // The module should export an object as below:
*
* module.exports = {
*
* // The "context" variable 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.
* default: function(context) {
* return {
*
* // This is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information
* // The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts), which
* // contains a number of options, mostly useful for Joplin's internal code.
* plugin: function(markdownIt, options) {
* // ...
* },
*
* // You may also specify additional assets such as JS or CSS that should be loaded in the rendered HTML document.
* // Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to
* // see how the data should be structured.
* assets: {},
* assets: {
* // ...
* },
* }
* }
* }
* ```
*
* To include a regular Markdown-It plugin, that doesn't make use of any Joplin-specific feature, you
* would simply create a file such as this:
* - The `context` 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.
*
* - The **required** `plugin` key is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information. The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml.ts), which contains a number of options, mostly useful for Joplin's internal code.
*
* - Using the **optional** `assets` key you may specify assets such as JS or CSS that should be loaded in the rendered HTML document. Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to see how the data should be structured.
*
* 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:
*
* ```javascript
* module.exports = {

View File

@ -1,6 +1,6 @@
import Plugin from '../Plugin';
import Joplin from './Joplin';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
/**
* @ignore
*/

View File

@ -7,9 +7,21 @@ import JoplinCommands from './JoplinCommands';
import JoplinViews from './JoplinViews';
import JoplinInterop from './JoplinInterop';
import JoplinSettings from './JoplinSettings';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
*
* **This is a beta API**
*
* Please note that the plugin API is relatively new and should be considered Beta state. Besides possible bugs, what it means is that there might be necessary breaking changes from one version to the next. Whenever such change is needed, best effort will be done to:
*
* - Maintain backward compatibility;
* - When possible, deprecate features instead of removing them;
* - Document breaking changes in the changelog;
*
* So if you are developing a plugin, please keep an eye on the changelog as everything will be in there with information about how to update your code. There won't be any major API rewrite or architecture changes, but possibly small tweaks like function signature change, type change, etc.
*
* Eventually, the plugin API will be versioned to make this process smoother.
*/
export default class Joplin {
private data_;

View File

@ -1,25 +1,35 @@
import { Command } from './types';
/**
* This class allows executing or registering new Joplin commands. Commands can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or {@link JoplinViewsMenuItems | menu items}.
* This class allows executing or registering new Joplin commands. Commands
* can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or
* {@link JoplinViewsMenuItems | menu items}.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*
* ## Executing Joplin's internal commands
*
* 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:
* 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:
*
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/MainScreen/commands
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/commands
* https://github.com/laurent22/joplin/tree/dev/ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.ts
* * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands)
* * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands)
* * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts)
*
* To view what arguments are supported, you can open any of these files and look at the `execute()` command.
* To view what arguments are supported, you can open any of these files
* and look at the `execute()` command.
*/
export default class JoplinCommands {
/**
* <span class="platform-desktop">desktop</span> Executes the given command.
* The `props` are the arguments passed to the command, and they vary based on the command
* <span class="platform-desktop">desktop</span> Executes the given
* command.
*
* The command can take any number of arguments, and the supported
* arguments will vary based on the command. For custom commands, this
* is the `args` passed to the `execute()` function. For built-in
* commands, you can find the supported arguments by checking the links
* above.
*
* ```typescript
* // Create a new note in the current notebook:

View File

@ -6,7 +6,7 @@ import { Path } from './types';
*
* This is also what you would use to search notes, via the `search` endpoint.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/simple)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/simple)
*
* 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:

View File

@ -2,7 +2,7 @@ import { ExportModule, ImportModule } from './types';
/**
* Provides a way to create modules to import external data into Joplin or to export notes into any arbitrary format.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export)
*
* 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.

View File

@ -1,5 +1,5 @@
import Plugin from '../Plugin';
import Logger from 'lib/Logger';
import Logger from '../../../Logger';
import { ContentScriptType, Script } from './types';
/**
* This class provides access to plugin-related features.
@ -28,7 +28,7 @@ export default class JoplinPlugins {
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/content_script)
*
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.

View File

@ -7,7 +7,7 @@ import { SettingItem, SettingSection } from './types';
*
* Note: Currently this API does **not** provide access to Joplin's built-in settings. This is by design as plugins that modify user settings could give unexpected results
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/settings)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/settings)
*/
export default class JoplinSettings {
private plugin_;
@ -37,7 +37,7 @@ export default class JoplinSettings {
*
* The list of available settings is not documented yet, but can be found by looking at the source code:
*
* https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/ReactNativeClient/lib/models/Setting.ts#L142
* https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/packages/app-mobile/lib/models/Setting.ts#L142
*/
globalValue(key: string): Promise<any>;
}

View File

@ -1,11 +1,12 @@
import Plugin from '../Plugin';
import { ButtonSpec, ViewHandle, ButtonId } from './types';
import { ButtonSpec, ViewHandle, DialogResult } from './types';
/**
* Allows creating and managing dialogs. A dialog is modal window that contains a webview and a row of buttons. You can update the update the webview using the `setHtml` method.
* Dialogs are hidden by default and you need to call `open()` to open them. Once the user clicks on a button, the `open` 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.
* Dialogs are hidden by default and you need to call `open()` to open them. Once the user clicks on a button, the `open` call will return an object indicating what button was clicked
* on. If your HTML content included one or more form, a `formData` object will also be included with the key/value for each form.
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/dialog)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/dialog)
*/
export default class JoplinViewsDialogs {
private store;
@ -16,7 +17,7 @@ export default class JoplinViewsDialogs {
/**
* Creates a new dialog
*/
create(): Promise<ViewHandle>;
create(id: string): Promise<ViewHandle>;
/**
* Displays a message box with OK/Cancel buttons. Returns the button index that was clicked - "0" for OK and "1" for "Cancel"
*/
@ -32,5 +33,5 @@ export default class JoplinViewsDialogs {
/**
* Opens the dialog
*/
open(handle: ViewHandle): Promise<ButtonId>;
open(handle: ViewHandle): Promise<DialogResult>;
}

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating and managing menu items.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsMenuItems {
private store;
@ -12,5 +12,5 @@ export default class JoplinViewsMenuItems {
/**
* Creates a new menu item and associate it with the given command. You can specify under which menu the item should appear using the `location` parameter.
*/
create(commandName: string, location?: MenuItemLocation, options?: CreateMenuItemOptions): Promise<void>;
create(id: string, commandName: string, location?: MenuItemLocation, options?: CreateMenuItemOptions): Promise<void>;
}

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating menus.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/menu)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/menu)
*/
export default class JoplinViewsMenus {
private store;
@ -14,5 +14,5 @@ export default class JoplinViewsMenus {
* Creates a new menu from the provided menu items and place it at the given location. As of now, it is only possible to place the
* menu as a sub-menu of the application build-in menus.
*/
create(label: string, menuItems: MenuItem[], location?: MenuItemLocation): Promise<void>;
create(id: string, label: string, menuItems: MenuItem[], location?: MenuItemLocation): Promise<void>;
}

View File

@ -1,10 +1,13 @@
import Plugin from '../Plugin';
import { ViewHandle } from './types';
/**
* 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.
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/toc)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc)
*/
export default class JoplinViewsPanels {
private store;
@ -14,7 +17,7 @@ export default class JoplinViewsPanels {
/**
* Creates a new panel
*/
create(): Promise<ViewHandle>;
create(id: string): Promise<ViewHandle>;
/**
* Sets the panel webview HTML
*/

View File

@ -3,7 +3,7 @@ import Plugin from '../Plugin';
/**
* Allows creating and managing toolbar buttons.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsToolbarButtons {
private store;
@ -12,5 +12,5 @@ export default class JoplinViewsToolbarButtons {
/**
* Creates a new toolbar button and associate it with the given command.
*/
create(commandName: string, location: ToolbarButtonLocation): Promise<void>;
create(id: string, commandName: string, location: ToolbarButtonLocation): Promise<void>;
}

View File

@ -2,7 +2,7 @@
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins)
*/
export default class JoplinWorkspace {
private store;

View File

@ -6,7 +6,7 @@ export interface Command {
/**
* Name of command - must be globally unique
*/
name: string
name: string;
/**
* Label to be displayed on menu items or keyboard shortcut editor for example.
@ -14,17 +14,17 @@ export interface Command {
* In that case the command will not appear in the shortcut editor or command panel, and logically
* should not be used as a menu item.
*/
label?: string
label?: string;
/**
* Icon to be used on toolbar buttons for example
*/
iconName?: string,
iconName?: string;
/**
* Code to be ran when the command is executed. It may return a result.
*/
execute(...args:any[]):Promise<any | void>
execute(...args: any[]): Promise<any | void>;
/**
* Defines whether the command should be enabled or disabled, which in turns affects
@ -40,13 +40,11 @@ export interface Command {
* Or | \|\| | "noteIsTodo \|\| noteTodoCompleted"
* And | && | "oneNoteSelected && !inConflictFolder"
*
* Currently the supported context variables aren't documented, but you can find the list there:
*
* https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/services/commands/stateToWhenClauseContext.ts
* Currently the supported context variables aren't documented, but you can [find the list here](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/services/commands/stateToWhenClauseContext.ts).
*
* Note: Commands are enabled by default unless you use this property.
*/
enabledCondition?: string
enabledCondition?: string;
}
// =================================================================
@ -64,7 +62,7 @@ export enum ImportModuleOutputFormat {
}
/**
* Used to implement a module to export data from Joplin. [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export) for an example.
* Used to implement a module to export data from Joplin. [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export) for an example.
*
* In general, all the event handlers you'll need to implement take a `context` 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.
*
@ -74,113 +72,113 @@ export interface ExportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string,
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string,
description: string;
/**
* Whether the module will export a single file or multiple files in a directory. It affects the open dialog that will be presented to the user when using your exporter.
*/
target: FileSystemItem,
target: FileSystemItem;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean,
isNoteArchive: boolean;
/**
* The extensions of the files exported by your module. For example, it is `["htm", "html"]` for the HTML module, and just `["jex"]` for the JEX module.
*/
fileExtensions?: string[],
fileExtensions?: string[];
/**
* Called when the export process starts.
*/
onInit(context:ExportContext): Promise<void>;
onInit(context: ExportContext): Promise<void>;
/**
* Called when an item needs to be processed. An "item" can be any Joplin object, such as a note, a folder, a notebook, etc.
*/
onProcessItem(context:ExportContext, itemType:number, item:any):Promise<void>;
onProcessItem(context: ExportContext, itemType: number, item: any): Promise<void>;
/**
* Called when a resource file needs to be exported.
*/
onProcessResource(context:ExportContext, resource:any, filePath:string):Promise<void>;
onProcessResource(context: ExportContext, resource: any, filePath: string): Promise<void>;
/**
* Called when the export process is done.
*/
onClose(context:ExportContext):Promise<void>;
onClose(context: ExportContext): Promise<void>;
}
export interface ImportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string,
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string,
description: string;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean,
isNoteArchive: boolean;
/**
* The type of sources that are supported by the module. Tells whether the module can import files or directories or both.
*/
sources: FileSystemItem[],
sources: FileSystemItem[];
/**
* Tells the file extensions of the exported files.
*/
fileExtensions?: string[],
fileExtensions?: string[];
/**
* Tells the type of notes that will be generated, either HTML or Markdown (default).
*/
outputFormat?: ImportModuleOutputFormat,
outputFormat?: ImportModuleOutputFormat;
/**
* Called when the import process starts. There is only one event handler within which you should import the complete data.
*/
onExec(context:ImportContext): Promise<void>;
onExec(context: ImportContext): Promise<void>;
}
export interface ExportOptions {
format?: string,
path?:string,
sourceFolderIds?: string[],
sourceNoteIds?: string[],
modulePath?:string,
target?:FileSystemItem,
format?: string;
path?: string;
sourceFolderIds?: string[];
sourceNoteIds?: string[];
modulePath?: string;
target?: FileSystemItem;
}
export interface ExportContext {
destPath: string,
options: ExportOptions,
destPath: string;
options: ExportOptions;
/**
* You can attach your own custom data using this propery - it will then be passed to each event handler, allowing you to keep state from one event to the next.
*/
userData?: any,
userData?: any;
}
export interface ImportContext {
sourcePath: string,
options: any,
warnings: string[],
sourcePath: string;
options: any;
warnings: string[];
}
// =================================================================
@ -188,7 +186,7 @@ export interface ImportContext {
// =================================================================
export interface Script {
onStart?(event:any):Promise<void>,
onStart?(event: any): Promise<void>;
}
// =================================================================
@ -196,7 +194,7 @@ export interface Script {
// =================================================================
export interface CreateMenuItemOptions {
accelerator: string,
accelerator: string;
}
export enum MenuItemLocation {
@ -206,7 +204,12 @@ export enum MenuItemLocation {
Note = 'note',
Tools = 'tools',
Help = 'help',
/*
* Deprecated - do not use - same as NoteListContext
*/
Context = 'context',
NoteListContextMenu = 'noteListContextMenu',
EditorContextMenu = 'editorContextMenu',
}
export interface MenuItem {
@ -214,22 +217,22 @@ export interface MenuItem {
* Command that should be associated with the menu item. All menu item should
* have a command associated with them unless they are a sub-menu.
*/
commandName?: string,
commandName?: string;
/**
* Accelerator associated with the menu item
*/
accelerator?: string,
accelerator?: string;
/**
* Menu items that should appear below this menu item. Allows creating a menu tree.
*/
submenu?: MenuItem[],
submenu?: MenuItem[];
/**
* Menu item label. If not specified, the command label will be used instead.
*/
label?: string,
label?: string;
}
// =================================================================
@ -237,9 +240,9 @@ export interface MenuItem {
// =================================================================
export interface ButtonSpec {
id: ButtonId,
title?: string,
onClick?():void,
id: ButtonId;
title?: string;
onClick?(): void;
}
export type ButtonId = string;
@ -263,6 +266,11 @@ export interface EditorCommand {
value?: any;
}
export interface DialogResult {
id: ButtonId;
formData?: any;
}
// =================================================================
// Settings types
// =================================================================
@ -279,28 +287,28 @@ export enum SettingItemType {
// Redefine a simplified interface to mask internal details
// and to remove function calls as they would have to be async.
export interface SettingItem {
value: any,
type: SettingItemType,
public: boolean,
label:string,
value: any;
type: SettingItemType;
public: boolean;
label: string;
description?:string,
isEnum?: boolean,
section?: string,
options?:any,
appTypes?:string[],
secure?: boolean,
advanced?: boolean,
minimum?: number,
maximum?: number,
step?: number,
description?: string;
isEnum?: boolean;
section?: string;
options?: any;
appTypes?: string[];
secure?: boolean;
advanced?: boolean;
minimum?: number;
maximum?: number;
step?: number;
}
export interface SettingSection {
label: string,
iconName?: string,
description?: string,
name?: string,
label: string;
iconName?: string;
description?: string;
name?: string;
}
// =================================================================
@ -322,36 +330,30 @@ export type Path = string[];
export enum ContentScriptType {
/**
* Registers a new Markdown-It plugin, which should follow this template:
* Registers a new Markdown-It plugin, which should follow the template below.
*
* ```javascript
* // The module should export an object as below:
*
* module.exports = {
*
* // The "context" variable 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.
* default: function(context) {
* return {
*
* // This is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information
* // The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts), which
* // contains a number of options, mostly useful for Joplin's internal code.
* plugin: function(markdownIt, options) {
* // ...
* },
*
* // You may also specify additional assets such as JS or CSS that should be loaded in the rendered HTML document.
* // Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to
* // see how the data should be structured.
* assets: {},
* assets: {
* // ...
* },
* }
* }
* }
* ```
*
* To include a regular Markdown-It plugin, that doesn't make use of any Joplin-specific feature, you
* would simply create a file such as this:
* - The `context` 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.
*
* - The **required** `plugin` key is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information. The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml.ts), which contains a number of options, mostly useful for Joplin's internal code.
*
* - Using the **optional** `assets` key you may specify assets such as JS or CSS that should be loaded in the rendered HTML document. Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to see how the data should be structured.
*
* 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:
*
* ```javascript
* module.exports = {

View File

@ -4,12 +4,12 @@ joplin.plugins.register({
onStart: async function() {
const dialogs = joplin.views.dialogs;
const handle = await dialogs.create();
const handle = await dialogs.create('myDialog1');
await dialogs.setHtml(handle, '<p>Testing dialog with default buttons</p><p>Second line</p><p>Third line</p>');
const result = await dialogs.open(handle);
alert('This button was clicked: ' + result);
alert('Got result: ' + JSON.stringify(result));
const handle2 = await dialogs.create();
const handle2 = await dialogs.create('myDialog2');
await dialogs.setHtml(handle2, '<p>Testing dialog with custom buttons</p><p>Second line</p><p>Third line</p>');
await dialogs.setButtons(handle2, [
{
@ -25,7 +25,20 @@ joplin.plugins.register({
]);
const result2 = await dialogs.open(handle2);
alert('This button was clicked: ' + result2);
alert('Got result: ' + JSON.stringify(result2));
const handle3 = await dialogs.create();
await dialogs.setHtml(handle3, `
<p>Testing dialog with form elements</p>
<form name="user">
Name: <input type="text" name="name"/>
<br/>
Email: <input type="text" name="email"/>
</form>
`);
const result3 = await dialogs.open(handle3);
alert('Got result: ' + JSON.stringify(result3));
},
});

View File

@ -0,0 +1,2 @@
dist/*
node_modules/

View File

@ -0,0 +1,14 @@
# Joplin Plugin
This is a template to create a new Joplin plugin.
The main two files you will want to look at are:
- `/src/index.ts`, which contains the entry point for the plugin source code.
- `/src/manifest.json`, which is the plugin manifest. It contains information such as the plugin a name, version, etc.
The plugin is built using webpack, which create the compiled code in `/dist`. The project is setup to use TypeScript, although you can change the configuration to use plain JavaScript.
## Building the plugin
To build the plugin, simply run `npm run dist`.

View File

@ -0,0 +1,15 @@
import Plugin from '../Plugin';
import Joplin from './Joplin';
import Logger from '../../../Logger';
/**
* @ignore
*/
export default class Global {
private joplin_;
private requireWhiteList_;
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
get joplin(): Joplin;
private requireWhiteList;
require(filePath: string): any;
get process(): any;
}

View File

@ -0,0 +1,50 @@
import Plugin from '../Plugin';
import JoplinData from './JoplinData';
import JoplinPlugins from './JoplinPlugins';
import JoplinWorkspace from './JoplinWorkspace';
import JoplinFilters from './JoplinFilters';
import JoplinCommands from './JoplinCommands';
import JoplinViews from './JoplinViews';
import JoplinInterop from './JoplinInterop';
import JoplinSettings from './JoplinSettings';
import Logger from '../../../Logger';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
*
* **This is a beta API**
*
* Please note that the plugin API is relatively new and should be considered Beta state. Besides possible bugs, what it means is that there might be necessary breaking changes from one version to the next. Whenever such change is needed, best effort will be done to:
*
* - Maintain backward compatibility;
* - When possible, deprecate features instead of removing them;
* - Document breaking changes in the changelog;
*
* So if you are developing a plugin, please keep an eye on the changelog as everything will be in there with information about how to update your code. There won't be any major API rewrite or architecture changes, but possibly small tweaks like function signature change, type change, etc.
*
* Eventually, the plugin API will be versioned to make this process smoother.
*/
export default class Joplin {
private data_;
private plugins_;
private workspace_;
private filters_;
private commands_;
private views_;
private interop_;
private settings_;
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
get data(): JoplinData;
get plugins(): JoplinPlugins;
get workspace(): JoplinWorkspace;
/**
* @ignore
*
* Not sure if it's the best way to hook into the app
* so for now disable filters.
*/
get filters(): JoplinFilters;
get commands(): JoplinCommands;
get views(): JoplinViews;
get interop(): JoplinInterop;
get settings(): JoplinSettings;
}

View File

@ -0,0 +1,61 @@
import { Command } from './types';
/**
* This class allows executing or registering new Joplin commands. Commands
* can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or
* {@link JoplinViewsMenuItems | menu items}.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*
* ## Executing Joplin's internal commands
*
* 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:
*
* * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands)
* * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands)
* * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts)
*
* To view what arguments are supported, you can open any of these files
* and look at the `execute()` command.
*/
export default class JoplinCommands {
/**
* <span class="platform-desktop">desktop</span> Executes the given
* command.
*
* The command can take any number of arguments, and the supported
* arguments will vary based on the command. For custom commands, this
* is the `args` passed to the `execute()` function. For built-in
* commands, you can find the supported arguments by checking the links
* above.
*
* ```typescript
* // Create a new note in the current notebook:
* await joplin.commands.execute('newNote');
*
* // Create a new sub-notebook under the provided notebook
* // Note: internally, notebooks are called "folders".
* await joplin.commands.execute('newFolder', "SOME_FOLDER_ID");
* ```
*/
execute(commandName: string, ...args: any[]): Promise<any | void>;
/**
* <span class="platform-desktop">desktop</span> Registers a new command.
*
* ```typescript
* // Register a new commmand called "testCommand1"
*
* await joplin.commands.register({
* name: 'testCommand1',
* label: 'My Test Command 1',
* iconName: 'fas fa-music',
* execute: () => {
* alert('Testing plugin command 1');
* },
* });
* ```
*/
register(command: Command): Promise<void>;
}

View File

@ -0,0 +1,47 @@
import { Path } from './types';
/**
* This module provides access to the Joplin data API: https://joplinapp.org/api/references/rest_api/
* This is the main way to retrieve data, such as notes, notebooks, tags, etc.
* or to update them or delete them.
*
* This is also what you would use to search notes, via the `search` endpoint.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/simple)
*
* 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:
*
* * `path`: This is an array that represents the path to the resource in the form `["resouceName", "resourceId", "resourceLink"]` (eg. ["tags", ":id", "notes"]). The "resources" segment is the name of the resources you want to access (eg. "notes", "folders", etc.). If not followed by anything, it will refer to all the resources in that collection. The optional "resourceId" points to a particular resources within the collection. Finally, an optional "link" can be present, which links the resource to a collection of resources. This can be used in the API for example to retrieve all the notes associated with a tag.
* * `query`: (Optional) The query parameters. In a URL, this is the part after the question mark "?". In this case, it should be an object with key/value pairs.
* * `data`: (Optional) Applies to PUT and POST calls only. The request body contains the data you want to create or modify, for example the content of a note or folder.
* * `files`: (Optional) Used to create new resources and associate them with files.
*
* Please refer to the [Joplin API documentation](https://joplinapp.org/api/references/rest_api/) for complete details about each call. As the plugin runs within the Joplin application **you do not need an authorisation token** to use this API.
*
* For example:
*
* ```typescript
* // Get a note ID, title and body
* const noteId = 'some_note_id';
* const note = await joplin.data.get(['notes', noteId], { fields: ['id', 'title', 'body'] });
*
* // Get all folders
* const folders = await joplin.data.get(['folders']);
*
* // Set the note body
* await joplin.data.put(['notes', noteId], null, { body: "New note body" });
*
* // Create a new note under one of the folders
* await joplin.data.post(['notes'], null, { body: "my new note", title: "some title", parent_id: folders[0].id });
* ```
*/
export default class JoplinData {
private api_;
private pathSegmentRegex_;
private serializeApiBody;
private pathToString;
get(path: Path, query?: any): Promise<any>;
post(path: Path, query?: any, body?: any, files?: any[]): Promise<any>;
put(path: Path, query?: any, body?: any, files?: any[]): Promise<any>;
delete(path: Path, query?: any): Promise<any>;
}

View File

@ -0,0 +1,10 @@
/**
* @ignore
*
* Not sure if it's the best way to hook into the app
* so for now disable filters.
*/
export default class JoplinFilters {
on(name: string, callback: Function): Promise<void>;
off(name: string, callback: Function): Promise<void>;
}

View File

@ -0,0 +1,17 @@
import { ExportModule, ImportModule } from './types';
/**
* Provides a way to create modules to import external data into Joplin or to export notes into any arbitrary format.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export)
*
* 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.
*
* See the documentation of the [[ExportModule]] and [[ImportModule]] for more information.
*
* You may also want to refer to the Joplin API documentation to see the list of properties for each item (note, notebook, etc.) - https://joplinapp.org/api/references/rest_api/
*/
export default class JoplinInterop {
registerExportModule(module: ExportModule): Promise<void>;
registerImportModule(module: ImportModule): Promise<void>;
}

View File

@ -0,0 +1,38 @@
import Plugin from '../Plugin';
import Logger from '../../../Logger';
import { ContentScriptType, Script } from './types';
/**
* This class provides access to plugin-related features.
*/
export default class JoplinPlugins {
private logger;
private plugin;
constructor(logger: Logger, plugin: Plugin);
/**
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
* That `onStart` method will be executed as soon as the plugin is loaded.
*
* ```typescript
* joplin.plugins.register({
* onStart: async function() {
* // Run your plugin code here
* }
* });
* ```
*/
register(script: Script): Promise<void>;
/**
* Registers a new content script. Unlike regular plugin code, which runs in a separate process, content scripts run within the main process code
* and thus allow improved performances and more customisations in specific cases. It can be used for example to load a Markdown or editor plugin.
*
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/content_script)
*
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.
* @param scriptPath Must be a path relative to the plugin main script. For example, if your file content_script.js is next to your index.ts file, you would set `scriptPath` to `"./content_script.js`.
*/
registerContentScript(type: ContentScriptType, id: string, scriptPath: string): Promise<void>;
}

View File

@ -0,0 +1,43 @@
import Plugin from '../Plugin';
import { SettingItem, SettingSection } from './types';
/**
* This API allows registering new settings and setting sections, as well as getting and setting settings. Once a setting has been registered it will appear in the config screen and be editable by the user.
*
* Settings are essentially key/value pairs.
*
* Note: Currently this API does **not** provide access to Joplin's built-in settings. This is by design as plugins that modify user settings could give unexpected results
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/settings)
*/
export default class JoplinSettings {
private plugin_;
constructor(plugin: Plugin);
private namespacedKey;
/**
* Registers a new setting. Note that registering a setting item is dynamic and will be gone next time Joplin starts.
* What it means is that you need to register the setting every time the plugin starts (for example in the onStart event).
* The setting value however will be preserved from one launch to the next so there is no risk that it will be lost even if for some
* reason the plugin fails to start at some point.
*/
registerSetting(key: string, settingItem: SettingItem): Promise<void>;
/**
* Registers a new setting section. Like for registerSetting, it is dynamic and needs to be done every time the plugin starts.
*/
registerSection(name: string, section: SettingSection): Promise<void>;
/**
* Gets a setting value (only applies to setting you registered from your plugin)
*/
value(key: string): Promise<any>;
/**
* Sets a setting value (only applies to setting you registered from your plugin)
*/
setValue(key: string, value: any): Promise<void>;
/**
* Gets a global setting value, including app-specific settings and those set by other plugins.
*
* The list of available settings is not documented yet, but can be found by looking at the source code:
*
* https://github.com/laurent22/joplin/blob/3539a452a359162c461d2849829d2d42973eab50/packages/app-mobile/lib/models/Setting.ts#L142
*/
globalValue(key: string): Promise<any>;
}

View File

@ -0,0 +1,28 @@
import Plugin from '../Plugin';
import JoplinViewsDialogs from './JoplinViewsDialogs';
import JoplinViewsMenuItems from './JoplinViewsMenuItems';
import JoplinViewsMenus from './JoplinViewsMenus';
import JoplinViewsToolbarButtons from './JoplinViewsToolbarButtons';
import JoplinViewsPanels from './JoplinViewsPanels';
/**
* This namespace provides access to view-related services.
*
* All view services provide a `create()` method which you would use to create the view object, whether it's a dialog, a toolbar button or a menu item.
* In some cases, the `create()` method will return a [[ViewHandle]], which you would use to act on the view, for example to set certain properties or call some methods.
*/
export default class JoplinViews {
private store;
private plugin;
private dialogs_;
private panels_;
private menuItems_;
private menus_;
private toolbarButtons_;
private implementation_;
constructor(implementation: any, plugin: Plugin, store: any);
get dialogs(): JoplinViewsDialogs;
get panels(): JoplinViewsPanels;
get menuItems(): JoplinViewsMenuItems;
get menus(): JoplinViewsMenus;
get toolbarButtons(): JoplinViewsToolbarButtons;
}

View File

@ -0,0 +1,37 @@
import Plugin from '../Plugin';
import { ButtonSpec, ViewHandle, DialogResult } from './types';
/**
* Allows creating and managing dialogs. A dialog is modal window that contains a webview and a row of buttons. You can update the update the webview using the `setHtml` method.
* Dialogs are hidden by default and you need to call `open()` to open them. Once the user clicks on a button, the `open` call will return an object indicating what button was clicked
* on. If your HTML content included one or more form, a `formData` object will also be included with the key/value for each form.
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/dialog)
*/
export default class JoplinViewsDialogs {
private store;
private plugin;
private implementation_;
constructor(implementation: any, plugin: Plugin, store: any);
private controller;
/**
* Creates a new dialog
*/
create(id: string): Promise<ViewHandle>;
/**
* Displays a message box with OK/Cancel buttons. Returns the button index that was clicked - "0" for OK and "1" for "Cancel"
*/
showMessageBox(message: string): Promise<number>;
/**
* Sets the dialog HTML content
*/
setHtml(handle: ViewHandle, html: string): Promise<string>;
/**
* Sets the dialog buttons.
*/
setButtons(handle: ViewHandle, buttons: ButtonSpec[]): Promise<ButtonSpec[]>;
/**
* Opens the dialog
*/
open(handle: ViewHandle): Promise<DialogResult>;
}

View File

@ -0,0 +1,16 @@
import { CreateMenuItemOptions, MenuItemLocation } from './types';
import Plugin from '../Plugin';
/**
* Allows creating and managing menu items.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsMenuItems {
private store;
private plugin;
constructor(plugin: Plugin, store: any);
/**
* Creates a new menu item and associate it with the given command. You can specify under which menu the item should appear using the `location` parameter.
*/
create(id: string, commandName: string, location?: MenuItemLocation, options?: CreateMenuItemOptions): Promise<void>;
}

View File

@ -0,0 +1,18 @@
import { MenuItem, MenuItemLocation } from './types';
import Plugin from '../Plugin';
/**
* Allows creating menus.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/menu)
*/
export default class JoplinViewsMenus {
private store;
private plugin;
constructor(plugin: Plugin, store: any);
private registerCommandAccelerators;
/**
* Creates a new menu from the provided menu items and place it at the given location. As of now, it is only possible to place the
* menu as a sub-menu of the application build-in menus.
*/
create(id: string, label: string, menuItems: MenuItem[], location?: MenuItemLocation): Promise<void>;
}

View File

@ -0,0 +1,33 @@
import Plugin from '../Plugin';
import { ViewHandle } from './types';
/**
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/toc)
*/
export default class JoplinViewsPanels {
private store;
private plugin;
constructor(plugin: Plugin, store: any);
private controller;
/**
* Creates a new panel
*/
create(id: string): Promise<ViewHandle>;
/**
* Sets the panel webview HTML
*/
setHtml(handle: ViewHandle, html: string): Promise<string>;
/**
* Adds and loads a new JS or CSS files into the panel.
*/
addScript(handle: ViewHandle, scriptPath: string): Promise<void>;
/**
* Called when a message is sent from the webview (using postMessage).
*/
onMessage(handle: ViewHandle, callback: Function): Promise<void>;
}

View File

@ -0,0 +1,16 @@
import { ToolbarButtonLocation } from './types';
import Plugin from '../Plugin';
/**
* Allows creating and managing toolbar buttons.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/register_command)
*/
export default class JoplinViewsToolbarButtons {
private store;
private plugin;
constructor(plugin: Plugin, store: any);
/**
* Creates a new toolbar button and associate it with the given command.
*/
create(id: string, commandName: string, location: ToolbarButtonLocation): Promise<void>;
}

View File

@ -0,0 +1,34 @@
/**
* 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.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins)
*/
export default class JoplinWorkspace {
private store;
constructor(_implementation: any, store: any);
/**
* Called when a new note or notes are selected.
*/
onNoteSelectionChange(callback: Function): Promise<void>;
/**
* Called when the content of a note changes.
*/
onNoteContentChange(callback: Function): Promise<void>;
/**
* Called when an alarm associated with a to-do is triggered.
*/
onNoteAlarmTrigger(callback: Function): Promise<void>;
/**
* Called when the synchronisation process has finished.
*/
onSyncComplete(callback: Function): Promise<void>;
/**
* Gets the currently selected note
*/
selectedNote(): Promise<any>;
/**
* Gets the IDs of the selected notes (can be zero, one, or many). Use the data API to retrieve information about these notes.
*/
selectedNoteIds(): Promise<string[]>;
}

View File

@ -0,0 +1,5 @@
import type Joplin from './Joplin';
declare const joplin:Joplin;
export default joplin;

View File

@ -0,0 +1,370 @@
// =================================================================
// Command API types
// =================================================================
export interface Command {
/**
* Name of command - must be globally unique
*/
name: string;
/**
* Label to be displayed on menu items or keyboard shortcut editor for example.
* If it is missing, it's assumed it's a private command, to be called programmatically only.
* In that case the command will not appear in the shortcut editor or command panel, and logically
* should not be used as a menu item.
*/
label?: string;
/**
* Icon to be used on toolbar buttons for example
*/
iconName?: string;
/**
* Code to be ran when the command is executed. It may return a result.
*/
execute(...args: any[]): Promise<any | void>;
/**
* Defines whether the command should be enabled or disabled, which in turns affects
* the enabled state of any associated button or menu item.
*
* The condition should be expressed as a "when-clause" (as in Visual Studio Code). It's a simple boolean expression that evaluates to
* `true` or `false`. It supports the following operators:
*
* Operator | Symbol | Example
* -- | -- | --
* Equality | == | "editorType == markdown"
* Inequality | != | "currentScreen != config"
* Or | \|\| | "noteIsTodo \|\| noteTodoCompleted"
* And | && | "oneNoteSelected && !inConflictFolder"
*
* Currently the supported context variables aren't documented, but you can [find the list here](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/services/commands/stateToWhenClauseContext.ts).
*
* Note: Commands are enabled by default unless you use this property.
*/
enabledCondition?: string;
}
// =================================================================
// Interop API types
// =================================================================
export enum FileSystemItem {
File = 'file',
Directory = 'directory',
}
export enum ImportModuleOutputFormat {
Markdown = 'md',
Html = 'html',
}
/**
* Used to implement a module to export data from Joplin. [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/json_export) for an example.
*
* In general, all the event handlers you'll need to implement take a `context` 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.
*
* To get a better sense of what it will contain it can be useful to print it using `console.info(context)`.
*/
export interface ExportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string;
/**
* Whether the module will export a single file or multiple files in a directory. It affects the open dialog that will be presented to the user when using your exporter.
*/
target: FileSystemItem;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean;
/**
* The extensions of the files exported by your module. For example, it is `["htm", "html"]` for the HTML module, and just `["jex"]` for the JEX module.
*/
fileExtensions?: string[];
/**
* Called when the export process starts.
*/
onInit(context: ExportContext): Promise<void>;
/**
* Called when an item needs to be processed. An "item" can be any Joplin object, such as a note, a folder, a notebook, etc.
*/
onProcessItem(context: ExportContext, itemType: number, item: any): Promise<void>;
/**
* Called when a resource file needs to be exported.
*/
onProcessResource(context: ExportContext, resource: any, filePath: string): Promise<void>;
/**
* Called when the export process is done.
*/
onClose(context: ExportContext): Promise<void>;
}
export interface ImportModule {
/**
* The format to be exported, eg "enex", "jex", "json", etc.
*/
format: string;
/**
* The description that will appear in the UI, for example in the menu item.
*/
description: string;
/**
* Only applies to single file exporters or importers
* It tells whether the format can package multiple notes into one file.
* For example JEX or ENEX can, but HTML cannot.
*/
isNoteArchive: boolean;
/**
* The type of sources that are supported by the module. Tells whether the module can import files or directories or both.
*/
sources: FileSystemItem[];
/**
* Tells the file extensions of the exported files.
*/
fileExtensions?: string[];
/**
* Tells the type of notes that will be generated, either HTML or Markdown (default).
*/
outputFormat?: ImportModuleOutputFormat;
/**
* Called when the import process starts. There is only one event handler within which you should import the complete data.
*/
onExec(context: ImportContext): Promise<void>;
}
export interface ExportOptions {
format?: string;
path?: string;
sourceFolderIds?: string[];
sourceNoteIds?: string[];
modulePath?: string;
target?: FileSystemItem;
}
export interface ExportContext {
destPath: string;
options: ExportOptions;
/**
* You can attach your own custom data using this propery - it will then be passed to each event handler, allowing you to keep state from one event to the next.
*/
userData?: any;
}
export interface ImportContext {
sourcePath: string;
options: any;
warnings: string[];
}
// =================================================================
// Misc types
// =================================================================
export interface Script {
onStart?(event: any): Promise<void>;
}
// =================================================================
// Menu types
// =================================================================
export interface CreateMenuItemOptions {
accelerator: string;
}
export enum MenuItemLocation {
File = 'file',
Edit = 'edit',
View = 'view',
Note = 'note',
Tools = 'tools',
Help = 'help',
/*
* Deprecated - do not use - same as NoteListContext
*/
Context = 'context',
NoteListContextMenu = 'noteListContextMenu',
EditorContextMenu = 'editorContextMenu',
}
export interface MenuItem {
/**
* Command that should be associated with the menu item. All menu item should
* have a command associated with them unless they are a sub-menu.
*/
commandName?: string;
/**
* Accelerator associated with the menu item
*/
accelerator?: string;
/**
* Menu items that should appear below this menu item. Allows creating a menu tree.
*/
submenu?: MenuItem[];
/**
* Menu item label. If not specified, the command label will be used instead.
*/
label?: string;
}
// =================================================================
// View API types
// =================================================================
export interface ButtonSpec {
id: ButtonId;
title?: string;
onClick?(): void;
}
export type ButtonId = string;
export enum ToolbarButtonLocation {
/**
* This toolbar in the top right corner of the application. It applies to the note as a whole, including its metadata.
*/
NoteToolbar = 'noteToolbar',
/**
* This toolbar is right above the text editor. It applies to the note body only.
*/
EditorToolbar = 'editorToolbar',
}
export type ViewHandle = string;
export interface EditorCommand {
name: string;
value?: any;
}
export interface DialogResult {
id: ButtonId;
formData?: any;
}
// =================================================================
// Settings types
// =================================================================
export enum SettingItemType {
Int = 1,
String = 2,
Bool = 3,
Array = 4,
Object = 5,
Button = 6,
}
// Redefine a simplified interface to mask internal details
// and to remove function calls as they would have to be async.
export interface SettingItem {
value: any;
type: SettingItemType;
public: boolean;
label: string;
description?: string;
isEnum?: boolean;
section?: string;
options?: any;
appTypes?: string[];
secure?: boolean;
advanced?: boolean;
minimum?: number;
maximum?: number;
step?: number;
}
export interface SettingSection {
label: string;
iconName?: string;
description?: string;
name?: string;
}
// =================================================================
// Data API types
// =================================================================
/**
* An array of at least one element and at most three elements.
*
* [0]: Resource name (eg. "notes", "folders", "tags", etc.)
* [1]: (Optional) Resource ID.
* [2]: (Optional) Resource link.
*/
export type Path = string[];
// =================================================================
// Plugins type
// =================================================================
export enum ContentScriptType {
/**
* Registers a new Markdown-It plugin, which should follow the template below.
*
* ```javascript
* module.exports = {
* default: function(context) {
* return {
* plugin: function(markdownIt, options) {
* // ...
* },
* assets: {
* // ...
* },
* }
* }
* }
* ```
*
* - The `context` 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.
*
* - The **required** `plugin` key is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information. The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml.ts), which contains a number of options, mostly useful for Joplin's internal code.
*
* - Using the **optional** `assets` key you may specify assets such as JS or CSS that should be loaded in the rendered HTML document. Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/packages/app-mobile/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to see how the data should be structured.
*
* 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:
*
* ```javascript
* module.exports = {
* default: function(context) {
* return {
* plugin: require('markdown-it-toc-done-right');
* }
* }
* }
* ```
*/
MarkdownItPlugin = 'markdownItPlugin',
CodeMirrorPlugin = 'codeMirrorPlugin',
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
{
"name": "joplin_plugin",
"version": "1.0.0",
"description": "",
"scripts": {
"dist": "webpack",
"postinstall": "npm run dist"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@types/node": "^14.0.14",
"copy-webpack-plugin": "^6.1.0",
"ts-loader": "^7.0.5",
"typescript": "^3.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
}
}

View File

@ -0,0 +1,16 @@
import joplin from 'api';
import { MenuItemLocation } from 'api/types';
joplin.plugins.register({
onStart: async function() {
await joplin.commands.register({
name: 'sayHi',
label: 'Say Hi',
execute: async () => {
await joplin.commands.execute('replaceSelection', 'hi!');
},
});
await joplin.views.menuItems.create('myContextMenuItem', 'sayHi', MenuItemLocation.EditorContextMenu);
},
});

View File

@ -0,0 +1,8 @@
{
"manifest_version": 1,
"name": "Editor Context Menu Demo",
"description": "",
"version": "1.0.0",
"author": "",
"homepage_url": ""
}

Some files were not shown because too many files have changed in this diff Show More