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

DOI link: opens in preview and causes an exception #7706

Closed
1 task done
mlep opened this issue May 6, 2021 · 5 comments · Fixed by #8255
Closed
1 task done

DOI link: opens in preview and causes an exception #7706

mlep opened this issue May 6, 2021 · 5 comments · Fixed by #8255
Labels
bug Confirmed bugs or reports that are very likely to be bugs good first issue An issue intended for project-newcomers. Varies in difficulty.

Comments

@mlep
Copy link
Contributor

mlep commented May 6, 2021

JabRef 5.3--2021-05-05--a3f093d
Linux 4.19.0-16-amd64 amd64
Java 16.0.1
JavaFX 16+8

When clicking on the DOI link displayed in the preview panel, the webpage is displayed in the preview (which is unexpected), and barely unusable (because it is very small), and then an exception is raised.

Steps to reproduce the behavior:

  1. Open the file jabref-authors.bib (https://github.com/JabRef/jabref/blob/main/src/test/resources/testbib/jabref-authors.bib)
  2. Double-click on the entry Afzal et al. (for example). The entry editor opens.
  3. In the preview panel, click on the DOI

Note: the exception is surely a bug. But is the display of the website in the preview panel a new feature? If so, how to get the previous behaviour back? (i.e. opening links in the regular web browser)

Uncaught exception details
netscape.javascript.JSException: ReferenceError: Can't find variable: Mark
  at [email protected]/com.sun.webkit.dom.JSObject.fwkMakeException(Unknown Source)
  at [email protected]/com.sun.webkit.WebPage.twkExecuteScript(Native Method)
  at [email protected]/com.sun.webkit.WebPage.executeScript(Unknown Source)
  at [email protected]/javafx.scene.web.WebEngine.executeScript(Unknown Source)
  at [email protected]/org.jabref.gui.preview.PreviewViewer.highlightSearchPattern(Unknown Source)
  at [email protected]/org.jabref.gui.preview.PreviewViewer.lambda$new$1(Unknown Source)
  at [email protected]/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(Unknown Source)
  at [email protected]/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(Unknown Source)
  at [email protected]/javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(Unknown Source)
  at [email protected]/javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(Unknown Source)
  at [email protected]/javafx.beans.property.ObjectPropertyBase.markInvalid(Unknown Source)
  at [email protected]/javafx.beans.property.ObjectPropertyBase.set(Unknown Source)
  at [email protected]/javafx.scene.web.WebEngine$LoadWorker.updateState(Unknown Source)
  at [email protected]/javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(Unknown Source)
  at [email protected]/javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(Unknown Source)
  at [email protected]/com.sun.webkit.WebPage.fireLoadEvent(Unknown Source)
  at [email protected]/com.sun.webkit.WebPage.fwkFireLoadEvent(Unknown Source)
  at [email protected]/com.sun.webkit.network.URLLoaderBase.twkDidFinishLoading(Native Method)
  at [email protected]/com.sun.webkit.network.HTTP2Loader.notifyDidFinishLoading(Unknown Source)
  at [email protected]/com.sun.webkit.network.HTTP2Loader.lambda$callBackIfNotCanceled$10(Unknown Source)
  at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
  at java.base/java.security.AccessController.doPrivileged(Unknown Source)
  at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
  at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
  at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
  at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
  at java.base/java.lang.Thread.run(Unknown Source)

@mlep mlep changed the title DOI link: open in preview and cause an exception DOI link: opens in preview and causes an exception May 6, 2021
@Siedlerchr
Copy link
Member

Hi do you use one of the CSL styles or the custom jabref style? If the latter one, can you paste it? By default it's not displayed for me in the preview

@mlep
Copy link
Contributor Author

mlep commented May 7, 2021

Indeed, I have a customize preview style. Here it is:

<font face="sans-serif"><b><i>\bibtextype</i><a name="\citationkey">\begin{citationkey} (\citationkey)</a>\end{citationkey}</b><br>
\begin{author} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\author}\end{author} \begin{editor} \format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\editor} <i>(\format[IfPlural(Eds.,Ed.)]{\editor})</i>\end{editor}
(\begin{year}\year\end{year}).
\begin{title} \format[HTMLChars]{\title}. \end{title}
\begin{chapter} \format[HTMLChars]{\chapter}\end{chapter}
\begin{journal} <em>\format[HTMLChars]{\journal}, </em>\end{journal}
\begin{booktitle} <em>\format[HTMLChars]{\booktitle}, </em>\end{booktitle}
\begin{school} <em>\format[HTMLChars]{\school}, </em>\end{school}
\begin{institution} <em>\format[HTMLChars]{\institution}, </em>\end{institution}
\begin{publisher} <em>\format[HTMLChars]{\publisher}, </em>\end{publisher}
\begin{volume}<i> \volume</i>\end{volume}: \begin{pages}\format[FormatPagesForHTML]{\pages}\end{pages}.
\begin{doi}<a href="\format[DOICheck]{\DOI}">\DOI</a>\end{doi}
</font>

Note: in Options -> Preferences, tab Entry preview, a left-click on the selected style raises an exception (see below).
Do you want me to open a specific issue?

Details about another uncaught exception details java.lang.IllegalArgumentException: Visible paragraphs' last index is [-1] but visibleParIndex was [0] at [email protected]/org.fxmisc.richtext.GenericStyledArea.visibleParToAllParIndex(Unknown Source) at [email protected]/org.fxmisc.richtext.ViewActions.firstVisibleParToAllParIndex(Unknown Source) at [email protected]/org.fxmisc.richtext.LineNumberFactory.insertParagraphCheck(Unknown Source) at [email protected]/org.fxmisc.richtext.LineNumberFactory.lambda$new$2(Unknown Source) at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

@k3KAW8Pnf7mkmdSMPHz27
Copy link
Member

Did it open in an external browser before?

PreviewViewer uses a WebView so, in theory, any link is clickable and opens in the same view. I haven't seen any good option for opening some links in an external browser and some (markdown anchors) in the WebView, but perhaps someone else knows of something.

I haven't verified it but the netscape.javascript.JSException: ReferenceError: Can't find variable: Mark should be from trying to run the code for highlighting on the new webpage (where it doesn't exist).

@Siedlerchr
Copy link
Member

Seems like it's requires some listener to intercept links and then call the "normal" opening methods.
https://stackoverflow.com/questions/15555510/javafx-stop-opening-url-in-webview-open-in-browser-instead

@mlep
Copy link
Contributor Author

mlep commented May 7, 2021

Did it open in an external browser before?

A long time ago, indeed, it opened in an external browser.
But for a while, it was not possible to save the custom preview settings, so it was not possible to try it.

Digging in the development releases:

  • the one published on January 21, 2021 did not do anything when clicking on the URL located in the preview.
  • the one published on January 27, 2021 behaves as the current one (display of the webpage in the preview)

@Siedlerchr Siedlerchr added good first issue An issue intended for project-newcomers. Varies in difficulty. bug Confirmed bugs or reports that are very likely to be bugs labels Jul 4, 2021
@koppor koppor moved this to Done in Prioritization Nov 10, 2022
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 good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants