Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in entry preview are not saved #6447

Open
mlep opened this issue May 8, 2020 · 30 comments · Fixed by #6516 or #7077
Open

Changes in entry preview are not saved #6447

mlep opened this issue May 8, 2020 · 30 comments · Fixed by #6516 or #7077
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview preferences ui

Comments

@mlep
Copy link
Contributor

mlep commented May 8, 2020

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.
@Siedlerchr
Copy link
Member

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

@mlep
Copy link
Contributor Author

mlep commented May 8, 2020

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 Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label May 8, 2020
@dimitra-karadima
Copy link
Contributor

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

@Siedlerchr
Copy link
Member

@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

@dimitra-karadima
Copy link
Contributor

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

@dimitra-karadima
Copy link
Contributor

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?

@leitianjian
Copy link
Contributor

leitianjian commented May 24, 2020

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.

@dimitra-karadima
Copy link
Contributor

dimitra-karadima commented May 24, 2020

@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.

@leitianjian
Copy link
Contributor

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.

@Siedlerchr
Copy link
Member

Thanks to @leitianjian this should be fixed

@mlep
Copy link
Contributor Author

mlep commented Jun 11, 2020

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.

@mlep
Copy link
Contributor Author

mlep commented Jun 17, 2020

ping @Siedlerchr @leitianjian

@Siedlerchr Siedlerchr reopened this Jun 17, 2020
@teertinker
Copy link
Contributor

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"

@mlep mlep changed the title Entry preview: content updated only after restart Changes in entry preview are not saved Oct 13, 2020
@Siedlerchr
Copy link
Member

Siedlerchr commented Nov 5, 2020

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

Siedlerchr added a commit that referenced this issue Nov 5, 2020
Introduce internal name for finding layout
Fixes #6447
Siedlerchr added a commit that referenced this issue Nov 6, 2020
* Fix preview settings not saved due to l10n

Introduce internal name for finding layout
Fixes #6447

* rename getInternalName
@Siedlerchr
Copy link
Member

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.

@AtrusRiven
Copy link
Contributor

AtrusRiven commented Nov 7, 2020

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!

@teertinker
Copy link
Contributor

Can also confirm that it works.

@mlep
Copy link
Contributor Author

mlep commented Nov 12, 2020

Fixed, indeed. Thank you @Siedlerchr!

@AtrusRiven
Copy link
Contributor

AtrusRiven commented Nov 13, 2020

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.

@mlep
Copy link
Contributor Author

mlep commented Nov 13, 2020

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

@AtrusRiven
Copy link
Contributor

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

@Siedlerchr
Copy link
Member

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

@Siedlerchr
Copy link
Member

@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.

