-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implement book cover feature #12198
Open
damgam0288
wants to merge
46
commits into
JabRef:main
Choose a base branch
from
thanhnguyen123-dev:fix-10120
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement book cover feature #12198
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
bf9388b
Add method to check if file is image in LinkedFile.java
damgam0288 6aaa9af
Add method to retrieve cover image in BibEntry.java
damgam0288 aa64848
Add HTML image for book cover to setPreviewText
damgam0288 b74e022
Remove unnecessary TODO
damgam0288 2100210
Check EntryType is a book or related item in BibEntry
damgam0288-anu c89f3c8
Fix book cover size too large in PreviewViewer
damgam0288-anu d7c559b
Refactor locations of methods in BibEntry
damgam0288-anu 7c82123
Remove todo comments. Add comments.
damgam0288-anu fd3750a
Add todo comments for testing new methods
damgam0288-anu 0e04bbf
Refactor BibEntry to return cover image file instead of path
damgam0288 5e9d764
Refactor PreviewViewer to receive cover file from BibEntry and conver…
damgam0288 0f0d2fa
Add tests for getCoverImageFile method in BibEntry
damgam0288 ab2d3ab
Change cover string to a static field
damgam0288 da906f7
Align book cover to right side in PreviewViewer setPreviewText
damgam0288 eb06002
Fix checkstyle issues
damgam0288 23c04d5
Make getCoverImageFile only return image with "cover" in the descript…
damgam0288 c902323
Fix poor cover image resizing
damgam0288 6b789f5
Add test for getCoverImage in BibEntryTest.java
damgam0288 34647c8
Fix cover image not being displayed when its title has spaces
damgam0288 42ac2c9
Refactor getBookCoverURI in PreviewViewer
damgam0288 c561303
Merge branch 'JabRef:main' into fix-10120
damgam0288 a9c5dbd
Update Changelog for book cover feature issue 10120
damgam0288 aacffed
Merge branch 'main' into fix-10120
damgam0288 4119b7d
Fix CI tests failure: change getBookCoverURI
damgam0288 8b1a961
Merge remote-tracking branch 'origin/fix-10120' into fix-10120
damgam0288 871fcaa
Fix CI tests failure: handle entry field null value
damgam0288 6d2e3b1
Merge branch 'main' into fix-10120
damgam0288 a7e9b10
Revise getCoverImage tests to use parameterization.
damgam0288 2cf00f3
Revise Image_Extensions to use HashSet of StandardExternalFileTypes enum
damgam0288 28a762d
Reword CHANGELOG.md. Remove wrong import BibEntry.java
damgam0288 23a691f
Revise LinkedFile.isImage to check for keyword "image" instead of che…
damgam0288 b1b39d7
Revise BibEntryTest.java with correct "filetypes" for getCoverImage t…
damgam0288 edd101e
Fix cover image scales too wide in PreviewViewer.java
damgam0288 015a14c
Revise isCoverable in BibEntry.java to use HashSet instead of List
damgam0288 7198ce8
Merge branch 'main' into fix-10120
damgam0288 75ad6ee
Merge branch 'main' into fix-10120
damgam0288 8684dbd
Attempt fix OpenRewrite error in BibEntryTest.java
damgam0288 a94dac7
Rewrite getCoverImage tests in BibEntryTest.java
damgam0288 eb0a1b7
Fix getCoverImage to check files is null or empty
damgam0288 d0ffcc1
Remove all getCoverImage tests that expect Optional.empty as a result
damgam0288 c7b71d4
Add BibEntryTest - getCoverImageUpdatesWithChangeToDescription
damgam0288 f377939
Add OpenRewrite changes to multiple classes
damgam0288 4f3df63
Fix missing Junit imports for tests
damgam0288 87cc072
Remove unused import in BibEntry
damgam0288 80cdf05
Merge branch 'main' into fix-10120
damgam0288 b85aab9
Add tests for getCoverImage in BibEntryTest
damgam0288 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,14 +218,35 @@ private void setPreviewText(String text) { | |
layoutText = """ | ||
<html> | ||
<body id="previewBody"> | ||
<div id="content"> %s </div> | ||
<div style="display: flex;"> | ||
<div id="content" style="flex: 1;"> | ||
%s | ||
</div> | ||
<div id="bookCover" style="flex: 1;"> | ||
<img | ||
src="%s" | ||
style="width: 75vh; height: auto; max-height: 100vh;" | ||
align="right"; | ||
> | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
""".formatted(text); | ||
""".formatted(text, getBookCoverURI()); | ||
highlightLayoutText(); | ||
this.setHvalue(0); | ||
} | ||
|
||
private String getBookCoverURI() { | ||
if (entry != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this check really necessary? I would convert it into |
||
if (entry.getCoverImageFile().isPresent()) { | ||
return "file:///" + entry.getCoverImageFile().get().getLink(); | ||
} | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
private void highlightLayoutText() { | ||
if (layoutText == null) { | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. See general review comments.