Plugins are currently implemented as an external website embedded in an iframe
which is invoked by a shortcut or slash command.
Native Plugins can add Custom JavaScript (similear to Custom CSS) which runs in the background.
This has a number of advantages:
- Native Plugins can run automatically and do not have have to be invoked manually via shortcut or slash command, e.g. expand
->
to→
RemNote can provide a set of hooks (enterRem
,exitRem
,addTag
, …) on which a plugin can subscribe and perform actions, or listen to native events themselves (keypress
etc.) - Native Plugins can modify and control RemNote directly, e.g. add a button to the sidebar or focus a different rem. (See also Feature Policies for Plugin IFrames).
- Native Plugins can work offline and run fast. There is on external website which has to load first. This makes small actions like adding a tag more interactive.
Related: RoamResearch has this with roam/js
(see this for some examples ROAM JS EXTENSIONS - September 2020 Releases! - YouTube) and I also like Trilium’s API: Scripts · zadam/trilium Wiki · GitHub
A workaround is to use a browser extension for user scripts but when I tried to make a pane switcher it did not work because I could not even click on stuff (React handles events internally).