static void upgradePreviewStyleAllowMarkdown(JabRefPreferences prefs) {
String currentPreviewStyle = prefs.getPreviewStyle();
String migratedStyle = currentPreviewStyle.replace("\\format[HTMLChars]{\\comment}", "\\format[Markdown,HTMLChars]{\\comment}")
.replace("<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>", "<b><i>\\bibtextype</i><a name=\"\\citationkey\">\\begin{citationkey} (\\citationkey)</a>")
.replace("\\end{bibtexkey}</b><br>__NEWLINE__", "\\end{citationkey}</b><br>__NEWLINE__");
prefs.setPreviewStyle(migratedStyle);

@AtrusRiven
Copy link
Contributor

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

@Siedlerchr
Copy link
Member

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.

@AtrusRiven
Copy link
Contributor

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?

@mlep
Copy link
Contributor Author

mlep commented Nov 16, 2021

Bug seems to be in JabRef 5.4--2021-11-15--8a3b77b
Linux 4.19.0-18-amd64 amd64
Java 16.0.2
JavaFX 17.0.1+1

@Siedlerchr Please, re-open.

@fl-la
Copy link

fl-la commented Jan 10, 2022

Bug seems to be in JabRef 5.4--2021-11-15--8a3b77b Linux 4.19.0-18-amd64 amd64 Java 16.0.2 JavaFX 17.0.1+1

@Siedlerchr Please, re-open.

Can confirm, the bug is very annoying.
JabRef 5.4--2021-12-20--ab44182
Linux 5.15.8-76051508-generic amd64
Java 16.0.2
JavaFX 17.0.1+1

@Siedlerchr
Copy link
Member

@fl-la Solution/workaround:

. Just add a space after the HtnlChars Formatter Name : \format[HTMLChars ]{\comment} to prevent an exact match.

@jpmvferreira
Copy link

I'm facing a similar issue: Whenever to try to edit the Entry Preview, it fails. It doesn't show on the preview tab, by contrast with what the author of this issue is experiencing, and rebooting doesn't make any change whatsoever.

However, using JabRef 5.5 portable, the issue is the same as yours: editing will only take effect after rebooting, and is shown in the preview tab.

Curiously, going back to JabRef 5.4 which is installed system-wide, reveals the edited entry preview, but I still can't edit it.

Also curiously, I found a situation where this does not seem to apply when using JabRef 5.5.
Currently my customized preview style looks like the following:

<font face="sans-serif">
\begin{title}<b>\format[HTMLChars]{\title}</b> \end{title}
\begin{author}<BR>\format[Authors(10, 10, FirstLast, FullName, Sep=,,LastSep= and ),HTMLChars]{\author}\end{author}
\begin{date}<BR>\date\end{date}\begin{edition}, \edition. edition\end{edition}
\begin{comment}<BR><BR><b>Comment: </b>\format[Markdown,HTMLChars]{\comment}\end{comment}
\begin{abstract}<BR><BR><b>Abstract: </b>\format[HTMLChars]{\abstract} \end{abstract}
</font>

For some reason, having the Markdown setting on the comment creates a lot of unnecessary newlines and, because I'm not planning on using markdown anyways, I decided to edit it out (again, with v. 5.5 portable where I am able to successfully edit the entry preview).
Preview panel shows that the new lines are removed and, surprisingly, changes take effect immediately and I don't have to reboot JabRef, cool!
Once I reboot JabRef, however, my edits are gone! It seems like I'm back to v. 5.4, where I couldn't do the editing.

It seems that, after fooling around, some edits take place immediately, others don't and some aren't even allowed.

This seems like quite a strange bug, and I'm not sure if I'm making myself clear, so feel free to ask me for further information.

System:

  • OS: Manjaro
  • Kernel: 5.4.169-1
  • WM: i3
  • Installation method for JabRef: AUR

koppor pushed a commit that referenced this issue Apr 1, 2023
41531558a8 Fix unsigned newspaper articles throughout Chicago 17 (#6486)
7678212826 Create trames.csl (#6479)
0cae26ac85 Update hochschule-fur-soziale-arbeit-fhnw.csl (#6480)
85c4b693a2 Update to UP Harvard Theology & Religion (#6485)
c273aa7e43 Update ieee.csl (#6481)
fe67b80e47 Update open-window.csl (#6367)
f2229705ef Create iainutuban-tarbiyah.csl (#6361)
1867a56a26 Create business-and-human-rights-journal (#6359)
1371dbdf26 Update iso690-author-date-es.csl (#6477)
6953a43efd Update ieee.csl (#6478)
f56d5ef1cc Create czech-journal-of-international-relations.csl (#6453)
678b53f99c Update harvard-stellenbosch-university.csl (#6464)
3074938038 Update ucl-university-college-apa.csl (#6475)
27dab9ea0f Update iso690-author-date-es.csl (#6476)
a8aea63d00 Create elsevier-american-chemical-society.csl (#6342)
f8f290fa63 Update iso690-author-date-es.csl (#6472)
7fdc621eee Update journal-of-neolithic-archaeology (#6466)
7025568e70 Update offa.csl (#6465)
2d69299b19 Create uni-fribourg-theologie.csl (#6473)
8db531a73e Create travail-et-emploi.csl (#6351)
c8b54fc531 Make monash-university-harvard dependent style (#6470)
b95f59ff5c Update journal-of-the-marine-biological-association-of-the-united-kingdom.csl (#6456)
a12b513119 Update universite-du-quebec-a-montreal.csl (#6463)
048e6641e4 Update zeitschrift-fur-geschichtsdidaktik.csl (#6454)
f0d3d7ef15 Update journal-fur-kulturpflanzen-journal-of-cultivated-plants.csl (#6447)
3b814fe048 Update the-accounting-review.csl (#6459)
f24befd580 Update survey-of-ophthalmology.csl from ama.csl to its own independent style (#6460)
c868ab54f6 Create vancouver-alphabetical.csl (#6461)
782e39cfe1 Update american-institute-of-physics.csl (#6457)
a56cf03e3c Fix Chicago Cases & Newspaper sorting (#6458)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 41531558a873b2533f2d17d8d6484c2408174fce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview preferences ui
Projects
Status: Normal priority
8 participants