Persist Editor Layout Plugin

Sorry, I don't understand what you mean? Could you share a screenshot or something?

I can select more than one note in Joplin, from a notebook, search result, tag, etc.

When I do so I get a series of buttons. "Persist Editor Layout" is one of those buttons, but it doesn't achieve anything to click it (which view would it change each selected note to?).

My suggestion is to simply remove that button, and also the right-click context menu when more than one note is selected.

Ah okay... now I see.
In case of multiple notes are selected this button persists the current active layout for each of them.
Actually I'm using this functionality so I'm afraid that I can't remove the button.

Ok, now I'm confused. What do you mean it persists the "current active" layout? Isn't that just just the standard Joplin split view for notes in a list that are not selected / open? I thought the point of the attachment was to prevent Joplin from reverting to default for some notes.

Perhaps there some trick functionality I'm missing here!

Ah! I get it now. I see how this works. Although I can select multiple notes, whatever the view in my last current note's window was, will get applied to the notes I select. I wasn't aware I could do this.

Great plugin!

Right now the option is under Tools. Doesn't it make more sense under note

1 Like

I've changed it in the last version of the plugin.

1 Like

There is a new, completely revamped, version of the plugin:

Now it is possible to define your own (custom) tags for the specific layouts.
That means you don't have to use the predefined ones (e.g. layout:editor) anymore.
How this works you can find in the README.
But don`t worry, by default the old predefined labels are set in the options. So you should not notice any difference at first.

But there is a small disadvantage: I had to remove the command persistEditorLayout.
I just didn't find a suitable solution to implement it the correctly with the custom tags (which one to set? etc...).
But the app or external plugins offer enough possibilities to add tags to a note :wink:

It should be available in the App soon.

A new version of the plugin has just been released and published to the plugin repository.

:warning: CAUTION - Requires Joplin v1.8.2 or newer

Changed

  • Updated plugin API to version v1.8.2 ( registerSettings ) to support app version v2.2.4 or newer (see here for details)
2 Likes

@benji300 , thank you for your nice plugin. In my use cases, some of my notes are almost read-only. So, the plugin very fits my situations. If you have add an optional feature such as the following, it would make me happier. How do you think about it?

[Feature Request]

  • One more alternative for Default editor layout option. When a note without-persistent-layout is selected, the layout of the PREVIOUS note without-persistent-layout is restored.

[Description]

  • I know None option, but it brings the editor only to the specified layout.
  • In my usual work flows, I usually evenly edit or view notes WITHOUT-persistent-layout, and sometimes visit to a read-only note WITH-persistent-layout (viewer) for browsing. After browsing, I want to go back to the previous note with its previous layout (editor or viewer) to keep my concentration.

Let me summarize if I understood you correctly....

  • Add new value Previous to user option Default editor layout
  • If Previous is selected then save the current layout if the note has NO layout tags specified
  • When switching to a note without layout tags the previously saved layout will be restored

Am I correct?

2 Likes

Am I correct?

Exactly.

3 Likes

A new version of the plugin has just been released and published to the plugin repository.

Added

  • Previous selection to user option Default editor layout

Fixed

2 Likes

I found a bug being caused by the plugin. It's very annoying, and can also result in unintentional changes to notes. To replicate:

  1. Open Joplin and set up the plugin to default to Split View. Add a tag (let's call it "Rendered" here) for rendered markdown editor view.
  2. Navigate to a note that is set to go to default view.
  3. Go to the search box, and start typing text that will cause the search results list to bring a note with the Rendered tag to the top of the search results list.
  4. Watch the note switch to the rendered view as it should.
  5. The search box loses focus and the note gains focus! This shouldn't happen.

The loss of focus in the search box is a significant issue. There are two big problems with this:

  • When typing in the search box, partial results display as one types. For example, if I am searching for "schoolbus", "school" might cause the results list to update and the search box to lose focus, making it impossible to type "schoolbus" without clicking back into the search box. This sort of thing happens all the time, since a few characters in the search box very often brings up results that cause a change in the viewer layout.
  • If the search results in a note switching from rendered view to split view or markdown view, the note body gains focus. Characters being typed into the search box now begin appearing in the note body, causing unintended changes to the note.

Disabling the plugin makes the above issue go away.

Thanks for this detailed analysis @mzguy... I've created an issue and will have a look at this problem.

@laurent: Is it possible to retrieve the global search status from a plugin? For example, if it is active or was active before the layout switch. So I could disable the layout switching as long as a global search is active or at least set the focus back to the search box. Because I think the loss of focus in the search box is caused by switching the editor layout triggered by the plugin.

No, but I think the bug is that somehow the focus is lost when the plugin is activated. Do you do something to change the focus? If not it might be a bug in the app then, as just switching the layout probably shouldn't steal focus from the search box.

No, only the commands toggleVisiblePanes and toggleEditors are triggered by the plugin.

I can also reproduce the behavior with the plugin disabled:

  1. open note and set layout to e.g. rendered markdown
  2. starting typing something into search box
  3. wait until first note from search result is opened (focus is still in search box)
  4. toggle editor layout (e.g. via shortcut) to editor or split view
  5. focus is set to note content now
1 Like

Any updates on this bug?

@benji300 @laurent

It appears this nasty bug has been sidelined somehow? Any chance for a fix soon? Misplaced app focus can lead to data loss.

Anyone? This is a pretty serious bug, as it allows unintended changes to notes.