Jabref: Changes in entry preview are not saved

Created on 8 May 2020  路  26Comments  路  Source: JabRef/jabref

JabRef 5.1--2020-05-04--b5599c9
Linux 4.9.0-12-amd64 amd64
Java 14.0.1

Changes in the entry preview format are accounted for _only_ after restarting.

Note 1: may seem similar to issue #5464, but the present issue is about _the content_ of the preview.
Note 2: issue is present with "Show preview as tab in entry editor" checked or unchecked.

Steps to reproduce the behavior:

  1. Create a file with the following entry and save it
@Article{MyKey,
  author    = {Author1, Surname1 and Author2 Surname2},
  journal   = {The Journal title},
  title     = {The title of the article},
  year      = {2020},
  number    = {12},
  pages     = {1-100},
  volume    = {15},
 }
  1. Go to Options -> Preferences -> Entry preview
  2. Select "Preview" in the column "Selected"
  3. Click on the Edit tab
  4. Change
    \begin{journal} <em>\format[HTMLChars]{\journal}, </em>\end{journal}
    into
    \begin{journal} <em>\format[HTMLChars]{\journal},HereIsMyChange </em>\end{journal}
  5. Go to the preview Tab.
    ==> The preview is updated accordingly.
  6. Click on save
  7. Edit the entry
    The preview shows:
    Capture du 2020-05-08 15-26-09
    HereIsMyChange is not displayed ==> The preview is NOT updated.
  8. Close and reopen JabRef
  9. Edit the entry
    The preview shows:
    Capture du 2020-05-08 15-20-54
    HereIsMyChange is displayed ==> The preview is updated NOW.
entry-preview preferences bug 馃悰 ui

All 26 comments

Thanks for the report. Does the Preview update if you close and reopen the entry editor?

No.
And it does not update if I switch tabs (between already-open files).
But the preview get updated if I close and reopen a file (but only for this file. Not for the ones in the other tabs).

@Siedlerchr I am interested in this issue. Can you give me any suggestions or any relevant code where the bug might be?

@dimitra-karadima Some points: PreviewTab (in the preferences) as well and for the entry editor it might be the PreviewPanel. Probably that the PreviewPreferences are not reloaded in the PreviewPanel when a new style or a modified style is saved

Maybe @leitianjian can help you a bit, she/he worked recently in that area

@Siedlerchr thanks for the guidance! I will check it out.

My point of view was to find out where the new changes are being saved in order to update there the PreviewTab. I have found that this happens in https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/gui/preferences/PreviewTabViewModel.java#L204 so I made an instance of PreviewPanel in order to update Layout, but it didn't work. I don't know if it is that I created a new Object or it was the wrong thought. @Siedlerchr or anyone else any thoughts?

Hi, I think this bug is hard to locate and has huge gaps between the previous bug I fixed and this one. I also stuck in it. If you don't mind and you don't work on it, I will fix this bug. If you are still working on it, keep going on, we can discuss it according to your progress. Sorry for my late reply. I do not receive any notification that I have been mentioned. Sorry again.

@leitianjian I am not working on it because I am kinda stuck. All I have found was what I mentioned above. I am kind of busy so you can work on it if there are a lot of steps left, but if I am on the right path we can discuss it and try to find the solution together.

Thanks for your kindness. In fact, I find that your path is not exactly correct. We should not initialize another object of PreviewPanel which is JavaFX Vbox. I think we should modify some code to let the PreviewPanel content update after saving the preferences, which is a little difficult and deep tasks. The things I'm doing now is to figure out how the preview showing on the EntryEditor, and trying to give an elegant solution to update the preview. If you are still interested in it. Feel free to ask, we can work on this bug together.

Thanks to @leitianjian this should be fixed

Sorry for the delay in testing the fix.
The behavior changed, but I am afraid the issue is not fixed.
Now (JabRef 5.1--2020-06-09--595f085), the preview cannot be redefined: The changes in the preview (carried out at step 5) are not saved (after step 7). When I go back to the preferences, my changes in the preview code are not recorded.

ping @Siedlerchr @leitianjian

Hello,
may it is helpful to change to topic of the bug. I just wanted to report a new bug and did find this one only by accident. Maybe something like "Changes in entry preview are not saves"

Still reproducible in the current dev version. Problem was that the layout was not found due to incorrectly using a l10n value for comparison

The issue is now finally resolved in the latest master (currently building)

We would like to ask you to use a development build from https://builds.jabref.org/master and report back if it works for you. Please remember to make a backup of your library before trying-out this version.

Works in 5.2--2020-11-06--2f27dd3 and 5.2--2020-11-07--df80c13 (Win 10, Java 1.8.0_271-b09). Thanks for fixing!

Can also confirm that it works.

Fixed, indeed. Thank you @Siedlerchr!

Every time I open JabRef something in the customized entry preview style I have already changed many times is reset again.

  • Instead of
    \begin{comment}<BR><BR><b>Comment: </b>\format[HTMLChars]{\comment}\end{comment}
  • the following reappears again:
    \begin{comment}<BR><BR><b>Comment: </b>\format[Markdown,HTMLChars]{\comment}\end{comment}

So, Markdown keeps reappearing in the \format[] command. This causes an additional line break after "Comment:" which I don't want to have there. Where does that come from? If others discover the same problem I unfortunately consider the issue not solved.

@AtrusRiven Which version of JabRef are you using?
Note: the fix is in the development version (https://builds.jabref.org/master/)

I'm using the actual master build (5.2--2020-11-10--f5c52a2).

Indeed, can reproduce this. for some reason it's not saved after a restart or reset on a restart.

@AtrusRiven You have triggered an edge case, it's the Preferences Migration that is executed on startup that overwrites your changes. Just add a space after the HtnlChars Formatter Name : \format[HTMLChars ]{\comment} to prevent an exact match.

https://github.com/JabRef/jabref/blob/b9be53e056d92837d827efc2a70a06ff733ad0b7/src/main/java/org/jabref/migrations/PreferencesMigrations.java#L313-L319

Thanks, now it works. What is this replacement for?

It's a migration if you come from a previous version. E.g. If some internal fields or prefs got renamed
Migrations are run on startup. As the newer versions support Markdown,the preview should show that as well.

At the moment, switched on Markdown results in a line break as I mentioned above. Would it be possible to remove that automated line break?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Siedlerchr picture Siedlerchr  路  37Comments

LyzardKing picture LyzardKing  路  62Comments

HainesB picture HainesB  路  37Comments

jimjianghk picture jimjianghk  路  42Comments

ilippert picture ilippert  路  34Comments