New script: restore Map Views roots (Jump Ins) and selected nodes #1750
euu2021
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Disclaimer: I still did not test this script extensively, so I don't know if there are negative side effects. It relies on internal methods, and throws a ton of exceptions. Before using on important maps, test extensively and create backups.
At startup, Freeplane restores the Map views that were opened, but it doesn't restore the selection and Jump ins of each map view. So, I created a script that, for each map view, restores:
There are 2 scripts that need to be used in combination:
Script 1 (the saver):
Saves the Id of nodes to be restored as attributes of a certain node (I call this node "nodeStoringAttributes"). So, choose a node to be the nodeStoringAttributes, and put its Id in the script, at the variable nodeStoringAttributes.
I recommend assigning this script to a hotkey that will be used as a Save Map, so you then have a Save Map. I included a Save action in the version below (but, you can deactivate it, if you want). Maybe, I will later create a script that forces the user to save using the custom save hotkey, if he tries to exit by saving in other ways.
I also included two lines that save the layout (as explained at #1745 (comment)).
Script 1:
Script 2 (the loader):
This could be much more simple if used only on simple maps with not many map views. But, I'm using it on a map with almost 30 map views, so I had to add a lot of checks to increase the chance of success in the reload.
It will create a OK icon at nodeStoringAttributes if the reload is sucessfull. Otherwise, it will create a Red X icon. If you get Red X icon, try running the script again and it will probabbly work (maybe, after some tries).
The way the user executes the script is important. Executing using a hotkey, for example, works fine (I think that's because the UI gets locked). Executing in ways that don't lock the interface don't work, because the execution gets interrupted by exceptions (and I didn't manage to find a way to catch those exceptions).
Script 2:
As long as you remember to save using the custom save hotkey, it seems to work well. It works on my giant map, with 30 map views.
Saving the folding of each map view would be lovely, but I still don't know how to do it.
Beta Was this translation helpful? Give feedback.
All reactions