Editor Commands Pt. 1 (Click on Rems with JavaScript)

(I’ll make a longer post about keyboard driven workflow and commands when I have time.)

Making user scripts is pretty fun (thanks @UMNiK for the suggestion :D) and there are many ways to extend RemNotes functionality this way (e.g. [:cookie: User Script] Toggle Sidebar and Resize Pane Shortcuts and snippet/template manager).

But there is one thing that is not possible with a react app:

  • Focusing a rem to edit (aka clicking on it, see Stackoverflow: Simulate click event on react element) [At least I was not able to do it with my limited React skills. If it is possible a snippet would be appreciated! Otherwise this can be implemented with a ref I think, see Stackoverflow above or here]

This alone could go a long way. Like enable us making a pane switcher or vim-mode like in roam-toolkit.

Additionally I’d like to be able to:

  • Navigate to another rem without page reload (I did not manage to make the History API do it).
  • Insert text into a rem, like triggering a paste action (which is blocked for security reasons.) This can be done by exposing Editor.insertText as shown in https://docs.slatejs.org/concepts/04-commands.
    Roam has an advantage here in hackability as it uses plain text areas.

This is a preparation for/first step towards Native Plugins (Custom JavaScript).