Native Plugins (Custom JavaScript)

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 and I also like Trilium’s API:

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).

What is the current status of this (being able to have custom JS the same way we can have custom CSS)?

Do you know if this is going to be implemented?
When it does, should it work in desktop too?
Are there any workarounds for playing around with this currently (desktop)?

So many questions. :roll_eyes:

This is basically having User Scripts built into RemNote itself.
This would be required to have it work on the Desktop app since you can not install browser extensions like Violentmonkey there.

I really don’t think this should be/is a priority for the devs now. A first step is opening up a few more areas to scriptability (Editor Commands Pt. 1 (Click on Rems with JavaScript)).

If the Desktop app is indeed electron based then there are also DevTools (sometimes Ctrl + Shift + I) where you can paste scripts into the console.

1 Like

Paste scripts into the console? But if u restart the desktop app (assuming electron-based), the pasted scripts would disappear, since it is only in the memory.

Yes, that’s why it is a workaround :upside_down_face:

Did you manage to open the console?

I couldn’t make it to work in desktop

Press Alt > View > Toggle Developer Tools.

I guess the shortcut (Ctrl + Shift + I) does not make it through RemNotes shortcut processing logic.

1 Like