Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Entry preview: Does not adapt to dark mode #5463

Closed
AEgit opened this issue Oct 17, 2019 · 11 comments
Closed

Entry preview: Does not adapt to dark mode #5463

AEgit opened this issue Oct 17, 2019 · 11 comments
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@AEgit
Copy link

AEgit commented Oct 17, 2019

JabRef 5.0.0-dev--2019-10-17----e81d58c51
Windows 10 10.0 amd64
Java 12.0.2

The entry preview does not adapt to dark mode. This issue has already been reported by @Siedlerchr here (including an image):
#5244 (comment)

@tobiasdiez tobiasdiez added bug Confirmed bugs or reports that are very likely to be bugs entry-preview good first issue An issue intended for project-newcomers. Varies in difficulty. labels Oct 17, 2019
@taerim25
Copy link
Contributor

Hello, I'm pretty new to github but would like to work on this issue. Is it okay?

@Siedlerchr
Copy link
Member

@taerim25 Sure, go ahead ! I think it should work if you adapt the background color of the entry preview control in the dark theme css file

Please have a look at our contributing guide for gettings things done.
https://github.com/JabRef/jabref/blob/master/CONTRIBUTING.md

@taerim25
Copy link
Contributor

UPDATE: Preview content itself was updated in form of HTML injected in previewView = new WebView() (located in PreviewViewer.java). I was able to change the color of WebView object itself, but it wouldn't show on the app as the injected HTML is placed on top of it. I can modify the css of the injected HTML by manually making a new css file and embedding it on to the HTML, but that wouldn't make it compatible with existing css files (Dark.css and Base.css).

Anybody has any idea on how to approach this?

@Siedlerchr
Copy link
Member

@tobiasdiez do we have a variable for checking if Dark Mode is enabled?

@tobiasdiez
Copy link
Member

Yes, sadly it is not possible to style the content of the webview using the central javafx css. The easiest solution is probably to embed the correct style directly as done here:

" <style>" +
" mark{" +
" background: orange;" +
" color: black;" +
" }" +
" </style>" +

@Siedlerchr
Copy link
Member

@taerim25 Actually there is a preferences key which stores which theme the user has selected. So you could use this for checking and adapting the css,

@taerim25 taerim25 mentioned this issue Oct 19, 2019
6 tasks
@tobiasdiez
Copy link
Member

Thanks to the good work of @taerim25 this should be fixed in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version.

@AEgit
Copy link
Author

AEgit commented Oct 20, 2019

JabRef 5.0.0-dev--2019-10-20----dfad2fdea
Windows 10 10.0 amd64
Java 12.0.2

Cannot confirm. The entry preview is not visible at all. And sometimes the exception reported below occurs, when trying to open the entry preview/entry editor. Note, that the issue does not appear, if the dark mode is not activated, so it is very likely that these issues are related to the attempted fix herein:

Uncaught exception in Thread[JavaFX Application Thread,5,main]

Invalid stylesheet URL

java.lang.IllegalArgumentException: Invalid stylesheet URL
	at org.jabref.merged.module/javafx.scene.web.WebEngine$2.invalidated(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.markInvalid(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.beans.property.StringPropertyBase.set(Unknown Source)
	at org.jabref.merged.module/javafx.scene.web.WebEngine.setUserStyleSheetLocation(Unknown Source)
	at org.jabref/org.jabref.gui.preview.PreviewViewer.setTheme(Unknown Source)
	at org.jabref/org.jabref.gui.preview.PreviewPanel.<init>(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.PreviewTab.bindToEntry(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditorTab.notifyAboutFocus(Unknown Source)
	at org.jabref/org.jabref.gui.entryeditor.EntryEditor.setEntry(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.lambda$createMainTable$21(Unknown Source)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.lambda$createMainTable$22(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.SelectedItemsReadOnlyObservableList.lambda$new$1(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.fireChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.commit(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ListChangeBuilder.endChange(Unknown Source)
	at org.jabref.merged.module/javafx.collections.ObservableListBase.endChange(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._endChange(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.MultipleSelectionModelBase$SelectedIndicesList._endChange(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.ControlUtils.updateSelectedIndices(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.fireCustomSelectedCellsListChangeEvent(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewArrayListSelectionModel.clearAndSelect(Unknown Source)
	at org.jabref.merged.module/javafx.scene.control.TableView$TableViewSelectionModel.clearAndSelect(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.behavior.TableCellBehaviorBase.simpleSelect(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.behavior.TableCellBehaviorBase.doSelect(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.behavior.CellBehaviorBase.mousePressed(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.scene.Scene$MouseHandler.process(Unknown Source)
	at org.jabref.merged.module/javafx.scene.Scene.processMouseEvent(Unknown Source)
	at org.jabref.merged.module/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.View.notifyMouse(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at org.jabref.merged.module/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

@Siedlerchr Siedlerchr reopened this Oct 20, 2019
@Siedlerchr
Copy link
Member

@tobiasdiez I guess it's due to the variable you replaced with the constant

@Siedlerchr
Copy link
Member

This should be fixed now in the latest master.

@AEgit
Copy link
Author

AEgit commented Oct 25, 2019

JabRef 5.0.0-dev--2019-10-25----681d6aa6f
Windows 10 10.0 amd64
Java 12.0.2

I can confirm that this has been fixed in the current dev version. Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Archived in project
Development

No branches or pull requests

4 participants