Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an exception which occurred when trying to import entries without an open library. [#5447](https://github.com/JabRef/jabref/issues/5447)
- After successful import of one or multiple bib entries the main table scrolls to the first imported entry [#5383](https://github.com/JabRef/jabref/issues/5383)
- We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452)

- We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463)

### Removed

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/Dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@

-jr-tooltip-fg: derive(-fx-light-text-color, 50%);
}

#previewBody{
background-color: #272b38; /* -fx-control-inner-background*/
color : #7d8591; /* -fx-mid-text-color*/
}
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/preview/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public PreviewPanel(BibDatabaseContext database, DialogService dialogService, Ex
previewView = new PreviewViewer(database, dialogService, Globals.stateManager);
previewView.setLayout(previewPreferences.getCurrentPreviewStyle());
previewView.setContextMenu(createPopupMenu());
previewView.setTheme(this.preferences.get(JabRefPreferences.FX_THEME));
previewView.setOnDragDetected(event -> {
previewView.startFullDrag();

Expand Down
9 changes: 8 additions & 1 deletion src/main/java/org/jabref/gui/preview/PreviewViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S

}

public void setTheme(String theme){
if(theme.equals("Dark.css")){
previewView.getEngine().setUserStyleSheetLocation(ClipBoardManager.class.getResource("Dark.css").toString());
}

}

private void highlightSearchPattern() {
if (searchHighlightPattern.isPresent()) {
String pattern = searchHighlightPattern.get().pattern().replace("\\Q", "").replace("\\E", "");
Expand Down Expand Up @@ -175,7 +182,7 @@ private void update() {
}

private void setPreviewText(String text) {
String myText = "<html>" + JS_HIGHLIGHT_FUNCTION + "<body><div id=\"content\">" + text + "</div></body></html>";
String myText = "<html>" + JS_HIGHLIGHT_FUNCTION + "<body id=\"previewBody\"><div id=\"content\">" + text + "</div></body></html>";
previewView.getEngine().setJavaScriptEnabled(true);
previewView.getEngine().loadContent(myText);

Expand Down