diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ac0763c54e..4f83695e2a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,8 +63,9 @@ inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://git - We fixed an issue where identity column header had incorrect foreground color in the Dark theme. [#6796](https://github.com/JabRef/jabref/issues/6796) - We fixed an issue where the RIS exporter added extra blank lines.[#7007](https://github.com/JabRef/jabref/pull/7007/files) - We fixed an issue where clicking on Collapse All button in the Search for Unlinked Local Files expanded the directory structure erroneously [#6848](https://github.com/JabRef/jabref/issues/6848) -- We fixed an issue, when pulling changes from shared database via shortcut caused creation a new new tech report [6867](https://github.com/JabRef/jabref/issues/6867) +- We fixed an issue, when pulling changes from shared database via shortcut caused creation of a new tech report [6867](https://github.com/JabRef/jabref/issues/6867) - We fixed an issue where the JabRef GUI does not highlight the "All entries" group on start-up [#6691](https://github.com/JabRef/jabref/issues/6691) +- We fixed an issue where a custom dark theme was not applied to the entry preview tab [7068](https://github.com/JabRef/jabref/issues/7068) ### Removed diff --git a/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 7e2fae665cf..c6515d61e67 100644 --- a/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -1,5 +1,6 @@ package org.jabref.gui.preview; +import java.net.MalformedURLException; import java.net.URL; import java.util.Base64; import java.util.Objects; @@ -119,12 +120,19 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S public void setTheme(Theme theme) { if (theme.getType() == Theme.Type.DARK) { // We need to load the css file manually, due to a bug in the jdk - // TODO: Remove this workaround as soon as https://github.com/openjdk/jfx/pull/22 is merged + // https://bugs.openjdk.java.net/browse/JDK-8240969 + // TODO: Remove this workaround as soon as openjfx 16 is released URL url = JabRefFrame.class.getResource(theme.getPath().getFileName().toString()); String dataUrl = "data:text/css;charset=utf-8;base64," + Base64.getEncoder().encodeToString(StringUtil.getResourceFileAsString(url).getBytes()); previewView.getEngine().setUserStyleSheetLocation(dataUrl); + } else if (theme.getType() != Theme.Type.LIGHT) { + try { + previewView.getEngine().setUserStyleSheetLocation(theme.getPath().toUri().toURL().toExternalForm()); + } catch (MalformedURLException ex) { + LOGGER.error("Cannot set custom theme, invalid url", ex); + } } } @@ -171,7 +179,7 @@ public void setEntry(BibEntry newEntry) { } private void update() { - if (entry.isEmpty() || layout == null) { + if (entry.isEmpty() || (layout == null)) { // Nothing to do return; }