Hello @laurent,
as mentioned in this post I started to implement a simple plugin.
It simply adds some new commands and maps existing commands to the "main menu".
In this thread I would like to share some questions and findings (I guess they are findings ) I have noticed so far. I would be glad if you have some time to look at them.
I will add them as extra posts below.
If you want to have a look at the plugin itself, here's the current version of the index.ts
:
index.ts (14.4 KB)
Once again, many thanks for all your hard work and efforts!!!
1 Like
First a few general questions.
Please consider that I am a newby in the Node.js/Electron/Typescript environment...
-
Is there a command to open the note history view?
-
Is it possible to specify the minimum version of Joplin for a plugin?
- I guess this would be necessary if you want to add additional APIs in the future
-
Is it possible to create separators in menus?
- If it is not possible to create separators, may add a separator in menus before adding plugin entries to differentiate them a bit
-
Is it possible to specify own enabledCondition
queries?
- I would like to have the possibility to specify own queries (not sure how this could be solved)
- For example: I would like to disable a command if the selected note is first in the current note-list and the order type is 'custom order'
- But this is only "nice to have"
- To be save I will add runtime checks to the commands of course
And here a few Findings:
-
Internal shortcuts have higher priority then default accelarators from plugin
- For example: If note-list has focus, the
Arrow Up
key is always considered to change the selected note in the list. A command with shortcut Ctrl+Alt+Up
will not be triggered
- Currently the command is only triggered when the note-body/title has focus.
-
Disabling commands with enabledCondition
has no effect in note context menu
-
Sub-menu entries are not shown in keyboard editor unless they have a default accelarator (or manually added shortcuts in keymap-desktop.json
)
- For example:
Note > Sub-Menu > My command
- My command will not be shown in keyboard editor
-
Plugin icons in toolbars (e.g. note toolbar) seem to be bigger than the default ones
-
Context menu cannot have sub-menus
- The following entry is not shown as expected
await joplin.views.menus.create('Move in list', moveNoteSubMenu, MenuItemLocation.Context);
- The
moveNoteSubMenu
is created previously with
const moveNoteSubMenu = [{commandName: "moveNoteToTop"}];
- It works as expected in
MenuItemLocation.Note
All these findings can be tested with the attached plugin from the first post.
Search for "API" in index.ts
for the relevant code lines of the above mentioned findings.