Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fixnotonfxthread
Browse files Browse the repository at this point in the history
* upstream/master:
  Amend the reference to JabRefReferences initialization (#5487)
  Fix for issue 5463 (#5481)
  Rename index.md to README.md
  • Loading branch information
Siedlerchr committed Oct 21, 2019
2 parents 269a786 + dfad2fd commit cbaf5ea
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
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
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Globals {
public static final RemoteListenerServerLifecycle REMOTE_LISTENER = new RemoteListenerServerLifecycle();
public static final ImportFormatReader IMPORT_FORMAT_READER = new ImportFormatReader();
public static final TaskExecutor TASK_EXECUTOR = new DefaultTaskExecutor();
// In the main program, this field is initialized in JabRef.java
// In the main program, this field is initialized in JabRefMain.java
// Each test case initializes this field if required
public static JabRefPreferences prefs;
/**
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
11 changes: 10 additions & 1 deletion src/main/java/org/jabref/gui/preview/PreviewViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import org.jabref.Globals;
import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.DialogService;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.StateManager;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.ThemeLoader;
import org.jabref.logic.citationstyle.PreviewLayout;
import org.jabref.logic.exporter.ExporterFactory;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -112,6 +114,13 @@ public PreviewViewer(BibDatabaseContext database, DialogService dialogService, S

}

public void setTheme(String theme) {
if (theme.equals(ThemeLoader.DARK_CSS)) {
previewView.getEngine().setUserStyleSheetLocation(JabRefFrame.class.getResource(ThemeLoader.DARK_CSS).toString());
}

}

private void highlightSearchPattern() {
if (searchHighlightPattern.isPresent()) {
String pattern = searchHighlightPattern.get().pattern().replace("\\Q", "").replace("\\E", "");
Expand Down Expand Up @@ -175,7 +184,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

0 comments on commit cbaf5ea

Please sign in to comment.