Menu

Scripting: node.detailsText is not saved

2018-01-08
2018-01-21
  • Unglaublich

    Unglaublich - 2018-01-08

    I have this script, added to a node:

    node.text = "Hello World!"
    node.detailsText = "Keine Datei(def)"
    

    I run it with "Tools - run Scripts of the selected node" - both text and detailsText are written. Then I close and save the mm. I open the mm again - only the text is displayed, the detailsText is empty.

    When I write a detailsText with usual commands (F3, Ctrl+F3), is is saved and reopened with problems.

    Where or what is the difference?

     
  • Dimitry Polivaev

    Actually you could use

    node.details = "Keine Datei(def)"

    Please test it and report how it works.

    But I am confused by too, so we should think about what to do with node.detailsText = "Keine Datei(def)" and if we should fix it too.

    Regards,
    Dimirty

     
  • Unglaublich

    Unglaublich - 2018-01-14

    Thanks to both. I will try with "node.details" ..

    @Dimitry
    my question is a side-effect of myvery first code here:
    https://sourceforge.net/p/freeplane/discussion/758437/thread/4fef1f94/

    There you can check if the code does something wrong or if the software has to be checked.

     
  • Volker Börchers

    As Luigi pointed out, node.setDetailsText() expects HTML as an argument. node.setDetails() on the other hand provides conversion. The lowlevel access method setDetailsText() is important to set the details exactly but it's a bit more difficult to use.

    Of course it's not satisfying that the details text is not saved although it seemingly displays correctly. I am not sure what to do:

    • throw an exception if non-html is handed to setDetailsText()?
    • extend the description of setDetailsText() with a warning?

    I am also worried about the fact that people thouroughly trying to take up scripting miss to find the API documentation - do you have suggestions for that, too?

    Sorry for replying so late.

    Volker

     

    Last edit: Volker Börchers 2018-01-21