Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix for issue 5463 #5481

Merged
merged 15 commits into from
Oct 20, 2019
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