Ideally, yes, it should work for both. There is a way to get and set the cursor position in the RTE. I don't know if it's technically possible to do so via a Joplin plugin (I haven't tried).
As I'm switching a lot between multiple notes (especially via the Note Tabs plugin) I'd find it very helpful if not only the cursor position is saved but also the scroll position. Otherwise the resumed note still does not look exactly as I have left it.
Do you think this would be a possible feature for this extension?
It doesn't save after restart. And it the cursor position that it remembers jumps around quite a bit. Thank you for this plugin. It is a big time saver. Just needs some polish.
Check the settings. There's an experimental feature to save across restarts. Regarding "jumping around" I'm not sure what you mean by that, but perhaps setting the refresh interval to a lower value might help.
It does two things. Across restarts AND across devices. That gave me pause. Not sure why, but it did.
The cursor will move by a line or two. I wonder it is has anything to do with some HTML mingled in the document. I will try to put together succinct example that can be replicated.
No. HTML doesn't seem to be the culprit. This is how I am testing now …
Joplin 3.1.23, Desktop, Linux (Fedora specifically, but it is the AppImage)
my custom userstyles.css and userchrome.css were removed
I turned off all plugins except Persistent Editor Layout (to save a headache) and Resume Note
I have scrolled to a spot and selected text
I have scrolled to a spot and merely planted the cursor
I switched between Default and VIM modes just to see what would happen.
Markdown editor only.
What I have found.
Upon restart of Jopln:
The only thing that survives a restart of Joplin is the note selected. This alone is a huge win, but the cursor is always kicked to the top and scrolled to the top and if something was selected, it is no longer selected
The VIM mode shows you a flash of the cursor (helpful) whereas the the Default mode shows no cursor. The editor is not input-focused when you restart Joplin.
Switching between notes:
It seems to work as designed. But only not when …
With all plugins turned on, I get jumps in cursor location, scrolling, and selections do not retain.
Conclusion:
the cursor location, selection, and scroll position is not retained upon restart, but the note selected is! Which is great.
my issues with retained selection, cursor position, etc. is the result of some plugin conflict. I will try to narrow that down. So, far, I have eliminated a number of them.
I made some improvements in v0.2.1 to the scrolling method, cursor update, and how the data is stored (without sync / note properties) so that it is persistent across sessions. Hopefully these changes will improve the user experience and compatibility with other plugins.
That said, I have some of the aforementioned conflicting plugins, and I installed some of the others, and did not experience problems on my end. So I suspect that the issue may be related to the general impact of plugins on Joplin's speed and latency (this also obviously depends on your machine). To address this, I added a new setting that I encourage you to explore: Delay before setting cursor and scroll position (in ms). This delay is meant to ensure that the editor is fully loaded before trying to set the cursor. Some users may be able to decrease this setting for a smoother experience, while others may need to increase it in order for the plugin to work properly. Perhaps in the future I'll have a better solution for this (like getting a ping from the editor once it's loaded).
Are you sure about that? I've tested the plugin in the Rich Text Editor, however to no avail. It doesn't seem to do anything for me, i.e. the note after switching back to it always starts at the beginning.
I do agree that having this plugin work for both editors and also when switching between the two would be perfect .
Hmm. I get the behavior noted no matter how long I wait before switching to a different note. And if I disable all those top listed plugins, everything works appropriately.
The desktop I am testing all of this on is rather beefy: 5GHz CPU, 32GiB RAM.
My settings in Joplin:
Resume Note v0.2.1
Refresh interval for cursor and scroll position (ms): 2000
Delay before setting cursor and scroll position (in ms): 300
Save cursor selection
Sync data using note properties (Experimental)
Note. I don't really understand what those two timing settings do. You explain them in your release notes, but I still don't understand. To me, they sound like they do the same thing.
I'm trying to see a pattern with the Plugins that affect this situation and I am scratching my head. I mean, Whitespacer goes in and changes the edit window, so I can see that, depending on ordering of Plugin runs, maybe altering the highlighted selection. Dunno. This is mysterious.
Just to clarify: I'm aware that it doesn't work, as it hasn't been implemented yet. I wasn't able to make it work, but perhaps someone else will and open a PR at some point. (I know the response was to @bj-286, just thought I'll update on the subject.)
EDIT: I was finally able to reproduce the problem with your help (thanks!). I've released v0.2.2 to try to solve it. Here's a settings guide:
This setting determines how often the cursor is saved. EDIT: Renamed to Refresh interval for saving cursor and scroll position (ms).
This setting determines how long the plugin waits before trying to set in the editor the cursor position.
New setting! (v0.2.2)
Delay before starting the plugin (in ms): 1000
Since you love these timing settings, I've added another one. This one is meant to help the plugin setup the editor without interference from other plugins. I hope that the default value will work for you, otherwise try to increase it to 2000-3000.