Skip to content

Commit

Permalink
Merge pull request #16787 from wordpress-mobile/fix/image-block-prese…
Browse files Browse the repository at this point in the history
…rves-alt-text

fix: Image block preserves alt text from media library
  • Loading branch information
dcalhoun authored Jun 23, 2022
2 parents 2679fe1 + e61f4dc commit 24fd7e2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
20.2
-----
* [*] Added heic/heif image format support [https://github.com/wordpress-mobile/WordPress-Android/pull/16773]
* [*] Block Editor: Image block copies the alt text from the media library when selecting an item [https://github.com/wordpress-mobile/WordPress-Android/pull/16787]

20.1
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static MediaModel mediaModelFromMediaFile(MediaFile file) {
mediaModel.setTitle(file.getTitle());
mediaModel.setDescription(file.getDescription());
mediaModel.setCaption(file.getCaption());
mediaModel.setAlt(file.getAlt());
mediaModel.setMediaId(file.getMediaId() != null ? Long.valueOf(file.getMediaId()) : 0);
mediaModel.setId(file.getId());
mediaModel.setUploadState(file.getUploadState());
Expand All @@ -75,6 +76,7 @@ public static MediaFile mediaFileFromMediaModel(MediaModel media) {
mediaFile.setTitle(media.getTitle());
mediaFile.setDescription(media.getDescription());
mediaFile.setCaption(media.getCaption());
mediaFile.setAlt(media.getAlt());
mediaFile.setUploadState(media.getUploadState());
mediaFile.setVideo(org.wordpress.android.fluxc.utils.MediaUtils.isVideoMimeType(media.getMimeType()));
mediaFile.setVideoPressShortCode(ShortcodeUtils.getVideoPressShortcodeFromId(media.getVideoPressGuid()));
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
ext {
wordPressUtilsVersion = '2.5.0'
wordPressLoginVersion = '0.14.0'
gutenbergMobileVersion = 'v1.79.0-alpha1'
gutenbergMobileVersion = 'v1.79.0-alpha2'
storiesVersion = '1.3.0'
aboutAutomatticVersion = '0.0.5'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,8 @@ public void appendMediaFiles(Map<String, MediaFile> mediaList) {
url,
mediaEntry.getValue().getMimeType(),
mediaEntry.getValue().getCaption(),
mediaEntry.getValue().getTitle()));
mediaEntry.getValue().getTitle(),
mediaEntry.getValue().getAlt()));
}

getGutenbergContainerFragment().appendMediaFiles(rnMediaList);
Expand Down

0 comments on commit 24fd7e2

Please sign in to comment.