diff --git a/AUTHORS b/AUTHORS index c57cec7736e..b29955a7371 100644 --- a/AUTHORS +++ b/AUTHORS @@ -279,6 +279,7 @@ Nikita Borovikov Niklas Schmitt nikmilpv NikodemKch +Nikolaus Koopmann Nils Streijffert Niv Ierushalmi Nivedha Sunderraj diff --git a/CHANGELOG.md b/CHANGELOG.md index 4629e113f0a..7194eaa8b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where the `.sav` file was not deleted upon exiting JabRef. [#6109](https://github.com/JabRef/jabref/issues/6109) - We fixed a linked identifier icon inconsistency. [#6705](https://github.com/JabRef/jabref/issues/6705) - We fixed the wrong behavior that font size changes are not reflected in dialogs. [#6039](https://github.com/JabRef/jabref/issues/6039) +- We fixed the failure to Copy citation key and link. [#5835](https://github.com/JabRef/jabref/issues/5835) - We fixed an issue where the sort order of the entry table was reset after a restart of JabRef. [#6898](https://github.com/JabRef/jabref/pull/6898) - We fixed an issue where no longer a warning was displayed when inserting references into LibreOffice with an invalid "ReferenceParagraphFormat". [#6907](https://github.com/JabRef/jabref/pull/60907). diff --git a/src/main/java/org/jabref/gui/ClipBoardManager.java b/src/main/java/org/jabref/gui/ClipBoardManager.java index 78f9e7aa39a..d78183a3479 100644 --- a/src/main/java/org/jabref/gui/ClipBoardManager.java +++ b/src/main/java/org/jabref/gui/ClipBoardManager.java @@ -73,7 +73,7 @@ public static void addX11Support(TextInputControl input) { // using InvalidationListener because of https://bugs.openjdk.java.net/browse/JDK-8176270 observable -> Platform.runLater(() -> { String newValue = input.getSelectedText(); - if (!newValue.isEmpty() && primary != null) { + if (!newValue.isEmpty() && (primary != null)) { primary.setContents(new StringSelection(newValue), null); } })); @@ -105,7 +105,7 @@ public static String getContents() { public static String getContentsPrimary() { if (primary != null) { Transferable contents = primary.getContents(null); - if (contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) { + if ((contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) { try { return (String) contents.getTransferData(DataFlavor.stringFlavor); } catch (UnsupportedFlavorException | IOException e) { @@ -137,9 +137,10 @@ public void setPrimaryClipboardContent(ClipboardContent content) { } } - public void setHtmlContent(String html) { + public void setHtmlContent(String html, String fallbackPlain) { final ClipboardContent content = new ClipboardContent(); content.putHtml(html); + content.putString(fallbackPlain); clipboard.setContent(content); setPrimaryClipboardContent(content); } @@ -181,7 +182,7 @@ private List handleBibTeXData(String entries) { } private List handleStringData(String data) { - if (data == null || data.isEmpty()) { + if ((data == null) || data.isEmpty()) { return Collections.emptyList(); } diff --git a/src/main/java/org/jabref/gui/edit/CopyMoreAction.java b/src/main/java/org/jabref/gui/edit/CopyMoreAction.java index ac138cf5a85..9ef0f292594 100644 --- a/src/main/java/org/jabref/gui/edit/CopyMoreAction.java +++ b/src/main/java/org/jabref/gui/edit/CopyMoreAction.java @@ -207,6 +207,7 @@ private void copyKeyAndLink() { List entries = stateManager.getSelectedEntries(); StringBuilder keyAndLink = new StringBuilder(); + StringBuilder fallbackString = new StringBuilder(); List entriesWithKey = entries.stream() .filter(BibEntry::hasCitationKey) @@ -222,9 +223,11 @@ private void copyKeyAndLink() { String url = entry.getField(StandardField.URL).orElse(""); keyAndLink.append(url.isEmpty() ? key : String.format("%s", url, key)); keyAndLink.append(OS.NEWLINE); + fallbackString.append(url.isEmpty() ? key : String.format("%s - %s", key, url)); + fallbackString.append(OS.NEWLINE); } - clipBoardManager.setHtmlContent(keyAndLink.toString()); + clipBoardManager.setHtmlContent(keyAndLink.toString(), fallbackString.toString()); if (entriesWithKey.size() == entries.size()) { // All entries had keys.