Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into convertRemainingTest
Browse files Browse the repository at this point in the history
* upstream/master:
  New ADS Fetcher (#5501)
  snap: Add browser proxy for confined browser integration (#5512)
  Fix dark theme loading
  Update PreviewViewer.java
  [WIP] Try to fix dark theme path
  • Loading branch information
Siedlerchr committed Oct 25, 2019
2 parents 98f0a7c + fdd06d7 commit 6a2760c
Show file tree
Hide file tree
Showing 7 changed files with 285 additions and 147 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added an option to show the preview as an extra tab in the entry editor (instead of in a split view). [#5244](https://github.com/JabRef/jabref/issues/5244)
- A custom Open/LibreOffice jstyle file now requires a layout line for the entry type `default` [#5452](https://github.com/JabRef/jabref/issues/5452)
- The entry editor is now open by default when JabRef starts up. [#5460](https://github.com/JabRef/jabref/issues/5460)
- We add a new ADS fetcher to use the new ADS API [#4949](https://github.com/JabRef/jabref/issues/4949)

### Fixed

Expand Down
38 changes: 20 additions & 18 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,32 @@ license: MIT
architectures:
- build-on: amd64

apps:
jabref:
command: bin/JabRef
extensions: [gnome-3-28]
browser-proxy:
command: lib/jabrefHost.py
extensions: [gnome-3-28]

environment:
_JAVA_OPTIONS: "-Duser.home=$SNAP_USER_DATA"
plugs:
desktop:
desktop-legacy:
wayland:
unity7:
home:
opengl:
network-bind:
removable-media:
browser-extension:
interface: system-files
read:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts
write:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json

apps:
jabref:
command: bin/JabRef
extensions: [gnome-3-28]
environment:
_JAVA_OPTIONS: "-Duser.home=$SNAP_USER_DATA"
plugs:
- desktop
- desktop-legacy
- wayland
- unity7
- home
- opengl
- network-bind
- removable-media

parts:
jabref:
plugin: dump
Expand All @@ -47,5 +49,5 @@ parts:
override-build: |
snapcraftctl build
snapcraftctl set-version "$(cat $SNAPCRAFT_PART_INSTALL/lib/app/JabRef.cfg | grep "app.version=" | cut -d'=' -f2)"
sed -i 's|/opt/jabref/lib/jabrefHost.py|/snap/jabref/current/lib/jabrefHost.py|g' $SNAPCRAFT_PART_INSTALL/lib/org.jabref.jabref.json
sed -i 's|/opt/jabref/lib/jabrefHost.py|/snap/bin/jabref.browser-proxy|g' $SNAPCRAFT_PART_INSTALL/lib/org.jabref.jabref.json
chmod +x $SNAPCRAFT_PART_INSTALL/lib/jabrefHost.py
12 changes: 10 additions & 2 deletions src/main/java/org/jabref/gui/preview/PreviewViewer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jabref.gui.preview;

import java.net.URL;
import java.util.Base64;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -27,6 +29,7 @@
import org.jabref.logic.search.SearchQuery;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.strings.StringUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -116,9 +119,14 @@ 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());
// 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
URL url = JabRefFrame.class.getResource(ThemeLoader.DARK_CSS);
String dataUrl = "data:text/css;charset=utf-8;base64," +
Base64.getEncoder().encodeToString(StringUtil.getResourceFileAsString(url).getBytes());

previewView.getEngine().setUserStyleSheetLocation(dataUrl);
}

}

private void highlightSearchPattern() {
Expand Down
Loading

0 comments on commit 6a2760c

Please sign in to comment.